Merge branch 'feature/coupon' into release/180420
Showing
7 changed files
with
18 additions
and
11 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, |
@@ -47,7 +47,9 @@ | @@ -47,7 +47,9 @@ | ||
47 | {{/isEqualOr}} | 47 | {{/isEqualOr}} |
48 | </div> | 48 | </div> |
49 | </div> | 49 | </div> |
50 | + {{#isEqualOr is_overdue_soon 'Y'}} | ||
50 | <span class="top-tip"></span> | 51 | <span class="top-tip"></span> |
52 | + {{/isEqualOr}} | ||
51 | </div> | 53 | </div> |
52 | {{/each}} | 54 | {{/each}} |
53 | {{/ usableCouponsList}} | 55 | {{/ usableCouponsList}} |
@@ -102,7 +104,7 @@ | @@ -102,7 +104,7 @@ | ||
102 | <span class="nums">{{to_pay_amount_str}}</span> 元</p> | 104 | <span class="nums">{{to_pay_amount_str}}</span> 元</p> |
103 | </div> | 105 | </div> |
104 | {{/ couponPay}} | 106 | {{/ couponPay}} |
105 | - <button class="use-now-btn" id="useNowBtn">立即使用</button> | 107 | + <button class="use-now-btn" id="useNowBtn">确认</button> |
106 | </div> | 108 | </div> |
107 | {{/ result}} | 109 | {{/ result}} |
108 | </section> | 110 | </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); |
@@ -270,14 +270,14 @@ body { | @@ -270,14 +270,14 @@ body { | ||
270 | z-index: 3; | 270 | z-index: 3; |
271 | 271 | ||
272 | .left-info { | 272 | .left-info { |
273 | - width: 490px; | 273 | + width: 510px; |
274 | height: 100px; | 274 | height: 100px; |
275 | float: left; | 275 | float: left; |
276 | padding-right: 20px; | 276 | padding-right: 20px; |
277 | } | 277 | } |
278 | 278 | ||
279 | .use-now-btn { | 279 | .use-now-btn { |
280 | - width: 260px; | 280 | + width: 240px; |
281 | height: 100px; | 281 | height: 100px; |
282 | background-color: #d0021b; | 282 | background-color: #d0021b; |
283 | color: #fff; | 283 | color: #fff; |
@@ -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