Commit 2fac268ba78fdb13f85e9846c0de35d3637601c3
1 parent
63b70d12
搭配购优化OA单
Showing
3 changed files
with
47 additions
and
8 deletions
components/cart_collect_temp/cart_collect_temp.js
| @@ -17,6 +17,11 @@ Component({ | @@ -17,6 +17,11 @@ Component({ | ||
| 17 | type: Number, | 17 | type: Number, |
| 18 | value: 0 | 18 | value: 0 |
| 19 | }, | 19 | }, |
| 20 | + //主商品物流方式 | ||
| 21 | + distr_t: { | ||
| 22 | + type: Number, | ||
| 23 | + value: 0 | ||
| 24 | + }, | ||
| 20 | 25 | ||
| 21 | sales_rules: { | 26 | sales_rules: { |
| 22 | type: Number, | 27 | type: Number, |
| @@ -45,7 +50,7 @@ Component({ | @@ -45,7 +50,7 @@ Component({ | ||
| 45 | index: index, | 50 | index: index, |
| 46 | selected: !itr.selected | 51 | selected: !itr.selected |
| 47 | } | 52 | } |
| 48 | - | 53 | + |
| 49 | if(this.properties.is_cart){ | 54 | if(this.properties.is_cart){ |
| 50 | ob.is_cart =1; | 55 | ob.is_cart =1; |
| 51 | ob.cart_index =this.properties.cart_index; | 56 | ob.cart_index =this.properties.cart_index; |
| @@ -66,6 +71,40 @@ Component({ | @@ -66,6 +71,40 @@ Component({ | ||
| 66 | return false; | 71 | return false; |
| 67 | } | 72 | } |
| 68 | } | 73 | } |
| 74 | + //判断物流是否一致 | ||
| 75 | + if(ob.selected){ | ||
| 76 | + let distr_t=this.properties.distr_t | ||
| 77 | + let distr_type=itr.distr_type | ||
| 78 | + let all_collocation_list=this.properties.all_collocation_list | ||
| 79 | + let disoff=0 | ||
| 80 | + if(distr_t==0){ | ||
| 81 | + all_collocation_list.map(item=>{ | ||
| 82 | + if (item.selected && item.distr_type !=0 && item.distr_type !=distr_type) { | ||
| 83 | + disoff=1 | ||
| 84 | + } | ||
| 85 | + }) | ||
| 86 | + }else{ | ||
| 87 | + all_collocation_list.map(item=>{ | ||
| 88 | + if (item.selected && item.distr_type !=0 && item.distr_type !=distr_type) { | ||
| 89 | + disoff=1 | ||
| 90 | + } | ||
| 91 | + }) | ||
| 92 | + if(!disoff){ | ||
| 93 | + if (distr_type !=distr_t) { | ||
| 94 | + disoff=1 | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + if(disoff){ | ||
| 99 | + wx.showToast({ | ||
| 100 | + title: "商品的配送方式不一致", | ||
| 101 | + icon: 'none', | ||
| 102 | + duration: 2000 | ||
| 103 | + }) | ||
| 104 | + return false; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 69 | 108 | ||
| 70 | 109 | ||
| 71 | var txt = "all_collocation_list[" + index + "].selected" | 110 | var txt = "all_collocation_list[" + index + "].selected" |
packageE/pages/cart/cart2/cart2.js
| @@ -625,7 +625,7 @@ Page({ | @@ -625,7 +625,7 @@ Page({ | ||
| 625 | } | 625 | } |
| 626 | } | 626 | } |
| 627 | }) | 627 | }) |
| 628 | - | 628 | + |
| 629 | if (!collocation_list) return null; | 629 | if (!collocation_list) return null; |
| 630 | 630 | ||
| 631 | var new_arr = collocation_list; | 631 | var new_arr = collocation_list; |
| @@ -910,16 +910,16 @@ Page({ | @@ -910,16 +910,16 @@ Page({ | ||
| 910 | if (e_t == 0) th.setData({ is_all_zt: 0 }); | 910 | if (e_t == 0) th.setData({ is_all_zt: 0 }); |
| 911 | //else if (e_t == 1) th.setData({ is_all_zt: 1 }); | 911 | //else if (e_t == 1) th.setData({ is_all_zt: 1 }); |
| 912 | } | 912 | } |
| 913 | - | 913 | + |
| 914 | //-- 把等级卡会优惠多少钱装进去 -- | 914 | //-- 把等级卡会优惠多少钱装进去 -- |
| 915 | if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; | 915 | if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; |
| 916 | 916 | ||
| 917 | arr[j].goods.push(car_item); | 917 | arr[j].goods.push(car_item); |
| 918 | if (car_item.collocationList) { | 918 | if (car_item.collocationList) { |
| 919 | 919 | ||
| 920 | - if (!arr[j].collocationList) arr[j].collocationList = cart_item.collocationList; | 920 | + if (!arr[j].collocationList) arr[j].collocationList = car_item.collocationList; |
| 921 | else { | 921 | else { |
| 922 | - var arr_new = [...arr[j].collocationList, ...cart_item.collocationList]; | 922 | + var arr_new = [...arr[j].collocationList, ...car_item.collocationList]; |
| 923 | arr[j].collocationList = arr_new; | 923 | arr[j].collocationList = arr_new; |
| 924 | } | 924 | } |
| 925 | } | 925 | } |
| @@ -6333,9 +6333,9 @@ Page({ | @@ -6333,9 +6333,9 @@ Page({ | ||
| 6333 | var th = this; | 6333 | var th = this; |
| 6334 | var cart_index = e.cart_index; | 6334 | var cart_index = e.cart_index; |
| 6335 | var index = e.index; | 6335 | var index = e.index; |
| 6336 | - | 6336 | + |
| 6337 | var collocationList = this.data.cartlist[cart_index].collocationList; | 6337 | var collocationList = this.data.cartlist[cart_index].collocationList; |
| 6338 | - var item = collocationList[cart_index]; | 6338 | + var item = collocationList[index]; |
| 6339 | var goods = this.data.cartlist[cart_index].goods; | 6339 | var goods = this.data.cartlist[cart_index].goods; |
| 6340 | var txt = 'cartlist[' + cart_index + '].goods'; | 6340 | var txt = 'cartlist[' + cart_index + '].goods'; |
| 6341 | var txt2 = 'cartlist[' + cart_index + '].collocationList[' + index + '].selected'; | 6341 | var txt2 = 'cartlist[' + cart_index + '].collocationList[' + index + '].selected'; |
packageE/pages/cart/cart2/cart2.wxml
| @@ -110,7 +110,7 @@ | @@ -110,7 +110,7 @@ | ||
| 110 | 110 | ||
| 111 | <!-- 使用搭配 --> | 111 | <!-- 使用搭配 --> |
| 112 | <cart_collect_temp bind:childFun="select_coll" sales_rules="{{sales_rules}}" pick="{{item.pickup_id}}" | 112 | <cart_collect_temp bind:childFun="select_coll" sales_rules="{{sales_rules}}" pick="{{item.pickup_id}}" |
| 113 | - is_cart="1" cart_index="{{index}}" appoint_pick_keyid="{{appoint_pick_keyid}}" | 113 | + is_cart="1" cart_index="{{pidx}}" distr_t="{{item.distr_t}}" appoint_pick_keyid="{{appoint_pick_keyid}}" |
| 114 | all_collocation_list="{{item.collocationList}}" /> | 114 | all_collocation_list="{{item.collocationList}}" /> |
| 115 | 115 | ||
| 116 | <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | 116 | <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> |