Commit 6639cdfb2cc7afa02e46448eeed440fe1933125a
1 parent
0ec67832
阶梯促销使用优惠券的bug优化
Showing
1 changed file
with
17 additions
and
6 deletions
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -3252,15 +3252,25 @@ Page({ |
3252 | 3252 | //-- 如果是零售价的时候 --- |
3253 | 3253 | if(th.data.using_quan[pickid].FactPriceType){ |
3254 | 3254 | let scj_arr=c_arr[i].scj_arr; |
3255 | - let scj_check_quan_price_list=''; | |
3256 | - let scj_check_quan_ware_list=''; | |
3255 | + let scj_check_quan_price_list=[]; | |
3256 | + let scj_check_quan_ware_list=[]; | |
3257 | 3257 | for (let jh = 0; jh <scj_arr.length ; jh++) { |
3258 | - scj_check_quan_price_list+=(scj_arr[jh].sum_price+",") | |
3259 | - scj_check_quan_ware_list+=(scj_arr[jh].erpwareid+",") | |
3258 | + | |
3259 | + //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 | |
3260 | + var idxx = scj_check_quan_ware_list.findIndex(function (ele) { | |
3261 | + return ele == encodeURIComponent(scj_arr[jh].erpwareid); | |
3262 | + }) | |
3263 | + | |
3264 | + if (idxx > -1) { | |
3265 | + scj_check_quan_price_list[idxx] += scj_arr[jh].sum_price; | |
3266 | + } else { | |
3267 | + scj_check_quan_price_list.push(scj_arr[jh].sum_price); | |
3268 | + scj_check_quan_ware_list.push(encodeURIComponent(scj_arr[jh].erpwareid)); | |
3269 | + } | |
3260 | 3270 | } |
3261 | 3271 | |
3262 | - get_c_price_data.WaresSum= ut.sub_last(scj_check_quan_price_list); | |
3263 | - get_c_price_data.WareIds= ut.sub_last(scj_check_quan_ware_list); | |
3272 | + get_c_price_data.WaresSum= scj_check_quan_price_list.join(); | |
3273 | + get_c_price_data.WareIds= scj_check_quan_ware_list.join(); | |
3264 | 3274 | is_quan_scj=1; |
3265 | 3275 | } |
3266 | 3276 | |
... | ... | @@ -7187,6 +7197,7 @@ Page({ |
7187 | 7197 | } |
7188 | 7198 | }, 500); |
7189 | 7199 | }, |
7200 | + | |
7190 | 7201 | //-----获取购物车进来的劵------- |
7191 | 7202 | get_cart_quan: async function (order_prom_list_cart) { |
7192 | 7203 | var th = this; | ... | ... |