Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
郭成尧
7 years ago
Commit
809aa9fd80bb4b483986e3c1d1b05bc769c27ef4
2 parents
5fb9447c
f5ba7562
Merge branch 'feature/coupon' into release/180420
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
apps/cart/controllers/buy-now-controller.js
apps/cart/controllers/order.js
apps/cart/models/cart.js
apps/cart/models/shopping.js
apps/cart/controllers/buy-now-controller.js
View file @
809aa9f
...
...
@@ -111,7 +111,7 @@ class BuyNowController {
}
});
if
(
autoSelectCouponCodeStr
)
{
if
(
!
orderInfo
.
coupon_code
&&
autoSelectCouponCodeStr
)
{
orderInfo
.
coupon_code
=
autoSelectCouponCodeStr
;
res
.
cookie
(
'order-info'
,
JSON
.
stringify
(
orderInfo
),
actCkOpthn
);
}
...
...
apps/cart/controllers/order.js
View file @
809aa9f
...
...
@@ -100,7 +100,7 @@ exports.orderEnsure = (req, res, next) => {
}
}
if
(
autoSelectCouponCodeStr
)
{
if
(
!
orderInfo
.
coupon_code
&&
autoSelectCouponCodeStr
)
{
orderInfo
.
coupon_code
=
autoSelectCouponCodeStr
;
res
.
cookie
(
'order-info'
,
JSON
.
stringify
(
orderInfo
),
actCkOpthn
);
}
...
...
apps/cart/models/cart.js
View file @
809aa9f
...
...
@@ -79,7 +79,10 @@ class cartModel extends global.yoho.BaseModel {
return
Promise
.
all
([
cartPayAPI
,
// 0. 订单数据
orderComputeAPI
,
this
.
ctx
.
req
.
ctx
(
shoppingModel
).
getValidCouponCount
(
params
.
uid
),
// 2. 有效优惠券
this
.
ctx
.
req
.
ctx
(
shoppingModel
).
getValidCouponCount
({
uid
:
params
.
uid
,
delivery_way
:
orderInfoCookie
.
deliveryId
}),
// 2. 有效优惠券
this
.
ctx
.
req
.
ctx
(
shoppingModel
).
countUsableGiftCard
(
params
.
uid
)
// 3 可用礼品卡数量
]).
then
(
res
=>
{
let
pay
=
res
[
0
];
...
...
apps/cart/models/shopping.js
View file @
809aa9f
...
...
@@ -234,10 +234,11 @@ class shoppingModel extends global.yoho.BaseModel {
* @param uid int 用户uid
* @return see doc
*/
getValidCouponCount
(
uid
)
{
getValidCouponCount
(
params
)
{
let
param
=
{
method
:
'app.Shopping.countUsableCoupon'
,
uid
uid
:
params
.
uid
,
delivery_way
:
params
.
delivery_way
};
return
this
.
get
({
data
:
param
});
...
...
@@ -268,7 +269,7 @@ class shoppingModel extends global.yoho.BaseModel {
*/
useCoupon
(
uid
,
couponCode
)
{
let
param
=
{
method
:
'app.
Shopping.use
Coupon'
,
method
:
'app.
coupons.bindP
Coupon'
,
coupon_code
:
couponCode
,
uid
};
...
...
Please
register
or
login
to post a comment