Authored by hongweigao

即将售罄标签

... ... @@ -104,7 +104,7 @@ const _getProductFavoriteDataAsync = (uid, pid) => {
// 商品标签
const _getTagsDataByProductInfo = (data) => {
let tags = [];
_.get(data, 'tags', []).forEach((value) => {
let tag = {};
... ... @@ -1276,9 +1276,12 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 去掉即将售罄
if (totalStorageNum || soldOut) {
if (result.tags.isFew) {
delete result.tags.isFew; // 去掉即将售罄
}
// 去掉即将售罄
_.forEach(result.tags, function(value, key) {
if (value.isFew) {
result.tags[key] = {};
}
});
}
// 分享相关,产品的链接
... ...
... ... @@ -215,11 +215,12 @@ exports.processProductList = (list, options) => {
let tags = [];
_.get(product, 'tags', []).forEach((value) => {
let tag = {};
let tag = {},
isfew = {};
switch (value) {
case 'is_soon_sold_out': // 即将售磬
options.showFew && (tag.is_few = true);
options.showFew && (tag.is_few = true, isfew = true);
break;
case 'is_new': // 新品NEW
options.showNew && (tag.is_new = true);
... ... @@ -250,7 +251,7 @@ exports.processProductList = (list, options) => {
}
tags.push(tag);
product.tags = tags;
product.is_few = tag.is_few;
product.is_few = isfew;
});
}
if (options.query && _.isString(product.product_name)) {
... ...