Commit 769464a88b8ed69c1b57cfd392a104f0d644d67e
1 parent
484162f6
搭配购优化
Showing
3 changed files
with
19 additions
and
12 deletions
components/cart_collect_temp/cart_collect_temp.wxml
@@ -13,9 +13,9 @@ | @@ -13,9 +13,9 @@ | ||
13 | binderror="bind_bnerr3" data-img="{{item.original_img}}"></image> | 13 | binderror="bind_bnerr3" data-img="{{item.original_img}}"></image> |
14 | </view> | 14 | </view> |
15 | <view class="ellipsis-2 fs30" style="height: 84rpx;">{{item.goods_name}}</view> | 15 | <view class="ellipsis-2 fs30" style="height: 84rpx;">{{item.goods_name}}</view> |
16 | - <view class="co-red flex jc_sb ai_c" style="margin-top:6rpx"> | 16 | + <view class="co-red flex jc_sb ai_c" style="margin-top:6rpx" data-index="{{index}}" catchtap="select_coll"> |
17 | <view><text class="fs20">¥</text>{{item.price}}</view> | 17 | <view><text class="fs20">¥</text>{{item.price}}</view> |
18 | - <view style="margin-right:10rpx" catchtap="select_coll" data-index="{{index}}" > | 18 | + <view style="margin-right:10rpx" data-index="{{index}}" > |
19 | <icon color="{{item.selected?'red':'gray'}}" size="14" type="success"></icon> | 19 | <icon color="{{item.selected?'red':'gray'}}" size="14" type="success"></icon> |
20 | </view> | 20 | </view> |
21 | </view> | 21 | </view> |
packageE/pages/cart/cart2/cart2.js
@@ -1420,25 +1420,32 @@ Page({ | @@ -1420,25 +1420,32 @@ Page({ | ||
1420 | t.data.data.guide_type = gg.guide_type; | 1420 | t.data.data.guide_type = gg.guide_type; |
1421 | } | 1421 | } |
1422 | //搭配购如果原来就有勾选,不能直接赋值,旧的要保留 | 1422 | //搭配购如果原来就有勾选,不能直接赋值,旧的要保留 |
1423 | - if(th.data.collocation_goods && th.data.collocation_goods.length){ | ||
1424 | - if(gg.collocation_goods){ | ||
1425 | - let coll_goods=th.data.collocation_goods | ||
1426 | - coll_goods.push(...gg.collocation_goods) | ||
1427 | - th.setData({collocation_goods:coll_goods}) | ||
1428 | - } | ||
1429 | - }else{ | 1423 | + if(!th.data.collocation_goods){ |
1430 | th.setData({ collocation_goods: gg.collocation_goods }); | 1424 | th.setData({ collocation_goods: gg.collocation_goods }); |
1431 | } | 1425 | } |
1426 | + // if(th.data.collocation_goods && th.data.collocation_goods.length){ | ||
1427 | + // if(gg.collocation_goods){ | ||
1428 | + // let coll_goods=th.data.collocation_goods | ||
1429 | + // coll_goods.push(...gg.collocation_goods) | ||
1430 | + // th.setData({collocation_goods:coll_goods}) | ||
1431 | + // } | ||
1432 | + // }else{ | ||
1433 | + // th.setData({ collocation_goods: gg.collocation_goods }); | ||
1434 | + // } | ||
1432 | 1435 | ||
1433 | if (th.data.all_collocation_list && gg.collocation_goods) { | 1436 | if (th.data.all_collocation_list && gg.collocation_goods) { |
1434 | for (var i = 0; i < th.data.all_collocation_list.length; i++) { | 1437 | for (var i = 0; i < th.data.all_collocation_list.length; i++) { |
1435 | var item0 = th.data.all_collocation_list[i]; | 1438 | var item0 = th.data.all_collocation_list[i]; |
1436 | var idx = gg.collocation_goods.findIndex(function (e) { | 1439 | var idx = gg.collocation_goods.findIndex(function (e) { |
1437 | - return e.goods_id == item0.goods_id && e.prom_id == item0.prom_id; | 1440 | + // return e.goods_id == item0.goods_id && e.prom_id == item0.prom_id; |
1441 | + return e.goods_id == item0.goods_id; | ||
1438 | }) | 1442 | }) |
1439 | if (idx != -1) { | 1443 | if (idx != -1) { |
1440 | var txt = 'all_collocation_list[' + i + '].selected'; | 1444 | var txt = 'all_collocation_list[' + i + '].selected'; |
1441 | th.setData({ [txt]: 1 }); | 1445 | th.setData({ [txt]: 1 }); |
1446 | + }else{ | ||
1447 | + var txt = 'all_collocation_list[' + i + '].selected'; | ||
1448 | + th.setData({ [txt]: 0 }); | ||
1442 | } | 1449 | } |
1443 | } | 1450 | } |
1444 | 1451 | ||
@@ -6423,7 +6430,7 @@ Page({ | @@ -6423,7 +6430,7 @@ Page({ | ||
6423 | //要进行深拷贝 | 6430 | //要进行深拷贝 |
6424 | var coll_arr_new = JSON.parse(JSON.stringify(coll_arr)); | 6431 | var coll_arr_new = JSON.parse(JSON.stringify(coll_arr)); |
6425 | coll_arr_new.unshift(this.data.bn_goods); | 6432 | coll_arr_new.unshift(this.data.bn_goods); |
6426 | - await th.get_collocation_list(coll_arr); | 6433 | + await th.get_collocation_list(coll_arr_new); |
6427 | //计算价格 | 6434 | //计算价格 |
6428 | th.calculatePrice2(); | 6435 | th.calculatePrice2(); |
6429 | th.get_cart_quan(); | 6436 | th.get_cart_quan(); |
packageE/pages/cart/cart2/cart2.wxml
@@ -384,7 +384,7 @@ | @@ -384,7 +384,7 @@ | ||
384 | </block> | 384 | </block> |
385 | 385 | ||
386 | <!-- 使用搭配 --> | 386 | <!-- 使用搭配 --> |
387 | - <cart_collect_temp bind:childFun="select_coll" all_collocation_list="{{all_collocation_list}}" appoint_pick_keyid="{{appoint_pick_keyid}}" sales_rules="{{sales_rules}}" pick="{{bn_pick}}" /> | 387 | + <cart_collect_temp bind:childFun="select_coll" all_collocation_list="{{all_collocation_list}}" distr_t="{{bn_goods.distr_type}}" appoint_pick_keyid="{{appoint_pick_keyid}}" sales_rules="{{sales_rules}}" pick="{{bn_pick}}" /> |
388 | 388 | ||
389 | 389 | ||
390 | <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | 390 | <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> |