Commit 72e43ad67ce2ae755287425b5c03fabb27793ba6

Authored by yvan.ni
1 parent ac9e5f46

搭配购的优化

packageE/pages/cart/cart2/cart2.js
@@ -5983,15 +5983,18 @@ Page({ @@ -5983,15 +5983,18 @@ Page({
5983 setexptype_w2: function (e) { 5983 setexptype_w2: function (e) {
5984 5984
5985 5985
5986 - for (let i = 0; i <this.data.cartlist ; i++) { 5986 +
  5987 + for (let i = 0; i <this.data.cartlist.length ; i++) {
  5988 +
  5989 +
5987 var collocationList=this.data.cartlist[i].collocationList; 5990 var collocationList=this.data.cartlist[i].collocationList;
5988 if(collocationList){ 5991 if(collocationList){
5989 5992
5990 - var txt2 = 'cartlist[' + cart_index + '].collocationList'; 5993 + var txt2 = 'cartlist[' + i + '].collocationList';
5991 for (let jy = 0; jy <collocationList.length ; jy++) { 5994 for (let jy = 0; jy <collocationList.length ; jy++) {
5992 collocationList[jy].selected=0; 5995 collocationList[jy].selected=0;
5993 } 5996 }
5994 - th.setData({[txt2]:collocationList}) 5997 + this.setData({[txt2]:collocationList})
5995 5998
5996 5999
5997 var bn_coll= this.selectComponent("#col"+i); 6000 var bn_coll= this.selectComponent("#col"+i);
@@ -6003,9 +6006,10 @@ Page({ @@ -6003,9 +6006,10 @@ Page({
6003 if(goods[j].is_collocation) continue; 6006 if(goods[j].is_collocation) continue;
6004 g_arr.push(goods[j]); 6007 g_arr.push(goods[j]);
6005 } 6008 }
6006 - var txt = 'cartlist[' + cart_index + '].goods';  
6007 6009
6008 - th.setData({ [txt]: g_arr}); 6010 + var txt = 'cartlist[' + i + '].goods';
  6011 +
  6012 + this.setData({ [txt]: g_arr});
6009 } 6013 }
6010 } 6014 }
6011 6015