Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
a594811cc637c0fcf9b587a741bf0bdcf5d9681d
1 parent
db657099
mobile
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
apps/cart/controllers/order-ensure.js
apps/cart/models/order-ensure.js
apps/cart/controllers/order-ensure.js
View file @
a594811
...
...
@@ -62,10 +62,6 @@ const convertCoupons = (req, res, next) => {
// 获取礼品卡列表
const
getGiftCards
=
(
req
,
res
,
next
)
=>
{
req
.
ctx
(
oeModel
).
getGiftCards
(
req
.
user
.
uid
).
then
(
data
=>
{
if
(
data
.
data
)
{
data
.
data
.
userMobile
=
req
.
user
.
mobile
;
}
res
.
send
(
data
);
}).
catch
(
next
);
};
...
...
apps/cart/models/order-ensure.js
View file @
a594811
...
...
@@ -85,14 +85,26 @@ module.exports = class extends global.yoho.BaseModel {
// 获取礼品卡列表
getGiftCards
(
uid
)
{
return
new
EnsureApi
(
this
.
ctx
).
getGiftCardAsync
(
uid
).
then
(
result
=>
{
if
(
!
_
.
isEmpty
(
_
.
get
(
result
,
'data.usable_giftCards'
,
[])))
{
_
.
map
(
result
.
data
.
usable_giftCards
,
value
=>
{
const
ensureApiModel
=
new
EnsureApi
(
this
.
ctx
);
return
Promise
.
all
([
ensureApiModel
.
getGiftCardAsync
(
uid
),
ensureApiModel
.
getUserProfileAsync
(
uid
)
]).
then
(
result
=>
{
let
resData
=
result
[
0
];
if
(
!
_
.
isEmpty
(
_
.
get
(
resData
,
'data.usable_giftCards'
,
[])))
{
_
.
map
(
resData
.
data
.
usable_giftCards
,
value
=>
{
return
Object
.
assign
(
value
,
{
price
:
_
.
replace
(
value
.
remainAmount
,
/
[^
(0-9.)
]
/ig
,
''
)});
});
}
return
result
;
if
(
result
[
1
].
code
===
200
)
{
_
.
set
(
resData
,
'data.userMobile'
,
_
.
get
(
result
[
1
],
'data.verify_mobile'
));
}
return
resData
;
});
}
...
...
Please
register
or
login
to post a comment