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
郝肖肖
2017-08-29 16:32:04 +0800
Commit
773fc08c022fffbafc2f19bc6369355596f93df4
2 parents
35f27d41
d5ba422c
Merge branch 'feature/shopCoupon' into 'release/6.0.2'
优惠券已抢光 See merge request
!852
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
61 deletions
apps/product/models/coupon.js
apps/product/views/partial/reds-shop/coupon.hbs
public/hbs/product/shop/coupon.hbs
apps/product/models/coupon.js
View file @
773fc08
...
...
@@ -4,6 +4,12 @@ const _ = require('lodash');
const
crypto
=
global
.
yoho
.
crypto
;
const
api
=
global
.
yoho
.
API
;
const
couponStatus
=
{
1
:
'立即领取'
,
2
:
'已抢光'
,
3
:
'已领取'
};
/**
* [查询商品详情页优惠券]
* doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/促销/product_detail_page_coupon.md
...
...
@@ -45,22 +51,17 @@ exports.shopCouponsList = (params) => {
cache
:
params
.
uid
?
false
:
180
}).
then
(
result
=>
{
let
shopCoupons
=
[];
let
couPonstatus
;
if
(
result
&&
result
.
data
)
{
_
.
forEach
(
result
.
data
,
value
=>
{
couPonstatus
=
parseInt
(
value
.
status
,
10
);
if
(
couPonstatus
===
1
||
couPonstatus
===
3
)
{
shopCoupons
.
push
({
validity
:
value
.
couponValidity
,
id
:
crypto
.
encryption
(
''
,
value
.
coupon_id
+
''
),
name
:
value
.
coupon_name
,
pic
:
value
.
coupon_pic
,
money
:
parseInt
(
value
.
money
,
10
),
status
:
couPonstatus
===
1
});
}
shopCoupons
.
push
({
validity
:
value
.
couponValidity
,
id
:
crypto
.
encryption
(
''
,
value
.
coupon_id
+
''
),
name
:
value
.
coupon_name
,
pic
:
value
.
coupon_pic
,
money
:
parseInt
(
value
.
money
,
10
),
status
:
couponStatus
[
value
.
status
]
||
'立即领取'
});
});
}
...
...
apps/product/views/partial/reds-shop/coupon.hbs
View file @
773fc08
...
...
@@ -34,4 +34,4 @@
</div>
<!--/coupon-small-->
{{/
each
}}
{{/if}}
{{/
couponData
}}
\ No newline at end of file
{{/
couponData
}}
...
...
public/hbs/product/shop/coupon.hbs
View file @
773fc08
{{#if
couponsOne
}}
{{#
each
coupons
}}
<div
class=
"coupon-center coupon-big"
data-id =
"
{{
id
}}
"
>
<div
class=
'coupon-left'
>
<span
class=
"coupon-left-price"
>
<span
class=
"coupon-sign"
>
¥
</span>
<span
class=
"coupon-price"
>
{{
money
}}
</span>
</span>
<span
class=
"coupon-left-name"
>
{{
name
}}
</span>
</div>
{{#if
status
}}
<div
class=
'coupon-right receive-btn'
>
立即领取
</div>
{{^}}
<div
class=
'coupon-right receive-btn'
>
已领取
</div>
{{/if}}
</div>
<!--/coupon-big-->
{{/
each
}}
{{^}}
{{#
each
coupons
}}
<div
class=
"coupon-center coupon-small"
data-id =
"
{{
id
}}
"
>
<div
class=
'coupon-left'
>
<span
class=
"coupon-left-price"
>
<span
class=
"coupon-sign"
>
¥
</span>
<span
class=
"coupon-price"
>
{{
money
}}
</span>
</span>
<span
class=
"coupon-left-name"
>
{{
name
}}
</span>
</div>
{{#if
status
}}
<div
class=
'coupon-right receive-btn'
>
立即领取
</div>
{{^}}
<div
class=
'coupon-right receive-btn'
>
已领取
</div>
{{/if}}
</div>
<!--/coupon-small-->
{{/
each
}}
{{/if}}
{{#if
couponsOne
}}
{{#
each
coupons
}}
<div
class=
"coupon-center coupon-big"
data-id =
"
{{
id
}}
"
>
<div
class=
'coupon-left'
>
<span
class=
"coupon-left-price"
>
<span
class=
"coupon-sign"
>
¥
</span>
<span
class=
"coupon-price"
>
{{
money
}}
</span>
</span>
<span
class=
"coupon-left-name"
>
{{
name
}}
</span>
</div>
<div
class=
'coupon-right receive-btn'
>
{{
status
}}
</div>
</div>
<!--/coupon-big-->
{{/
each
}}
{{^}}
{{#
each
coupons
}}
<div
class=
"coupon-center coupon-small"
data-id =
"
{{
id
}}
"
>
<div
class=
'coupon-left'
>
<span
class=
"coupon-left-price"
>
<span
class=
"coupon-sign"
>
¥
</span>
<span
class=
"coupon-price"
>
{{
money
}}
</span>
</span>
<span
class=
"coupon-left-name"
>
{{
name
}}
</span>
</div>
<div
class=
'coupon-right receive-btn'
>
{{
status
}}
</div>
</div>
<!--/coupon-small-->
{{/
each
}}
{{/if}}
...
...
Please
register
or
login
to post a comment