From 1bcb40140c1cb4d96e11c4bdb030e7c3f87a1ee3 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 24 May 2023 14:43:25 +0800 Subject: [PATCH] 幸运购 和 阶梯团尾款 --- packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js | 5 +++-- pages/cart/cart_wk/cart_wk.js | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index 93a0f32..73e19d9 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -1246,8 +1246,9 @@ Page({ if(item.exp_type==2){ item.lon=th.data.lon?th.data.lon:0; item.lat=th.data.lat?th.data.lat:0; - item.goods_weight=t_item.gd_w; - item.samecity_order_amount=t_item.samecity_order_amount; + item.goods_weight=th.data.bn_gd_w; + item.samecity_order_amount= th.data.bn_samecity_order_amount; + } //--判断有没有优惠活动-- diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 4d5e79e..82ab925 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -106,10 +106,10 @@ Page({ } th.getuser_addr(function (addr) { if (addr == null || addr == undefined || addr.length == 0) { - th.setData({ user_addr: null, enterAddressPage: 1, }); + th.setData({ user_addr: null, enterAddressPage: 1,same_ok:1 }); } else { th.setData({ - user_addr: addr, enterAddressPage: 0, + user_addr: addr, enterAddressPage: 0,same_ok:1 }); } @@ -653,7 +653,7 @@ Page({ th.jumpPaymentPage(th.data.order.order_sn, allmoney); },function (){ th.data.paying=0; - getApp().my_warnning("支付失败", 0, th); + //getApp().my_warnning("支付失败", 0, th); }) //var n = t.data.data; @@ -976,6 +976,11 @@ Page({ var good = th.data.goods; good.buynum=th.data.order.order_goods['goods_num']; + + var ord_prom = this.data.ord_prom; + var order_prom_id=0; + var order_prom_amount=0; + //--全部金额-- var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; //-----------当地址不为空,且是物流时,计算物流费用---------- @@ -1025,13 +1030,50 @@ Page({ return false } - th.data.lon=lon; + //-- 计算一下订单促销 -- + if (ord_prom) { + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - allpice).toFixed(2); + break; + case 1: + //-- 如果有优惠促销倍减的时候 -- + var bs = 1; + if (ord_prom.is_bz) { + bs = Math.floor(o_condition / ord_prom.money); + } + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } + } + + //--订单优惠的显示-- + var order_prom_txt1 = "formData.order_prom_id"; + var order_prom_txt2 = "formData.order_prom_amount"; + if (order_prom_id > 0) { + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) + } else { + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) + } + + + + th.data.lon=lon; th.data.lat=lat; th.data.bn_gd_w=gd_w; th.data.bn_samecity_order_amount=req_data.order_amount; var exp_price = parseFloat(shipping_price).toFixed(2); + allpice = parseFloat(exp_price) + parseFloat(allpice); + + + + + if(th.data.bn_use_commission){ allpice-=th.data.goods.use_commission; } @@ -1045,7 +1087,39 @@ Page({ } else { - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; + + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; + + //-- 计算一下订单促销 -- + if (ord_prom) { + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - allpice).toFixed(2); + break; + case 1: + //-- 如果有优惠促销倍减的时候 -- + var bs = 1; + if (ord_prom.is_bz) { + bs = Math.floor(o_condition / ord_prom.money); + } + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; + } + } + + //--订单优惠的显示-- + var order_prom_txt1 = "formData.order_prom_id"; + var order_prom_txt2 = "formData.order_prom_amount"; + if (order_prom_id > 0) { + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) + } else { + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) + } + + if(th.data.bn_use_commission){ allpice-=th.data.goods.use_commission; -- libgit2 0.21.4