entrustDetail.js
21.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
/**
* 买卖详情页面
*/
var EntrustDetail = function() {
var _entrust = null;
var _clickTag = 0;
var _showTradePrice = false;
var _beforeBuyPrice = -1;
return {
init : function() {
EntrustDetail.connect();
// 买入按钮
$("#xyfBuyButton").click(function() {
EntrustDetail.buy();
});
//卖出按钮
$("#xyfSellButton").click(function() {
EntrustDetail.sell();
});
//买入价文本框
$('#txtBuyPrice').blur(function() {
EntrustDetail.buyAmount();
});
$('#spUserBalance').hide();
EntrustDetail.queryPosition();
EntrustDetail.sellAmount();
},
/** 连接 */
connect : function() {
_sock = new SockJS("/sockjs/ec/detail/");
_sock.onopen = function() {
// console.log('open');
setTimeout('EntrustDetail.send()', 500);
};
_sock.onmessage = function(event) {
var entrust = $.parseJSON(event.data);
_entrust = entrust;
EntrustDetail.showEntrustInfo(entrust);
};
_sock.onclose = function() {
EntrustDetail.reconnect();
}
},
/** 发送消息 */
send : function() {
if (_sock != null) {
_sock.send($('#otcCode').val());
}
},
/** 断开连接 */
disconnect : function() {
if (_sock != null) {
_sock.close();
_sock = null;
}
},
/** 显示行情信息 */
showEntrustInfo : function(entrust) {
var mclose_price = parseFloat(entrust.mclose_price); // 昨收盘
var last_price = parseFloat(entrust.last_price); // 最新价
var trend = last_price <= 0 ? '-' :
((last_price - mclose_price) / mclose_price * 100).toMoney(2, "", ","); // 涨跌幅
var business_balance_total = parseFloat(entrust.business_balance); // 成交金额
var open_price = parseFloat(entrust.open_price);
var buyList = entrust.buyList, sellList = entrust.sellList;
var buys = [], sells = [], sellsTemp = [];
var low_price = entrust.low_price == '0' ? '-' : '¥' + parseFloat(entrust.low_price).toMoney(2, "", ",");
var high_price = entrust.high_price == '0' ? '-' : '¥' + parseFloat(entrust.high_price).toMoney(2, "", ",");
var className = '', firstSellClassName = '';
if (last_price <= 0) {
last_price = parseFloat(entrust.mclose_price);
}
// 页面加载后首次显示买入/卖出价
if (!_showTradePrice) {
// 买入价
var buyPrice = last_price;
if (sellList != null && sellList.length >= 1) {
buyPrice = sellList[sellList.length - 1].ENTRUST_PRICE;
}
buyPrice = parseFloat(buyPrice).toMoney(2, "", "");
$('#txtBuyPrice').val(buyPrice);
EntrustDetail.buyAmount();
// 卖出价
var sellPrice = last_price;
if (buyList != null && buyList.length >= 1) {
sellPrice = buyList[0].ENTRUST_PRICE;
}
sellPrice = parseFloat(sellPrice).toMoney(2, "", "");
$('#txtSellPrice').val(sellPrice);
_showTradePrice = true;
}
if (trend > 0) {
className = 'xyfHighPrice';
$('#imgTrend').attr('src', '/resource/images/icons/xyfUpArrow.png');
//$('#imgBusinessTotal').attr('src', '/resource/images/icons/xyfLittleUpArrow.png');
} else if (trend < 0) {
className = 'xyfLowPrice';
$('#imgTrend').attr('src', '/resource/images/icons/xyfDownArrow.png');
//$('#imgBusinessTotal').attr('src', '/resource/images/icons/xyfLittleDownArrow.png');
}
$('#txtCurrentPrice').text('¥' + last_price.toMoney(2, "", ","));
$('#txtCurrentPrice').attr('class', className);
$('#txtLowPrice').text(low_price);
//$('#txtLowPrice').attr('class', className);
$('#txtHighPrice').text(high_price);
// $('#txtHighPrice').attr('class', className);
$('#txtTrend').text(trend + '%');
$('#txtTrend').attr('class', className);
$('#txtBusinessTotal').text('¥' + business_balance_total.toMoney(2, "", ","));
//$('#txtBusinessTotal').attr('class', className);
// 卖出五档
className = '';
for (var i = 0; i < 5; i++) {
if (sellList == undefined || sellList[i] == undefined) {
var index = sellList == undefined ? 0 : sellList.length;
index = 5 - i + index;
sellsTemp.push('<tr><td style="text-align: center;">卖 ' + index +
'</td><td>-</td><td>-</td></tr>');
continue;
}
var entrust_price = parseFloat(sellList[i].ENTRUST_PRICE);
/*if (entrust_price > mclose_price) {
className = 'xyfHighPrice';
} else if (entrust_price < mclose_price) {
className = 'xyfLowPrice';
} else {
className = '';
}
if (i == 0) {
firstSellClassName = className;
}*/
entrust_price = entrust_price.toMoney(2, "", ",");
sells.push('<tr onclick="EntrustDetail.clickSellList(' + entrust_price + ')">');
sells.push('<td style="text-align: center;">卖 ' + sellList[i].RANKING + '</td>');
sells.push('<td>¥' + entrust_price + '</td>');
sells.push('<td>' + sellList[i].AMOUNT + '</td>');
sells.push('</tr>');
}
sellsTemp.push(sells);
//IE9下join方法会加逗号
$('#tabSellFive').html(sellsTemp.join('').replace(/,/g, ''));
// 买入五档
className = '';
for (var i = 0; i < 5; i++) {
if (buyList == undefined || buyList[i] == undefined) {
buys.push('<tr><td style="text-align: center;">买 ' + (i + 1) +
'</td><td>-</td><td>-</td></tr>');
continue;
}
var entrust_price = parseFloat(buyList[i].ENTRUST_PRICE);
/*if (entrust_price > mclose_price) {
className = 'xyfHighPrice';
} else if (entrust_price < mclose_price) {
className = 'xyfLowPrice';
} else {
className = '';
}*/
entrust_price = entrust_price.toMoney(2, "", ",");
buys.push('<tr onclick="EntrustDetail.clickBuyList(' + entrust_price + ')">');
buys.push('<td style="text-align: center;">买 ' + buyList[i].RANKING + '</td>');
buys.push('<td>¥' + entrust_price + '</td>');
buys.push('<td>' + buyList[i].AMOUNT + '</td>');
buys.push('</tr>');
}
$('#tabBuyFive').html(buys.join(''));
},
/** 计算可买数量 */
buyAmount : function() {
var buyPrice = $('#txtBuyPrice').val();
if (isNaN(buyPrice)) {
return;
}
buyPrice = parseFloat(buyPrice);
if (buyPrice == _beforeBuyPrice) {
return;
}
_beforeBuyPrice = buyPrice;
$.ajax({
type: 'GET',
url: '/fund/balance?t=' + Math.random(),
dataType: 'json',
success: function(data) {
$('#txtUserBalance').text(data);
if (data == null || data == '') {
return;
}
var balance = parseFloat(data.enable_balance);
//var balance = 11221;
if (buyPrice > 0) {
var buyAmount = parseInt(balance / buyPrice);
$('#spBuyAmount').text(buyAmount);
}
$('#spUserBalance').show();
$('#txtUserBalance').text(balance.toMoney(2, "", ","));
}
});
},
/** 可卖数量 */
sellAmount : function() {
var otcCode = $('#spOtcCode').text();
if (otcCode == '') {
return;
}
$.ajax({
type: 'GET',
url: '/ec/entrust/position?otcCode=' + otcCode + '&t=' + Math.random(),
dataType: 'json',
success: function(data) {
if (data != null && data.length > 0) {
$('#spSellAmount').text(parseInt(data[0].enable_amount));
}
}
});
},
buyAll:function(){
var buyAmount = $('#spBuyAmount').text();
$('#txtBuyAmount').val(buyAmount)
},
sellAll:function(){
var buyAmount = $('#spSellAmount').text();
$('#xyfFeedbackNum').val(buyAmount)
},
/** 点击卖出五档 */
clickSellList : function(price) {
price = parseFloat(price).toMoney(2, "", "");
$('#txtBuyPrice').val(price);
EntrustDetail.buyAmount();
},
/** 点击买入五档 */
clickBuyList : function(price) {
price = parseFloat(price).toMoney(2, "", "");
$('#txtSellPrice').val(price);
},
/** 断线重连 */
reconnect : function() {
// console.log('reconnect');
setTimeout("EntrustDetail.connect()", 5000);
},
/**买入按钮*/
buy : function() {
var price = $("#txtBuyPrice").val();
var amount = $("#txtBuyAmount").val();
if (price == '' || isNaN(price) || parseFloat(price) <= 0) {
alert('请输入买入价格');
$("#txtBuyPrice").focus();
} else if (amount == '' || isNaN(amount) || parseInt(amount) <= 0) {
alert('请输入买入数量');
$("#txtBuyAmount").focus();
} else {
EntrustDetail.dealSubmit("0B0", price, amount);
}
},
/**卖出按钮*/
sell : function() {
var price = $("#txtSellPrice").val();
var amount = $("#txtSellAmount").val();
if (price == '' || isNaN(price) || parseFloat(price) <= 0) {
alert('请输入卖出价格');
$("#txtSellPrice").focus();
} else if (amount == '' || isNaN(amount) || parseInt(amount) <= 0) {
alert('请输入卖出数量');
$("#txtSellAmount").focus();
} else {
EntrustDetail.dealSubmit("0S0", price, amount);
}
},
/**
* 买卖提交
*/
dealSubmit : function(otcProp, price, amount) {
$.post("/user/entrust2", {
price : price,
amount : amount,
prop : otcProp,
otcCode : _entrust.mch_code
}, function(data) {
$("#entrust_result").html(data.resultMsg);
easyDialog.open({
container : 'ensure'
});
$('#txtBuyAmount').val('');
$('#txtSellAmount').val('');
setTimeout('EntrustDetail.sellAmount()', 2000);
setTimeout('EntrustDetail.buyAmount()', 2000);
setTimeout('EntrustDetail.queryPosition()', 2000);
}, "json");
},
// tab切换
tabChange : function(tab, content, selecedClass) {
var $tab = $(tab);
$tab.find("a").eq(0).addClass(selecedClass);
$tab.find("a").on("click", function() {
var index = $(this).index();
$(this).addClass(selecedClass).siblings().removeClass(selecedClass);
$(content).children("div").eq(index).show().siblings().hide();
if ($(tab).attr("id") == "myDealList") {
if (index == 0) {
EntrustDetail.queryPosition();
} else if (index == 1) {
EntrustDetail.queryEntrust();
} else if (index == 2) {
EntrustDetail.queryTransaction();
}
} else if($(tab).attr("id")=="tab") {
if (index == 1) {
// EntrustDetail.instruction();
} else if (index == 2) {
EntrustDetail.tradingRecord();
}
}else if($(tab).attr("id")=="tradeTab"){
if (index == 2) {
EntrustAttention.init();
}
}
})
},
login : function() {
changeCaptcha2();
$('#loginModal').modal({
closeOnOverlayClick : false
}).open();
},
/**
* 用户持仓查询
*/
queryPosition : function() {
$.getJSON("/ec/entrust/position?t=" + Math.random(), function(data) {
if (data == null) {
return;
}
$("#dcTable").show();
if (data.length == 0) {
return;
}
var total_current_amount = 0, total_enable_amount = 0, total_market_value = 0, total_income_balance = 0;
var text = new Array();
for (var i = 0; i < data.length; i++) {
var position = data[i];
text.push("<tr><td style='width:4%'>" + (i + 1) + "</td>");
text.push("<td>" + position.otc_code + "</td>");
text.push("<td style='width:15%' class='left-font'>" + position.otc_name + "</td>");
text.push("<td style='width:8%' class='right-font'>" + Number(position.current_amount) + "</td>");
text.push("<td class='right-font'>" + Number(position.enable_amount) + "</td>");
text.push("<td class='right-font'>" + Number(position.cost_price).toMoney(3, '', ',') + "</td>");
text.push("<td class='right-font'>" + Number(position.last_price).toMoney(3, '', ',') + "</td>");
text.push("<td class='right-font'>" + Number(position.market_value).toMoney(2, '', ',') + "</td>");
text.push("<td class='right-font'>" + Number(position.income_balance).toMoney(2, '', ',') + "</td>");
text.push("<td class='right-font'>" + position.per + "</td></tr>");
total_current_amount += Number(position.current_amount);
total_enable_amount += Number(position.enable_amount);
total_market_value += Number(position.market_value);
total_income_balance += Number(position.income_balance);
}
$("#total_current_amount").html(total_current_amount);
$("#total_enable_amount").html(total_enable_amount);
$("#total_market_value").html(total_market_value.toMoney(2, "", ","));
$("#total_income_balance").html(total_income_balance.toMoney(2, "", ","));
$("#otc_code_position").html(text.join(''));
});
},
/**
* 用户当日委托查询
*/
queryEntrust : function() {
var url;
if ($("#cancel_order").prop("checked")) {
url = '/user/ec/reversibility';
} else {
url = '/ec/entrust';
}
$.getJSON(url, function(data) {
if (data != null) {
var text = new Array();
for (var i = 0; i < data.length; i++) {
var entrust = data[i];
text.push("<tr><td style='width: 20px;'><input type='radio' name='order' value='" + entrust.entrust_no + "'></input></td>");
text.push("<td style='width: 70px;'>" + entrust.entrust_no + "</td>");
text.push("<td style='width: 70px;'>" + entrust.entrust_date + "</td>");
text.push("<td style='width: 70px;'>" + entrust.entrust_time + "</td>");
text.push("<td style='width: 70px;'>" + entrust.entrust_status + "</td>");
text.push("<td style='width: 80px;'>" + entrust.otc_code + "</td>");
text.push("<td class='left-font' style='width: 90px;'>" + entrust.otc_name + "</td>");
text.push("<td class='right-font' style='width: 70px;'> " + Number(entrust.entrust_price).toMoney(2, '', ',') + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + Number(entrust.entrust_amount) + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + Number(entrust.business_price).toMoney(2, '', ',') + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + Number(entrust.business_amount) + "</td>");
text.push("<td style='width: 70px;'>" + entrust.otc_prop + "</td></tr>");
}
$("#entrust_info").html(text.join(''));
}
});
},
/**
* 用户当日成交查询
*/
queryTransaction : function() {
$.getJSON('/ec/entrust/transaction', {
queryMode : "0"
}, function(data) {
// var text = new Array();
// text.push("<tr><td style='width: 30px;'>1</td>");
// text.push("<td style='width: 70px;'>2018-03-33</td>");
// text.push("<td style='width: 70px;'>622112</td>");
// text.push("<td class='left-font' style='width: 90px;'>T167M水浒传3组</td>");
// text.push("<td class='right-font' style='width: 70px;'>133.330</td>");
// text.push("<td class='right-font' style='width: 70px;'>133.330</td>");
// text.push("<td class='right-font' style='width: 70px;'>133.330</td>");
// text.push("<td class='right-font' style='width: 70px;'>133.330</td>");
// text.push("<td style='width: 70px;'>已成交</td>");
// text.push("<td style='width: 70px;'>卖出</td></tr>");
// $("#transaction").html(text.join(''));
if (data != null) {
var text = new Array();
for (var i = 0; i < data.length; i++) {
var transaction = data[i];
text.push("<tr><td style='width: 30px;'>" + (i + 1) + "</td>");
text.push("<td style='width: 70px;'>" + transaction.business_time + "</td>");
text.push("<td style='width: 70px;'>" + transaction.otc_code + "</td>");
text.push("<td class='left-font' style='width: 90px;'>" + transaction.otc_name + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + Number(transaction.business_price).toMoney(3, '', ',') + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + Number(transaction.business_amount) + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + transaction.business_no + "</td>");
text.push("<td class='right-font' style='width: 70px;'>" + transaction.business_balance + "</td>");
text.push("<td style='width: 70px;'>" + transaction.real_status + "</td>");
text.push("<td style='width: 70px;'>" + transaction.otc_prop + "</td></tr>");
}
$("#transaction").html(text.join(''));
}
});
},
/**
* 买卖确认
*/
sureSubmit : function(otcProp) {
if (otcProp == "0B0") {
$("#sure_prop").html("买入");
$("#sure_price").html($("#txtBuyPrice").val());
$("#sure_amount").html($("#txtBuyAmount").val());
} else {
$("#sure_prop").html("卖出");
$("#sure_price").html($("#txtSellPrice").val());
$("#sure_amount").html($("#txtSellAmount").val());
}
$("#sure_otcCode").html(_entrust.mch_code);
$("#sure_otcName").html(_entrust.mch_name);
easyDialog.close();
easyDialog.open({
container : 'dealEnsure'
});
},
withdrawDialog : function() {
var entrustNo = $("input[name='order']:checked").val();
if (entrustNo == null) {
return;
}
$("#ensure_popup_text").html("委托编号=" + entrustNo);
easyDialog.open({
container : 'ensure_popup'
});
},
/**
* 撤单
*/
withdraw : function() {
easyDialog.close();
var entrustNo = $("input[name='order']:checked").val();
$.post("/user/withdraw", {
entrustNo : entrustNo
}, function(data) {
if (data.resultCode == "0") {
$("#entrust_result").html("操作成功");
} else {
$("#entrust_result").html("操作失败");
}
easyDialog.open({
container : 'ensure'
});
}, "json");
EntrustDetail.queryEntrust();
},
/**
* 藏品信息查询
*/
instruction : function() {
$.getJSON("/ec/entrust/instruction/" + _entrust.mch_code, function(data) {
if (data == null) {
$("#entrustContent").html("暂未查询到相关信息");
} else {
$("#entrustContent").html(data.content);
}
});
},
/**
* 当日成交查询
*/
tradingRecord : function() {
$.getJSON("/ec/entrust/transaction/" + _entrust.mch_code, function(data) {
var text = new Array();
var j = 0;
var fixLength = 30;
if (data.length == 0) {
j = 3;
for (var i = 0; i < fixLength; i++) {
if (i % 10 == 0) {
text.push("<table cellpadding='0' cellspacing='0'>");
text.push("<tr><th>成交时间</th><th>成交价格</th><th>成交量</th></tr>");
}
text.push("<tr><td>--</td>");
text.push("<td>--</td>");
text.push("<td>--</td></tr>");
if (i % 10 == 9) {
text.push("</table>");
}
}
} else {
var maxLength = data.length > fixLength ? data.length : fixLength;
var a = Math.ceil(maxLength / 10) * 10;
for (var i = 0; i < a; i++) {
var record = data[i];
if (i % 10 == 0) {
j = j + 1;
text.push("<table cellpadding='0' cellspacing='0'>");
text.push("<tr><th>成交时间</th><th>成交价格</th><th>成交量</th></tr>");
}
if (i < data.length) {
text.push("<tr><td>" + record.CURR_TIME + "</td>");
text.push("<td>" + record.BUSINESS_PRICE.toMoney(2, '', ',') + "</td>");
text.push("<td>" + record.BUSINESS_AMOUNT + "</td></tr>");
} else {
text.push("<tr><td>--</td>");
text.push("<td>--</td>");
text.push("<td>--</td></tr>");
}
if (i % 10 == 9) {
text.push("</table>");
}
}
}
$("#dealRecordList").html(text.join(''));
$("#dealRecordList").css('width', 300 * j);
});
},
/** 选择委托方式 */
chooseUseful : function() {
if ($("input[name='entrustUsefulRdo']:checked").val() == "0") {
$("#useful_context").html("你的所有未成交的订单将再每日日终后,进行撤单,不在持续到第二日。");
} else if ($("input[name='entrustUsefulRdo']:checked").val() == "1") {
$("#useful_context").html("你的所有未成交的订单将连续挂单七日,七日后未成交的订单,收盘后将自动撤单。");
}
},
/** 提价哦委托方式 */
usefulSubmit : function() {
var use = $("input[name='entrustUsefulRdo']:checked").val();
if (use == null || use == '') {
alert("委托方式不可为空");
}
$.post("/user/useful", {
useful : use
}, function(data) {
$("#entrust_result").html(data.resultMsg);
easyDialog.close();
easyDialog.open({
container : "ensure"
});
}, "json");
},
/** 关注 */
attention : function(otcCode, link) {
// 防止重复点击
if (_clickTag == 1) {
return false;
}
_clickTag = 1;
$.post('/user/attention/save', {
otcCode : otcCode
}, function(data) {
if (data != '') {
$('#attentionsResult').html(data);
$(link).prop('outerHTML', '<span style="font-size:12px;margin-left:15px">已关注</span>');
easyDialog.open({
container : 'sureAttention'
});
}
_clickTag = 0;
}, 'text');
}
}
}();
$(function() {
EntrustDetail.tabChange("#tradeTab", "#tradeTabContent", "tab-seletced");
EntrustDetail.tabChange("#tab", "#tabContent", "tab-seletced");
EntrustDetail.tabChange("#myDealList", "#dcTable", "tabseleced");
$("#ensurePopup").click(function() {
EntrustDetail.withdraw();
});
EntrustDetail.init();
});
/* xyf左侧滚动条重写 */
//$(function(){
// //内容高度
// var content = $("#xyfMyFocus");
// //框的高度
// var box = $("#xyfFormDetail");
// //自定义的滚动条
// var scrollbar = $("#xyfScrollbar");
// var scroll=function(content,box,scrollbar){
// var bigHeight = content.height();
// var smallHeight = box.height();
// var rate = smallHeight/bigHeight;
// var h = Math.floor(rate*smallHeight);
// scrollbar.height(h);
// var offset = box.offset()
// var offsetT = offset.top+1;
// scrollbar.mousedown(function(e){
// var divOffsetT = scrollbar.offset().top;
// var tempT = e.pageY-divOffsetT;
// function move(e){
// var newH = e.pageY-tempT-offsetT;
// if(newH<0){
// newH=0;
// }else if(newH>(smallHeight-h)){
// newH=smallHeight-h;
// }
// var rate2 = (newH+h)/smallHeight;
// var contentH = Math.floor(bigHeight*rate2-smallHeight);
// content.css("top",-contentH+"px");
// scrollbar.css("top",newH+"px");
// }
// $("body").on("mousemove",move);
// $("body").mouseup(function(){
// $("body").off("mousemove",move);
// });
// });
// }
// scroll(content,box,scrollbar);
// });
//