Commit 14fe2c916486cb7244eeb0018788b7570dbe7be1

Authored by yvan.ni
1 parent 33cd50cb

优化购物车的, 切换的

packageE/pages/cart/cart2/cart2.js
... ... @@ -8195,6 +8195,12 @@ Page({
8195 8195 goods[fg].prom_type=ck_prom_type.prom_type;
8196 8196 goods[fg].prom_id=ck_prom_type.prom_id;
8197 8197  
  8198 + //如果是不参与的话,商品的活动状态要清理
  8199 + if(th.data.cartlist[idx].show_can_cx[gd_key].no_cj_prom && ck_prom_type.prom_type==3){
  8200 + goods[fg].prom_type=0;
  8201 + goods[fg].prom_id=0;
  8202 + }
  8203 +
8198 8204 for(var ik=0;ik< th.data.cartlist[idx].goods.length;ik++){
8199 8205 if(th.data.cartlist[idx].goods[ik].id==goods[fg].id){
8200 8206 th.data.cartlist[idx].goods[ik].prom_type= goods[fg].prom_type;
... ... @@ -8392,7 +8398,7 @@ Page({
8392 8398 goods[fg].prom_id = ck_prom_type.prom_id;
8393 8399  
8394 8400 //如果是不参与的话,商品的活动状态要清理
8395   - if(item.no_cj_prom){
  8401 + if(item.no_cj_prom && ck_prom_type.prom_type==3){
8396 8402 goods[fg].prom_type=0;
8397 8403 goods[fg].prom_id=0;
8398 8404 }
... ...
pages/cart/cart/cart.js
... ... @@ -2381,9 +2381,11 @@ Page({
2381 2381 rd_arr.push({});
2382 2382 continue;
2383 2383 }
  2384 +
  2385 + //不需要修改价格
2384 2386 await m_cx.cart_cx_group(th, ite1, car[a], 0, n_ok, (show_can_cx) => {
2385 2387 rd_arr.push(show_can_cx)
2386   - })
  2388 + },1)
2387 2389 }
2388 2390  
2389 2391 if(car.length>1 && c_ind>-1){
... ... @@ -2391,7 +2393,7 @@ Page({
2391 2393 //检验和设置商品的最终是以 取用什么活动,因为多促销
2392 2394 await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => {
2393 2395 rd_arr[c_ind]=show_can_cx;
2394   - })
  2396 + },1)
2395 2397 }
2396 2398  
2397 2399 for (var a = 0; a < car.length; a++) {
... ... @@ -5132,7 +5134,7 @@ Page({
5132 5134 m_cx.cart_cx_group(this, item, car[c_idx], 0, 0, (show_can_cx) => {
5133 5135 car[c_idx].show_can_cx = show_can_cx;
5134 5136 th.cx_check_ok2(func, car);
5135   - });
  5137 + },1);
5136 5138  
5137 5139 },
5138 5140  
... ...
utils/more_cx.js
... ... @@ -314,7 +314,7 @@ module.exports = {
314 314 //-- 判读一下促销分组的问题 --
315 315 //-- is_need_ck_num 是多门店计算的时候,数量是不是要累家计算,主要是拿来计算限购 --
316 316 //-- need_ok是判断要不要满足条件,这是在cart2的时候,才会赋值成1 --
317   - async cart_cx_group(th,goods,car_item,is_need_ck_num,need_ok,func){
  317 + async cart_cx_group(th,goods,car_item,is_need_ck_num,need_ok,func,is_no_change){
318 318  
319 319 var os= getApp().globalData.setting;
320 320 //更改活动的时候,就不能再重新计算活动,只有再加减数量和选择商品的时候,就要重新计算活动
... ... @@ -525,17 +525,24 @@ module.exports = {
525 525 for(var f=0;f<t_goods.length;f++){
526 526 all_num+=t_goods[f].goods_num;
527 527  
528   - //-- 优惠促销取价的优化 --
529   - let f_price=t_goods[f].goods_price;
530   - if(fd.discount_field!=undefined){
531   - switch (fd.discount_field){
532   - case 0: f_price=t_goods[f].goods_price;break;
533   - case 1: f_price=t_goods[f].shop_price;break;
534   - case 2: f_price=t_goods[f].goods_market_price;break;
  528 + if(!is_no_change) {
  529 + //-- 优惠促销取价的优化 --
  530 + let f_price = t_goods[f].goods_price;
  531 + if (fd.discount_field != undefined) {
  532 + switch (fd.discount_field) {
  533 + case 0:
  534 + f_price = t_goods[f].goods_price;
  535 + break;
  536 + case 1:
  537 + f_price = t_goods[f].shop_price;
  538 + break;
  539 + case 2:
  540 + f_price = t_goods[f].goods_market_price;
  541 + break;
  542 + }
535 543 }
  544 + t_goods[f].goods_price = f_price;
536 545 }
537   - t_goods[f].goods_price=f_price;
538   -
539 546  
540 547 all_pri+=t_goods[f].goods_num*t_goods[f].goods_price;
541 548 }
... ...