Authored by 郝肖肖

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

@@ -33,7 +33,7 @@ const couponsAjax = (req, res, next) => { @@ -33,7 +33,7 @@ const couponsAjax = (req, res, next) => {
33 method: 'app.coupons.li', 33 method: 'app.coupons.li',
34 uid: req.user.uid, 34 uid: req.user.uid,
35 status: parseInt(req.body.status || 0, 10), 35 status: parseInt(req.body.status || 0, 10),
36 - page: req.body.page || 1, 36 + page: parseInt(req.body.page || 1, 10),
37 limit: 10, 37 limit: 10,
38 }).then(result => { 38 }).then(result => {
39 res.json(result); 39 res.json(result);
@@ -7,6 +7,7 @@ const helpers = global.yoho.helpers; @@ -7,6 +7,7 @@ const helpers = global.yoho.helpers;
7 7
8 const couponData = (params) => { 8 const couponData = (params) => {
9 return api.get('', params).then(result => { 9 return api.get('', params).then(result => {
  10 +
10 if (result && result.data && result.data.couponList) { 11 if (result && result.data && result.data.couponList) {
11 let times = moment().valueOf() / 1000; 12 let times = moment().valueOf() / 1000;
12 let expireTime = 3600 * 24 * 3; //即将过期时间3天 13 let expireTime = 3600 * 24 * 3; //即将过期时间3天
@@ -14,6 +15,12 @@ const couponData = (params) => { @@ -14,6 +15,12 @@ const couponData = (params) => {
14 let status1 = params.status === 1; 15 let status1 = params.status === 1;
15 16
16 return result.data.couponList.map(function(elem) { 17 return result.data.couponList.map(function(elem) {
  18 + delete elem.id;
  19 +
  20 + elem.isNoLimit = elem.isNoLimit === 'true';// 全场通用
  21 + elem.isDiscount = (`,${elem.shopPriceLimits},`).indexOf(',1,') !== -1;// 三折以下
  22 + elem.isLimited = (`,${elem.shopPriceLimits},`).indexOf(',2,') !== -1;// 限量
  23 +
17 if (status0) { 24 if (status0) {
18 elem.isSoonExpire = (elem.endTime - times) < expireTime; 25 elem.isSoonExpire = (elem.endTime - times) < expireTime;
19 elem.bestowLink = helpers.urlFormat('/product/index/index', 26 elem.bestowLink = helpers.urlFormat('/product/index/index',
@@ -28,9 +35,9 @@ const couponData = (params) => { @@ -28,9 +35,9 @@ const couponData = (params) => {
28 } 35 }
29 return elem; 36 return elem;
30 }); 37 });
31 - } else {  
32 - return [];  
33 } 38 }
  39 +
  40 + return [];
34 }); 41 });
35 }; 42 };
36 43
@@ -36,13 +36,14 @@ @@ -36,13 +36,14 @@
36 </div> 36 </div>
37 </div> 37 </div>
38 <div class="coupon-footer hide"> 38 <div class="coupon-footer hide">
39 - {{#if brandLimit}}  
40 - <p>限品牌:{{brandLimit}}</p> 39 + {{#if brandNameLimit}}
  40 + <p>限品牌:{{brandNameLimit}}</p>
  41 + {{else if sortNameLimit}}
  42 + <p>限品类:{{sortNameLimit}}</p>
  43 + {{else if isNoLimit}}
  44 + <p>全场通用</p>
41 {{/if}} 45 {{/if}}
42 - {{#if sortLimit}}  
43 - <p>限品类:{{sortLimit}}</p>  
44 - {{/if}}  
45 - <p>特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</p> 46 + <p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isDiscount}}、限量{{/if}}等)暂不支持使用优惠券。</p>
46 {{#if explains}}<p>说明:{{explains}}</p>{{/if}} 47 {{#if explains}}<p>说明:{{explains}}</p>{{/if}}
47 </div> 48 </div>
48 </div> 49 </div>
@@ -26,13 +26,14 @@ @@ -26,13 +26,14 @@
26 </div> 26 </div>
27 </div> 27 </div>
28 <div class="coupon-footer hide"> 28 <div class="coupon-footer hide">
29 - {{#if brandLimit}}  
30 - <p>限品牌:{{brandLimit}}</p> 29 + {{#if brandNameLimit}}
  30 + <p>限品牌:{{brandNameLimit}}</p>
  31 + {{else if sortNameLimit}}
  32 + <p>限品类:{{sortNameLimit}}</p>
  33 + {{else if isNoLimit}}
  34 + <p>全场通用</p>
31 {{/if}} 35 {{/if}}
32 - {{#if sortLimit}}  
33 - <p>限品类:{{sortLimit}}</p>  
34 - {{/if}}  
35 - <p>特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</p> 36 + <p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isDiscount}}、限量{{/if}}等)暂不支持使用优惠券。</p>
36 {{#if explains}}<p>说明:{{explains}}</p>{{/if}} 37 {{#if explains}}<p>说明:{{explains}}</p>{{/if}}
37 </div> 38 </div>
38 </div> 39 </div>
@@ -18,6 +18,8 @@ var $couponTab1 = $('.coupon-tab1'), @@ -18,6 +18,8 @@ var $couponTab1 = $('.coupon-tab1'),
18 require('home/coupons.page.css'); 18 require('home/coupons.page.css');
19 require('../common'); 19 require('../common');
20 20
  21 +$('body').css({'background-color': '#f2f2f2'});
  22 +
21 couponFun = function() { 23 couponFun = function() {
22 $tabDom = $couponUl.find('li.activate'); 24 $tabDom = $couponUl.find('li.activate');
23 25
@@ -106,8 +108,6 @@ $('.coupon-list').on('click', '.info-btn', function() { @@ -106,8 +108,6 @@ $('.coupon-list').on('click', '.info-btn', function() {
106 } 108 }
107 }); 109 });
108 110
109 -$('body').css({'background-color': '#f2f2f2'});  
110 -  
111 // 首屏渲染无结果判断 111 // 首屏渲染无结果判断
112 if ($('.coupon-tab1').find('.coupon-group').length <= 0) { 112 if ($('.coupon-tab1').find('.coupon-group').length <= 0) {
113 $('.coupon-tab1').html(notResultHbs()); 113 $('.coupon-tab1').html(notResultHbs());