From aec835abdccdd5c68173c17dc446b9e8a9dc49f8 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 25 Aug 2021 14:25:57 +0800 Subject: [PATCH] 组合购的 价格小 组合价格比较大的时候的计算bug --- pages/cart/cart2/cart2.js | 18 ++++++++++++------ pages/goods/goodsInfo/goodsInfo.js | 9 +++++++++ utils/wxParse/wxParse.js | 3 ++- utils/wxParse/wxParse.wxml | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 57817a1..accff90 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -2027,11 +2027,11 @@ Page({ } //--判断优惠活动的提交-- - if (th.data.formData.cut_price > 0) { + if (th.data.formData.cut_price > 0 ) { order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); var ob = [{ "prom_id": th.data.bn_goods.prom_id, - "dis": th.data.formData.cut_price.toFixed(2), + "dis": parseFloat(th.data.formData.cut_price).toFixed(2), "ispt": 0 }] order_prom_list.prom_pt_json = JSON.stringify(ob); @@ -2266,12 +2266,12 @@ Page({ order_prom_list.discount_amount =0; //--判断优惠活动的提交-- if (t_item.cut_price > 0) { - order_prom_list.discount_amount += t_item.cut_price.toFixed(2); + order_prom_list.discount_amount += t_item.cut_price; order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); } //--判断组合优惠活动的提交-- - if (t_item.zh_cut_price > 0) { - order_prom_list.discount_amount += t_item.zh_cut_price.toFixed(2); + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { + order_prom_list.discount_amount += t_item.zh_cut_price; order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); } if (t_item.s_intValue > 0) { @@ -2285,8 +2285,14 @@ Page({ order_prom_list.give_lb_id = t_item.s_libao; order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); } - if (Object.keys(order_prom_list).length > 0) + if (Object.keys(order_prom_list).length > 0){ + if(order_prom_list.discount_amount) + order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); + if(order_prom_list.order_prom_amount) + order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); item.order_prom_list = order_prom_list; + } + //老会员成为分销下线需要的参数 if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 6afbe9d..39f1b3a 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -711,6 +711,11 @@ Page({ onShow: function() { console.log('djfijsaoifjoisadjfoij'); var goods_list = null,th = this,that=this; + var show_prew_img= this.data.show_prew_img + if(show_prew_img){ + show_prew_img=0; + return false; + } //优惠券要实时更新 getApp().getConfig2(function(e) { @@ -2061,6 +2066,7 @@ Page({ for(var i in b){ b[i] = this.data.iurl + e[i]; } + this.data.show_prew_img=1; wx.previewImage({ current: b[t.currentTarget.dataset.id], @@ -2074,6 +2080,7 @@ Page({ for (var i in b) { b[i] = this.data.iurl + e[i]; } + this.data.show_prew_img=1; wx.previewImage({ current: b[t.currentTarget.dataset.id], urls: b @@ -2089,6 +2096,7 @@ Page({ current: a[t.currentTarget.dataset.id], urls: a }); + this.data.show_prew_img=1; }, closePromModal: function() { this.setData({ @@ -5388,6 +5396,7 @@ Page({ }, previewImage() { + this.data.show_prew_img=1; wx.previewImage({ //将图片预览出来 urls: [this.data.shareImgPath] diff --git a/utils/wxParse/wxParse.js b/utils/wxParse/wxParse.js index d35ffaf..8f650c9 100644 --- a/utils/wxParse/wxParse.js +++ b/utils/wxParse/wxParse.js @@ -15,9 +15,10 @@ function t(e, t, a) { function a(e) { var t = this, a = e.target.dataset.src, i = e.target.dataset.from; + t.data.show_prew_img=1; void 0 !== i && i.length > 0 && wx.previewImage({ current: a, - urls: t.data[i].imageUrls + urls: t.data[i].imageUrls, }); } diff --git a/utils/wxParse/wxParse.wxml b/utils/wxParse/wxParse.wxml index 2251a18..90aa270 100644 --- a/utils/wxParse/wxParse.wxml +++ b/utils/wxParse/wxParse.wxml @@ -377,7 +377,7 @@