...
|
...
|
@@ -15,6 +15,7 @@ var dispatchModeHammer, |
|
|
dispatchTimeHammer,
|
|
|
$invoice = $('.invoice'),
|
|
|
$price = $('.price-cal'),
|
|
|
payType,
|
|
|
priceTmpl = Handlebars.compile($('#tmpl-price').html());
|
|
|
|
|
|
lazyLoad();
|
...
|
...
|
@@ -99,23 +100,33 @@ function submitOrder() { |
|
|
addressId: orderInfo('addressId'),
|
|
|
cartType: orderInfo('cartType'),
|
|
|
deliveryId: orderInfo('deliveryId') || 1,
|
|
|
deliveryTimeId: orderInfo('deliveryTimeId') || 1,
|
|
|
invoiceText: orderInfo('invoiceText'),
|
|
|
invoiceType: orderInfo('invoiceType'),
|
|
|
msg: orderInfo('msg'),
|
|
|
deliveryTimeId: orderInfo('deliveryTimeId') || 2,
|
|
|
invoiceText: $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
|
|
|
invoiceType: $invoice.find('.invoice-type').val() || orderInfo('invoiceType'),
|
|
|
msg: $('#msg').find('input').val() || orderInfo('msg'),
|
|
|
paymentTypeId: orderInfo('paymentTypeId'),
|
|
|
paymentType: orderInfo('paymentType'), //支付方式
|
|
|
couponCode: orderInfo('couponCode'),
|
|
|
yohoCoin: orderInfo('yohoCoin')
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
var url;
|
|
|
|
|
|
if (!res) {
|
|
|
tip.show('网络出错');
|
|
|
return;
|
|
|
}
|
|
|
if (res.code !== 200) {
|
|
|
tip.show(res.message || '网络出错');
|
|
|
if (res.code === 200) {
|
|
|
if (payType === 2) {
|
|
|
|
|
|
// 货到付款的进入订单页面
|
|
|
url = '/home/orderDetail?order_code=' + res.data.order_code;
|
|
|
} else {
|
|
|
url = '/home/pay?order_code=' + res.data.order_code;
|
|
|
}
|
|
|
window.location.href = url;
|
|
|
} else {
|
|
|
console.log(1);
|
|
|
tip.show(res.messege || '网络出错');
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出错');
|
...
|
...
|
@@ -124,7 +135,7 @@ function submitOrder() { |
|
|
|
|
|
// 界面点击,状态存 cookie
|
|
|
if (!orderInfo('addressId')) {
|
|
|
orderInfo('addressId', $('.address-wrap').data('address-id'));
|
|
|
orderInfo('addressId', $('.address-wrap').data('id'));
|
|
|
}
|
|
|
|
|
|
$('.dispatch-mode').on('touchend', 'li', function() {
|
...
|
...
|
@@ -166,7 +177,10 @@ $('#msg').find('input').on('blur', function() { |
|
|
});
|
|
|
|
|
|
$('.pay-mode').on('click', 'li', function() {
|
|
|
orderInfo('paymentTypeId', $(this).data('pay-id'));
|
|
|
orderInfo('paymentType', $(this).data('pay-type'));
|
|
|
var $this = $(this);
|
|
|
|
|
|
orderInfo('paymentTypeId', $this.data('pay-id'));
|
|
|
orderInfo('paymentType', $this.data('pay-type'));
|
|
|
payType = $this.data('pay-type');
|
|
|
submitOrder();
|
|
|
}); |
...
|
...
|
|