Showing
6 changed files
with
14 additions
and
9 deletions
@@ -100,7 +100,7 @@ exports.orderEnsure = (req, res, next) => { | @@ -100,7 +100,7 @@ exports.orderEnsure = (req, res, next) => { | ||
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | - if (!orderInfo.coupon_code && autoSelectCouponCodeStr) { | 103 | + if (orderInfo.user_check_coupon !== 'Y' && autoSelectCouponCodeStr) { |
104 | orderInfo.coupon_code = autoSelectCouponCodeStr; | 104 | orderInfo.coupon_code = autoSelectCouponCodeStr; |
105 | res.cookie('order-info', JSON.stringify(orderInfo), actCkOpthn); | 105 | res.cookie('order-info', JSON.stringify(orderInfo), actCkOpthn); |
106 | } | 106 | } |
@@ -37,7 +37,7 @@ class cartModel extends global.yoho.BaseModel { | @@ -37,7 +37,7 @@ class cartModel extends global.yoho.BaseModel { | ||
37 | 37 | ||
38 | // 是否需要重新计算 | 38 | // 是否需要重新计算 |
39 | let needReComputer = orderInfoCookie && !_.isEmpty(orderInfoCookie) && | 39 | let needReComputer = orderInfoCookie && !_.isEmpty(orderInfoCookie) && |
40 | - (orderInfoCookie.yohoCoin || orderInfoCookie.coupon_code); | 40 | + (orderInfoCookie.yohoCoin || orderInfoCookie.user_check_coupon === 'Y'); |
41 | 41 | ||
42 | if (needReComputer) { | 42 | if (needReComputer) { |
43 | orderInfoCookie.paymentType = orderInfoCookie.paymentType ? orderInfoCookie.paymentType : ''; | 43 | orderInfoCookie.paymentType = orderInfoCookie.paymentType ? orderInfoCookie.paymentType : ''; |
@@ -114,7 +114,8 @@ class cartModel extends global.yoho.BaseModel { | @@ -114,7 +114,8 @@ class cartModel extends global.yoho.BaseModel { | ||
114 | coupon: paymentProcess.handleCoupons({ | 114 | coupon: paymentProcess.handleCoupons({ |
115 | paymentApiCouponData, | 115 | paymentApiCouponData, |
116 | validCouponCount: validCouponCount, | 116 | validCouponCount: validCouponCount, |
117 | - orderComputeCouponPay: orderCompute.coupon_pay | 117 | + orderComputeCouponPay: orderCompute.coupon_pay, |
118 | + userCheckCoupon: orderInfoCookie.user_check_coupon === 'Y' | ||
118 | }), | 119 | }), |
119 | giftCards: paymentProcess.handleGiftCards({ | 120 | giftCards: paymentProcess.handleGiftCards({ |
120 | validGiftCardCount: validGiftCardCount, | 121 | validGiftCardCount: validGiftCardCount, |
@@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
102 | <span class="nums">{{to_pay_amount_str}}</span> 元</p> | 102 | <span class="nums">{{to_pay_amount_str}}</span> 元</p> |
103 | </div> | 103 | </div> |
104 | {{/ couponPay}} | 104 | {{/ couponPay}} |
105 | - <button class="use-now-btn" id="useNowBtn">立即使用</button> | 105 | + <button class="use-now-btn" id="useNowBtn">确认</button> |
106 | </div> | 106 | </div> |
107 | {{/ result}} | 107 | {{/ result}} |
108 | </section> | 108 | </section> |
@@ -18,7 +18,6 @@ class qrcodeModel extends global.yoho.BaseModel { | @@ -18,7 +18,6 @@ class qrcodeModel extends global.yoho.BaseModel { | ||
18 | order_code: id, | 18 | order_code: id, |
19 | uid: uid | 19 | uid: uid |
20 | }}).then(result => { | 20 | }}).then(result => { |
21 | - console.log(result); | ||
22 | if (result && result.code === 200) { | 21 | if (result && result.code === 200) { |
23 | return result.data; | 22 | return result.data; |
24 | } else { | 23 | } else { |
@@ -144,8 +144,6 @@ class SelectCouponController extends Page { | @@ -144,8 +144,6 @@ class SelectCouponController extends Page { | ||
144 | tabChange(event) { | 144 | tabChange(event) { |
145 | let itemClicked = $(event.currentTarget); | 145 | let itemClicked = $(event.currentTarget); |
146 | 146 | ||
147 | - console.log(this.view.useNowBox); | ||
148 | - | ||
149 | if (itemClicked.hasClass('active')) { | 147 | if (itemClicked.hasClass('active')) { |
150 | itemClicked.removeClass('active'); | 148 | itemClicked.removeClass('active'); |
151 | } else { | 149 | } else { |
@@ -184,7 +182,9 @@ class SelectCouponController extends Page { | @@ -184,7 +182,9 @@ class SelectCouponController extends Page { | ||
184 | let theCoupon = $(e.delegateTarget); | 182 | let theCoupon = $(e.delegateTarget); |
185 | let theCouponData = theCoupon.data(); | 183 | let theCouponData = theCoupon.data(); |
186 | 184 | ||
187 | - console.log(theCouponData.code); | 185 | + if (!this.orderInfo('user_check_coupon')) { |
186 | + this.orderInfo('user_check_coupon', 'Y'); | ||
187 | + } | ||
188 | 188 | ||
189 | if (theCouponCheck.hasClass('icon-cb-radio')) { | 189 | if (theCouponCheck.hasClass('icon-cb-radio')) { |
190 | this.selectCouponCodes.splice($.inArray(theCouponData.code, this.selectCouponCodes), 1); | 190 | this.selectCouponCodes.splice($.inArray(theCouponData.code, this.selectCouponCodes), 1); |
@@ -348,6 +348,7 @@ function handleCoupons(params) { | @@ -348,6 +348,7 @@ function handleCoupons(params) { | ||
348 | let showText = ''; | 348 | let showText = ''; |
349 | let priceText = ''; | 349 | let priceText = ''; |
350 | 350 | ||
351 | + // 重新计算过后取重新计算的值 | ||
351 | if (!_.isEmpty(orderComputeCouponPay)) { | 352 | if (!_.isEmpty(orderComputeCouponPay)) { |
352 | couponData = orderComputeCouponPay; | 353 | couponData = orderComputeCouponPay; |
353 | } | 354 | } |
@@ -365,11 +366,15 @@ function handleCoupons(params) { | @@ -365,11 +366,15 @@ function handleCoupons(params) { | ||
365 | showText = `${validCouponCount}张可用,未使用`; | 366 | showText = `${validCouponCount}张可用,未使用`; |
366 | } | 367 | } |
367 | 368 | ||
368 | - if (!_.isEmpty(orderComputeCouponPay)) { | 369 | + if (!_.isEmpty(orderComputeCouponPay) && couponData.coupon_count) { |
369 | showText = `已选${couponData.coupon_count}张`; | 370 | showText = `已选${couponData.coupon_count}张`; |
370 | priceText = `-¥${couponData.coupon_amount_str}`; | 371 | priceText = `-¥${couponData.coupon_amount_str}`; |
371 | } | 372 | } |
372 | 373 | ||
374 | + if (!_.isEmpty(orderComputeCouponPay) && !couponData.coupon_count) { | ||
375 | + showText = `${validCouponCount}张可用,未使用`; | ||
376 | + } | ||
377 | + | ||
373 | return { | 378 | return { |
374 | showText, priceText, couponCode | 379 | showText, priceText, couponCode |
375 | }; | 380 | }; |
-
Please register or login to post a comment