Commit 4019c168aada03fa21ff64ae365701954eff002e

Authored by yvan.ni
1 parent 9ebc7272

1、普通商品没有订单优惠的使用,使用预存使用不了

2、优惠促销商品没有订单优惠的使用,使用预存使用不了(优化促销要测试有减价和没有减价俩种)
packageE/pages/cart/cart2/cart2.js
... ... @@ -577,7 +577,7 @@ Page({
577 577 if(!ite.is_gift) {
578 578 let obj = {
579 579 wareno: ite.goods_sn,
580   - price: ite.first_account, //account是平摊后的实收价格
  580 + price: ite.account_fir, //account是平摊后的实收价格
581 581 qty: ite.goods_num,
582 582 sumprice: parseFloat(ite.account_fir * ite.goods_num - ite.account_yu_fir-(ite.quan_num?ite.quan_num:0)).toFixed(2)
583 583 }
... ... @@ -2440,6 +2440,11 @@ Page({
2440 2440 var o_price = 0, q_conditin = 0;
2441 2441 //--------循环计算总价-----------
2442 2442 for (var j = 0; j < ord_goods.length; j++) {
  2443 +
  2444 + if (ord_goods[j].is_gift) continue;
  2445 + ord_goods[j].account_fir=ord_goods[j].goods_price; //初始实际价格
  2446 + ord_goods[j].account_yu_fir=0; //初始余数
  2447 +
2443 2448 if (ord_goods[j].whsle_id) continue;
2444 2449 o_price += ord_goods[j].goods_price * ord_goods[j].goods_num;
2445 2450 }
... ... @@ -2476,8 +2481,6 @@ Page({
2476 2481 item_map.zxlbtitle = get_data.zxlbtitle;
2477 2482  
2478 2483  
2479   -
2480   -
2481 2484 var rule=JSON.parse(get_data.rule);
2482 2485 if(rule.is_monthgiftbag && parseFloat(rule.is_monthgiftbag )>0){
2483 2486 //每月礼包
... ... @@ -2625,7 +2628,6 @@ Page({
2625 2628 if (!item_map.is_xz_yh) q_conditin = o_price;
2626 2629 }
2627 2630  
2628   -
2629 2631 //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表-----------
2630 2632 for (var j = 0; j < ord_goods.length; j++) {
2631 2633 if (ord_goods[j].whsle_id) continue;
... ... @@ -2633,10 +2635,11 @@ Page({
2633 2635 ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh;
2634 2636 ord_goods[j].is_past = item_map.is_past;
2635 2637 if (ord_goods[j].is_gift) continue; //赠品不平摊
2636   - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
2637   - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
2638   - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
2639   - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
  2638 +
  2639 + // ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
  2640 + // ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
  2641 + // ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
  2642 + // ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
2640 2643  
2641 2644 //-- 如果有参与促销才来进行计算 --
2642 2645 if (item_map.cy_cx) {
... ... @@ -2650,10 +2653,15 @@ Page({
2650 2653 ord_goods[j].is_order_yh = item_map.is_order_yh;
2651 2654 ord_goods[j].is_post_temp = item_map.is_post_temp;
2652 2655  
2653   - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
2654   - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
2655   - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account;
2656   - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu;
  2656 + //-- 真的判断 --
  2657 + var fd_map_gd=th.item_map_get_goods(ord_goods[j].goods_id, item_map);
  2658 + if(fd_map_gd){
  2659 + if(fd_map_gd.account_fir!=undefined) ord_goods[j].account_fir = fd_map_gd.account_fir;
  2660 + if(fd_map_gd.account_yu_fir!=undefined) ord_goods[j].account_yu_fir = fd_map_gd.account_yu_fir;
  2661 + if(fd_map_gd.account!=undefined) ord_goods[j].account = fd_map_gd.account;
  2662 + if(fd_map_gd.account_yu!=undefined) ord_goods[j].account_yu = fd_map_gd.account_yu;
  2663 + }
  2664 +
2657 2665 }
2658 2666 }
2659 2667 }
... ...