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
Email Patches
Plain Diff
Browse Files
Authored by
郝肖肖
8 years ago
Commit
1a7838f6f84016572400e53c2145e52bcbea00b6
1 parent
cc8267c4
个人中心 折扣、限量优惠券提示
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
17 deletions
apps/home/controllers/coupons.js
apps/home/models/coupons.js
apps/home/views/action/coupons.hbs
public/hbs/home/coupons-list.hbs
public/js/home/coupons.page.js
apps/home/controllers/coupons.js
View file @
1a7838f
...
...
@@ -33,7 +33,7 @@ const couponsAjax = (req, res, next) => {
method
:
'app.coupons.li'
,
uid
:
req
.
user
.
uid
,
status
:
parseInt
(
req
.
body
.
status
||
0
,
10
),
page
:
req
.
body
.
page
||
1
,
page
:
parseInt
(
req
.
body
.
page
||
1
,
10
)
,
limit
:
10
,
}).
then
(
result
=>
{
res
.
json
(
result
);
...
...
apps/home/models/coupons.js
View file @
1a7838f
...
...
@@ -7,6 +7,7 @@ const helpers = global.yoho.helpers;
const
couponData
=
(
params
)
=>
{
return
api
.
get
(
''
,
params
).
then
(
result
=>
{
if
(
result
&&
result
.
data
&&
result
.
data
.
couponList
)
{
let
times
=
moment
().
valueOf
()
/
1000
;
let
expireTime
=
3600
*
24
*
3
;
//即将过期时间3天
...
...
@@ -14,6 +15,12 @@ const couponData = (params) => {
let
status1
=
params
.
status
===
1
;
return
result
.
data
.
couponList
.
map
(
function
(
elem
)
{
delete
elem
.
id
;
elem
.
isNoLimit
=
elem
.
isNoLimit
===
'true'
;
// 全场通用
elem
.
isDiscount
=
(
`
,
$
{
elem
.
shopPriceLimits
},
`
).
indexOf
(
',1,'
)
!==
-
1
;
// 三折以下
elem
.
isLimited
=
(
`
,
$
{
elem
.
shopPriceLimits
},
`
).
indexOf
(
',2,'
)
!==
-
1
;
// 限量
if
(
status0
)
{
elem
.
isSoonExpire
=
(
elem
.
endTime
-
times
)
<
expireTime
;
elem
.
bestowLink
=
helpers
.
urlFormat
(
'/product/index/index'
,
...
...
@@ -28,9 +35,9 @@ const couponData = (params) => {
}
return
elem
;
});
}
else
{
return
[];
}
return
[];
});
};
...
...
apps/home/views/action/coupons.hbs
View file @
1a7838f
...
...
@@ -36,13 +36,14 @@
</div>
</div>
<div
class=
"coupon-footer hide"
>
{{#if
brandLimit
}}
<p>
限品牌:
{{
brandLimit
}}
</p>
{{#if
brandNameLimit
}}
<p>
限品牌:
{{
brandNameLimit
}}
</p>
{{else
if
sortNameLimit
}}
<p>
限品类:
{{
sortNameLimit
}}
</p>
{{else
if
isNoLimit
}}
<p>
全场通用
</p>
{{/if}}
{{#if
sortLimit
}}
<p>
限品类:
{{
sortLimit
}}
</p>
{{/if}}
<p>
特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。
</p>
<p>
特例商品(秒杀、限定、境外、预售
{{#if
isDiscount
}}
、3折以下
{{/if}}{{#if
isDiscount
}}
、限量
{{/if}}
等)暂不支持使用优惠券。
</p>
{{#if
explains
}}
<p>
说明:
{{
explains
}}
</p>
{{/if}}
</div>
</div>
...
...
public/hbs/home/coupons-list.hbs
View file @
1a7838f
...
...
@@ -26,13 +26,14 @@
</div>
</div>
<div
class=
"coupon-footer hide"
>
{{#if
brandLimit
}}
<p>
限品牌:
{{
brandLimit
}}
</p>
{{#if
brandNameLimit
}}
<p>
限品牌:
{{
brandNameLimit
}}
</p>
{{else
if
sortNameLimit
}}
<p>
限品类:
{{
sortNameLimit
}}
</p>
{{else
if
isNoLimit
}}
<p>
全场通用
</p>
{{/if}}
{{#if
sortLimit
}}
<p>
限品类:
{{
sortLimit
}}
</p>
{{/if}}
<p>
特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。
</p>
<p>
特例商品(秒杀、限定、境外、预售
{{#if
isDiscount
}}
、3折以下
{{/if}}{{#if
isDiscount
}}
、限量
{{/if}}
等)暂不支持使用优惠券。
</p>
{{#if
explains
}}
<p>
说明:
{{
explains
}}
</p>
{{/if}}
</div>
</div>
...
...
public/js/home/coupons.page.js
View file @
1a7838f
...
...
@@ -18,6 +18,8 @@ var $couponTab1 = $('.coupon-tab1'),
require
(
'home/coupons.page.css'
);
require
(
'../common'
);
$
(
'body'
).
css
({
'background-color'
:
'#f2f2f2'
});
couponFun
=
function
()
{
$tabDom
=
$couponUl
.
find
(
'li.activate'
);
...
...
@@ -106,8 +108,6 @@ $('.coupon-list').on('click', '.info-btn', function() {
}
});
$
(
'body'
).
css
({
'background-color'
:
'#f2f2f2'
});
// 首屏渲染无结果判断
if
(
$
(
'.coupon-tab1'
).
find
(
'.coupon-group'
).
length
<=
0
)
{
$
(
'.coupon-tab1'
).
html
(
notResultHbs
());
...
...
Please
register
or
login
to post a comment