entrustOld.js
4.4 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
/**
* 再托管申请 @author xiangwei
*/
$(function() {
// 退还本人 转交赵涌在线
$("input[name='return_deal']").change(function() {
var radioval = $("input[name='return_deal']:checked").val();
if (radioval == "01") {
$("#return_deal_zhaoonline").css("display", "none");
$("#return_deal_pivate").css("display", "block");
} else {
$("#return_deal_pivate").css("display", "none");
$("#return_deal_zhaoonline").css("display", "block");
}
});
/**证件类型*/
var cards = {
'0': '身份证',
'1': '外国护照',
'3': '军官证',
'4': '社会保障号',
'F': '户口本'
};
var card = cards[$('#id_kind').text()];
$('#id_kind').text(card);
/**审核费合计*/
$('#apply_count').keyup(calculateFee);
$('#apply_count').blur(calculateFee);
$('#reset').click(function() {
$('#entrust-form')[0].reset();
});
/**提交*/
var isSubmit = false;
$('#submit').click(function() {
//申请数量
var apply_count = $('#apply_count').val();
var low_amount = $('#low_amount').val();
var remainAmount=$("#remainAmount").val();
var maxApplyAmount=$('#maxApplyAmount').val();
if (!$.isNumeric(apply_count)) {
showMessage('申请数量应该为数字');
$('#apply_count').focus();
return;
}
if (apply_count.indexOf('.') != -1) {
showMessage('申请数量应该是整数');
$('#apply_count').focus();
return;
}
if (parseInt(apply_count) < parseInt(low_amount)) {
showMessage('对不起,你申请数量小于最小托管量(' + low_amount+"),故申请失败");
$('#apply_count').focus();
return;
}
if (parseInt(apply_count) >parseInt(remainAmount)) {
showMessage('对不起,您申请的数量不能大于可申请数量(' + remainAmount+"),故申请失败");
$('#apply_count').focus();
return;
}
if (parseInt(apply_count) >parseInt(maxApplyAmount)) {
showMessage('对不起,您申请的数量大于最大申请数量(' + maxApplyAmount+"),故申请失败");
$('#apply_count').focus();
return;
}
//重要提示
if ($("#chkProtocol").is(":checked") == false) {
showMessage('请勾选重要提示');
return;
}
//交付方式
var picking_type = $('input:radio[name="picking_type"]:checked').val();
if (picking_type == null) {
showMessage('请选择交付方式');
$('input:radio[name="picking_type"]:checked').focus();
return;
}
//退货方式
var radioval = $("input[name='return_deal']:checked").val();
//退还本人
if (radioval == "01") {
/*if ($('input[name="addressId"]').length == 0) {
showMessage('请选择退件地址');
return;
}*/
} else {
//转交赵涌在线拍卖
if ($('#zhaoonline_user_id').val().length < 7 || $('#zhaoonline_user_id').val().length > 11) {
showMessage('赵涌在线账号应为7位数字用户ID或11位手机号码');
return;
}
}
if (isSubmit == true) {
showMessage('请勿重复提交。如需继续托管,请刷新页面后重试。');
return;
}
isSubmit = true;
$.post('/entrust/old', $('#entrust-form').serializeArray(), function(data) {
$('#submit').removeAttr("disabled");
if (data.success == true) {
window.location.href = '/entrust/old/success';
} else {
showMessage(data.data);
isSubmit = false;
}
});
});
// getAddressInfo();
});
function entrustOld(id) {
$.ajax({
type: 'GET',
url: '/login/state?r=' + Math.random(),
success: function(data) {
if (data == 'N') {
$('#stockId').val(id);
changeCaptcha2();
$('#loginModal').modal({closeOnOverlayClick: false}).open();
} else {
window.location.href = '/user/entrustOld?stockId=' + id;
}
},
error: function(data) {
if (data.responseText == 'N') {
$('#stockId').val(id);
changeCaptcha2();
$('#loginModal').modal({closeOnOverlayClick: false}).open();
} else {
window.location.href = '/user/entrustOld?stockId=' + id;
}
}
});
}
/** 显示提示信息 */
function showMessage(msg) {
$('#dialog-content').html(msg);
easyDialog.open({
container : 'easyDialogWrapper'
});
}
/**计算审核费和上市费*/
function calculateFee() {
var apply_count = $('#apply_count').val();
if (isNaN(apply_count)) {
return;
}
var appraisal_fare = new Number(apply_count * $('#appraisal_fare').val());
var issue_price = new Number(apply_count * $('#issue_price').val());
$('#appraisal_fare_total').text(appraisal_fare.toFixed(2));
$('#issue_price_total').text(issue_price.toFixed(2));
}