Authored by htoooth

fix error

@@ -121,12 +121,12 @@ export default { @@ -121,12 +121,12 @@ export default {
121 // 插入商品 121 // 插入商品
122 const [goodsList, favsList] = await Promise.all([ 122 const [goodsList, favsList] = await Promise.all([
123 this.$api.post('/api/guang/article/queryGoods', { 123 this.$api.post('/api/guang/article/queryGoods', {
124 - query: processContents.allgoods.join(','), 124 + query: processContents.allgoods.skn.join(','),
125 order: 's_t_desc', 125 order: 's_t_desc',
126 - limit: processContents.allgoods.length || 1 126 + limit: processContents.allgoods.skn.length || 1
127 }), 127 }),
128 this.$api.post('/api/favorite/batchCheckIsFavorite', { 128 this.$api.post('/api/favorite/batchCheckIsFavorite', {
129 - favIds: processContents.allgoods.join(','), 129 + favIds: processContents.allgoods.id.join(','),
130 type: 'product' 130 type: 'product'
131 }) 131 })
132 ]).then(([res1, res2]) => { 132 ]).then(([res1, res2]) => {
@@ -81,7 +81,7 @@ function productGlobalUrl(skn) { @@ -81,7 +81,7 @@ function productGlobalUrl(skn) {
81 81
82 export function processArticleDetail(articleContent) { 82 export function processArticleDetail(articleContent) {
83 let finalDetail = []; 83 let finalDetail = [];
84 - let allgoods = []; 84 + let allgoods = {id: [], skn: []};
85 let recommends = []; 85 let recommends = [];
86 86
87 for (let value of articleContent) { 87 for (let value of articleContent) {
@@ -160,18 +160,21 @@ export function processArticleDetail(articleContent) { @@ -160,18 +160,21 @@ export function processArticleDetail(articleContent) {
160 160
161 // 普通商品 161 // 普通商品
162 forEach(goodsData, (item) => { 162 forEach(goodsData, (item) => {
163 - allgoods.push(get(item, 'productId', 0)); 163 + allgoods.id.push(get(item, 'productId', 0));
  164 + allgoods.skn.push(get(item, 'id', 0));
164 }); 165 });
165 166
166 // 全球购商品 167 // 全球购商品
167 forEach(goodsDataGlobal, (item) => { 168 forEach(goodsDataGlobal, (item) => {
168 - allgoods.push(get(item, 'productId', 0)); 169 + allgoods.id.push(get(item, 'productId', 0));
  170 + allgoods.skn.push(get(item, 'id', 0));
169 goodsData.push(item); 171 goodsData.push(item);
170 }); 172 });
171 173
172 // 限定商品 174 // 限定商品
173 forEach(goodsDataLimit, (item) => { 175 forEach(goodsDataLimit, (item) => {
174 - allgoods.push(get(item, 'productId', 0)); 176 + allgoods.id.push(get(item, 'productId', 0));
  177 + allgoods.skn.push(get(item, 'id', 0));
175 goodsData.push(item); 178 goodsData.push(item);
176 }); 179 });
177 180
@@ -337,30 +340,34 @@ export function pushGoodsInfo(finalDetail, goodsList, favsList) { @@ -337,30 +340,34 @@ export function pushGoodsInfo(finalDetail, goodsList, favsList) {
337 340
338 forEach(finalDetail, (value, key) => { 341 forEach(finalDetail, (value, key) => {
339 if (value.relatedReco) { 342 if (value.relatedReco) {
340 - let goodsIds = []; 343 + let goodsSkn = [];
341 344
342 forEach(value.relatedReco.goods, relatedGoods => { 345 forEach(value.relatedReco.goods, relatedGoods => {
343 - goodsIds.push(relatedGoods.id); 346 + goodsSkn.push(relatedGoods.id);
344 }); 347 });
345 348
346 - goodsIds = uniq(goodsIds); 349 + goodsSkn = uniq(goodsSkn);
347 finalDetail[key].relatedReco.goods = []; 350 finalDetail[key].relatedReco.goods = [];
348 351
349 - forEach(goodsIds, (item, subKey) => { 352 + forEach(goodsSkn, (item, subKey) => {
  353 + console.log(goodsObj, item)
350 if (goodsObj[item]) { 354 if (goodsObj[item]) {
  355 + console.log(goodsObj[item])
351 finalDetail[key].relatedReco.goods[subKey] = goodsObj[item]; 356 finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
352 } else { 357 } else {
  358 + console.log('delete');
353 delete finalDetail[key].relatedReco.goods[subKey]; 359 delete finalDetail[key].relatedReco.goods[subKey];
354 } 360 }
355 }); 361 });
356 362
357 - finalDetail[key].relatedReco.goods = remove(finalDetail[key].relatedReco.goods, (obj) => {  
358 - return obj;  
359 - });  
360 -  
361 - let moreNum = get(finalDetail[key], 'relatedReco.goods.length', 0);  
362 -  
363 - finalDetail[key].relatedReco.moreNum = moreNum - 4 > 0 ? moreNum - 4 : 0; // 改成第一屏幕最多展示4个 363 + //
  364 + // finalDetail[key].relatedReco.goods = remove(finalDetail[key].relatedReco.goods, (obj) => {
  365 + // return obj;
  366 + // });
  367 + //
  368 + // let moreNum = get(finalDetail[key], 'relatedReco.goods.length', 0);
  369 + //
  370 + // finalDetail[key].relatedReco.moreNum = moreNum - 4 > 0 ? moreNum - 4 : 0; // 改成第一屏幕最多展示4个
364 } 371 }
365 372
366 if (value.collocation) { 373 if (value.collocation) {