Authored by 郝肖肖

个人中心 折扣、限量优惠券提示

... ... @@ -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);
... ...
... ... @@ -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 [];
});
};
... ...
... ... @@ -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>
... ...
... ... @@ -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>
... ...
... ... @@ -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());
... ...