From 1ea4423edf8a3c4141b6c66709d52c3af2cb05e0 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Sun, 25 Jun 2023 14:44:14 +0800 Subject: [PATCH] 1、购物车的优化, 2、确认订单页面的优化 --- packageE/pages/cart/cart2/cart2.js | 14 +++++++++++--- pages/cart/cart/cart.js | 14 +++++++++----- utils/more_cx.js | 19 +++++++++++++++---- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index bbb72c0..14a5c9a 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -1073,7 +1073,6 @@ Page({ ie.collocationList = car_item.collocationList; } - arr.push(ie); } } @@ -1288,9 +1287,18 @@ Page({ } //-- 判断一下,获取搭配购的消息,只有prom_type==5才会判断优惠活动 -- - if ( item1.prom_type == 5 && (!carr[i].collocationList || !carr[i].collocationList.length)) { - await th.set_collection(item1, carr, i); + if ( item1.prom_type == 5 && (!item1.collocationList || !item1.collocationList.length)) { + await th.set_collection(item1, arr[k].goods, jh); + } + + if (item1.collocationList) { + if (!arr[k].collocationList) arr[k].collocationList = item1.collocationList; + else { + var arr_new = [...arr[k].collocationList, ...item1.collocationList]; + arr[k].collocationList = arr_new; + } } + } diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index f2ed3e0..45dfc29 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -3188,13 +3188,17 @@ Page({ //检查活动是不是满足了条件,或者要取满足条件的活动 var fd1 = null; if (this.data.requestData[i].show_can_cx && (i_arr[j].prom_type == 3 || i_arr[j].prom_type == 7)) { - for (var ik in this.data.requestData[i].show_can_cx) { - var ch_map = this.data.requestData[i].show_can_cx[ik].ch_map; + + var show_can_cx=this.data.requestData[i].show_can_cx; + + //-- 查找选中了什么 -- + for (var ik in show_can_cx) { + var ch_map = show_can_cx[ik].ch_map; if (ch_map.indexOf(i_arr[j].goods_id) == -1) continue; - var item_arr = this.data.requestData[i].show_can_cx[ik].act_arr; + var item_arr = show_can_cx[ik].act_arr; fd1 = item_arr.find(function (hb) { - return !hb.is_no_ok; + return hb.sele; }) if (fd1) break; } @@ -3340,7 +3344,7 @@ Page({ } } - console.error(checkObj3); + console.log(checkObj3); let checkObj3_off = false //多门店优惠促销次数控制 diff --git a/utils/more_cx.js b/utils/more_cx.js index 7294500..6bb7bd3 100644 --- a/utils/more_cx.js +++ b/utils/more_cx.js @@ -405,8 +405,9 @@ module.exports = { cx_act_map.push(p_item); } } - goods[i].prom_type=0; - goods[i].prom_id=0; + + //goods[i].prom_type=0; + //goods[i].prom_id=0; } //-- 如果活动数量大于1个,那么活动就要排序一下,有商品种类数最多排再前面,降序进行排列 -- if(cx_act_map.length>1){ @@ -633,9 +634,19 @@ module.exports = { return el.sele; }) - //如果 - + //-- 看一下是不是购物车已经选择好了,购物车选择好了,再确认订单页面也应该是购物车选择的结果,这个也很重要 -- + if(!ck_prom_type){ + for(var ij=0;ij