Merge branch 'feature/coupon' into release/180420
Showing
4 changed files
with
10 additions
and
6 deletions
@@ -111,7 +111,7 @@ class BuyNowController { | @@ -111,7 +111,7 @@ class BuyNowController { | ||
111 | } | 111 | } |
112 | }); | 112 | }); |
113 | 113 | ||
114 | - if (autoSelectCouponCodeStr) { | 114 | + if (!orderInfo.coupon_code && autoSelectCouponCodeStr) { |
115 | orderInfo.coupon_code = autoSelectCouponCodeStr; | 115 | orderInfo.coupon_code = autoSelectCouponCodeStr; |
116 | res.cookie('order-info', JSON.stringify(orderInfo), actCkOpthn); | 116 | res.cookie('order-info', JSON.stringify(orderInfo), actCkOpthn); |
117 | } | 117 | } |
@@ -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 (autoSelectCouponCodeStr) { | 103 | + if (!orderInfo.coupon_code && 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 | } |
@@ -79,7 +79,10 @@ class cartModel extends global.yoho.BaseModel { | @@ -79,7 +79,10 @@ class cartModel extends global.yoho.BaseModel { | ||
79 | return Promise.all([ | 79 | return Promise.all([ |
80 | cartPayAPI, // 0. 订单数据 | 80 | cartPayAPI, // 0. 订单数据 |
81 | orderComputeAPI, | 81 | orderComputeAPI, |
82 | - this.ctx.req.ctx(shoppingModel).getValidCouponCount(params.uid), // 2. 有效优惠券 | 82 | + this.ctx.req.ctx(shoppingModel).getValidCouponCount({ |
83 | + uid: params.uid, | ||
84 | + delivery_way: orderInfoCookie.deliveryId | ||
85 | + }), // 2. 有效优惠券 | ||
83 | this.ctx.req.ctx(shoppingModel).countUsableGiftCard(params.uid) // 3 可用礼品卡数量 | 86 | this.ctx.req.ctx(shoppingModel).countUsableGiftCard(params.uid) // 3 可用礼品卡数量 |
84 | ]).then(res => { | 87 | ]).then(res => { |
85 | let pay = res[0]; | 88 | let pay = res[0]; |
@@ -234,10 +234,11 @@ class shoppingModel extends global.yoho.BaseModel { | @@ -234,10 +234,11 @@ class shoppingModel extends global.yoho.BaseModel { | ||
234 | * @param uid int 用户uid | 234 | * @param uid int 用户uid |
235 | * @return see doc | 235 | * @return see doc |
236 | */ | 236 | */ |
237 | - getValidCouponCount(uid) { | 237 | + getValidCouponCount(params) { |
238 | let param = { | 238 | let param = { |
239 | method: 'app.Shopping.countUsableCoupon', | 239 | method: 'app.Shopping.countUsableCoupon', |
240 | - uid | 240 | + uid: params.uid, |
241 | + delivery_way: params.delivery_way | ||
241 | }; | 242 | }; |
242 | 243 | ||
243 | return this.get({data: param}); | 244 | return this.get({data: param}); |
@@ -268,7 +269,7 @@ class shoppingModel extends global.yoho.BaseModel { | @@ -268,7 +269,7 @@ class shoppingModel extends global.yoho.BaseModel { | ||
268 | */ | 269 | */ |
269 | useCoupon(uid, couponCode) { | 270 | useCoupon(uid, couponCode) { |
270 | let param = { | 271 | let param = { |
271 | - method: 'app.Shopping.useCoupon', | 272 | + method: 'app.coupons.bindPCoupon', |
272 | coupon_code: couponCode, | 273 | coupon_code: couponCode, |
273 | uid | 274 | uid |
274 | }; | 275 | }; |
-
Please register or login to post a comment