Authored by 郝肖肖

优惠券到期判断

// 优惠券 by acgpiano
'use strict';
const moment = require('moment');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
... ... @@ -9,8 +8,6 @@ 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天
let status0 = params.status === 0;
let status1 = params.status === 1;
... ... @@ -20,9 +17,10 @@ const couponData = (params) => {
elem.isNoLimit = elem.isNoLimit === 'true';// 全场通用
elem.isDiscount = (`,${elem.shopPriceLimits},`).indexOf(',1,') !== -1;// 三折以下
elem.isLimited = (`,${elem.shopPriceLimits},`).indexOf(',2,') !== -1;// 限量
elem.brandNameLimits = elem.brandNameLimit && elem.brandNameLimit.join('、');
elem.sortNameLimits = elem.sortNameLimit && elem.sortNameLimit.join('、');
if (status0) {
elem.isSoonExpire = (elem.endTime - times) < expireTime;
elem.bestowLink = helpers.urlFormat('/product/index/index',
{
coupon_id: elem.couponId,
... ...
... ... @@ -20,7 +20,7 @@
<div class="coupon-content-group2-table">
<div>
{{couponValidity}}
{{#if isSoonExpire}}<span class="coupon-soon-expire">(即将到期</span>{{/if}}
{{#if overState}}<span class="coupon-soon-expire">{{overState}}</span>{{/if}}
</div>
<div>
<div class="left down info-btn">详细信息<i class="iconfont"></i></div>
... ... @@ -36,13 +36,18 @@
</div>
</div>
<div class="coupon-footer hide">
{{#if brandNameLimit}}
<p>限品牌:{{brandNameLimit}}</p>
{{else if sortNameLimit}}
<p>限品类:{{sortNameLimit}}</p>
{{else if isNoLimit}}
{{#if isNoLimit}}
<p>全场通用</p>
{{/if}}
{{#if brandNameLimits}}
<p>限品牌:{{brandNameLimits}}</p>
{{/if}}
{{#if sortNameLimits}}
<p>限品类:{{sortNameLimits}}</p>
{{/if}}
<p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isDiscount}}、限量{{/if}}等)暂不支持使用优惠券。</p>
{{#if explains}}<p>说明:{{explains}}</p>{{/if}}
</div>
... ...
... ... @@ -10,7 +10,7 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://dev-api.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
... ...