|
@@ -3,17 +3,17 @@ |
|
@@ -3,17 +3,17 @@ |
3
|
* @author: xuqi<qi.xu@yoho.cn>
|
3
|
* @author: xuqi<qi.xu@yoho.cn>
|
4
|
* @date: 2015/11/12
|
4
|
* @date: 2015/11/12
|
5
|
*/
|
5
|
*/
|
6
|
-
|
|
|
7
|
-var $ = require('yoho-jquery'),
|
6
|
+require('cart/order-ensure.page.css');
|
|
|
7
|
+let $ = require('yoho-jquery'),
|
8
|
lazyLoad = require('yoho-jquery-lazyload'),
|
8
|
lazyLoad = require('yoho-jquery-lazyload'),
|
9
|
cookie = require('yoho-cookie');
|
9
|
cookie = require('yoho-cookie');
|
10
|
|
10
|
|
11
|
-var tip = require('../plugin/tip'),
|
11
|
+let tip = require('../plugin/tip'),
|
12
|
loading = require('../plugin/loading'),
|
12
|
loading = require('../plugin/loading'),
|
13
|
order = require('./order-info'),
|
13
|
order = require('./order-info'),
|
14
|
richTip = require('../plugin/rich-tip');
|
14
|
richTip = require('../plugin/rich-tip');
|
15
|
|
15
|
|
16
|
-var $invoice = $('.invoice'),
|
16
|
+let $invoice = $('.invoice'),
|
17
|
$couponUse = $('.coupon-use.used'),
|
17
|
$couponUse = $('.coupon-use.used'),
|
18
|
$addressWrap = $('.address-wrap'),
|
18
|
$addressWrap = $('.address-wrap'),
|
19
|
$coinCheck = $('.coin-check'),
|
19
|
$coinCheck = $('.coin-check'),
|
|
@@ -33,8 +33,8 @@ var $invoice = $('.invoice'), |
|
@@ -33,8 +33,8 @@ var $invoice = $('.invoice'), |
33
|
isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
|
33
|
isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
|
34
|
addressTop = $('.address-wrap').outerHeight();
|
34
|
addressTop = $('.address-wrap').outerHeight();
|
35
|
|
35
|
|
36
|
-var orderCont = cookie.get('order-info') && JSON.parse(cookie.get('order-info'));
|
|
|
37
|
-var invoiceCont = {
|
36
|
+let orderCont = cookie.get('order-info') && JSON.parse(cookie.get('order-info'));
|
|
|
37
|
+let invoiceCont = {
|
38
|
7: '服装',
|
38
|
7: '服装',
|
39
|
1: '图书',
|
39
|
1: '图书',
|
40
|
9: '配件',
|
40
|
9: '配件',
|
|
@@ -62,7 +62,7 @@ function invoiceInit() { |
|
@@ -62,7 +62,7 @@ function invoiceInit() { |
62
|
}
|
62
|
}
|
63
|
|
63
|
|
64
|
function getQueryParam() {
|
64
|
function getQueryParam() {
|
65
|
- var queryArray = location.search.substr(1).split('&'),
|
65
|
+ let queryArray = location.search.substr(1).split('&'),
|
66
|
i,
|
66
|
i,
|
67
|
subArr = [],
|
67
|
subArr = [],
|
68
|
obj = {};
|
68
|
obj = {};
|
|
@@ -98,9 +98,9 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) |
|
@@ -98,9 +98,9 @@ if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) |
98
|
}
|
98
|
}
|
99
|
|
99
|
|
100
|
isLimitGood() && (function() {
|
100
|
isLimitGood() && (function() {
|
101
|
- var a = [];
|
101
|
+ let a = [];
|
102
|
|
102
|
|
103
|
- var data = getQueryParam();
|
103
|
+ let data = getQueryParam();
|
104
|
|
104
|
|
105
|
data.type = 'limitcode';
|
105
|
data.type = 'limitcode';
|
106
|
|
106
|
|
|
@@ -114,7 +114,7 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { |
|
@@ -114,7 +114,7 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { |
114
|
}
|
114
|
}
|
115
|
|
115
|
|
116
|
// function dispacthTapEvt(e) {
|
116
|
// function dispacthTapEvt(e) {
|
117
|
-// var $cur = $(e.target).closest('li');
|
117
|
+// let $cur = $(e.target).closest('li');
|
118
|
|
118
|
|
119
|
// if ($cur.length === 0 || $cur.hasClass('chosed')) {
|
119
|
// if ($cur.length === 0 || $cur.hasClass('chosed')) {
|
120
|
// return;
|
120
|
// return;
|
|
@@ -125,7 +125,7 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { |
|
@@ -125,7 +125,7 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) { |
125
|
// }
|
125
|
// }
|
126
|
|
126
|
|
127
|
$('.checkbox').on('touchstart', function(e) {
|
127
|
$('.checkbox').on('touchstart', function(e) {
|
128
|
- var $this = $(this);
|
128
|
+ let $this = $(this);
|
129
|
|
129
|
|
130
|
if ($(e.target).closest('.coin-check').length && !isYohoCoinClick) {
|
130
|
if ($(e.target).closest('.coin-check').length && !isYohoCoinClick) {
|
131
|
return true;
|
131
|
return true;
|
|
@@ -142,7 +142,7 @@ $('.checkbox').on('touchstart', function(e) { |
|
@@ -142,7 +142,7 @@ $('.checkbox').on('touchstart', function(e) { |
142
|
});
|
142
|
});
|
143
|
|
143
|
|
144
|
$invoice.on('touchend', '.checkbox', function() {
|
144
|
$invoice.on('touchend', '.checkbox', function() {
|
145
|
- var $this = $(this);
|
145
|
+ let $this = $(this);
|
146
|
|
146
|
|
147
|
if ($this.hasClass('icon-cb-radio')) {
|
147
|
if ($this.hasClass('icon-cb-radio')) {
|
148
|
$invoice.addClass('focus');
|
148
|
$invoice.addClass('focus');
|
|
@@ -167,7 +167,7 @@ $invoice.on('touchend', '.checkbox', function() { |
|
@@ -167,7 +167,7 @@ $invoice.on('touchend', '.checkbox', function() { |
167
|
|
167
|
|
168
|
|
168
|
|
169
|
function updateDeliverId(id) {
|
169
|
function updateDeliverId(id) {
|
170
|
- var $moreJit = $('.more-jit a').get(0),
|
170
|
+ let $moreJit = $('.more-jit a').get(0),
|
171
|
url;
|
171
|
url;
|
172
|
|
172
|
|
173
|
if ($moreJit) {
|
173
|
if ($moreJit) {
|
|
@@ -184,7 +184,7 @@ function updateDeliverId(id) { |
|
@@ -184,7 +184,7 @@ function updateDeliverId(id) { |
184
|
}
|
184
|
}
|
185
|
|
185
|
|
186
|
function orderCompute() {
|
186
|
function orderCompute() {
|
187
|
- var yohoCoin = orderInfo('yohoCoin'),
|
187
|
+ let yohoCoin = orderInfo('yohoCoin'),
|
188
|
deliverId = orderInfo('deliveryId'),
|
188
|
deliverId = orderInfo('deliveryId'),
|
189
|
data = {
|
189
|
data = {
|
190
|
cartType: orderInfo('cartType') || 'ordinary',
|
190
|
cartType: orderInfo('cartType') || 'ordinary',
|
|
@@ -192,7 +192,7 @@ function orderCompute() { |
|
@@ -192,7 +192,7 @@ function orderCompute() { |
192
|
paymentType: orderInfo('paymentType'),
|
192
|
paymentType: orderInfo('paymentType'),
|
193
|
couponCode: orderInfo('couponCode'),
|
193
|
couponCode: orderInfo('couponCode'),
|
194
|
yohoCoin: yohoCoin,
|
194
|
yohoCoin: yohoCoin,
|
195
|
- skuList: isLimitGood() ? orderInfo('skuList') : undefined
|
195
|
+ skuList: isLimitGood() ? orderInfo('skuList') : void 0
|
196
|
};
|
196
|
};
|
197
|
|
197
|
|
198
|
// 门票
|
198
|
// 门票
|
|
@@ -214,7 +214,7 @@ function orderCompute() { |
|
@@ -214,7 +214,7 @@ function orderCompute() { |
214
|
if ($.type(res) !== 'object') {
|
214
|
if ($.type(res) !== 'object') {
|
215
|
window.location.reload();
|
215
|
window.location.reload();
|
216
|
} else {
|
216
|
} else {
|
217
|
- if (typeof res.last_order_amount !== undefined) {
|
217
|
+ if (typeof res.last_order_amount !== 'undefined') {
|
218
|
res.last_order_amount = (+res.last_order_amount).toFixed(2);
|
218
|
res.last_order_amount = (+res.last_order_amount).toFixed(2);
|
219
|
}
|
219
|
}
|
220
|
|
220
|
|
|
@@ -249,7 +249,7 @@ function orderCompute() { |
|
@@ -249,7 +249,7 @@ function orderCompute() { |
249
|
}
|
249
|
}
|
250
|
|
250
|
|
251
|
function submitOrder() {
|
251
|
function submitOrder() {
|
252
|
- var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
|
252
|
+ let invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
|
253
|
msg = $('#msg').find('input').val() || orderInfo('msg');
|
253
|
msg = $('#msg').find('input').val() || orderInfo('msg');
|
254
|
|
254
|
|
255
|
if (isSubmiting) {
|
255
|
if (isSubmiting) {
|
|
@@ -291,10 +291,10 @@ function submitOrder() { |
|
@@ -291,10 +291,10 @@ function submitOrder() { |
291
|
paymentType: orderInfo('paymentType'), // 支付方式
|
291
|
paymentType: orderInfo('paymentType'), // 支付方式
|
292
|
couponCode: orderInfo('couponCode'),
|
292
|
couponCode: orderInfo('couponCode'),
|
293
|
yohoCoin: orderInfo('yohoCoin'),
|
293
|
yohoCoin: orderInfo('yohoCoin'),
|
294
|
- skuList: isLimitGood() ? orderInfo('skuList') : undefined
|
294
|
+ skuList: isLimitGood() ? orderInfo('skuList') : void 0
|
295
|
}
|
295
|
}
|
296
|
}).then(function(res) {
|
296
|
}).then(function(res) {
|
297
|
- var url;
|
297
|
+ let url;
|
298
|
|
298
|
|
299
|
if (!res) {
|
299
|
if (!res) {
|
300
|
tip.show('系统繁忙,请稍后再试!');
|
300
|
tip.show('系统繁忙,请稍后再试!');
|
|
@@ -364,7 +364,7 @@ $('.delivery-id').on('touchend', 'li', function() { |
|
@@ -364,7 +364,7 @@ $('.delivery-id').on('touchend', 'li', function() { |
364
|
});
|
364
|
});
|
365
|
|
365
|
|
366
|
$('.payment-type').on('touchend', 'li', function() {
|
366
|
$('.payment-type').on('touchend', 'li', function() {
|
367
|
- var $paymentType = $('.icon-cb-radio', this);
|
367
|
+ let $paymentType = $('.icon-cb-radio', this);
|
368
|
|
368
|
|
369
|
orderInfo('paymentTypeId', $paymentType.data('id')); // 支付方式id
|
369
|
orderInfo('paymentTypeId', $paymentType.data('id')); // 支付方式id
|
370
|
orderInfo('paymentType', $paymentType.data('payment-type')); // 支付方式
|
370
|
orderInfo('paymentType', $paymentType.data('payment-type')); // 支付方式
|
|
@@ -381,7 +381,7 @@ $('.yoho-coin-help-dialog-bg, .yoho-coin-footer').on('touchend', function(e) { |
|
@@ -381,7 +381,7 @@ $('.yoho-coin-help-dialog-bg, .yoho-coin-footer').on('touchend', function(e) { |
381
|
});
|
381
|
});
|
382
|
|
382
|
|
383
|
$('.coin').on('touchend', function(e) {
|
383
|
$('.coin').on('touchend', function(e) {
|
384
|
- var $this = $(this);
|
384
|
+ let $this = $(this);
|
385
|
|
385
|
|
386
|
if ($(e.target).closest('.yoho-coin-help').length) {
|
386
|
if ($(e.target).closest('.yoho-coin-help').length) {
|
387
|
$('.yoho-coin-help-dialog-bg').removeClass('hide');
|
387
|
$('.yoho-coin-help-dialog-bg').removeClass('hide');
|
|
@@ -410,7 +410,7 @@ $('.coin').on('touchend', function(e) { |
|
@@ -410,7 +410,7 @@ $('.coin').on('touchend', function(e) { |
410
|
});
|
410
|
});
|
411
|
|
411
|
|
412
|
$invoice.on('touchend', '.checkbox', function(e) {
|
412
|
$invoice.on('touchend', '.checkbox', function(e) {
|
413
|
- var $this = $(this);
|
413
|
+ let $this = $(this);
|
414
|
|
414
|
|
415
|
orderInfo('invoice', $this.hasClass('icon-cb-radio'));
|
415
|
orderInfo('invoice', $this.hasClass('icon-cb-radio'));
|
416
|
e.preventDefault();
|
416
|
e.preventDefault();
|
|
@@ -479,7 +479,7 @@ $subBlock.on('touchstart', 'li', function() { |
|
@@ -479,7 +479,7 @@ $subBlock.on('touchstart', 'li', function() { |
479
|
|
479
|
|
480
|
|
480
|
|
481
|
$('.bill a').on('touchstart', function() {
|
481
|
$('.bill a').on('touchstart', function() {
|
482
|
- var $paymentType;
|
482
|
+ let $paymentType;
|
483
|
|
483
|
|
484
|
if (isTickets) {
|
484
|
if (isTickets) {
|
485
|
ticketsConfirm(); // eslint-disable-line
|
485
|
ticketsConfirm(); // eslint-disable-line
|
|
@@ -508,18 +508,13 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { |
|
@@ -508,18 +508,13 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') { |
508
|
|
508
|
|
509
|
// 电子票下单
|
509
|
// 电子票下单
|
510
|
function ticketsConfirm() {
|
510
|
function ticketsConfirm() {
|
511
|
- var data = {
|
511
|
+ let data = {
|
512
|
productSku: productSku,
|
512
|
productSku: productSku,
|
513
|
buyNumber: buyNumber,
|
513
|
buyNumber: buyNumber,
|
514
|
mobile: $ticketsMobile.val(),
|
514
|
mobile: $ticketsMobile.val(),
|
515
|
useYohoCoin: orderInfo('yohoCoin')
|
515
|
useYohoCoin: orderInfo('yohoCoin')
|
516
|
};
|
516
|
};
|
517
|
|
517
|
|
518
|
- // 如果没有勾选选择有货币,不取cookie有货币值,直接置0
|
|
|
519
|
- if (!$('.checkbox').hasClass('icon-cb-radio')) {
|
|
|
520
|
- data.useYohoCoin = 0;
|
|
|
521
|
- }
|
|
|
522
|
-
|
|
|
523
|
if (!$ticketsMobile.val()) {
|
518
|
if (!$ticketsMobile.val()) {
|
524
|
tip.show('手机号必填');
|
519
|
tip.show('手机号必填');
|
525
|
return;
|
520
|
return;
|
|
@@ -548,8 +543,8 @@ function ticketsConfirm() { |
|
@@ -548,8 +543,8 @@ function ticketsConfirm() { |
548
|
|
543
|
|
549
|
// 校验手机号
|
544
|
// 校验手机号
|
550
|
$ticketsMobile.blur(function() {
|
545
|
$ticketsMobile.blur(function() {
|
551
|
- var reg = /^[0123456789]{1,30}$/;
|
|
|
552
|
- var mobile = $ticketsMobile.val();
|
546
|
+ let reg = /^[0123456789]{1,30}$/;
|
|
|
547
|
+ let mobile = $ticketsMobile.val();
|
553
|
|
548
|
|
554
|
if (!reg.test(mobile)) {
|
549
|
if (!reg.test(mobile)) {
|
555
|
tip.show('手机号码不正确!');
|
550
|
tip.show('手机号码不正确!');
|