Merge branch 'feature/orderEnsurefreight' into 'release/5.4.1'
套餐结算页选择优惠券返回修复 1、套餐结算页选择运费,涮新未选中修复。 2、套餐结算页提交订单,参数有误修复。 3、套餐结算页支付方式和支付方式ID修复。 4、优惠券选择返回修复。 See merge request !286
Showing
7 changed files
with
35 additions
and
42 deletions
@@ -118,7 +118,7 @@ exports.orderEnsure = (req, res, next) => { | @@ -118,7 +118,7 @@ exports.orderEnsure = (req, res, next) => { | ||
118 | exports.orderCompute = (req, res, next) => { | 118 | exports.orderCompute = (req, res, next) => { |
119 | let cartType = req.body.cartType || 'ordinary'; | 119 | let cartType = req.body.cartType || 'ordinary'; |
120 | let deliveryId = req.body.deliveryId || 1; | 120 | let deliveryId = req.body.deliveryId || 1; |
121 | - let paymentTypeId = req.body.paymentTypeId || 1; | 121 | + let paymentType = req.body.paymentType || 1; |
122 | let couponCode = req.body.couponCode || null; | 122 | let couponCode = req.body.couponCode || null; |
123 | let yohoCoin = req.body.yohoCoin || null; | 123 | let yohoCoin = req.body.yohoCoin || null; |
124 | let productSku = req.body.productSku || null; | 124 | let productSku = req.body.productSku || null; |
@@ -131,11 +131,11 @@ exports.orderCompute = (req, res, next) => { | @@ -131,11 +131,11 @@ exports.orderCompute = (req, res, next) => { | ||
131 | if (req.body.cartType === 'bundle') { | 131 | if (req.body.cartType === 'bundle') { |
132 | let activityInfo = JSON.parse(req.cookies['activity-info']); | 132 | let activityInfo = JSON.parse(req.cookies['activity-info']); |
133 | 133 | ||
134 | - cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => { | 134 | + cartModel.orderCompute(uid, cartType, deliveryId, paymentType, couponCode, yohoCoin, null, activityInfo).then(result => { |
135 | res.json(result); | 135 | res.json(result); |
136 | }).catch(next); | 136 | }).catch(next); |
137 | } else { | 137 | } else { |
138 | - cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, skuList).then(result => { | 138 | + cartModel.orderCompute(uid, cartType, deliveryId, paymentType, couponCode, yohoCoin, skuList).then(result => { |
139 | res.json(result); | 139 | res.json(result); |
140 | }).catch(next); | 140 | }).catch(next); |
141 | } | 141 | } |
@@ -159,7 +159,7 @@ exports.orderSub = (req, res, next) => { | @@ -159,7 +159,7 @@ exports.orderSub = (req, res, next) => { | ||
159 | let paymentType = req.body.paymentType || 1; | 159 | let paymentType = req.body.paymentType || 1; |
160 | let msg = req.body.msg || null; | 160 | let msg = req.body.msg || null; |
161 | let couponCode = req.body.couponCode || null; | 161 | let couponCode = req.body.couponCode || null; |
162 | - let yohoCoin = req.body.yohoCoin || 1; | 162 | + let yohoCoin = req.body.yohoCoin || 0; |
163 | let skuList = req.body.skuList || ''; | 163 | let skuList = req.body.skuList || ''; |
164 | let orderInfo; | 164 | let orderInfo; |
165 | 165 | ||
@@ -224,7 +224,7 @@ exports.orderSub = (req, res, next) => { | @@ -224,7 +224,7 @@ exports.orderSub = (req, res, next) => { | ||
224 | let result; | 224 | let result; |
225 | 225 | ||
226 | /* tar modified 161206 套餐 */ | 226 | /* tar modified 161206 套餐 */ |
227 | - if (req.body.activityType === 'bundle') { | 227 | + if (req.body.cartType === 'bundle') { |
228 | let activityInfo = JSON.parse(req.cookies['activity-info']); | 228 | let activityInfo = JSON.parse(req.cookies['activity-info']); |
229 | 229 | ||
230 | result = yield cartModel.orderSub(uid, addressId, 'bundle', deliveryTimeId, | 230 | result = yield cartModel.orderSub(uid, addressId, 'bundle', deliveryTimeId, |
@@ -261,7 +261,6 @@ exports.selectCoupon = (req, res) => { | @@ -261,7 +261,6 @@ exports.selectCoupon = (req, res) => { | ||
261 | 261 | ||
262 | let headerData = headerModel.setNav({ | 262 | let headerData = headerModel.setNav({ |
263 | navTitle: '选择优惠券', | 263 | navTitle: '选择优惠券', |
264 | - backUrl: helpers.urlFormat('/cart/index/new/orderEnsure', {cartType: req.cookies._cartType}), | ||
265 | navBtn: false | 264 | navBtn: false |
266 | }); | 265 | }); |
267 | 266 |
@@ -12,8 +12,8 @@ const BAD_REQUEST = '非法请求'; | @@ -12,8 +12,8 @@ const BAD_REQUEST = '非法请求'; | ||
12 | const SLAT = 'yohobuyseckill98'; | 12 | const SLAT = 'yohobuyseckill98'; |
13 | 13 | ||
14 | exports.ensure = (req, res, next) => { | 14 | exports.ensure = (req, res, next) => { |
15 | - const sku = Number.parseInt(req.query.sku, 10); | ||
16 | - const skn = Number.parseInt(req.query.skn, 10); | 15 | + const sku = parseInt(req.query.sku, 10); |
16 | + const skn = parseInt(req.query.skn, 10); | ||
17 | const uid = req.user.uid; | 17 | const uid = req.user.uid; |
18 | let activityId; | 18 | let activityId; |
19 | 19 | ||
@@ -116,7 +116,7 @@ exports.ensure = (req, res, next) => { | @@ -116,7 +116,7 @@ exports.ensure = (req, res, next) => { | ||
116 | exports.compute = (req, res, next) => { | 116 | exports.compute = (req, res, next) => { |
117 | const uid = req.user.uid, | 117 | const uid = req.user.uid, |
118 | sku = req.body.sku, | 118 | sku = req.body.sku, |
119 | - paymentType = Number.parseInt(req.body.paymentType || 1, 10), | 119 | + paymentType = parseInt(req.body.paymentType || 1, 10), |
120 | activityId = req.body.activityId; | 120 | activityId = req.body.activityId; |
121 | 121 | ||
122 | if (!req.xhr) { | 122 | if (!req.xhr) { |
@@ -155,10 +155,10 @@ exports.submit = (req, res, next) => { | @@ -155,10 +155,10 @@ exports.submit = (req, res, next) => { | ||
155 | const uid = req.user.uid, | 155 | const uid = req.user.uid, |
156 | sku = req.body.sku, | 156 | sku = req.body.sku, |
157 | activityId = req.body.activityId, | 157 | activityId = req.body.activityId, |
158 | - deliveryTime = Number.parseInt(req.body.deliveryTime, 10), | ||
159 | - deliveryWay = Number.parseInt(req.body.deliveryWay, 10), | ||
160 | - paymentId = Number.parseInt(req.body.paymentId, 10), | ||
161 | - paymentType = Number.parseInt(req.body.paymentType, 10), | 158 | + deliveryTime = parseInt(req.body.deliveryTime, 10), |
159 | + deliveryWay = parseInt(req.body.deliveryWay, 10), | ||
160 | + paymentId = parseInt(req.body.paymentId, 10), | ||
161 | + paymentType = parseInt(req.body.paymentType, 10), | ||
162 | token = req.body.cartToken; | 162 | token = req.body.cartToken; |
163 | 163 | ||
164 | let addressId = req.body.addressId || ''; | 164 | let addressId = req.body.addressId || ''; |
@@ -176,7 +176,7 @@ exports.submit = (req, res, next) => { | @@ -176,7 +176,7 @@ exports.submit = (req, res, next) => { | ||
176 | if (!addressId) { | 176 | if (!addressId) { |
177 | return res.json({code: 400, message: '请选择地址'}); | 177 | return res.json({code: 400, message: '请选择地址'}); |
178 | } else { | 178 | } else { |
179 | - addressId = Number.parseInt(crypto.decrypt(null, req.body.addressId), 10); | 179 | + addressId = parseInt(crypto.decrypt(null, req.body.addressId), 10); |
180 | } | 180 | } |
181 | 181 | ||
182 | if ([uid, sku, activityId, addressId, deliveryTime, | 182 | if ([uid, sku, activityId, addressId, deliveryTime, |
@@ -193,7 +193,7 @@ exports.submit = (req, res, next) => { | @@ -193,7 +193,7 @@ exports.submit = (req, res, next) => { | ||
193 | buy_number: 1, | 193 | buy_number: 1, |
194 | invoices_title: req.body.invoicesTitle || '', | 194 | invoices_title: req.body.invoicesTitle || '', |
195 | invoices_type_id: req.body.invoicesTypeId || '', | 195 | invoices_type_id: req.body.invoicesTypeId || '', |
196 | - use_yoho_coin: Number.parseFloat(req.body.useYohoCoin) || 0, | 196 | + use_yoho_coin: parseFloat(req.body.useYohoCoin) || 0, |
197 | remark: req.body.remark || '', | 197 | remark: req.body.remark || '', |
198 | 198 | ||
199 | address_id: addressId, | 199 | address_id: addressId, |
@@ -71,7 +71,7 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb | @@ -71,7 +71,7 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb | ||
71 | orderInfo.deliveryId, | 71 | orderInfo.deliveryId, |
72 | orderInfo.paymentType, | 72 | orderInfo.paymentType, |
73 | orderInfo.couponCode, | 73 | orderInfo.couponCode, |
74 | - orderInfo.yohoCoin, skuList | 74 | + orderInfo.yohoCoin, skuList, activityInfo |
75 | ); | 75 | ); |
76 | } | 76 | } |
77 | 77 |
@@ -219,7 +219,7 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | @@ -219,7 +219,7 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime, | ||
219 | // 购买套餐商品需要的数据 | 219 | // 购买套餐商品需要的数据 |
220 | if (activityInfo) { | 220 | if (activityInfo) { |
221 | params.activity_id = activityInfo.activity_id; | 221 | params.activity_id = activityInfo.activity_id; |
222 | - params.product_sku_list = activityInfo.product_sku_list; // TODO 检查 JSON 是否正常 | 222 | + params.product_sku_list = JSON.stringify(activityInfo.product_sku_list); |
223 | } | 223 | } |
224 | 224 | ||
225 | // 友盟有关信息的传递 | 225 | // 友盟有关信息的传递 |
@@ -58,8 +58,6 @@ function invoiceInit() { | @@ -58,8 +58,6 @@ function invoiceInit() { | ||
58 | $('.invoice-type').text(invoiceCont[orderCont.invoiceType] + '(' + invoicesType[orderCont.invoicesType] + ')'); | 58 | $('.invoice-type').text(invoiceCont[orderCont.invoiceType] + '(' + invoicesType[orderCont.invoicesType] + ')'); |
59 | } else { | 59 | } else { |
60 | $('.invoice-type').text('服装(电子)'); | 60 | $('.invoice-type').text('服装(电子)'); |
61 | - | ||
62 | - // $('.invoice-type').text('服装(纸质)'); | ||
63 | } | 61 | } |
64 | } | 62 | } |
65 | 63 | ||
@@ -191,7 +189,7 @@ function orderCompute() { | @@ -191,7 +189,7 @@ function orderCompute() { | ||
191 | data = { | 189 | data = { |
192 | cartType: orderInfo('cartType') || 'ordinary', | 190 | cartType: orderInfo('cartType') || 'ordinary', |
193 | deliveryId: orderInfo('deliveryId'), | 191 | deliveryId: orderInfo('deliveryId'), |
194 | - paymentTypeId: orderInfo('paymentTypeId'), | 192 | + paymentType: orderInfo('paymentType'), |
195 | couponCode: orderInfo('couponCode'), | 193 | couponCode: orderInfo('couponCode'), |
196 | yohoCoin: yohoCoin, | 194 | yohoCoin: yohoCoin, |
197 | skuList: isLimitGood() ? orderInfo('skuList') : undefined | 195 | skuList: isLimitGood() ? orderInfo('skuList') : undefined |
@@ -294,7 +292,6 @@ function submitOrder() { | @@ -294,7 +292,6 @@ function submitOrder() { | ||
294 | couponCode: orderInfo('couponCode'), | 292 | couponCode: orderInfo('couponCode'), |
295 | yohoCoin: orderInfo('yohoCoin'), | 293 | yohoCoin: orderInfo('yohoCoin'), |
296 | skuList: isLimitGood() ? orderInfo('skuList') : undefined | 294 | skuList: isLimitGood() ? orderInfo('skuList') : undefined |
297 | - | ||
298 | } | 295 | } |
299 | }).then(function(res) { | 296 | }).then(function(res) { |
300 | var url; | 297 | var url; |
@@ -358,7 +355,10 @@ $('.delivery-id').on('touchend', 'li', function() { | @@ -358,7 +355,10 @@ $('.delivery-id').on('touchend', 'li', function() { | ||
358 | }); | 355 | }); |
359 | 356 | ||
360 | $('.payment-type').on('touchend', 'li', function() { | 357 | $('.payment-type').on('touchend', 'li', function() { |
361 | - orderInfo('paymentType', $('.icon-cb-radio', this).data('id')); | 358 | + var $paymentType = $('.icon-cb-radio', this); |
359 | + | ||
360 | + orderInfo('paymentTypeId', $paymentType.data('id')); // 支付方式id | ||
361 | + orderInfo('paymentType', $paymentType.data('payment-type')); // 支付方式 | ||
362 | }); | 362 | }); |
363 | 363 | ||
364 | $('.dispatch-time').on('touchend', 'li', function() { | 364 | $('.dispatch-time').on('touchend', 'li', function() { |
@@ -418,14 +418,6 @@ $('#msg').find('textarea').on('blur', function() { | @@ -418,14 +418,6 @@ $('#msg').find('textarea').on('blur', function() { | ||
418 | orderInfo('msg', $(this).val()); | 418 | orderInfo('msg', $(this).val()); |
419 | }); | 419 | }); |
420 | 420 | ||
421 | -$('.pay-mode').on('click', 'li', function() { | ||
422 | - var $this = $(this); | ||
423 | - | ||
424 | - orderInfo('paymentTypeId', $this.data('pay-id')); | ||
425 | - orderInfo('paymentType', $this.data('pay-type')); | ||
426 | - payType = $this.data('pay-type'); | ||
427 | -}); | ||
428 | - | ||
429 | $('form').on('submit', function() { | 421 | $('form').on('submit', function() { |
430 | return false; | 422 | return false; |
431 | }); | 423 | }); |
@@ -478,15 +470,18 @@ $subBlock.on('touchstart', 'li', function() { | @@ -478,15 +470,18 @@ $subBlock.on('touchstart', 'li', function() { | ||
478 | 470 | ||
479 | 471 | ||
480 | $('.bill a').on('touchstart', function() { | 472 | $('.bill a').on('touchstart', function() { |
473 | + var $paymentType; | ||
474 | + | ||
481 | if (isTickets) { | 475 | if (isTickets) { |
482 | ticketsConfirm(); // eslint-disable-line | 476 | ticketsConfirm(); // eslint-disable-line |
483 | return; | 477 | return; |
484 | - | ||
485 | } | 478 | } |
486 | - orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id')); | ||
487 | - orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id')); | ||
488 | 479 | ||
489 | - payType = $('.payment-type .icon-cb-radio').data('id'); | 480 | + $paymentType = $('.payment-type .icon-cb-radio'); |
481 | + orderInfo('paymentTypeId', $paymentType.data('id')); // 支付方式id | ||
482 | + orderInfo('paymentType', $paymentType.data('payment-type')); // 支付方式 | ||
483 | + | ||
484 | + payType = $paymentType.data('payment-type'); | ||
490 | submitOrder(); | 485 | submitOrder(); |
491 | }); | 486 | }); |
492 | 487 |
@@ -59,7 +59,7 @@ $newCoupon.on('submit', function() { | @@ -59,7 +59,7 @@ $newCoupon.on('submit', function() { | ||
59 | orderInfo('yohoCoin', 0); | 59 | orderInfo('yohoCoin', 0); |
60 | orderInfo('couponCode', res.data.coupon_code); | 60 | orderInfo('couponCode', res.data.coupon_code); |
61 | orderInfo('couponName', res.data.coupon_title); | 61 | orderInfo('couponName', res.data.coupon_title); |
62 | - window.location.href = '/cart/index/new/orderEnsure'; | 62 | + history.go(-1); |
63 | } | 63 | } |
64 | }).fail(function() { | 64 | }).fail(function() { |
65 | tip.show('网络错误'); | 65 | tip.show('网络错误'); |
@@ -85,7 +85,7 @@ $('body').on('touchend', '.not-use', function() { | @@ -85,7 +85,7 @@ $('body').on('touchend', '.not-use', function() { | ||
85 | 85 | ||
86 | // 实付金额发生变化,使用有货币为0 | 86 | // 实付金额发生变化,使用有货币为0 |
87 | orderInfo('yohoCoin', 0); | 87 | orderInfo('yohoCoin', 0); |
88 | - location.href = '/cart/index/new/orderEnsure'; | 88 | + history.go(-1); |
89 | }); | 89 | }); |
90 | 90 | ||
91 | 91 | ||
@@ -142,7 +142,7 @@ function getCouponHandle(allCoupons) { | @@ -142,7 +142,7 @@ function getCouponHandle(allCoupons) { | ||
142 | 142 | ||
143 | // 实付金额发生变化,使用有货币为0 | 143 | // 实付金额发生变化,使用有货币为0 |
144 | orderInfo('yohoCoin', 0); | 144 | orderInfo('yohoCoin', 0); |
145 | - window.location.href = '/cart/index/new/orderEnsure'; | 145 | + history.go(-1); |
146 | } else if (res.message) { | 146 | } else if (res.message) { |
147 | tip.show(res.message); | 147 | tip.show(res.message); |
148 | } | 148 | } |
@@ -22,8 +22,7 @@ var $invoiceNotice = $('.invoice-notice'), | @@ -22,8 +22,7 @@ var $invoiceNotice = $('.invoice-notice'), | ||
22 | $copyTel = $('.copy-tel'), | 22 | $copyTel = $('.copy-tel'), |
23 | isModifyTel = false; | 23 | isModifyTel = false; |
24 | 24 | ||
25 | -var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/, | ||
26 | - linkUrl = document.referrer || '/cart/index/new/orderEnsure?cartType=ordinary'; | 25 | +var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/; |
27 | 26 | ||
28 | var C_ID = window._ChannelVary[window.cookie('_Channel')] || 1; | 27 | var C_ID = window._ChannelVary[window.cookie('_Channel')] || 1; |
29 | 28 | ||
@@ -93,13 +92,13 @@ function confirmAction() { | @@ -93,13 +92,13 @@ function confirmAction() { | ||
93 | autoHide: true, | 92 | autoHide: true, |
94 | fast: true | 93 | fast: true |
95 | }); | 94 | }); |
96 | - window.location.href = linkUrl; | 95 | + history.go(-1); |
97 | }, function() { | 96 | }, function() { |
98 | - window.location.href = linkUrl; | 97 | + history.go(-1); |
99 | }); | 98 | }); |
100 | } | 99 | } |
101 | } else { | 100 | } else { |
102 | - window.location.href = linkUrl; | 101 | + history.go(-1); |
103 | } | 102 | } |
104 | } | 103 | } |
105 | 104 |
-
Please register or login to post a comment