Authored by 郝肖肖

优惠券到期判断

1 // 优惠券 by acgpiano 1 // 优惠券 by acgpiano
2 'use strict'; 2 'use strict';
3 3
4 -const moment = require('moment');  
5 const api = global.yoho.API; 4 const api = global.yoho.API;
6 const helpers = global.yoho.helpers; 5 const helpers = global.yoho.helpers;
7 6
@@ -9,8 +8,6 @@ const couponData = (params) => { @@ -9,8 +8,6 @@ const couponData = (params) => {
9 return api.get('', params).then(result => { 8 return api.get('', params).then(result => {
10 9
11 if (result && result.data && result.data.couponList) { 10 if (result && result.data && result.data.couponList) {
12 - let times = moment().valueOf() / 1000;  
13 - let expireTime = 3600 * 24 * 3; //即将过期时间3天  
14 let status0 = params.status === 0; 11 let status0 = params.status === 0;
15 let status1 = params.status === 1; 12 let status1 = params.status === 1;
16 13
@@ -20,9 +17,10 @@ const couponData = (params) => { @@ -20,9 +17,10 @@ const couponData = (params) => {
20 elem.isNoLimit = elem.isNoLimit === 'true';// 全场通用 17 elem.isNoLimit = elem.isNoLimit === 'true';// 全场通用
21 elem.isDiscount = (`,${elem.shopPriceLimits},`).indexOf(',1,') !== -1;// 三折以下 18 elem.isDiscount = (`,${elem.shopPriceLimits},`).indexOf(',1,') !== -1;// 三折以下
22 elem.isLimited = (`,${elem.shopPriceLimits},`).indexOf(',2,') !== -1;// 限量 19 elem.isLimited = (`,${elem.shopPriceLimits},`).indexOf(',2,') !== -1;// 限量
  20 + elem.brandNameLimits = elem.brandNameLimit && elem.brandNameLimit.join('、');
  21 + elem.sortNameLimits = elem.sortNameLimit && elem.sortNameLimit.join('、');
23 22
24 if (status0) { 23 if (status0) {
25 - elem.isSoonExpire = (elem.endTime - times) < expireTime;  
26 elem.bestowLink = helpers.urlFormat('/product/index/index', 24 elem.bestowLink = helpers.urlFormat('/product/index/index',
27 { 25 {
28 coupon_id: elem.couponId, 26 coupon_id: elem.couponId,
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <div class="coupon-content-group2-table"> 20 <div class="coupon-content-group2-table">
21 <div> 21 <div>
22 {{couponValidity}} 22 {{couponValidity}}
23 - {{#if isSoonExpire}}<span class="coupon-soon-expire">(即将到期</span>{{/if}} 23 + {{#if overState}}<span class="coupon-soon-expire">{{overState}}</span>{{/if}}
24 </div> 24 </div>
25 <div> 25 <div>
26 <div class="left down info-btn">详细信息<i class="iconfont"></i></div> 26 <div class="left down info-btn">详细信息<i class="iconfont"></i></div>
@@ -36,13 +36,18 @@ @@ -36,13 +36,18 @@
36 </div> 36 </div>
37 </div> 37 </div>
38 <div class="coupon-footer hide"> 38 <div class="coupon-footer hide">
39 - {{#if brandNameLimit}}  
40 - <p>限品牌:{{brandNameLimit}}</p>  
41 - {{else if sortNameLimit}}  
42 - <p>限品类:{{sortNameLimit}}</p>  
43 - {{else if isNoLimit}} 39 + {{#if isNoLimit}}
44 <p>全场通用</p> 40 <p>全场通用</p>
45 {{/if}} 41 {{/if}}
  42 +
  43 + {{#if brandNameLimits}}
  44 + <p>限品牌:{{brandNameLimits}}</p>
  45 + {{/if}}
  46 +
  47 + {{#if sortNameLimits}}
  48 + <p>限品类:{{sortNameLimits}}</p>
  49 + {{/if}}
  50 +
46 <p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isDiscount}}、限量{{/if}}等)暂不支持使用优惠券。</p> 51 <p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isDiscount}}、限量{{/if}}等)暂不支持使用优惠券。</p>
47 {{#if explains}}<p>说明:{{explains}}</p>{{/if}} 52 {{#if explains}}<p>说明:{{explains}}</p>{{/if}}
48 </div> 53 </div>
@@ -10,7 +10,7 @@ const isProduction = process.env.NODE_ENV === 'production'; @@ -10,7 +10,7 @@ const isProduction = process.env.NODE_ENV === 'production';
10 const isTest = process.env.NODE_ENV === 'test'; 10 const isTest = process.env.NODE_ENV === 'test';
11 11
12 const domains = { 12 const domains = {
13 - api: 'http://dev-api.yohops.com:9999/', 13 + api: 'http://api-test3.yohops.com:9999/',
14 service: 'http://service-test3.yohops.com:9999/', 14 service: 'http://service-test3.yohops.com:9999/',
15 liveApi: 'http://testapi.live.yohops.com:9999/', 15 liveApi: 'http://testapi.live.yohops.com:9999/',
16 singleApi: 'http://api-test3.yohops.com:9999/', 16 singleApi: 'http://api-test3.yohops.com:9999/',