|
@@ -8,6 +8,7 @@ const $ = require('yoho-jquery'); |
|
@@ -8,6 +8,7 @@ const $ = require('yoho-jquery'); |
8
|
const lazyLoad = require('yoho-jquery-lazyload');
|
8
|
const lazyLoad = require('yoho-jquery-lazyload');
|
9
|
const cookie = require('yoho-cookie');
|
9
|
const cookie = require('yoho-cookie');
|
10
|
const qs = require('yoho-qs');
|
10
|
const qs = require('yoho-qs');
|
|
|
11
|
+const OrderEnsure = require('./cartbuynow/order-ensure');
|
11
|
|
12
|
|
12
|
let tip = require('plugin/tip'),
|
13
|
let tip = require('plugin/tip'),
|
13
|
loading = require('plugin/loading'),
|
14
|
loading = require('plugin/loading'),
|
|
@@ -27,9 +28,6 @@ let $invoice = $('.invoice'), |
|
@@ -27,9 +28,6 @@ let $invoice = $('.invoice'), |
27
|
isSubmiting,
|
28
|
isSubmiting,
|
28
|
dispatchInfo,
|
29
|
dispatchInfo,
|
29
|
total,
|
30
|
total,
|
30
|
- isTickets = $('#ticketsPage').val(),
|
|
|
31
|
- productSku = $('#productSku').val(),
|
|
|
32
|
- buyNumber = $('#buyNumber').val(),
|
|
|
33
|
headerTop = $('#yoho-header').outerHeight(),
|
31
|
headerTop = $('#yoho-header').outerHeight(),
|
34
|
isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
|
32
|
isYohoCoinClick = $coinLi.data('yoho-coin-click') * 1, // 判断有货币是否可以单击
|
35
|
addressTop = $('.address-wrap').outerHeight(),
|
33
|
addressTop = $('.address-wrap').outerHeight(),
|
|
@@ -37,8 +35,7 @@ let $invoice = $('.invoice'), |
|
@@ -37,8 +35,7 @@ let $invoice = $('.invoice'), |
37
|
delivery = 0,
|
35
|
delivery = 0,
|
38
|
$noPrintPrice = $('.no-print-price');
|
36
|
$noPrintPrice = $('.no-print-price');
|
39
|
|
37
|
|
40
|
-let $invoiceType = $('.invoice-type');
|
|
|
41
|
-let $userMobile = $('.user-mobile');
|
38
|
+new OrderEnsure(order);
|
42
|
|
39
|
|
43
|
require('common');
|
40
|
require('common');
|
44
|
|
41
|
|
|
@@ -47,78 +44,6 @@ lazyLoad(); |
|
@@ -47,78 +44,6 @@ lazyLoad(); |
47
|
// 存 COOKIE
|
44
|
// 存 COOKIE
|
48
|
orderInfo('product_sku', qs.product_sku);
|
45
|
orderInfo('product_sku', qs.product_sku);
|
49
|
|
46
|
|
50
|
-function getQueryParam() {
|
|
|
51
|
- let queryArray = location.search.substr(1).split('&'),
|
|
|
52
|
- i,
|
|
|
53
|
- subArr = [],
|
|
|
54
|
- obj = {};
|
|
|
55
|
-
|
|
|
56
|
- for (i = 0; i < queryArray.length; i++) {
|
|
|
57
|
- subArr = queryArray[i].split('=');
|
|
|
58
|
- obj[subArr[0]] = subArr[1];
|
|
|
59
|
- subArr = [];
|
|
|
60
|
- }
|
|
|
61
|
-
|
|
|
62
|
- return obj;
|
|
|
63
|
-}
|
|
|
64
|
-
|
|
|
65
|
-function isLimitGood() {
|
|
|
66
|
- return getQueryParam().limitproductcode;
|
|
|
67
|
-}
|
|
|
68
|
-
|
|
|
69
|
-// 电子票下单
|
|
|
70
|
-function _ticketsConfirm() {
|
|
|
71
|
- let data = {
|
|
|
72
|
- productSku: productSku,
|
|
|
73
|
- buyNumber: buyNumber,
|
|
|
74
|
- mobile: $ticketsMobile.val(),
|
|
|
75
|
- useYohoCoin: orderInfo('use_yoho_coin')
|
|
|
76
|
- };
|
|
|
77
|
-
|
|
|
78
|
- if (!$ticketsMobile.val()) {
|
|
|
79
|
- tip.show('手机号必填');
|
|
|
80
|
- return;
|
|
|
81
|
- }
|
|
|
82
|
-
|
|
|
83
|
- $.ajax({
|
|
|
84
|
- url: '/cart/index/submitTicket',
|
|
|
85
|
- type: 'POST',
|
|
|
86
|
- dataType: 'json',
|
|
|
87
|
- data: data,
|
|
|
88
|
- success: function(ticket) {
|
|
|
89
|
-
|
|
|
90
|
- // 下单成功调整支付页面
|
|
|
91
|
- if (ticket.code === 200) {
|
|
|
92
|
- window.location.href = '/home/orders/paynew?order_code=' + ticket.data.order_code;
|
|
|
93
|
- } else {
|
|
|
94
|
- tip.show(ticket.message);
|
|
|
95
|
- }
|
|
|
96
|
-
|
|
|
97
|
- },
|
|
|
98
|
- error: function() {
|
|
|
99
|
- tip.show('网络异常~');
|
|
|
100
|
- }
|
|
|
101
|
- });
|
|
|
102
|
-}
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-if (window.getUid() !== orderInfo('uid')) {
|
|
|
106
|
- order.init();
|
|
|
107
|
- window.location.reload();
|
|
|
108
|
-}
|
|
|
109
|
-
|
|
|
110
|
-isLimitGood() && (function() {
|
|
|
111
|
- let a = [];
|
|
|
112
|
-
|
|
|
113
|
- let data = getQueryParam();
|
|
|
114
|
-
|
|
|
115
|
- data.type = 'limitcode';
|
|
|
116
|
-
|
|
|
117
|
- a.push(data);
|
|
|
118
|
- orderInfo('skuList', JSON.stringify(a));
|
|
|
119
|
- orderInfo('limitUrlSufix', location.search);
|
|
|
120
|
-}());
|
|
|
121
|
-
|
|
|
122
|
if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
|
47
|
if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
|
123
|
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
|
48
|
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
|
124
|
}
|
49
|
}
|
|
@@ -140,32 +65,6 @@ $('.checkbox').on('touchstart', function(e) { |
|
@@ -140,32 +65,6 @@ $('.checkbox').on('touchstart', function(e) { |
140
|
}
|
65
|
}
|
141
|
});
|
66
|
});
|
142
|
|
67
|
|
143
|
-/**
|
|
|
144
|
- * 是否需要开发票
|
|
|
145
|
- */
|
|
|
146
|
-$invoice.on('touchend', '.checkbox', function(e) {
|
|
|
147
|
- let $this = $(this);
|
|
|
148
|
-
|
|
|
149
|
- orderInfo('invoice', $this.hasClass('icon-cb-radio'));
|
|
|
150
|
- if ($this.hasClass('icon-cb-radio')) {
|
|
|
151
|
- $invoice.addClass('focus');
|
|
|
152
|
- $invoiceType.html('电子发票(个人)<i class="iconfont"></i>');
|
|
|
153
|
- orderInfo('receiverMobile', $userMobile.val());
|
|
|
154
|
- orderInfo('invoices_type', 2);
|
|
|
155
|
- }
|
|
|
156
|
- if ($this.hasClass('icon-radio')) {
|
|
|
157
|
- $invoice.removeClass('focus');
|
|
|
158
|
- $invoiceType.html('');
|
|
|
159
|
- orderInfo('invoices_title', null);
|
|
|
160
|
- orderInfo('invoices_type', null);
|
|
|
161
|
- orderInfo('receiverMobile', null);
|
|
|
162
|
- orderInfo('buyerTaxNumber', null);
|
|
|
163
|
- }
|
|
|
164
|
- e.preventDefault();
|
|
|
165
|
- e.stopPropagation();
|
|
|
166
|
-});
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
function updateDeliverWay(deliver_way) {
|
68
|
function updateDeliverWay(deliver_way) {
|
170
|
let $moreJit = $('.more-jit a').get(0),
|
69
|
let $moreJit = $('.more-jit a').get(0),
|
171
|
url;
|
70
|
url;
|
|
@@ -193,8 +92,7 @@ function orderCompute() { |
|
@@ -193,8 +92,7 @@ function orderCompute() { |
193
|
delivery_way: orderInfo('delivery_way'),
|
92
|
delivery_way: orderInfo('delivery_way'),
|
194
|
payment_type: orderInfo('payment_type'),
|
93
|
payment_type: orderInfo('payment_type'),
|
195
|
coupon_code: orderInfo('coupon_code'),
|
94
|
coupon_code: orderInfo('coupon_code'),
|
196
|
- use_yoho_coin: use_yoho_coin,
|
|
|
197
|
- skuList: isLimitGood() ? orderInfo('skuList') : void 0
|
95
|
+ use_yoho_coin: use_yoho_coin
|
198
|
};
|
96
|
};
|
199
|
|
97
|
|
200
|
loading.showLoadingMask();
|
98
|
loading.showLoadingMask();
|
|
@@ -493,11 +391,6 @@ $subBlock.on('touchstart', 'li', function() { |
|
@@ -493,11 +391,6 @@ $subBlock.on('touchstart', 'li', function() { |
493
|
$('.bill a').on('touchstart', function() {
|
391
|
$('.bill a').on('touchstart', function() {
|
494
|
let $paymentType;
|
392
|
let $paymentType;
|
495
|
|
393
|
|
496
|
- if (isTickets) {
|
|
|
497
|
- _ticketsConfirm();
|
|
|
498
|
- return;
|
|
|
499
|
- }
|
|
|
500
|
-
|
|
|
501
|
$paymentType = $('.payment-type .icon-cb-radio');
|
394
|
$paymentType = $('.payment-type .icon-cb-radio');
|
502
|
orderInfo('payment_id', $paymentType.data('id')); // 支付方式id
|
395
|
orderInfo('payment_id', $paymentType.data('id')); // 支付方式id
|
503
|
orderInfo('payment_type', $paymentType.data('payment-type')); // 支付方式
|
396
|
orderInfo('payment_type', $paymentType.data('payment-type')); // 支付方式
|