Commit cc556a5850563208d576f157ed86489285570936
1 parent
70939314
1. 日志报警的修复
2. 立即购买的赠品的运费计算优化
Showing
3 changed files
with
35 additions
and
14 deletions
app.js
| @@ -209,8 +209,13 @@ App({ | @@ -209,8 +209,13 @@ App({ | ||
| 209 | } | 209 | } |
| 210 | }, | 210 | }, |
| 211 | //----------------获取配置参数-------------------- | 211 | //----------------获取配置参数-------------------- |
| 212 | - getConfig: function(t, o) { | ||
| 213 | - var e = this; if(this.globalData.config==undefined) this.globalData.config=null; | 212 | + getConfig: function(t, o) { |
| 213 | + var e = this; | ||
| 214 | + if(!e.globalData.setting.stoid){ | ||
| 215 | + t(null); | ||
| 216 | + return false; | ||
| 217 | + } | ||
| 218 | + if(this.globalData.config==undefined) this.globalData.config=null; | ||
| 214 | this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.request.get("/api/weshop/store/get/" + e.globalData.setting.stoid, { | 219 | this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.request.get("/api/weshop/store/get/" + e.globalData.setting.stoid, { |
| 215 | success: function(o) { | 220 | success: function(o) { |
| 216 | console.log('getConfig'); | 221 | console.log('getConfig'); |
| @@ -220,10 +225,13 @@ App({ | @@ -220,10 +225,13 @@ App({ | ||
| 220 | } | 225 | } |
| 221 | }); | 226 | }); |
| 222 | }, | 227 | }, |
| 223 | - | ||
| 224 | //----------------获取配置参数-------------------- | 228 | //----------------获取配置参数-------------------- |
| 225 | - getConfig2: function (t, o) { | 229 | + getConfig2: function (t, o) { |
| 226 | var e = this; | 230 | var e = this; |
| 231 | + if(!e.globalData.setting.stoid) { | ||
| 232 | + t(null); | ||
| 233 | + return false; | ||
| 234 | + } | ||
| 227 | this.globalData.config2 && !o ? | 235 | this.globalData.config2 && !o ? |
| 228 | "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { | 236 | "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { |
| 229 | success: function (o) { | 237 | success: function (o) { |
pages/cart/cart/cart.js
| @@ -783,7 +783,7 @@ Page({ | @@ -783,7 +783,7 @@ Page({ | ||
| 783 | isShowLoading: 0, | 783 | isShowLoading: 0, |
| 784 | success: function(res_d) { | 784 | success: function(res_d) { |
| 785 | 785 | ||
| 786 | - if(res_d.data.code==0){ | 786 | + if(res_d.data.code==0 && res_d.data.data){ |
| 787 | if (t.goods_num > store_count) { | 787 | if (t.goods_num > store_count) { |
| 788 | wx.showModal({ | 788 | wx.showModal({ |
| 789 | title: '提示', | 789 | title: '提示', |
pages/cart/cart2/cart2.js
| @@ -671,7 +671,7 @@ Page({ | @@ -671,7 +671,7 @@ Page({ | ||
| 671 | ob.buynum=num; | 671 | ob.buynum=num; |
| 672 | ob.weight=data.gift_weight; //商品的重量 | 672 | ob.weight=data.gift_weight; //商品的重量 |
| 673 | ob.exp_sum_type=data.gift_exp_sum_type; //商品的物流计算方式 | 673 | ob.exp_sum_type=data.gift_exp_sum_type; //商品的物流计算方式 |
| 674 | - ob.uniform_exp_sum=data.uniform_exp_sum //统一运费的金额 | 674 | + ob.uniform_exp_sum=data.gift_uniform_exp_sum //统一运费的金额 |
| 675 | 675 | ||
| 676 | th.setData({buy_now_gift_goods:ob}); | 676 | th.setData({buy_now_gift_goods:ob}); |
| 677 | } | 677 | } |
| @@ -1541,7 +1541,8 @@ Page({ | @@ -1541,7 +1541,8 @@ Page({ | ||
| 1541 | 1541 | ||
| 1542 | //如果有赠品的时候,也要计算赠品的物流费用 | 1542 | //如果有赠品的时候,也要计算赠品的物流费用 |
| 1543 | if(th.data.buy_now_gift_goods){ | 1543 | if(th.data.buy_now_gift_goods){ |
| 1544 | - shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, parseFloat(allpice)-cut_price-quan_price, rs,shipping_price,no_by_data); | 1544 | + shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, |
| 1545 | + parseFloat(allpice)-cut_price-quan_price, rs,shipping_price,no_by_data,goods_weight,goods_piece); | ||
| 1545 | } | 1546 | } |
| 1546 | 1547 | ||
| 1547 | if(shipping_price<=0){ | 1548 | if(shipping_price<=0){ |
| @@ -3161,7 +3162,7 @@ Page({ | @@ -3161,7 +3162,7 @@ Page({ | ||
| 3161 | arr.gift_original_img = get_data.goodsinfo.original_img; | 3162 | arr.gift_original_img = get_data.goodsinfo.original_img; |
| 3162 | arr.gift_weight = get_data.goodsinfo.weight; | 3163 | arr.gift_weight = get_data.goodsinfo.weight; |
| 3163 | arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | 3164 | arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; |
| 3164 | - arr.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | 3165 | + arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; |
| 3165 | arr.gift_limit_num = get_data.limit_num; | 3166 | arr.gift_limit_num = get_data.limit_num; |
| 3166 | arr.gift_storecount = get_data.gift_storecount; | 3167 | arr.gift_storecount = get_data.gift_storecount; |
| 3167 | } | 3168 | } |
| @@ -3239,7 +3240,7 @@ Page({ | @@ -3239,7 +3240,7 @@ Page({ | ||
| 3239 | }, | 3240 | }, |
| 3240 | 3241 | ||
| 3241 | //计算立即购买赠品的物流费用 | 3242 | //计算立即购买赠品的物流费用 |
| 3242 | - get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data) { | 3243 | + get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data,goods_weight1,goods_piece1) { |
| 3243 | var good=this.data.buy_now_gift_goods; | 3244 | var good=this.data.buy_now_gift_goods; |
| 3244 | var goods_weight=-1, goods_piece=-1; | 3245 | var goods_weight=-1, goods_piece=-1; |
| 3245 | var gift_shipping_price=0; | 3246 | var gift_shipping_price=0; |
| @@ -3247,17 +3248,28 @@ Page({ | @@ -3247,17 +3248,28 @@ Page({ | ||
| 3247 | switch (good['exp_sum_type']) { | 3248 | switch (good['exp_sum_type']) { |
| 3248 | case 1: | 3249 | case 1: |
| 3249 | //统一运费 | 3250 | //统一运费 |
| 3250 | - gift_shipping_price += good['uniform_exp_sum']; break; | 3251 | + gift_shipping_price += good['uniform_exp_sum']; |
| 3252 | + gift_shipping_price+=o_shipping_price; | ||
| 3253 | + break; | ||
| 3251 | case 2: | 3254 | case 2: |
| 3252 | if (goods_weight < 0) goods_weight = 0; | 3255 | if (goods_weight < 0) goods_weight = 0; |
| 3253 | //累积商品重量 每种商品的重量 * 数量 | 3256 | //累积商品重量 每种商品的重量 * 数量 |
| 3254 | - goods_weight += good['weight'] * good['buynum'];break; | 3257 | + goods_weight += good['weight'] * good['buynum']; |
| 3258 | + if(goods_weight1>0){ | ||
| 3259 | + goods_weight+=goods_weight1; | ||
| 3260 | + } | ||
| 3261 | + break; | ||
| 3255 | case 3: | 3262 | case 3: |
| 3256 | if (goods_piece < 0) goods_piece = 0; | 3263 | if (goods_piece < 0) goods_piece = 0; |
| 3257 | //累积商品数量 | 3264 | //累积商品数量 |
| 3258 | - goods_piece += good['buynum']; break; | 3265 | + goods_piece += good['buynum']; |
| 3266 | + if(goods_piece1){ | ||
| 3267 | + goods_piece+=goods_piece1; | ||
| 3268 | + } | ||
| 3269 | + break; | ||
| 3259 | } | 3270 | } |
| 3260 | - | 3271 | + |
| 3272 | + | ||
| 3261 | //如果有设置不包邮区域的时候 | 3273 | //如果有设置不包邮区域的时候 |
| 3262 | if(no_by_data && no_by_data.region_list){ | 3274 | if(no_by_data && no_by_data.region_list){ |
| 3263 | if(th.check_by_area(no_by_data.region_list)){ | 3275 | if(th.check_by_area(no_by_data.region_list)){ |
| @@ -3272,10 +3284,11 @@ Page({ | @@ -3272,10 +3284,11 @@ Page({ | ||
| 3272 | //th.data.is_no_by[th.data.bn_pick]=1; | 3284 | //th.data.is_no_by[th.data.bn_pick]=1; |
| 3273 | } | 3285 | } |
| 3274 | } | 3286 | } |
| 3287 | + | ||
| 3275 | var t_shipping_price= | 3288 | var t_shipping_price= |
| 3276 | this.calculatewuliu(code, gift_shipping_price, goods_weight, | 3289 | this.calculatewuliu(code, gift_shipping_price, goods_weight, |
| 3277 | goods_piece, user_addr, gift_freight_free, allpice, rs); | 3290 | goods_piece, user_addr, gift_freight_free, allpice, rs); |
| 3278 | - return t_shipping_price+shipping_price; | 3291 | + return t_shipping_price; |
| 3279 | 3292 | ||
| 3280 | }, | 3293 | }, |
| 3281 | 3294 |