Showing
2 changed files
with
11 additions
and
7 deletions
@@ -104,7 +104,7 @@ const _getProductFavoriteDataAsync = (uid, pid) => { | @@ -104,7 +104,7 @@ const _getProductFavoriteDataAsync = (uid, pid) => { | ||
104 | // 商品标签 | 104 | // 商品标签 |
105 | const _getTagsDataByProductInfo = (data) => { | 105 | const _getTagsDataByProductInfo = (data) => { |
106 | let tags = []; | 106 | let tags = []; |
107 | - | 107 | + |
108 | _.get(data, 'tags', []).forEach((value) => { | 108 | _.get(data, 'tags', []).forEach((value) => { |
109 | let tag = {}; | 109 | let tag = {}; |
110 | 110 | ||
@@ -1276,9 +1276,12 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { | @@ -1276,9 +1276,12 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => { | ||
1276 | 1276 | ||
1277 | // 去掉即将售罄 | 1277 | // 去掉即将售罄 |
1278 | if (totalStorageNum || soldOut) { | 1278 | if (totalStorageNum || soldOut) { |
1279 | - if (result.tags.isFew) { | ||
1280 | - delete result.tags.isFew; // 去掉即将售罄 | ||
1281 | - } | 1279 | + // 去掉即将售罄 |
1280 | + _.forEach(result.tags, function(value, key) { | ||
1281 | + if (value.isFew) { | ||
1282 | + result.tags[key] = {}; | ||
1283 | + } | ||
1284 | + }); | ||
1282 | } | 1285 | } |
1283 | 1286 | ||
1284 | // 分享相关,产品的链接 | 1287 | // 分享相关,产品的链接 |
@@ -215,11 +215,12 @@ exports.processProductList = (list, options) => { | @@ -215,11 +215,12 @@ exports.processProductList = (list, options) => { | ||
215 | let tags = []; | 215 | let tags = []; |
216 | 216 | ||
217 | _.get(product, 'tags', []).forEach((value) => { | 217 | _.get(product, 'tags', []).forEach((value) => { |
218 | - let tag = {}; | 218 | + let tag = {}, |
219 | + isfew = {}; | ||
219 | 220 | ||
220 | switch (value) { | 221 | switch (value) { |
221 | case 'is_soon_sold_out': // 即将售磬 | 222 | case 'is_soon_sold_out': // 即将售磬 |
222 | - options.showFew && (tag.is_few = true); | 223 | + options.showFew && (tag.is_few = true, isfew = true); |
223 | break; | 224 | break; |
224 | case 'is_new': // 新品NEW | 225 | case 'is_new': // 新品NEW |
225 | options.showNew && (tag.is_new = true); | 226 | options.showNew && (tag.is_new = true); |
@@ -250,7 +251,7 @@ exports.processProductList = (list, options) => { | @@ -250,7 +251,7 @@ exports.processProductList = (list, options) => { | ||
250 | } | 251 | } |
251 | tags.push(tag); | 252 | tags.push(tag); |
252 | product.tags = tags; | 253 | product.tags = tags; |
253 | - product.is_few = tag.is_few; | 254 | + product.is_few = isfew; |
254 | }); | 255 | }); |
255 | } | 256 | } |
256 | if (options.query && _.isString(product.product_name)) { | 257 | if (options.query && _.isString(product.product_name)) { |
-
Please register or login to post a comment