From 2fac268ba78fdb13f85e9846c0de35d3637601c3 Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Tue, 31 Jan 2023 16:35:43 +0800 Subject: [PATCH] 搭配购优化OA单 --- components/cart_collect_temp/cart_collect_temp.js | 41 ++++++++++++++++++++++++++++++++++++++++- packageE/pages/cart/cart2/cart2.js | 12 ++++++------ packageE/pages/cart/cart2/cart2.wxml | 2 +- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/components/cart_collect_temp/cart_collect_temp.js b/components/cart_collect_temp/cart_collect_temp.js index 2855ac0..c3e4e1e 100644 --- a/components/cart_collect_temp/cart_collect_temp.js +++ b/components/cart_collect_temp/cart_collect_temp.js @@ -17,6 +17,11 @@ Component({ type: Number, value: 0 }, + //主商品物流方式 + distr_t: { + type: Number, + value: 0 + }, sales_rules: { type: Number, @@ -45,7 +50,7 @@ Component({ index: index, selected: !itr.selected } - + if(this.properties.is_cart){ ob.is_cart =1; ob.cart_index =this.properties.cart_index; @@ -66,6 +71,40 @@ Component({ return false; } } + //判断物流是否一致 + if(ob.selected){ + let distr_t=this.properties.distr_t + let distr_type=itr.distr_type + let all_collocation_list=this.properties.all_collocation_list + let disoff=0 + if(distr_t==0){ + all_collocation_list.map(item=>{ + if (item.selected && item.distr_type !=0 && item.distr_type !=distr_type) { + disoff=1 + } + }) + }else{ + all_collocation_list.map(item=>{ + if (item.selected && item.distr_type !=0 && item.distr_type !=distr_type) { + disoff=1 + } + }) + if(!disoff){ + if (distr_type !=distr_t) { + disoff=1 + } + } + } + if(disoff){ + wx.showToast({ + title: "商品的配送方式不一致", + icon: 'none', + duration: 2000 + }) + return false; + } + } + var txt = "all_collocation_list[" + index + "].selected" diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 119d753..694e364 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -625,7 +625,7 @@ Page({ } } }) - + if (!collocation_list) return null; var new_arr = collocation_list; @@ -910,16 +910,16 @@ Page({ if (e_t == 0) th.setData({ is_all_zt: 0 }); //else if (e_t == 1) th.setData({ is_all_zt: 1 }); } - + //-- 把等级卡会优惠多少钱装进去 -- if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; arr[j].goods.push(car_item); if (car_item.collocationList) { - if (!arr[j].collocationList) arr[j].collocationList = cart_item.collocationList; + if (!arr[j].collocationList) arr[j].collocationList = car_item.collocationList; else { - var arr_new = [...arr[j].collocationList, ...cart_item.collocationList]; + var arr_new = [...arr[j].collocationList, ...car_item.collocationList]; arr[j].collocationList = arr_new; } } @@ -6333,9 +6333,9 @@ Page({ var th = this; var cart_index = e.cart_index; var index = e.index; - + var collocationList = this.data.cartlist[cart_index].collocationList; - var item = collocationList[cart_index]; + var item = collocationList[index]; var goods = this.data.cartlist[cart_index].goods; var txt = 'cartlist[' + cart_index + '].goods'; var txt2 = 'cartlist[' + cart_index + '].collocationList[' + index + '].selected'; diff --git a/packageE/pages/cart/cart2/cart2.wxml b/packageE/pages/cart/cart2/cart2.wxml index f926142..8d993a5 100644 --- a/packageE/pages/cart/cart2/cart2.wxml +++ b/packageE/pages/cart/cart2/cart2.wxml @@ -110,7 +110,7 @@ -- libgit2 0.21.4