Commit d77c7e9011ba87c3f838b04b2a81bcb7f9d5b659

Authored by yvan.ni
1 parent d2644598

使用优惠券的优化

packageC/pages/presell/cart/cart.js
... ... @@ -2234,6 +2234,7 @@ Page({
2234 2234  
2235 2235 if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
2236 2236 quan_rq.BuyPosSum=th.data.ckeck_quan_price;
  2237 + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list);
2237 2238 }
2238 2239  
2239 2240 app.request.time_limit_get(6, url, {
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -3314,6 +3314,7 @@ Page({
3314 3314  
3315 3315 if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
3316 3316 quan_req.BuyPosSum=th.data.ckeck_quan_price
  3317 + quan_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
3317 3318 }
3318 3319  
3319 3320 app.request.time_limit_get(6, url, {
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -5549,15 +5549,14 @@ Page({
5549 5549  
5550 5550 //房间号的ids
5551 5551 var room_ids = "";
5552   -
5553   - //-- 把券的钱,写入从表 ---
5554   - if (t_item.quan_youhui_list && t_item.coupon_price) {
5555   - for (var kk in t_item.quan_youhui_list) {
5556   - var you_item = t_item.quan_youhui_list[kk];
5557   - //-- 对券的价格进行平摊 --
5558   - await th.split_set_goods_quanprice(you_item, t_item);
5559   - }
5560   - }
  5552 + //-- 把券的钱,写入从表,前面已经摊了一次了,不要再摊第二次 ---
  5553 + // if (t_item.quan_youhui_list && t_item.coupon_price) {
  5554 + // for (var kk in t_item.quan_youhui_list) {
  5555 + // var you_item = t_item.quan_youhui_list[kk];
  5556 + // //-- 对券的价格进行平摊 --
  5557 + // await th.split_set_goods_quanprice(you_item, t_item);
  5558 + // }
  5559 + // }
5561 5560  
5562 5561 //看一下有没有活动不参与的,要记录到order_more表中
5563 5562 let can_cx = t_item.show_can_cx;
... ... @@ -7291,7 +7290,7 @@ Page({
7291 7290  
7292 7291 //如果实收价等于市场价的死后
7293 7292 if(real_price>=gd.goods_market_price){
7294   - ck_price_scj+= gd.goods_market_price * gd.goods_num; //市场价的优化
  7293 + ck_price_scj+= real_price * gd.goods_num; //市场价的优化
7295 7294 if(!arr[ind].scj_arr) arr[ind].scj_arr=[]; //组装市场价的数组,如果优惠券使用了零售价的券,就要带入使用券的接口
7296 7295 arr[ind].scj_arr.push({
7297 7296 sum_price:real_price * gd.goods_num,
... ... @@ -7375,8 +7374,15 @@ Page({
7375 7374 pageSize: 100
7376 7375 }
7377 7376  
7378   - if(arr[ind].scj_arr){
  7377 + if(arr[ind].scj_arr && arr[ind].scj_arr.length ){
7379 7378 quan_req.BuyPosSum=ck_price_scj //优化获取市场价的优惠券
  7379 +
  7380 + let PosWareIds=[];
  7381 + for (let is = 0; is < arr[ind].scj_arr.length; is++) {
  7382 + PosWareIds.push(arr[ind].scj_arr[is].erpwareid)
  7383 + }
  7384 +
  7385 + quan_req.PosWareIds=PosWareIds.join() //优化获取市场价的优惠券
7380 7386 }
7381 7387  
7382 7388 //-- 是否关闭使用优惠券,循环有找到商品 --
... ... @@ -7466,6 +7472,7 @@ Page({
7466 7472 var gg = to.get_b_now();
7467 7473 if(th.data.ckeck_quan_price>= good.market_price* gg.goods_num){
7468 7474 get_q_req.BuyPosSum=th.data.ckeck_quan_price //优化获取市场价的优惠券
  7475 + get_q_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) //优化获取市场价的优惠券
7469 7476 }
7470 7477  
7471 7478 app.request.time_limit_get(6, url, {
... ... @@ -8283,14 +8290,16 @@ Page({
8283 8290 var coupon_price = you_item.WareCashSum;
8284 8291 var goods = t_item.goods;
8285 8292 var arr = [];
  8293 +
  8294 + if(!t_item.quan_no) t_item.quan_no=you_item.CashRepNo;
  8295 +
8286 8296 //判断是不是有goods_id重复
8287 8297 for (var i = 0; i < goods.length; i++) {
8288 8298  
8289 8299 if(is_quan_scj){
8290 8300 let fd=t_item.scj_arr.find(function (e){
8291   - return e.index==i;
  8301 + return e.index==i && e.erpwareid==you_item.WareId;
8292 8302 })
8293   -
8294 8303 //不是零售价的商品,就进入下一轮
8295 8304 if(!fd) continue;
8296 8305 }
... ...
packageE/pages/cart/cart2_pt/cart2_pt.js
... ... @@ -2016,6 +2016,7 @@ Page({
2016 2016  
2017 2017 if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
2018 2018 quan_rq.BuyPosSum=th.data.ckeck_quan_price;
  2019 + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
2019 2020 }
2020 2021  
2021 2022 app.request.time_limit_get(6, url, {
... ...
packageE/pages/cart/cart_wk/cart_wk.js
... ... @@ -1559,6 +1559,7 @@ Page({
1559 1559  
1560 1560 if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
1561 1561 quan_rq.BuyPosSum=th.data.ckeck_quan_price;
  1562 + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
1562 1563 }
1563 1564  
1564 1565 app.request.promiseGet(url0, { 1: 1 }).then(res => {
... ...