|
@@ -16,6 +16,7 @@ var dispatchModeHammer, |
|
@@ -16,6 +16,7 @@ var dispatchModeHammer, |
16
|
dispatchTimeHammer,
|
16
|
dispatchTimeHammer,
|
17
|
$invoice = $('.invoice'),
|
17
|
$invoice = $('.invoice'),
|
18
|
$price = $('.price-cal'),
|
18
|
$price = $('.price-cal'),
|
|
|
19
|
+ $couponUse = $('.coupon-use.used'),
|
19
|
payType,
|
20
|
payType,
|
20
|
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
|
21
|
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
|
21
|
queryString = $.queryString(),
|
22
|
queryString = $.queryString(),
|
|
@@ -27,6 +28,11 @@ if (window.getUid() !== orderInfo('uid')) { |
|
@@ -27,6 +28,11 @@ if (window.getUid() !== orderInfo('uid')) { |
27
|
order.init();
|
28
|
order.init();
|
28
|
}
|
29
|
}
|
29
|
|
30
|
|
|
|
31
|
+if ($couponUse.data('value') !== orderInfo('couponValue')) {
|
|
|
32
|
+ orderInfo('couponCode', null);
|
|
|
33
|
+ orderInfo('couponValue', null);
|
|
|
34
|
+}
|
|
|
35
|
+
|
30
|
function dispacthTapEvt(e) {
|
36
|
function dispacthTapEvt(e) {
|
31
|
var $cur = $(e.target).closest('li');
|
37
|
var $cur = $(e.target).closest('li');
|
32
|
|
38
|
|
|
@@ -110,9 +116,24 @@ function orderCompute() { |
|
@@ -110,9 +116,24 @@ function orderCompute() { |
110
|
}
|
116
|
}
|
111
|
|
117
|
|
112
|
function submitOrder() {
|
118
|
function submitOrder() {
|
113
|
- if (orderInfo('invoice') && !orderInfo('invoiceText')) {
|
|
|
114
|
- tip.show('请输入发票抬头');
|
|
|
115
|
- return;
|
119
|
+ var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
|
|
|
120
|
+ msg = $('#msg').find('input').val() || orderInfo('msg');
|
|
|
121
|
+
|
|
|
122
|
+ if (orderInfo('invoice')) {
|
|
|
123
|
+ if (!invoiceText) {
|
|
|
124
|
+ tip.show('请输入发票抬头');
|
|
|
125
|
+ return;
|
|
|
126
|
+ }
|
|
|
127
|
+ if (invoiceText.length > 30) {
|
|
|
128
|
+ tip.show('发票抬头不得超过30个汉字');
|
|
|
129
|
+ return;
|
|
|
130
|
+ }
|
|
|
131
|
+ }
|
|
|
132
|
+ if (msg) {
|
|
|
133
|
+ if (msg.length > 40) {
|
|
|
134
|
+ tip.show('留言不得超过40个汉字');
|
|
|
135
|
+ return;
|
|
|
136
|
+ }
|
116
|
}
|
137
|
}
|
117
|
loading.showLoadingMask();
|
138
|
loading.showLoadingMask();
|
118
|
$.ajax({
|
139
|
$.ajax({
|
|
@@ -123,9 +144,9 @@ function submitOrder() { |
|
@@ -123,9 +144,9 @@ function submitOrder() { |
123
|
cartType: queryString.cartType || queryString.carttype || 'ordinary',
|
144
|
cartType: queryString.cartType || queryString.carttype || 'ordinary',
|
124
|
deliveryId: orderInfo('deliveryId'),
|
145
|
deliveryId: orderInfo('deliveryId'),
|
125
|
deliveryTimeId: orderInfo('deliveryTimeId'),
|
146
|
deliveryTimeId: orderInfo('deliveryTimeId'),
|
126
|
- invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
|
147
|
+ invoiceText: invoiceText,
|
127
|
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
|
148
|
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
|
128
|
- msg: $('#msg').find('input').val() || orderInfo('msg'),
|
149
|
+ msg: msg,
|
129
|
paymentTypeId: orderInfo('paymentTypeId'),
|
150
|
paymentTypeId: orderInfo('paymentTypeId'),
|
130
|
paymentType: orderInfo('paymentType'), //支付方式
|
151
|
paymentType: orderInfo('paymentType'), //支付方式
|
131
|
couponCode: orderInfo('couponCode'),
|
152
|
couponCode: orderInfo('couponCode'),
|
|
@@ -198,7 +219,7 @@ $invoice.find('[name="invoice-title"]').on('blur', function() { |
|
@@ -198,7 +219,7 @@ $invoice.find('[name="invoice-title"]').on('blur', function() { |
198
|
orderInfo('invoiceType', $(this).val());
|
219
|
orderInfo('invoiceType', $(this).val());
|
199
|
});
|
220
|
});
|
200
|
|
221
|
|
201
|
-$('#msg').find('input').on('blur', function() {
|
222
|
+$('#msg').find('textarea').on('blur', function() {
|
202
|
orderInfo('msg', $(this).val());
|
223
|
orderInfo('msg', $(this).val());
|
203
|
});
|
224
|
});
|
204
|
|
225
|
|