Commit 1ea4423edf8a3c4141b6c66709d52c3af2cb05e0
1 parent
36b9985b
1、购物车的优化,
2、确认订单页面的优化
Showing
3 changed files
with
35 additions
and
12 deletions
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -1073,7 +1073,6 @@ Page({ |
1073 | 1073 | ie.collocationList = car_item.collocationList; |
1074 | 1074 | } |
1075 | 1075 | |
1076 | - | |
1077 | 1076 | arr.push(ie); |
1078 | 1077 | } |
1079 | 1078 | } |
... | ... | @@ -1288,9 +1287,18 @@ Page({ |
1288 | 1287 | } |
1289 | 1288 | |
1290 | 1289 | //-- 判断一下,获取搭配购的消息,只有prom_type==5才会判断优惠活动 -- |
1291 | - if ( item1.prom_type == 5 && (!carr[i].collocationList || !carr[i].collocationList.length)) { | |
1292 | - await th.set_collection(item1, carr, i); | |
1290 | + if ( item1.prom_type == 5 && (!item1.collocationList || !item1.collocationList.length)) { | |
1291 | + await th.set_collection(item1, arr[k].goods, jh); | |
1292 | + } | |
1293 | + | |
1294 | + if (item1.collocationList) { | |
1295 | + if (!arr[k].collocationList) arr[k].collocationList = item1.collocationList; | |
1296 | + else { | |
1297 | + var arr_new = [...arr[k].collocationList, ...item1.collocationList]; | |
1298 | + arr[k].collocationList = arr_new; | |
1299 | + } | |
1293 | 1300 | } |
1301 | + | |
1294 | 1302 | } |
1295 | 1303 | |
1296 | 1304 | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -3188,13 +3188,17 @@ Page({ |
3188 | 3188 | //检查活动是不是满足了条件,或者要取满足条件的活动 |
3189 | 3189 | var fd1 = null; |
3190 | 3190 | if (this.data.requestData[i].show_can_cx && (i_arr[j].prom_type == 3 || i_arr[j].prom_type == 7)) { |
3191 | - for (var ik in this.data.requestData[i].show_can_cx) { | |
3192 | - var ch_map = this.data.requestData[i].show_can_cx[ik].ch_map; | |
3191 | + | |
3192 | + var show_can_cx=this.data.requestData[i].show_can_cx; | |
3193 | + | |
3194 | + //-- 查找选中了什么 -- | |
3195 | + for (var ik in show_can_cx) { | |
3196 | + var ch_map = show_can_cx[ik].ch_map; | |
3193 | 3197 | if (ch_map.indexOf(i_arr[j].goods_id) == -1) continue; |
3194 | 3198 | |
3195 | - var item_arr = this.data.requestData[i].show_can_cx[ik].act_arr; | |
3199 | + var item_arr = show_can_cx[ik].act_arr; | |
3196 | 3200 | fd1 = item_arr.find(function (hb) { |
3197 | - return !hb.is_no_ok; | |
3201 | + return hb.sele; | |
3198 | 3202 | }) |
3199 | 3203 | if (fd1) break; |
3200 | 3204 | } |
... | ... | @@ -3340,7 +3344,7 @@ Page({ |
3340 | 3344 | } |
3341 | 3345 | } |
3342 | 3346 | |
3343 | - console.error(checkObj3); | |
3347 | + console.log(checkObj3); | |
3344 | 3348 | let checkObj3_off = false |
3345 | 3349 | |
3346 | 3350 | //多门店优惠促销次数控制 | ... | ... |
utils/more_cx.js
... | ... | @@ -405,8 +405,9 @@ module.exports = { |
405 | 405 | cx_act_map.push(p_item); |
406 | 406 | } |
407 | 407 | } |
408 | - goods[i].prom_type=0; | |
409 | - goods[i].prom_id=0; | |
408 | + | |
409 | + //goods[i].prom_type=0; | |
410 | + //goods[i].prom_id=0; | |
410 | 411 | } |
411 | 412 | //-- 如果活动数量大于1个,那么活动就要排序一下,有商品种类数最多排再前面,降序进行排列 -- |
412 | 413 | if(cx_act_map.length>1){ |
... | ... | @@ -633,9 +634,19 @@ module.exports = { |
633 | 634 | return el.sele; |
634 | 635 | }) |
635 | 636 | |
636 | - //如果 | |
637 | - | |
637 | + //-- 看一下是不是购物车已经选择好了,购物车选择好了,再确认订单页面也应该是购物车选择的结果,这个也很重要 -- | |
638 | + if(!ck_prom_type){ | |
639 | + for(var ij=0;ij<k_item.act_arr.length;ij++){ | |
640 | + var act_gd=k_item.act_arr[ij].goods[0]; | |
641 | + if(act_gd.prom_type==k_item.act_arr[ij].prom_type){ | |
642 | + k_item.act_arr[ij].sele=1; | |
643 | + ck_prom_type= k_item.act_arr[ij]; | |
644 | + k_item.cur_act=ck_prom_type; | |
645 | + } | |
646 | + } | |
647 | + } | |
638 | 648 | } |
649 | + | |
639 | 650 | //-- 此时已经确定了商品的活动是什么类型的,可以确定购物车中商品的具体活动进行金额的计算 -- |
640 | 651 | if(!ck_prom_type){ |
641 | 652 | ck_prom_type=k_item.act_arr[0]; | ... | ... |