|
|
// 优惠券 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,
|
...
|
...
|
|