Commit e4fe4114125f9ba91f8cd5ca9698dad60d2cc5f4

Authored by 前端开发-罗建龙
1 parent 34279c05

搭配购优化

packageE/pages/cart/cart2/cart2.js
@@ -1436,7 +1436,7 @@ Page({ @@ -1436,7 +1436,7 @@ Page({
1436 // th.setData({ collocation_goods: gg.collocation_goods }); 1436 // th.setData({ collocation_goods: gg.collocation_goods });
1437 // } 1437 // }
1438 1438
1439 - if (th.data.all_collocation_list && gg.collocation_goods) { 1439 + if (th.data.all_collocation_list && gg.collocation_goods && gg.collocation_goods.leng>0) {
1440 for (var i = 0; i < th.data.all_collocation_list.length; i++) { 1440 for (var i = 0; i < th.data.all_collocation_list.length; i++) {
1441 var item0 = th.data.all_collocation_list[i]; 1441 var item0 = th.data.all_collocation_list[i];
1442 var idx = gg.collocation_goods.findIndex(function (e) { 1442 var idx = gg.collocation_goods.findIndex(function (e) {
@@ -1453,8 +1453,8 @@ Page({ @@ -1453,8 +1453,8 @@ Page({
1453 } 1453 }
1454 1454
1455 } 1455 }
1456 -  
1457 - if( gg.collocation_goods){ 1456 +
  1457 + if( gg.collocation_goods && gg.collocation_goods.leng>0){
1458 //var narr=gg.collocation_goods; 1458 //var narr=gg.collocation_goods;
1459 //修改成深拷贝,确保返回是数据正确 1459 //修改成深拷贝,确保返回是数据正确
1460 var narr = JSON.parse(JSON.stringify(gg.collocation_goods)); 1460 var narr = JSON.parse(JSON.stringify(gg.collocation_goods));