entrust.js
7.15 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
/**
* 托管申请 @author 仝玉甫
*/
$(function() {
//交付方式选择
$("input[name='picking_type']").change(function(){
var address=$("input[name='picking_type']:checked").val();
if( address== "01"){
$("#methodSelf").show();
$("#methodExpress").hide();
}else{
$("#methodSelf").hide();
$("#methodExpress").show();
}
})
//上门交付默认选择第一条
$("#methodSelf tr:first").addClass("checked");
$("#methodSelf tr:first").find("input[name='warehouseCode']").attr('checked','true');
$("input[name='warehouseCode']").change(function(){
$("input[name='warehouseCode']").parent().parent("tr").removeClass("checked");
$("input[name='warehouseCode']:checked").parent().parent("tr").addClass("checked");
})
//清空申请数量,很多浏览器会自动把之前申请的数量自动补全,导致用户申请数量出错
$('#apply_count').val('');
$('#apply_count').focus(function() {
$.get('/entrust/detail/' + $('#otc_code').val(), function(data) {
$('#spApplicableAmount').show();
$('#spApplicableAmount').text('剩余可申请数:' + data.applicableAmount);
});
});
// 退还本人 转交赵涌在线
$("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 otc_code = $('#otc_code').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 (otc_code == '813050') {
if (apply_count % 15 != 0) {
showMessage('申请数量必须是15的整倍数');
$('#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;
}
}
//$('#submit').attr("disabled","disabled");
if (isSubmit == true) {
showMessage('请勿重复提交。如需继续托管,请刷新页面后重试。');
return;
}
isSubmit = true;
$.post('/entrust', $('#entrust-form').serializeArray(), function(data) {
$('#submit').removeAttr("disabled");
if (data == null || data == '') {
showMessage('请勿重复提交', function() {
window.location.reload();
});
} else if (data.success == true) {
window.location.href = '/entrust/success';
} else {
showMessage(data.data, function() {
window.location.reload();
});
isSubmit = false;
}
});
});
});
/** 显示提示信息 */
function showMessage(msg, callFn) {
$('#dialog-content').html(msg);
$('#dialog-content').css({
'text-align': 'center',
'padding': '40px 0'
})
easyDialog.open({
container : 'easyDialogWrapper',
callback : callFn
});
}
/** 添加收货地址 *//*
function UserAddress() {
easyDialog.open({
container : 'address'
});
}*/
/**计算审核费和上市费*/
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));
}
/** 地址验证 *//*
function addressSubmit() {
var isValue = true;
var reg = /^1\d{10}$/;
// 退件地址
if ($("#userName").val() == '') {
$("#nameSpan").html('请填写收件人');
isValue = false;
} else {
$("#nameSpan").html("");
}
if ($('#mobile').val() == '') {
$("#numSpan").html('请填写联系电话');
isValue = false;
} else {
$("#numSpan").html('');
}
if ($('#province').val() == '' || $('#city').val() == ''
|| $('#area').val() == '') {
$("#pca").html('请选择退件地址');
isValue = false;
} else {
$("#pca").html('');
}
if ($('#street').val().length < 4) {
$("#detailSpan").html('退件详细地址不能少于4个字');
isValue = false;
} else {
$("#detailSpan").html('');
}
if (!reg.test($("#mobile").val())) {
$("#numSpan").html('手机号格式错误');
isValue = false;
} else {
$("#numSpan").html('');
}
return isValue
}
function getAddressInfo() {
var tbody = $('#addressTable');
var addressInfo = "";
$.ajax({
url : "/user/address/searchList",
type : "post",
dataType : "json",
async : false,
success : function(result) {
var text = new Array();
var data=result;
if (data != null && data.length > 0) {
for (var i = 0; i < data.length; i++) {
text.push('<tr id="usd_${status.count}">');
if(data[i].isDefault==1){
text.push('<td><input type="radio" name="addressId" checked="checked" value="'+ data[i].id+ '"/> </td>');
}else{
text.push('<td><input type="radio" name="addressId" value="'+ data[i].id+ '"/> </td>');
}
text.push('<td>' + data[i].userName + '</td>');
text.push('<td>' + data[i].mobileNo + '</td>');
text.push('<td>' + data[i].address + '</td>');
text.push('</tr>');
}
exchangeInfo = text.join('');
tbody.html(exchangeInfo);
}
}
})
}
*/
/*function toSubmit() {
if (addressSubmit()) {
$.ajax({
url : "/user/address/addressToEntrust",
type : "post",
dataType : "json",
data : $("#add_from").serialize(),
async : false,
success : function(result) {
if(result.resultCode==0){
easyDialog.close();
getAddressInfo();
}
}
})
}
}*/