Authored by 毕凯

Merge remote-tracking branch 'origin/hotfix/online' into gray

@@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调 @@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调
15 // 隐藏筛选界面 15 // 隐藏筛选界面
16 function hideFilter() { 16 function hideFilter() {
17 setTimeout(function() { 17 setTimeout(function() {
18 - $filter.addClass('hide'); 18 + $filter && $filter.addClass('hide');
19 }, 301); 19 }, 301);
20 } 20 }
21 21
22 // 显示筛选界面 22 // 显示筛选界面
23 function showFilter() { 23 function showFilter() {
24 - $filter.removeClass('hide'); 24 + $filter && $filter.removeClass('hide');
25 } 25 }
26 26
27 // 一级菜单点击时背景高亮 27 // 一级菜单点击时背景高亮
@@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW @@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
313 finalDetail.push({ 313 finalDetail.push({
314 relatedReco: { 314 relatedReco: {
315 isApp: isApp, 315 isApp: isApp,
316 - goods: goodsData,  
317 - moreNum: goodsData.length - 2 > 0 ? goodsData.length - 2 : 0 316 + goods: goodsData
318 } 317 }
319 }); 318 });
320 } 319 }
@@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => { @@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
380 379
381 _.forEach(finalDetail, (value, key) => { 380 _.forEach(finalDetail, (value, key) => {
382 if (value.relatedReco) { 381 if (value.relatedReco) {
383 - _.forEach(value.relatedReco.goods, (item, subKey) => {  
384 - if (goodsObj[item.id]) {  
385 - finalDetail[key].relatedReco.goods[subKey] = goodsObj[item.id]; 382 + let goodsIds = [];
  383 +
  384 + _.forEach(value.relatedReco.goods, relatedGoods => {
  385 + goodsIds.push(relatedGoods.id);
  386 + });
  387 +
  388 + goodsIds = _.uniq(goodsIds);
  389 + finalDetail[key].relatedReco.goods = [];
  390 +
  391 + _.forEach(goodsIds, (item, subKey) => {
  392 + if (goodsObj[item]) {
  393 + finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
386 } else { 394 } else {
387 delete finalDetail[key].relatedReco.goods[subKey]; 395 delete finalDetail[key].relatedReco.goods[subKey];
388 - finalDetail[key].relatedReco.moreNum--;  
389 } 396 }
390 }); 397 });
  398 +
  399 + let moreNum = _.get(finalDetail[key], 'relatedReco.goods.length', 0);
  400 +
  401 + finalDetail[key].relatedReco.moreNum = moreNum - 2 > 0 ? moreNum - 2 : 0;
391 } 402 }
392 403
393 if (value.collocation) { 404 if (value.collocation) {