Commit d96122807a6ab986627271b9ef3286d08013dec5

Authored by yvan.ni
1 parent 978b96a2

优化完成

components/promate_pop/promate_pop.wxss
@@ -261,6 +261,7 @@ @@ -261,6 +261,7 @@
261 .xc-hook.on { 261 .xc-hook.on {
262 transform: rotate(-135deg); 262 transform: rotate(-135deg);
263 background-color: #d60021; 263 background-color: #d60021;
  264 + font-size: 24rpx
264 } 265 }
265 266
266 @import '../../app.wxss'; 267 @import '../../app.wxss';
packageE/pages/cart/cart2/cart2.js
@@ -1294,7 +1294,7 @@ Page({ @@ -1294,7 +1294,7 @@ Page({
1294 await m_cx.cart_cx_group(th, arr[k].goods, c_item, 0, 0, (show_can_cx) => { 1294 await m_cx.cart_cx_group(th, arr[k].goods, c_item, 0, 0, (show_can_cx) => {
1295 1295
1296 arr[k].show_can_cx = show_can_cx; 1296 arr[k].show_can_cx = show_can_cx;
1297 - }) 1297 + },2)
1298 } else { 1298 } else {
1299 var show_can_cx = this.data.cartlist[k].show_can_cx; 1299 var show_can_cx = this.data.cartlist[k].show_can_cx;
1300 //-- 多促销活动的优化 -- 1300 //-- 多促销活动的优化 --
pages/cart/cart/cart.js
@@ -855,6 +855,7 @@ Page({ @@ -855,6 +855,7 @@ Page({
855 item.selected = 0; 855 item.selected = 0;
856 item.erpwareid = good.erpwareid; //要同步下线商品的id 856 item.erpwareid = good.erpwareid; //要同步下线商品的id
857 item.shop_price = good.shop_price; //要同步下线商品的id 857 item.shop_price = good.shop_price; //要同步下线商品的id
  858 + item.init_goods_price=good.goods_price;
858 859
859 //-- 读出每一种商品的所有的活动,方便后面的活动切换使用 -- 860 //-- 读出每一种商品的所有的活动,方便后面的活动切换使用 --
860 if (item.prom_type == 0) 861 if (item.prom_type == 0)
@@ -1559,6 +1560,10 @@ Page({ @@ -1559,6 +1560,10 @@ Page({
1559 var fir = 0; 1560 var fir = 0;
1560 for (var j = 0; j < item.length; j++) { 1561 for (var j = 0; j < item.length; j++) {
1561 if (item[j].is_gift) continue; 1562 if (item[j].is_gift) continue;
  1563 +
  1564 + //把价格还原
  1565 + item[j].goods_price=item[j].init_goods_price;
  1566 +
1562 var obj = JSON.parse(JSON.stringify(item[j])); 1567 var obj = JSON.parse(JSON.stringify(item[j]));
1563 var gd_info=obj; 1568 var gd_info=obj;
1564 1569
@@ -2078,6 +2083,7 @@ Page({ @@ -2078,6 +2083,7 @@ Page({
2078 this.data.btn_click = 1; 2083 this.data.btn_click = 1;
2079 var garr = e.data.service_data; 2084 var garr = e.data.service_data;
2080 2085
  2086 + //之前没有选中,代表现在要选中
2081 if (!a.selected) { 2087 if (!a.selected) {
2082 2088
2083 //如果是标记的时候 2089 //如果是标记的时候
@@ -2385,7 +2391,7 @@ Page({ @@ -2385,7 +2391,7 @@ Page({
2385 //不需要修改价格 2391 //不需要修改价格
2386 await m_cx.cart_cx_group(th, ite1, car[a], 0, n_ok, (show_can_cx) => { 2392 await m_cx.cart_cx_group(th, ite1, car[a], 0, n_ok, (show_can_cx) => {
2387 rd_arr.push(show_can_cx) 2393 rd_arr.push(show_can_cx)
2388 - },1) 2394 + })
2389 } 2395 }
2390 2396
2391 if(car.length>1 && c_ind>-1){ 2397 if(car.length>1 && c_ind>-1){
@@ -2393,7 +2399,7 @@ Page({ @@ -2393,7 +2399,7 @@ Page({
2393 //检验和设置商品的最终是以 取用什么活动,因为多促销 2399 //检验和设置商品的最终是以 取用什么活动,因为多促销
2394 await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => { 2400 await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => {
2395 rd_arr[c_ind]=show_can_cx; 2401 rd_arr[c_ind]=show_can_cx;
2396 - },1) 2402 + })
2397 } 2403 }
2398 2404
2399 for (var a = 0; a < car.length; a++) { 2405 for (var a = 0; a < car.length; a++) {
@@ -4012,7 +4018,7 @@ Page({ @@ -4012,7 +4018,7 @@ Page({
4012 4018
4013 //如果会员是等级会员,商品有等级价,且不是活动商品 4019 //如果会员是等级会员,商品有等级价,且不是活动商品
4014 if (card_field && val[card_field] > 0 && 4020 if (card_field && val[card_field] > 0 &&
4015 - ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 3 || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) { 4021 + ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) {
4016 if (g_arr[i].goods_price != val[card_field]) { 4022 if (g_arr[i].goods_price != val[card_field]) {
4017 isok = 0; 4023 isok = 0;
4018 gname = val.goods_name; 4024 gname = val.goods_name;
@@ -5104,8 +5110,11 @@ Page({ @@ -5104,8 +5110,11 @@ Page({
5104 5110
5105 var th = this; 5111 var th = this;
5106 var car = JSON.parse(JSON.stringify(this.data.requestData)); 5112 var car = JSON.parse(JSON.stringify(this.data.requestData));
5107 - var item = car[c_idx].goods,  
5108 - is_s_sele = 1; 5113 + var item = car[c_idx].goods, is_s_sele = 1;
  5114 +
  5115 + for (var i = 0; i < item.length; i++) {
  5116 + item[i].goods_price = item[i].init_goods_price;
  5117 + }
5109 5118
5110 var is_has_other = 0; 5119 var is_has_other = 0;
5111 for (var ii = 0; ii < car.length; ii++) { 5120 for (var ii = 0; ii < car.length; ii++) {
@@ -5126,15 +5135,16 @@ Page({ @@ -5126,15 +5135,16 @@ Page({
5126 } 5135 }
5127 //-- 让选择进入对应 -- 5136 //-- 让选择进入对应 --
5128 for (var i = 0; i < item.length; i++) { 5137 for (var i = 0; i < item.length; i++) {
5129 - if (sele_arr.hasOwnProperty(i)) {  
5130 - item[i].selected = sele_arr[i];  
5131 - } 5138 + if (sele_arr.hasOwnProperty(i)) {
  5139 + item[i].selected = sele_arr[i];
  5140 + }
5132 } 5141 }
  5142 +
5133 //-- 先批量判断一下活动的类型,同时要同步跟新 -- 5143 //-- 先批量判断一下活动的类型,同时要同步跟新 --
5134 m_cx.cart_cx_group(this, item, car[c_idx], 0, 0, (show_can_cx) => { 5144 m_cx.cart_cx_group(this, item, car[c_idx], 0, 0, (show_can_cx) => {
5135 car[c_idx].show_can_cx = show_can_cx; 5145 car[c_idx].show_can_cx = show_can_cx;
5136 th.cx_check_ok2(func, car); 5146 th.cx_check_ok2(func, car);
5137 - },1); 5147 + });
5138 5148
5139 }, 5149 },
5140 5150
@@ -5257,6 +5267,7 @@ Page({ @@ -5257,6 +5267,7 @@ Page({
5257 } 5267 }
5258 } 5268 }
5259 } 5269 }
  5270 +
5260 func({ 5271 func({
5261 'code': 0, 5272 'code': 0,
5262 'msg': '成功' 5273 'msg': '成功'
utils/more_cx.js
@@ -364,8 +364,29 @@ module.exports = { @@ -364,8 +364,29 @@ module.exports = {
364 return g_item.goods_id==ck_prom_type.goods[b].goods_id && [0,3,5,7,10].indexOf(g_item.prom_type)>-1; 364 return g_item.goods_id==ck_prom_type.goods[b].goods_id && [0,3,5,7,10].indexOf(g_item.prom_type)>-1;
365 }) 365 })
366 if(fg>-1){ 366 if(fg>-1){
  367 +
  368 + goods[fg].goods_price = goods[fg].init_goods_price;
367 goods[fg].prom_type=ck_prom_type.prom_type; 369 goods[fg].prom_type=ck_prom_type.prom_type;
368 goods[fg].prom_id=ck_prom_type.prom_id; 370 goods[fg].prom_id=ck_prom_type.prom_id;
  371 +
  372 + if(ck_prom_type.prom_type==3){
  373 + let ffd=th.data.in_yhact[ck_prom_type.prom_id];
  374 + let f_price = goods[fg].goods_price;
  375 + if (ffd.discount_field != undefined) {
  376 + switch (ffd.discount_field) {
  377 + case 0:
  378 + f_price = goods[fg].goods_price;
  379 + break;
  380 + case 1:
  381 + f_price = goods[fg].shop_price;
  382 + break;
  383 + case 2:
  384 + f_price = goods[fg].goods_market_price;
  385 + break;
  386 + }
  387 + }
  388 + goods[fg].goods_price = f_price;
  389 + }
369 } 390 }
370 } 391 }
371 392
@@ -402,7 +423,10 @@ module.exports = { @@ -402,7 +423,10 @@ module.exports = {
402 //-- 促销活动对象表,最初的map表,包含活动类型,活动id,goods商品 --- 423 //-- 促销活动对象表,最初的map表,包含活动类型,活动id,goods商品 ---
403 var cx_act_map=[]; 424 var cx_act_map=[];
404 for(var i=0; i<goods.length;i++){ 425 for(var i=0; i<goods.length;i++){
405 - var c_item=goods[i]; 426 + //商品的价格要还原
  427 + goods[i].goods_price=goods[i].init_goods_price;
  428 + //进行深拷贝
  429 + var c_item=JSON.parse(JSON.stringify(goods[i]));
406 //没有选中 430 //没有选中
407 if(!c_item.selected) continue; 431 if(!c_item.selected) continue;
408 //如果是秒杀之类是商品 432 //如果是秒杀之类是商品
@@ -525,7 +549,7 @@ module.exports = { @@ -525,7 +549,7 @@ module.exports = {
525 for(var f=0;f<t_goods.length;f++){ 549 for(var f=0;f<t_goods.length;f++){
526 all_num+=t_goods[f].goods_num; 550 all_num+=t_goods[f].goods_num;
527 551
528 - if(!is_no_change) { 552 + if(is_no_change!=1) {
529 //-- 优惠促销取价的优化 -- 553 //-- 优惠促销取价的优化 --
530 let f_price = t_goods[f].goods_price; 554 let f_price = t_goods[f].goods_price;
531 if (fd.discount_field != undefined) { 555 if (fd.discount_field != undefined) {
@@ -751,6 +775,25 @@ module.exports = { @@ -751,6 +775,25 @@ module.exports = {
751 if(fg>-1){ 775 if(fg>-1){
752 goods[fg].prom_type=ck_prom_type.prom_type; 776 goods[fg].prom_type=ck_prom_type.prom_type;
753 goods[fg].prom_id=ck_prom_type.prom_id; 777 goods[fg].prom_id=ck_prom_type.prom_id;
  778 +
  779 + if(ck_prom_type.prom_type==3 && (is_no_change!=2 || ck_prom_type.is_no_ok!=1) ){
  780 + let ffd=th.data.in_yhact[ck_prom_type.prom_id];
  781 + let f_price = goods[fg].goods_price;
  782 + if (ffd.discount_field != undefined) {
  783 + switch (ffd.discount_field) {
  784 + case 0:
  785 + f_price = goods[fg].goods_price;
  786 + break;
  787 + case 1:
  788 + f_price = goods[fg].shop_price;
  789 + break;
  790 + case 2:
  791 + f_price = goods[fg].goods_market_price;
  792 + break;
  793 + }
  794 + }
  795 + goods[fg].goods_price = f_price;
  796 + }
754 } 797 }
755 } 798 }
756 } 799 }