- 
Status changed to merged
 - 
mentioned in commit 5b0aae4972065c33122eb9997932075685b1641f
 
- 
Dev See merge request !1033
 
- 
Dev See merge request !1032
 
- 
1、虚拟成团 2、运费阶梯 3、 区域价格的时候,门店控制 See merge request !1031
 - 
2、运费阶梯 3、 区域价格的时候,门店控制
 
Showing
48 changed files
app.js
| @@ -530,21 +530,40 @@ App({ | @@ -530,21 +530,40 @@ App({ | ||
| 530 | } | 530 | } | 
| 531 | if (!th.globalData.pk_store) { | 531 | if (!th.globalData.pk_store) { | 
| 532 | var pick_id = 0; | 532 | var pick_id = 0; | 
| 533 | - //先找一个会员是否有设置默认的地址 | ||
| 534 | - if (th.globalData.userInfo.def_pickup_id) { | ||
| 535 | - pick_id = th.globalData.userInfo.def_pickup_id | ||
| 536 | - } | ||
| 537 | - //查找会员的注册的地址 | ||
| 538 | - else if (th.globalData.userInfo.pickup_id) { | 533 | + | 
| 534 | + var is_pricing_open_store=0; | ||
| 535 | + var is_regstores=0; | ||
| 536 | + if (conf.switch_list) { | ||
| 537 | + var t_swi = JSON.parse(conf.switch_list); | ||
| 539 | //--购买门店是否默认登记门店-- | 538 | //--购买门店是否默认登记门店-- | 
| 540 | - if (conf.switch_list) { | ||
| 541 | - var t_swi = JSON.parse(conf.switch_list); | ||
| 542 | - if (t_swi.is_regstores) { | ||
| 543 | - pick_id = th.globalData.userInfo.pickup_id | ||
| 544 | - } | 539 | + is_regstores=t_swi.is_regstores; | 
| 540 | + is_pricing_open_store=t_swi.is_pricing_open_store; | ||
| 541 | + } | ||
| 542 | + | ||
| 543 | + //-- 如果是区域价格提现,现在注册门店是默认 -- | ||
| 544 | + if(is_pricing_open_store){ | ||
| 545 | + | ||
| 546 | + //查找会员的注册的地址 | ||
| 547 | + if (th.globalData.userInfo.pickup_id) { | ||
| 548 | + pick_id = th.globalData.userInfo.pickup_id | ||
| 549 | + } | ||
| 550 | + //先找一个会员是否有设置默认的地址 | ||
| 551 | + else if (th.globalData.userInfo.def_pickup_id) { | ||
| 552 | + pick_id = th.globalData.userInfo.def_pickup_id | ||
| 545 | } | 553 | } | 
| 546 | 554 | ||
| 555 | + }else{ | ||
| 556 | + //先找一个会员是否有设置默认的地址 | ||
| 557 | + if (th.globalData.userInfo.def_pickup_id) { | ||
| 558 | + pick_id = th.globalData.userInfo.def_pickup_id | ||
| 559 | + } | ||
| 560 | + //查找会员的注册的地址 | ||
| 561 | + else if (th.globalData.userInfo.pickup_id && is_regstores) { | ||
| 562 | + pick_id = th.globalData.userInfo.pickup_id | ||
| 563 | + } | ||
| 547 | } | 564 | } | 
| 565 | + | ||
| 566 | + | ||
| 548 | //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- | 567 | //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- | 
| 549 | if (pick_id == 0) return func(null); | 568 | if (pick_id == 0) return func(null); | 
| 550 | 569 | 
components/diy_advertising/diy_advertising.js
| @@ -50,7 +50,7 @@ Component({ | @@ -50,7 +50,7 @@ Component({ | ||
| 50 | //宽高比 | 50 | //宽高比 | 
| 51 | var ratio = imgwidth / imgheight; | 51 | var ratio = imgwidth / imgheight; | 
| 52 | //计算的高度值 | 52 | //计算的高度值 | 
| 53 | - var viewHeight = 715 / ratio; | 53 | + var viewHeight = 750 / ratio; | 
| 54 | var hei=this.data.max_sw_height; | 54 | var hei=this.data.max_sw_height; | 
| 55 | 55 | ||
| 56 | if (hei< viewHeight) { | 56 | if (hei< viewHeight) { | 
components/diy_store_select/diy_store_select.js
| @@ -43,7 +43,7 @@ Component({ | @@ -43,7 +43,7 @@ Component({ | ||
| 43 | } | 43 | } | 
| 44 | 44 | ||
| 45 | //获取顶部的门店 | 45 | //获取顶部的门店 | 
| 46 | - getApp().get_user_store(function(){ | 46 | + getApp().get_user_store(function(e){ | 
| 47 | wx.getLocation({ | 47 | wx.getLocation({ | 
| 48 | type: 'gcj02', | 48 | type: 'gcj02', | 
| 49 | success: function(res) { | 49 | success: function(res) { | 
| @@ -59,6 +59,14 @@ Component({ | @@ -59,6 +59,14 @@ Component({ | ||
| 59 | }) | 59 | }) | 
| 60 | 60 | ||
| 61 | }) | 61 | }) | 
| 62 | + | ||
| 63 | + | ||
| 64 | + getApp().getConfig2(function (e) { | ||
| 65 | + var json_d = JSON.parse(e.switch_list); | ||
| 66 | + if(json_d.is_pricing_open_store){ | ||
| 67 | + th.setData({ no_select:1 }) | ||
| 68 | + } | ||
| 69 | + },1) | ||
| 62 | }, | 70 | }, | 
| 63 | 71 | ||
| 64 | 72 | ||
| @@ -101,10 +109,24 @@ Component({ | @@ -101,10 +109,24 @@ Component({ | ||
| 101 | }); | 109 | }); | 
| 102 | return false; | 110 | return false; | 
| 103 | } | 111 | } | 
| 104 | - var th=this; | ||
| 105 | - this.get_top_sto(function(){ | ||
| 106 | - th.setData({store:1}); | ||
| 107 | - }); | 112 | + var th=this; | 
| 113 | + | ||
| 114 | + if(this.data.no_select && getApp().globalData.pk_store ){ | ||
| 115 | + return false; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + //获取属性 | ||
| 119 | + getApp().getConfig2(function (e) { | ||
| 120 | + var json_d = JSON.parse(e.switch_list); | ||
| 121 | + if(getApp().globalData.pk_store && json_d.is_pricing_open_store){ | ||
| 122 | + return false; | ||
| 123 | + } | ||
| 124 | + th.get_top_sto(function(){ | ||
| 125 | + th.setData({store:1}); | ||
| 126 | + }); | ||
| 127 | + }) | ||
| 128 | + | ||
| 129 | + | ||
| 108 | }, | 130 | }, | 
| 109 | //选择更多门店 | 131 | //选择更多门店 | 
| 110 | more_store: function() { | 132 | more_store: function() { | 
components/diy_store_select/diy_store_select.wxml
| @@ -3,12 +3,16 @@ | @@ -3,12 +3,16 @@ | ||
| 3 | <!-- 如果是自定义模板的时候 --> | 3 | <!-- 如果是自定义模板的时候 --> | 
| 4 | <block wx:if="{{object}}"> | 4 | <block wx:if="{{object}}"> | 
| 5 | <view class="store_sele1 flex ai_c" bindtap="sele_top_store" style="background-color:{{object.bgcolor}};color: {{object.word_color}};"> | 5 | <view class="store_sele1 flex ai_c" bindtap="sele_top_store" style="background-color:{{object.bgcolor}};color: {{object.word_color}};"> | 
| 6 | - <image class="logo_box circle" src="{{url+store_config.store_logo}}"></image>{{top_store?top_store.pickup_name+'[切换]':'请选择门店'}} | 6 | + <image class="logo_box circle" src="{{url+store_config.store_logo}}"></image> | 
| 7 | + <block wx:if="{{no_select}}">{{top_store?top_store.pickup_name:'请选择门店'}}</block> | ||
| 8 | + <block wx:else>{{top_store?top_store.pickup_name+'[切换]':'请选择门店'}}</block> | ||
| 7 | </view> | 9 | </view> | 
| 8 | </block> | 10 | </block> | 
| 9 | <block wx:else> | 11 | <block wx:else> | 
| 10 | <view class="store_sele flex ai_c" bindtap="sele_top_store"> | 12 | <view class="store_sele flex ai_c" bindtap="sele_top_store"> | 
| 11 | - <image class="logo_box circle" src="{{url+store_config.store_logo}}"></image>{{top_store?top_store.pickup_name+'[切换]':'请选择门店'}} | 13 | + <image class="logo_box circle" src="{{url+store_config.store_logo}}"></image> | 
| 14 | + <block wx:if="{{no_select}}">{{top_store?top_store.pickup_name:'请选择门店'}}</block> | ||
| 15 | + <block wx:else>{{top_store?top_store.pickup_name+'[切换]':'请选择门店'}}</block> | ||
| 12 | </view> | 16 | </view> | 
| 13 | <view class="pd-view"></view> | 17 | <view class="pd-view"></view> | 
| 14 | </block> | 18 | </block> | 
packageA/pages/goodsInfo/buy_flash_normal.wxml
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | <view class="fs30" style="color:black;">选择门店</view> | 44 | <view class="fs30" style="color:black;">选择门店</view> | 
| 45 | </view> | 45 | </view> | 
| 46 | 46 | ||
| 47 | - <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 47 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 
| 48 | </view> | 48 | </view> | 
| 49 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 49 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 50 | <block wx:else> | 50 | <block wx:else> | 
packageA/pages/goodsInfo/goodsInfo.js
| @@ -357,6 +357,9 @@ Page({ | @@ -357,6 +357,9 @@ Page({ | ||
| 357 | th.data.fir_def_store={}; //赋值空对象 | 357 | th.data.fir_def_store={}; //赋值空对象 | 
| 358 | return false; | 358 | return false; | 
| 359 | } | 359 | } | 
| 360 | + | ||
| 361 | + th.setData({has_def:1}) | ||
| 362 | + | ||
| 360 | var ee=JSON.parse(JSON.stringify(e)); | 363 | var ee=JSON.parse(JSON.stringify(e)); | 
| 361 | //--定时器推迟一下-- | 364 | //--定时器推迟一下-- | 
| 362 | setTimeout(function () { | 365 | setTimeout(function () { | 
| @@ -1287,9 +1290,7 @@ Page({ | @@ -1287,9 +1290,7 @@ Page({ | ||
| 1287 | }, | 1290 | }, | 
| 1288 | 1291 | ||
| 1289 | openSpecModel: function(t) { | 1292 | openSpecModel: function(t) { | 
| 1290 | - var th=this; | ||
| 1291 | - var open_store = t.currentTarget.dataset.ind; | ||
| 1292 | - | 1293 | + var th=this; var open_store = t.currentTarget.dataset.ind; | 
| 1293 | if(getApp().is_sp_hao() && open_store==1){ | 1294 | if(getApp().is_sp_hao() && open_store==1){ | 
| 1294 | wx.showToast({ | 1295 | wx.showToast({ | 
| 1295 | title: "视频号商品不允许加入购物车", | 1296 | title: "视频号商品不允许加入购物车", | 
| @@ -1300,20 +1301,22 @@ Page({ | @@ -1300,20 +1301,22 @@ Page({ | ||
| 1300 | } | 1301 | } | 
| 1301 | 1302 | ||
| 1302 | 1303 | ||
| 1304 | + //--先判断会员状态-- | ||
| 1305 | + var user_info = getApp().globalData.userInfo; | ||
| 1306 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 1307 | + wx.navigateTo({ | ||
| 1308 | + url: '/pages/togoin/togoin', | ||
| 1309 | + }) | ||
| 1310 | + return false; | ||
| 1311 | + } | ||
| 1312 | + | ||
| 1303 | this.setData({ | 1313 | this.setData({ | 
| 1304 | store: 0, | 1314 | store: 0, | 
| 1305 | choice_sort_store: 0, | 1315 | choice_sort_store: 0, | 
| 1306 | sort_store: 0, | 1316 | sort_store: 0, | 
| 1307 | open_ind_store: open_store, | 1317 | open_ind_store: open_store, | 
| 1308 | }) | 1318 | }) | 
| 1309 | - //--先判断会员状态-- | ||
| 1310 | - var user_info = getApp().globalData.userInfo; | ||
| 1311 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
| 1312 | - wx.navigateTo({ | ||
| 1313 | - url: '/pages/togoin/togoin', | ||
| 1314 | - }) | ||
| 1315 | - return false; | ||
| 1316 | - } | 1319 | + | 
| 1317 | 1320 | ||
| 1318 | var ind = t.currentTarget.dataset.ind; | 1321 | var ind = t.currentTarget.dataset.ind; | 
| 1319 | this.setData({ | 1322 | this.setData({ | 
| @@ -2445,6 +2448,11 @@ Page({ | @@ -2445,6 +2448,11 @@ Page({ | ||
| 2445 | var ind=ee.currentTarget.dataset.ind; | 2448 | var ind=ee.currentTarget.dataset.ind; | 
| 2446 | var bconfig = th.data.bconfig; | 2449 | var bconfig = th.data.bconfig; | 
| 2447 | 2450 | ||
| 2451 | + | ||
| 2452 | + //如果开启了,则不在选择门店 | ||
| 2453 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 2454 | + return false; | ||
| 2455 | + } | ||
| 2448 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 2456 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 
| 2449 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 2457 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 2450 | return false; | 2458 | return false; | 
| @@ -3455,7 +3463,10 @@ Page({ | @@ -3455,7 +3463,10 @@ Page({ | ||
| 3455 | let prom_type = e.currentTarget.dataset.promtype; | 3463 | let prom_type = e.currentTarget.dataset.promtype; | 
| 3456 | let prom_id = e.currentTarget.dataset.promid; | 3464 | let prom_id = e.currentTarget.dataset.promid; | 
| 3457 | let goods_id = this.data.data.goods_id; | 3465 | let goods_id = this.data.data.goods_id; | 
| 3458 | - let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;s | 3466 | + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`; | 
| 3467 | + if(prom_type==6){ | ||
| 3468 | + url = `/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`; | ||
| 3469 | + } | ||
| 3459 | getApp().goto(url); | 3470 | getApp().goto(url); | 
| 3460 | }, | 3471 | }, | 
| 3461 | 3472 | ||
| @@ -3636,6 +3647,7 @@ Page({ | @@ -3636,6 +3647,7 @@ Page({ | ||
| 3636 | 3647 | ||
| 3637 | //-- 秒杀的普通购买 -- | 3648 | //-- 秒杀的普通购买 -- | 
| 3638 | openSpecModel_Nor: function () { | 3649 | openSpecModel_Nor: function () { | 
| 3650 | + var th=this; | ||
| 3639 | 3651 | ||
| 3640 | // 是否授权登陆 | 3652 | // 是否授权登陆 | 
| 3641 | var user_info = getApp().globalData.userInfo; | 3653 | var user_info = getApp().globalData.userInfo; | 
| @@ -3646,8 +3658,7 @@ Page({ | @@ -3646,8 +3658,7 @@ Page({ | ||
| 3646 | return false; | 3658 | return false; | 
| 3647 | } | 3659 | } | 
| 3648 | 3660 | ||
| 3649 | - | ||
| 3650 | - this.data.g_buy_num = new Map(); | 3661 | + this.data.g_buy_num = new Map(); | 
| 3651 | var th = this; | 3662 | var th = this; | 
| 3652 | this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 | 3663 | this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 | 
| 3653 | 3664 | 
packageA/pages/goodsInfo/goodsInfo.wxml
| @@ -155,7 +155,7 @@ | @@ -155,7 +155,7 @@ | ||
| 155 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 155 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 156 | <view class="fs30" style="color:black;">选择门店</view> | 156 | <view class="fs30" style="color:black;">选择门店</view> | 
| 157 | </view> | 157 | </view> | 
| 158 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 158 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 
| 159 | </view> | 159 | </view> | 
| 160 | 160 | ||
| 161 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 161 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 
| @@ -189,6 +189,7 @@ | @@ -189,6 +189,7 @@ | ||
| 189 | <!-- <block> --> | 189 | <!-- <block> --> | 
| 190 | <view class="flex ai_c" wx:for="{{actList}}"> | 190 | <view class="flex ai_c" wx:for="{{actList}}"> | 
| 191 | <view class="cx-sizs fs30 pdr40" wx:if="{{item.prom_type == 1}}">秒杀{{index+1}}</view> | 191 | <view class="cx-sizs fs30 pdr40" wx:if="{{item.prom_type == 1}}">秒杀{{index+1}}</view> | 
| 192 | + <view class="cx-sizs fs30 pdr40" wx:if="{{item.prom_type == 6}}">拼单{{index+1}}</view> | ||
| 192 | <view class="f1"> | 193 | <view class="f1"> | 
| 193 | <!-- <view class="fs28 f1"> --> | 194 | <!-- <view class="fs28 f1"> --> | 
| 194 | <!-- <view> | 195 | <!-- <view> | 
| @@ -302,7 +303,8 @@ | @@ -302,7 +303,8 @@ | ||
| 302 | <block wx:if="{{listServiceItem && listServiceItem.length > 0}}"> | 303 | <block wx:if="{{listServiceItem && listServiceItem.length > 0}}"> | 
| 303 | <view class="card fs28" wx:for="{{listServiceItem}}"> | 304 | <view class="card fs28" wx:for="{{listServiceItem}}"> | 
| 304 | <view class="flex ai_c jc_sb" style="height: 88rpx;"> | 305 | <view class="flex ai_c jc_sb" style="height: 88rpx;"> | 
| 305 | - <view class="ellipsis-2 f1">{{item.projectName}}({{item.frequency}}次)</view> | 306 | + <view class="ellipsis-2 f1" wx:if="{{item.displayqty==1}}" >{{item.projectName}}(无限次)</view> | 
| 307 | + <view class="ellipsis-2 f1" wx:else>{{item.projectName}}({{item.frequency}}次)</view> | ||
| 306 | <view class="pdl30 t-r"> | 308 | <view class="pdl30 t-r"> | 
| 307 | <view class="rmb fs36 bold c-red">{{item.vipprice}}</view> | 309 | <view class="rmb fs36 bold c-red">{{item.vipprice}}</view> | 
| 308 | <view class="fs22 c-9 del" wx:if="{{item.showPrice}}">零售价:¥{{item.showPrice}}</view> | 310 | <view class="fs22 c-9 del" wx:if="{{item.showPrice}}">零售价:¥{{item.showPrice}}</view> | 
| @@ -673,8 +675,7 @@ | @@ -673,8 +675,7 @@ | ||
| 673 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 675 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 674 | <view class="fs30" style="color:black;">选择门店</view> | 676 | <view class="fs30" style="color:black;">选择门店</view> | 
| 675 | </view> | 677 | </view> | 
| 676 | - | ||
| 677 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 678 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 678 | </view> | 679 | </view> | 
| 679 | 680 | ||
| 680 | 681 | 
packageA/pages/prom_list/prom_list.js
| @@ -91,6 +91,9 @@ Page({ | @@ -91,6 +91,9 @@ Page({ | ||
| 91 | th.data.fir_def_store={}; //赋值空对象 | 91 | th.data.fir_def_store={}; //赋值空对象 | 
| 92 | return false; | 92 | return false; | 
| 93 | } | 93 | } | 
| 94 | + | ||
| 95 | + th.setData({has_def:1}) | ||
| 96 | + | ||
| 94 | var appd=getApp().globalData; | 97 | var appd=getApp().globalData; | 
| 95 | var w_time = setInterval(function() { | 98 | var w_time = setInterval(function() { | 
| 96 | if (that.data.is_get_local_ok == 0) return false; | 99 | if (that.data.is_get_local_ok == 0) return false; | 
| @@ -1252,6 +1255,11 @@ Page({ | @@ -1252,6 +1255,11 @@ Page({ | ||
| 1252 | var th = this; | 1255 | var th = this; | 
| 1253 | var ind=ee.currentTarget.dataset.ind; | 1256 | var ind=ee.currentTarget.dataset.ind; | 
| 1254 | var bconfig = th.data.bconfig; | 1257 | var bconfig = th.data.bconfig; | 
| 1258 | + | ||
| 1259 | + //如果开启了,则不在选择门店 | ||
| 1260 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 1261 | + return false; | ||
| 1262 | + } | ||
| 1255 | 1263 | ||
| 1256 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 1264 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 
| 1257 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 1265 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
packageA/pages/prom_list/prom_list.wxml
| @@ -106,7 +106,7 @@ | @@ -106,7 +106,7 @@ | ||
| 106 | <view class="fs28 xc-ash-9f">选择门店</view> | 106 | <view class="fs28 xc-ash-9f">选择门店</view> | 
| 107 | </view> | 107 | </view> | 
| 108 | 108 | ||
| 109 | - <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 109 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 
| 110 | </view> | 110 | </view> | 
| 111 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 111 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 112 | <block wx:else> | 112 | <block wx:else> | 
packageB/pages/zuhegou/index/index.js
| @@ -259,8 +259,7 @@ Page({ | @@ -259,8 +259,7 @@ Page({ | ||
| 259 | th.data.fir_def_store = {}; //赋值空对象 | 259 | th.data.fir_def_store = {}; //赋值空对象 | 
| 260 | return false; | 260 | return false; | 
| 261 | } | 261 | } | 
| 262 | - | ||
| 263 | - | 262 | + th.setData({has_def:1}) | 
| 264 | 263 | ||
| 265 | var ee = JSON.parse(JSON.stringify(e)); | 264 | var ee = JSON.parse(JSON.stringify(e)); | 
| 266 | var appd = getApp().globalData; | 265 | var appd = getApp().globalData; | 
packageB/pages/zuhegou/index/index.wxml
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | <text wx:else bindtap="choose_store">{{def_pick_store.pickup_name}}</text> | 22 | <text wx:else bindtap="choose_store">{{def_pick_store.pickup_name}}</text> | 
| 23 | </block> | 23 | </block> | 
| 24 | 24 | ||
| 25 | - <text wx:else bindtap="choose_store" >请选择门店</text> | 25 | + <text hidden="{{has_def && sys_switch.is_pricing_open_store}}" wx:else bindtap="choose_store" >请选择门店</text> | 
| 26 | </view> | 26 | </view> | 
| 27 | 27 | ||
| 28 | <!-- 商品列表 --> | 28 | <!-- 商品列表 --> | 
packageB/pages/zuhegou/preindex/index.js
| @@ -260,7 +260,7 @@ Page({ | @@ -260,7 +260,7 @@ Page({ | ||
| 260 | return false; | 260 | return false; | 
| 261 | } | 261 | } | 
| 262 | 262 | ||
| 263 | - | 263 | + th.setData({has_def:1}) | 
| 264 | 264 | ||
| 265 | var ee = JSON.parse(JSON.stringify(e)); | 265 | var ee = JSON.parse(JSON.stringify(e)); | 
| 266 | var appd = getApp().globalData; | 266 | var appd = getApp().globalData; | 
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
| @@ -3,6 +3,7 @@ var t = getApp(), | @@ -3,6 +3,7 @@ var t = getApp(), | ||
| 3 | a = t.request, | 3 | a = t.request, | 
| 4 | e = require("../../../../utils/common.js"), | 4 | e = require("../../../../utils/common.js"), | 
| 5 | s = require("../../../../utils/util.js"), | 5 | s = require("../../../../utils/util.js"), | 
| 6 | + ut=s, | ||
| 6 | o = require("../../../../utils/md5.js"), | 7 | o = require("../../../../utils/md5.js"), | 
| 7 | to = getApp(); | 8 | to = getApp(); | 
| 8 | var oo = t.globalData.setting, | 9 | var oo = t.globalData.setting, | 
| @@ -499,7 +500,7 @@ Page({ | @@ -499,7 +500,7 @@ Page({ | ||
| 499 | var th = this, | 500 | var th = this, | 
| 500 | good = this.data.bn_goods; | 501 | good = this.data.bn_goods; | 
| 501 | //-----------计算商品总价-------------- | 502 | //-----------计算商品总价-------------- | 
| 502 | - var allpice = good.shop_price * good.buynum; | 503 | + var allpice = th.data.param.goods_price; | 
| 503 | allpice = parseFloat(allpice).toFixed(2); | 504 | allpice = parseFloat(allpice).toFixed(2); | 
| 504 | var txt = "formData.all_price"; | 505 | var txt = "formData.all_price"; | 
| 505 | th.setData({ | 506 | th.setData({ | 
| @@ -507,77 +508,82 @@ Page({ | @@ -507,77 +508,82 @@ Page({ | ||
| 507 | }); | 508 | }); | 
| 508 | console.log(th.data.formData); | 509 | console.log(th.data.formData); | 
| 509 | 510 | ||
| 510 | - to.getConfig2(function (ee) { | ||
| 511 | - to.getwuliuprice(async function (rs) { | ||
| 512 | - console.log('calculatePrice2222'); | ||
| 513 | - console.log(rs); | 511 | + | 
| 512 | + to.getwuliuprice(async function (rs) { | ||
| 513 | + | ||
| 514 | var o_shipping_price = 0, | 514 | var o_shipping_price = 0, | 
| 515 | goods_weight = -1, | 515 | goods_weight = -1, | 
| 516 | goods_piece = -1; | 516 | goods_piece = -1; | 
| 517 | var out_of_weight = null; //超出多少重量 | 517 | var out_of_weight = null; //超出多少重量 | 
| 518 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 519 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 520 | - var no_ex_id = ee.no_ex_id; | 518 | + | 
| 521 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 519 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 
| 522 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != | 520 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != | 
| 523 | 3 || th.data.bn_goods.is_normal == 1)) { | 521 | 3 || th.data.bn_goods.is_normal == 1)) { | 
| 524 | - switch (good['exp_sum_type']) { | ||
| 525 | - case 1: | ||
| 526 | - //统一运费 | ||
| 527 | - o_shipping_price += good['uniform_exp_sum']; | ||
| 528 | - break; | ||
| 529 | - case 2: | ||
| 530 | - if (goods_weight < 0) goods_weight = 0; | ||
| 531 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 532 | - goods_weight += good['weight'] * good['buynum']; | ||
| 533 | - if (weight_free > 0) { | ||
| 534 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 535 | - } | ||
| 536 | - break; | ||
| 537 | - case 3: | ||
| 538 | - if (goods_piece < 0) goods_piece = 0; | ||
| 539 | - //累积商品数量 | ||
| 540 | - goods_piece += good['buynum']; | ||
| 541 | - break; | ||
| 542 | - } | ||
| 543 | 522 | ||
| 544 | - console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece); | ||
| 545 | - console.log(th.data.wu_arr); | ||
| 546 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 547 | - var no_by_data = null; | 523 | + var user_addr=th.data.user_addr; | 
| 524 | + var req_d = { | ||
| 525 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 526 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 527 | + } | ||
| 528 | + var back_data = null; | ||
| 529 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 530 | + is_json: 1, data: req_d | ||
| 531 | + }).then(rs => { | ||
| 532 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 533 | + }); | ||
| 534 | + | ||
| 535 | + var gd_arr_list = []; | ||
| 536 | + gd_arr_list.push(good); | ||
| 537 | + var cut_good_weight = 0; | ||
| 538 | + for (let i in gd_arr_list) { | ||
| 539 | + let item = gd_arr_list[i]; | ||
| 540 | + | ||
| 541 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 542 | + | ||
| 543 | + | ||
| 544 | + if (item['exp_sum_type'] == 2) { | ||
| 545 | + goods_weight += item['weight'] * item['buynum']; | ||
| 546 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 547 | + } | ||
| 548 | + if (back_data.weight_free > 0) { | ||
| 549 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 550 | + } | ||
| 551 | + continue; | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + switch (item['exp_sum_type']) { | ||
| 555 | + case 1: | ||
| 556 | + //统一运费 | ||
| 557 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 558 | + break; | ||
| 559 | + case 2: | ||
| 560 | + if (goods_weight < 0) goods_weight = 0; | ||
| 561 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 562 | + goods_weight += item['weight'] * item['buynum']; | ||
| 563 | + | ||
| 564 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 565 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 566 | + if (back_data.weight_free > 0) { | ||
| 567 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 568 | + } | ||
| 569 | + } | ||
| 570 | + break; | ||
| 571 | + case 3: | ||
| 572 | + if (goods_piece < 0) goods_piece = 0; | ||
| 573 | + //累积商品数量 | ||
| 574 | + goods_piece += item['buynum']; | ||
| 575 | + break; | ||
| 576 | + } | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + //如果是正值的时候 | ||
| 580 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 581 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 582 | + | ||
| 548 | var code = th.data.wu_arr[th.data.index].code; | 583 | var code = th.data.wu_arr[th.data.index].code; | 
| 549 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 550 | - | ||
| 551 | - //有不包邮区域,且不免运费 | ||
| 552 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) { | ||
| 553 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 554 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 555 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 556 | - }).then(res => { | ||
| 557 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 558 | - no_by_data = res.data.data[0]; | ||
| 559 | - //如果有设置不包邮区域的时候 | ||
| 560 | - if (res.data.data[0].region_list) { | ||
| 561 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 562 | - freight_free = 0; | ||
| 563 | - // out_of_weight = 0; | ||
| 564 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 565 | - } | ||
| 566 | - } | ||
| 567 | - //如果有设置不包邮商品 | ||
| 568 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 569 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 570 | - freight_free = 0; | ||
| 571 | - // out_of_weight = 0; | ||
| 572 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 573 | - } | ||
| 574 | - } | ||
| 575 | - } | ||
| 576 | - }) | ||
| 577 | - } | ||
| 578 | var shipping_price = | 584 | var shipping_price = | 
| 579 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 580 | - goods_piece, th.data.user_addr, freight_free, allpice, rs,th.data.bn_pick); | 585 | + ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | 
| 586 | + goods_piece, th.data.user_addr, back_data,rs); | ||
| 581 | 587 | ||
| 582 | shipping_price = parseFloat(shipping_price).toFixed(2); | 588 | shipping_price = parseFloat(shipping_price).toFixed(2); | 
| 583 | var wl_txt = "formData.shipping_price"; | 589 | var wl_txt = "formData.shipping_price"; | 
| @@ -628,7 +634,7 @@ Page({ | @@ -628,7 +634,7 @@ Page({ | ||
| 628 | } | 634 | } | 
| 629 | 635 | ||
| 630 | }); | 636 | }); | 
| 631 | - }); | 637 | + | 
| 632 | }, | 638 | }, | 
| 633 | 639 | ||
| 634 | 640 | 
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml
| @@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
| 40 | <view class="fs30" style="color:black;">选择门店</view> | 40 | <view class="fs30" style="color:black;">选择门店</view> | 
| 41 | </view> | 41 | </view> | 
| 42 | 42 | ||
| 43 | - <view class="red-co fs28" bindtap="choice_store" > | 43 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | 
| 44 | 更多门店 | 44 | 更多门店 | 
| 45 | <text class="right-arrow"></text> | 45 | <text class="right-arrow"></text> | 
| 46 | </view> | 46 | </view> | 
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | <view class="fs30" style="color:black;">选择门店</view> | 42 | <view class="fs30" style="color:black;">选择门店</view> | 
| 43 | </view> | 43 | </view> | 
| 44 | 44 | ||
| 45 | - <view class="red-co fs28" bindtap="choice_store" > | 45 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | 
| 46 | 更多门店 | 46 | 更多门店 | 
| 47 | <text class="right-arrow"></text> | 47 | <text class="right-arrow"></text> | 
| 48 | </view> | 48 | </view> | 
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | <view class="fs28 xc-ash-9f">选择门店</view> | 64 | <view class="fs28 xc-ash-9f">选择门店</view> | 
| 65 | </view> | 65 | </view> | 
| 66 | 66 | ||
| 67 | - <view class="red-co fs28" bindtap="choice_store" > | 67 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | 
| 68 | 更多门店 | 68 | 更多门店 | 
| 69 | <text class="right-arrow"></text> | 69 | <text class="right-arrow"></text> | 
| 70 | </view> | 70 | </view> | 
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| @@ -474,6 +474,8 @@ Page({ | @@ -474,6 +474,8 @@ Page({ | ||
| 474 | th.data.fir_def_store = {}; //赋值空对象 | 474 | th.data.fir_def_store = {}; //赋值空对象 | 
| 475 | return false; | 475 | return false; | 
| 476 | } | 476 | } | 
| 477 | + | ||
| 478 | + th.setData({has_def:1}) | ||
| 477 | var ee = JSON.parse(JSON.stringify(e)); | 479 | var ee = JSON.parse(JSON.stringify(e)); | 
| 478 | //--定时器推迟一下-- | 480 | //--定时器推迟一下-- | 
| 479 | setTimeout(function () { | 481 | setTimeout(function () { | 
| @@ -1825,7 +1827,9 @@ Page({ | @@ -1825,7 +1827,9 @@ Page({ | ||
| 1825 | 1827 | ||
| 1826 | // console.log('11111111111111111111111111======》'); | 1828 | // console.log('11111111111111111111111111======》'); | 
| 1827 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); | 1829 | // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); | 
| 1828 | - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | 1830 | + //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id + "&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); | 
| 1831 | + | ||
| 1832 | + getApp().goto("/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) | ||
| 1829 | 1833 | ||
| 1830 | }) | 1834 | }) | 
| 1831 | } else { | 1835 | } else { | 
| @@ -2064,8 +2068,6 @@ Page({ | @@ -2064,8 +2068,6 @@ Page({ | ||
| 2064 | return false; | 2068 | return false; | 
| 2065 | } | 2069 | } | 
| 2066 | 2070 | ||
| 2067 | - | ||
| 2068 | - | ||
| 2069 | if (th.data.more_flash && open_store == 1) { | 2071 | if (th.data.more_flash && open_store == 1) { | 
| 2070 | th.setData({ is_pop_more: 1 }); | 2072 | th.setData({ is_pop_more: 1 }); | 
| 2071 | } else { | 2073 | } else { | 
| @@ -3877,6 +3879,8 @@ Page({ | @@ -3877,6 +3879,8 @@ Page({ | ||
| 3877 | // ind == 1 为普通购买 | 3879 | // ind == 1 为普通购买 | 
| 3878 | openSpecModel_pt: function (e) { | 3880 | openSpecModel_pt: function (e) { | 
| 3879 | 3881 | ||
| 3882 | + | ||
| 3883 | + | ||
| 3880 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); | 3884 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); | 
| 3881 | // 判断是否有待支付订单 | 3885 | // 判断是否有待支付订单 | 
| 3882 | var aid = this.data.group_id; | 3886 | var aid = this.data.group_id; | 
| @@ -3919,7 +3923,6 @@ Page({ | @@ -3919,7 +3923,6 @@ Page({ | ||
| 3919 | var th = this; | 3923 | var th = this; | 
| 3920 | var ind = parseInt(e.currentTarget.dataset.ind); | 3924 | var ind = parseInt(e.currentTarget.dataset.ind); | 
| 3921 | 3925 | ||
| 3922 | - console.log('当前ind========>>>>', ind); | ||
| 3923 | 3926 | ||
| 3924 | //ind == 1是普通购买 | 3927 | //ind == 1是普通购买 | 
| 3925 | if (ind == 1) { | 3928 | if (ind == 1) { | 
| @@ -5433,7 +5436,13 @@ Page({ | @@ -5433,7 +5436,13 @@ Page({ | ||
| 5433 | var ind = ee.currentTarget.dataset.ind; | 5436 | var ind = ee.currentTarget.dataset.ind; | 
| 5434 | var bconfig = th.data.bconfig; | 5437 | var bconfig = th.data.bconfig; | 
| 5435 | 5438 | ||
| 5436 | - if (!th.data.only_pk && !th.data.def_pickpu_list) { | 5439 | + //如果开启了,则不在选择门店 | 
| 5440 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 5441 | + return false; | ||
| 5442 | + } | ||
| 5443 | + | ||
| 5444 | + | ||
| 5445 | + if (!th.data.only_pk && !th.data.def_pickpu_list) { | ||
| 5437 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 5446 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 5438 | return false; | 5447 | return false; | 
| 5439 | } | 5448 | } | 
| @@ -5449,6 +5458,7 @@ Page({ | @@ -5449,6 +5458,7 @@ Page({ | ||
| 5449 | } | 5458 | } | 
| 5450 | 5459 | ||
| 5451 | 5460 | ||
| 5461 | + | ||
| 5452 | if (bconfig && bconfig.is_sort_storage) { | 5462 | if (bconfig && bconfig.is_sort_storage) { | 
| 5453 | wx.getLocation({ | 5463 | wx.getLocation({ | 
| 5454 | type: 'gcj02', | 5464 | type: 'gcj02', | 
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
| @@ -406,7 +406,7 @@ | @@ -406,7 +406,7 @@ | ||
| 406 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 406 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 407 | <view class="fs30" style="color:black;">选择门店</view> | 407 | <view class="fs30" style="color:black;">选择门店</view> | 
| 408 | </view> | 408 | </view> | 
| 409 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 409 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 
| 410 | </view> | 410 | </view> | 
| 411 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 411 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 
| 412 | <view class="flex-space-between address ai_end pdv10"> | 412 | <view class="flex-space-between address ai_end pdv10"> | 
| @@ -1115,7 +1115,7 @@ | @@ -1115,7 +1115,7 @@ | ||
| 1115 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 1115 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 1116 | <view class="fs30" style="color:black;">选择门店</view> | 1116 | <view class="fs30" style="color:black;">选择门店</view> | 
| 1117 | </view> | 1117 | </view> | 
| 1118 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 1118 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 1119 | </view> | 1119 | </view> | 
| 1120 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 1120 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 1121 | <block wx:else> | 1121 | <block wx:else> | 
packageC/pages/presell/cart/cart.js
| 1 | +//这个页面是付尾款 | ||
| 1 | var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | 2 | var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | 
| 2 | s = require("../../../../utils/util.js"), ut = s, o = require("../../../../utils/md5.js"), to = getApp(); | 3 | s = require("../../../../utils/util.js"), ut = s, o = require("../../../../utils/md5.js"), to = getApp(); | 
| 3 | var oo = t.globalData.setting, os = oo; | 4 | var oo = t.globalData.setting, os = oo; | 
| @@ -1717,33 +1718,21 @@ Page({ | @@ -1717,33 +1718,21 @@ Page({ | ||
| 1717 | //----计算物流的钱---- | 1718 | //----计算物流的钱---- | 
| 1718 | calculate_wuliu() { | 1719 | calculate_wuliu() { | 
| 1719 | var to = getApp(), th = this; | 1720 | var to = getApp(), th = this; | 
| 1720 | - to.getConfig2(function (ee) { | ||
| 1721 | - to.getwuliuprice(async function (rs) { | 1721 | + to.getwuliuprice(async function (rs) { | 
| 1722 | var o_shipping_price = 0, | 1722 | var o_shipping_price = 0, | 
| 1723 | goods_weight = -1, | 1723 | goods_weight = -1, | 
| 1724 | goods_piece = -1, | 1724 | goods_piece = -1, | 
| 1725 | good = th.data.goods, | 1725 | good = th.data.goods, | 
| 1726 | quan_price = 0, | 1726 | quan_price = 0, | 
| 1727 | exp_price = 0; | 1727 | exp_price = 0; | 
| 1728 | - var no_ex_id = ee.no_ex_id; | 1728 | + | 
| 1729 | var quan_no = null; | 1729 | var quan_no = null; | 
| 1730 | var bn_pick = th.data.pickup.pickup_id; | 1730 | var bn_pick = th.data.pickup.pickup_id; | 
| 1731 | var allpice = th.data.all_price; | 1731 | var allpice = th.data.all_price; | 
| 1732 | var out_of_weight = null; //超出多少重量 | 1732 | var out_of_weight = null; //超出多少重量 | 
| 1733 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 1734 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 1735 | - var no_ex_good = null; | ||
| 1736 | - var by_qc = {}; | ||
| 1737 | - if (no_ex_id && freight_free > 0) { | ||
| 1738 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 1739 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 1740 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 1741 | - }).then(res => { | ||
| 1742 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 1743 | - by_qc = res.data.data[0]; | ||
| 1744 | - } | ||
| 1745 | - }) | ||
| 1746 | - }; | 1733 | + | 
| 1734 | + good.buynum=th.data.order.order_goods.goods_num; | ||
| 1735 | + | ||
| 1747 | if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | 1736 | if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | 
| 1748 | quan_no = th.data.using_quan[bn_pick].coupon_no; | 1737 | quan_no = th.data.using_quan[bn_pick].coupon_no; | 
| 1749 | 1738 | ||
| @@ -1814,59 +1803,73 @@ Page({ | @@ -1814,59 +1803,73 @@ Page({ | ||
| 1814 | if (quan_no && th.data.using_quan[bn_pick].isby == 1) { | 1803 | if (quan_no && th.data.using_quan[bn_pick].isby == 1) { | 
| 1815 | exp_price = 0; | 1804 | exp_price = 0; | 
| 1816 | } else { | 1805 | } else { | 
| 1817 | - switch (good['exp_sum_type']) { | ||
| 1818 | - case 1: | ||
| 1819 | - //统一运费 | ||
| 1820 | - o_shipping_price += good['uniform_exp_sum']; | ||
| 1821 | - break; | ||
| 1822 | - case 2: | ||
| 1823 | - if (goods_weight < 0) goods_weight = 0; | ||
| 1824 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 1825 | - goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; | ||
| 1826 | - if (weight_free > 0) { | ||
| 1827 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 1828 | - } | ||
| 1829 | - break; | ||
| 1830 | - case 3: | ||
| 1831 | - if (goods_piece < 0) goods_piece = 0; | ||
| 1832 | - //累积商品数量 | ||
| 1833 | - goods_piece += th.data.order.order_goods['goods_num']; | ||
| 1834 | - break; | 1806 | + var user_addr=th.data.user_addr; | 
| 1807 | + var req_d = { | ||
| 1808 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 1809 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 1835 | } | 1810 | } | 
| 1811 | + var back_data = null; | ||
| 1812 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 1813 | + is_json: 1, data: req_d | ||
| 1814 | + }).then(rs => { | ||
| 1815 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 1816 | + }); | ||
| 1817 | + | ||
| 1818 | + var gd_arr_list = []; | ||
| 1819 | + gd_arr_list.push(good); | ||
| 1820 | + | ||
| 1821 | + var cut_good_weight = 0; | ||
| 1822 | + for (let i in gd_arr_list) { | ||
| 1823 | + let item = gd_arr_list[i]; | ||
| 1824 | + | ||
| 1825 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 1826 | + if (item['exp_sum_type'] == 2) { | ||
| 1827 | + goods_weight += item['weight'] * item['buynum']; | ||
| 1828 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 1829 | + } | ||
| 1830 | + if (back_data.weight_free > 0) { | ||
| 1831 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 1832 | + } | ||
| 1833 | + continue; | ||
| 1834 | + } | ||
| 1836 | 1835 | ||
| 1837 | - var code = th.data.wu_arr[th.data.index].code; | ||
| 1838 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 1839 | - var no_by_data = null; | ||
| 1840 | - //有不包邮区域,且不免运费 | ||
| 1841 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) { | ||
| 1842 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 1843 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 1844 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 1845 | - }).then(res => { | ||
| 1846 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 1847 | - no_by_data = res.data.data[0]; | ||
| 1848 | - //如果有设置不包邮区域的时候 | ||
| 1849 | - if (res.data.data[0].region_list) { | ||
| 1850 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 1851 | - freight_free = 0; | ||
| 1852 | - // out_of_weight = 0; | ||
| 1853 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 1854 | - } | ||
| 1855 | - } | ||
| 1856 | - //如果有设置不包邮商品 | ||
| 1857 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 1858 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 1859 | - freight_free = 0; | ||
| 1860 | - // out_of_weight = 0; | ||
| 1861 | - th.data.is_no_by[th.data.bn_pick] = 1; | 1836 | + switch (item['exp_sum_type']) { | 
| 1837 | + case 1: | ||
| 1838 | + //统一运费 | ||
| 1839 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 1840 | + break; | ||
| 1841 | + case 2: | ||
| 1842 | + if (goods_weight < 0) goods_weight = 0; | ||
| 1843 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 1844 | + goods_weight += item['weight'] * item['buynum']; | ||
| 1845 | + | ||
| 1846 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 1847 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 1848 | + if (back_data.weight_free > 0) { | ||
| 1849 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 1862 | } | 1850 | } | 
| 1863 | } | 1851 | } | 
| 1864 | - } | ||
| 1865 | - }) | 1852 | + break; | 
| 1853 | + case 3: | ||
| 1854 | + if (goods_piece < 0) goods_piece = 0; | ||
| 1855 | + //累积商品数量 | ||
| 1856 | + goods_piece += item['buynum']; | ||
| 1857 | + break; | ||
| 1858 | + } | ||
| 1866 | } | 1859 | } | 
| 1867 | - var shipping_price = | ||
| 1868 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1869 | - goods_piece, th.data.user_addr, freight_free, allpice, rs,th.data.bn_pick); | 1860 | + | 
| 1861 | + //如果是正值的时候 | ||
| 1862 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 1863 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 1864 | + | ||
| 1865 | + | ||
| 1866 | + var code = th.data.wu_arr[th.data.index].code; | ||
| 1867 | + th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 1868 | + | ||
| 1869 | + //--------------开始计算物流------------------ | ||
| 1870 | + var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1871 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 1872 | + | ||
| 1870 | exp_price = parseFloat(shipping_price).toFixed(2); | 1873 | exp_price = parseFloat(shipping_price).toFixed(2); | 
| 1871 | } | 1874 | } | 
| 1872 | th.wuliu_next(allpice, quan_price, exp_price); | 1875 | th.wuliu_next(allpice, quan_price, exp_price); | 
| @@ -1874,7 +1877,6 @@ Page({ | @@ -1874,7 +1877,6 @@ Page({ | ||
| 1874 | th.wuliu_next(allpice, quan_price, exp_price); | 1877 | th.wuliu_next(allpice, quan_price, exp_price); | 
| 1875 | } | 1878 | } | 
| 1876 | }); | 1879 | }); | 
| 1877 | - }); | ||
| 1878 | }, | 1880 | }, | 
| 1879 | //相同的东西统一在一起 | 1881 | //相同的东西统一在一起 | 
| 1880 | wuliu_next(allpice, quan_price, exp_price) { | 1882 | wuliu_next(allpice, quan_price, exp_price) { | 
packageC/pages/presell/cart/cart2.js
| 1 | +//预售全款 | ||
| 1 | var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | 2 | var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | 
| 2 | s = require("../../../../utils/util.js"), ut = s, to = getApp(); | 3 | s = require("../../../../utils/util.js"), ut = s, to = getApp(); | 
| 3 | var oo = t.globalData.setting, os = oo; | 4 | var oo = t.globalData.setting, os = oo; | 
| @@ -613,9 +614,7 @@ Page({ | @@ -613,9 +614,7 @@ Page({ | ||
| 613 | 614 | ||
| 614 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 615 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 
| 615 | var out_of_weight = null; //超出多少重量 | 616 | var out_of_weight = null; //超出多少重量 | 
| 616 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 617 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 618 | - var no_ex_id = ee.no_ex_id; | 617 | + | 
| 619 | //---如果有选择优惠券的情况下--- | 618 | //---如果有选择优惠券的情况下--- | 
| 620 | var quan_price = 0, bn_pick = th.data.bn_pick; | 619 | var quan_price = 0, bn_pick = th.data.bn_pick; | 
| 621 | var quan_no = null; | 620 | var quan_no = null; | 
| @@ -673,83 +672,90 @@ Page({ | @@ -673,83 +672,90 @@ Page({ | ||
| 673 | }) | 672 | }) | 
| 674 | } | 673 | } | 
| 675 | 674 | ||
| 676 | - switch (good['exp_sum_type']) { | ||
| 677 | - case 1: | ||
| 678 | - //统一运费 | ||
| 679 | - o_shipping_price += good['uniform_exp_sum']; | ||
| 680 | - break; | ||
| 681 | - case 2: | ||
| 682 | - if (goods_weight < 0) goods_weight = 0; | ||
| 683 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 684 | - goods_weight += good['weight'] * good['buynum']; | ||
| 685 | - if (weight_free > 0) { | ||
| 686 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 687 | - } | ||
| 688 | - break; | ||
| 689 | - case 3: | ||
| 690 | - if (goods_piece < 0) goods_piece = 0; | ||
| 691 | - //累积商品数量 | ||
| 692 | - goods_piece += good['buynum']; | ||
| 693 | - break; | ||
| 694 | - } | ||
| 695 | - | ||
| 696 | - var code = ""; | ||
| 697 | - if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | 675 | + var shipping_price =0; | 
| 676 | + //-- 在没有使用包邮券的时候 -- | ||
| 677 | + if(!quan_no || !th.data.using_quan[bn_pick].isby) { | ||
| 698 | 678 | ||
| 699 | - th.data.is_no_by[th.data.bn_pick] = 0; | 679 | + var gd_arr_list = []; | 
| 680 | + gd_arr_list.push(good); | ||
| 681 | + if (th.data.buy_now_gift_goods) { | ||
| 682 | + gd_arr_list = [...gd_arr_list, ...th.data.buy_now_gift_goods]; | ||
| 683 | + } | ||
| 700 | 684 | ||
| 701 | - var no_by_data = null; | ||
| 702 | - var gift_freight_free = freight_free; | 685 | + var user_addr=th.data.user_addr; | 
| 686 | + var req_d = { | ||
| 687 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 688 | + wuliu: parseFloat(parseFloat(allpice) - cut_price - quan_price).toFixed(2), store_id: os.stoid | ||
| 689 | + } | ||
| 690 | + var back_data = null; | ||
| 691 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 692 | + is_json: 1, data: req_d | ||
| 693 | + }).then(rs => { | ||
| 694 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 695 | + }); | ||
| 703 | 696 | ||
| 704 | - //有不包邮区域,且不免运费 | ||
| 705 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { | ||
| 706 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 707 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 708 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 709 | - }).then(res => { | ||
| 710 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 711 | - no_by_data = res.data.data[0]; | ||
| 712 | - //如果有设置不包邮区域的时候 | ||
| 713 | - if (res.data.data[0].region_list) { | ||
| 714 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 715 | - freight_free = 0; | ||
| 716 | - // out_of_weight = 0; | ||
| 717 | - // weight_free=-1; | ||
| 718 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 719 | - } | 697 | + var cut_good_weight = 0; | 
| 698 | + for (let i in gd_arr_list) { | ||
| 699 | + let item = gd_arr_list[i]; | ||
| 700 | + | ||
| 701 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 702 | + if (item['exp_sum_type'] == 2) { | ||
| 703 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 704 | + goods_weight += item['weight'] * item['buynum']; | ||
| 720 | } | 705 | } | 
| 721 | - //如果有设置不包邮商品 | ||
| 722 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 723 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 724 | - freight_free = 0; | ||
| 725 | - // out_of_weight = 0; | ||
| 726 | - // weight_free=-1; | ||
| 727 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 728 | - } | 706 | + if (back_data.weight_free > 0) { | 
| 707 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 729 | } | 708 | } | 
| 709 | + continue; | ||
| 730 | } | 710 | } | 
| 731 | - }) | ||
| 732 | - } | ||
| 733 | 711 | ||
| 734 | - th.data.is_by[th.data.bn_pick] = 0; | ||
| 735 | - //--------------开始计算物流------------------ | ||
| 736 | - var shipping_price = | ||
| 737 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 738 | - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs,th.data.bn_pick); | 712 | + switch (item['exp_sum_type']) { | 
| 713 | + case 1: | ||
| 714 | + //统一运费 | ||
| 715 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 716 | + break; | ||
| 717 | + case 2: | ||
| 718 | + if (goods_weight < 0) goods_weight = 0; | ||
| 719 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 720 | + goods_weight += item['weight'] * item['buynum']; | ||
| 721 | + | ||
| 722 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 723 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 724 | + if (back_data.weight_free > 0) { | ||
| 725 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 726 | + } | ||
| 727 | + } | ||
| 728 | + break; | ||
| 729 | + case 3: | ||
| 730 | + if (goods_piece < 0) goods_piece = 0; | ||
| 731 | + //累积商品数量 | ||
| 732 | + goods_piece += item['buynum']; | ||
| 733 | + break; | ||
| 734 | + } | ||
| 735 | + } | ||
| 739 | 736 | ||
| 740 | - //如果有赠品的时候,也要计算赠品的物流费用 | ||
| 741 | - if (th.data.buy_now_gift_goods) { | ||
| 742 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, gift_weight_free, | ||
| 743 | - parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece,th.data.bn_pick); | ||
| 744 | - } | 737 | + //如果是正值的时候 | 
| 738 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 739 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 740 | + | ||
| 741 | + | ||
| 742 | + var code = ""; | ||
| 743 | + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | ||
| 745 | 744 | ||
| 746 | - if (shipping_price <= 0) { | ||
| 747 | - th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | 745 | + //--------------开始计算物流------------------ | 
| 746 | + var shipping_price = | ||
| 747 | + ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 748 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 749 | + | ||
| 750 | + | ||
| 751 | + if (shipping_price <= 0) { | ||
| 752 | + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | ||
| 753 | + } | ||
| 748 | } | 754 | } | 
| 749 | 755 | ||
| 750 | shipping_price = parseFloat(shipping_price).toFixed(2); | 756 | shipping_price = parseFloat(shipping_price).toFixed(2); | 
| 751 | var wl_txt = "formData.shipping_price"; | 757 | var wl_txt = "formData.shipping_price"; | 
| 752 | - th.setData({ [wl_txt]: shipping_price, }) | 758 | + th.setData({[wl_txt]: shipping_price,}) | 
| 753 | 759 | ||
| 754 | } else { | 760 | } else { | 
| 755 | var wl_txt = "formData.shipping_price"; | 761 | var wl_txt = "formData.shipping_price"; | 
| @@ -1682,79 +1688,6 @@ Page({ | @@ -1682,79 +1688,6 @@ Page({ | ||
| 1682 | th.setData({ js_use_money: !th.data.js_use_money }); | 1688 | th.setData({ js_use_money: !th.data.js_use_money }); | 
| 1683 | th.calculatePrice(); | 1689 | th.calculatePrice(); | 
| 1684 | }, | 1690 | }, | 
| 1685 | - //-------------------计算物流--------------- | ||
| 1686 | - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1687 | - goods_piece, user_addr, freight_free, o_price, rs,pickid) { | ||
| 1688 | - var price = 0, th = this; | ||
| 1689 | - price += parseFloat(o_shipping_price); | ||
| 1690 | - //如果是包邮 | ||
| 1691 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { | ||
| 1692 | - return 0; | ||
| 1693 | - } | ||
| 1694 | - if (user_addr == null) { | ||
| 1695 | - return 0; | ||
| 1696 | - } | ||
| 1697 | - //计算物流的config item; | ||
| 1698 | - var item = null; | ||
| 1699 | - //先根据 镇 县 区找计算的config | ||
| 1700 | - item = th.get_wuliu_config(user_addr.district, code, rs); | ||
| 1701 | - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | ||
| 1702 | - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | ||
| 1703 | - if (item == null) item = th.get_wuliu_default(code, rs); | ||
| 1704 | - if (item == null) return o_shipping_price; | ||
| 1705 | - var fw_price = 0, fp_price = 0; | ||
| 1706 | - item = item.config; | ||
| 1707 | - if (item == null) return o_shipping_price; | ||
| 1708 | - //------按重量---------- | ||
| 1709 | - if (goods_weight >= 0 && item['money']) { | ||
| 1710 | - fw_price = parseFloat(item['money']); | ||
| 1711 | - if (goods_weight > item['first_weight']) { | ||
| 1712 | - var fw = goods_weight - item['first_weight']; | ||
| 1713 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 1714 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 1715 | - } | ||
| 1716 | - } | ||
| 1717 | - | ||
| 1718 | - //------超出重量---------- | ||
| 1719 | - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | ||
| 1720 | - fw_price = parseFloat(item['money']); | ||
| 1721 | - var out_of_weight = Math.abs(out_of_weight); | ||
| 1722 | - var n = Math.ceil(out_of_weight / item['second_weight']) | ||
| 1723 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 1724 | - } | ||
| 1725 | - //------按件数---------- | ||
| 1726 | - if (goods_piece > 0 && item['piecemoney']) { | ||
| 1727 | - fp_price = parseFloat(item['piecemoney']); | ||
| 1728 | - if (goods_piece > item['first_piece']) { | ||
| 1729 | - var fp = goods_piece - item['first_piece']; | ||
| 1730 | - var m = Math.ceil(fp / item['second_piece']) | ||
| 1731 | - fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 1732 | - } | ||
| 1733 | - } | ||
| 1734 | - var rspice = parseFloat(price + fw_price + fp_price); | ||
| 1735 | - return rspice; | ||
| 1736 | - }, | ||
| 1737 | - | ||
| 1738 | - //------------循环获取config----------- | ||
| 1739 | - get_wuliu_config: function (region_id, code, rs) { | ||
| 1740 | - var item = null, rslist = rs.pageData; | ||
| 1741 | - for (var i = 0; i < rslist.length; i++) { | ||
| 1742 | - if (rslist[i].code == code && rslist[i].region_id == region_id) { | ||
| 1743 | - item = rslist[i]; | ||
| 1744 | - } | ||
| 1745 | - } | ||
| 1746 | - return item; | ||
| 1747 | - }, | ||
| 1748 | - //-------循环获取config,code default------- | ||
| 1749 | - get_wuliu_default: function (code, rs) { | ||
| 1750 | - var item = null, rslist = rs.pageData; | ||
| 1751 | - for (var i = 0; i < rslist.length; i++) { | ||
| 1752 | - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { | ||
| 1753 | - item = rslist[i]; | ||
| 1754 | - } | ||
| 1755 | - } | ||
| 1756 | - return item; | ||
| 1757 | - }, | ||
| 1758 | 1691 | ||
| 1759 | //----------立即购买,选择物流------------- | 1692 | //----------立即购买,选择物流------------- | 
| 1760 | bindPickerChange: function (e) { | 1693 | bindPickerChange: function (e) { | 
| @@ -2552,62 +2485,6 @@ Page({ | @@ -2552,62 +2485,6 @@ Page({ | ||
| 2552 | } | 2485 | } | 
| 2553 | }, | 2486 | }, | 
| 2554 | 2487 | ||
| 2555 | - //计算立即购买赠品的物流费用 | ||
| 2556 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, gift_weight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1,pickid) { | ||
| 2557 | - var good = this.data.buy_now_gift_goods; | ||
| 2558 | - var goods_weight = -1, goods_piece = -1; | ||
| 2559 | - var gift_shipping_price = 0; | ||
| 2560 | - var th = this; | ||
| 2561 | - switch (good['exp_sum_type']) { | ||
| 2562 | - case 1: | ||
| 2563 | - //统一运费 | ||
| 2564 | - gift_shipping_price += good['uniform_exp_sum']; | ||
| 2565 | - gift_shipping_price += o_shipping_price; | ||
| 2566 | - break; | ||
| 2567 | - case 2: | ||
| 2568 | - if (goods_weight < 0) goods_weight = 0; | ||
| 2569 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 2570 | - goods_weight += good['weight'] * good['buynum']; | ||
| 2571 | - if (goods_weight1 > 0) { | ||
| 2572 | - out_of_weight = gift_weight_free - goods_weight; | ||
| 2573 | - //不能调换位置 下面goods_weight会变大 | ||
| 2574 | - goods_weight += goods_weight1; | ||
| 2575 | - } | ||
| 2576 | - break; | ||
| 2577 | - case 3: | ||
| 2578 | - if (goods_piece < 0) goods_piece = 0; | ||
| 2579 | - //累积商品数量 | ||
| 2580 | - goods_piece += good['buynum']; | ||
| 2581 | - if (goods_piece1) { | ||
| 2582 | - goods_piece += goods_piece1; | ||
| 2583 | - } | ||
| 2584 | - break; | ||
| 2585 | - } | ||
| 2586 | - | ||
| 2587 | - | ||
| 2588 | - //如果有设置不包邮区域的时候 | ||
| 2589 | - if (no_by_data && no_by_data.region_list) { | ||
| 2590 | - if (th.check_by_area(no_by_data.region_list)) { | ||
| 2591 | - gift_freight_free = 0; | ||
| 2592 | - // out_of_weight = 0; | ||
| 2593 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 2594 | - } | ||
| 2595 | - } | ||
| 2596 | - //如果有设置不包邮商品 | ||
| 2597 | - if (no_by_data && no_by_data.goods_list && gift_freight_free) { | ||
| 2598 | - if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { | ||
| 2599 | - gift_freight_free = 0; | ||
| 2600 | - // out_of_weight = 0; | ||
| 2601 | - th.data.is_no_by[th.data.bn_pick]=1; | ||
| 2602 | - } | ||
| 2603 | - } | ||
| 2604 | - | ||
| 2605 | - var t_shipping_price = | ||
| 2606 | - this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight, | ||
| 2607 | - goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick); | ||
| 2608 | - return t_shipping_price; | ||
| 2609 | - | ||
| 2610 | - }, | ||
| 2611 | 2488 | ||
| 2612 | //从优惠的映射中拿出商品从表的item | 2489 | //从优惠的映射中拿出商品从表的item | 
| 2613 | item_map_get_goods: function (goods_id, map) { | 2490 | item_map_get_goods: function (goods_id, map) { | 
packageC/pages/presell/cart/cart2_pre.js
| 1 | +//预付定金 | ||
| 1 | var t = getApp(), app = t, a = t.request, ut = require("../../../../utils/util.js"); | 2 | var t = getApp(), app = t, a = t.request, ut = require("../../../../utils/util.js"); | 
| 2 | var os = t.globalData.setting; | 3 | var os = t.globalData.setting; | 
| 3 | var regeneratorRuntime = require('../../../../utils/runtime.js'); | 4 | var regeneratorRuntime = require('../../../../utils/runtime.js'); | 
| @@ -340,34 +341,74 @@ Page({ | @@ -340,34 +341,74 @@ Page({ | ||
| 340 | th.setData({ [txt]: allpice, }); | 341 | th.setData({ [txt]: allpice, }); | 
| 341 | console.log(th.data.formData); | 342 | console.log(th.data.formData); | 
| 342 | 343 | ||
| 343 | - app.getConfig2(function (ee) { | ||
| 344 | - app.getwuliuprice(function (rs) { | 344 | + app.getwuliuprice(async function (rs) { | 
| 345 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 345 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 
| 346 | var out_of_weight = null; //超出多少重量 | 346 | var out_of_weight = null; //超出多少重量 | 
| 347 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 348 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 349 | - var no_ex_id = ee.no_ex_id; | 347 | + | 
| 350 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 348 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 
| 351 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 | 349 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 | 
| 352 | && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 350 | && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 
| 353 | - switch (good['exp_sum_type']) { | ||
| 354 | - case 1: | ||
| 355 | - //统一运费 | ||
| 356 | - o_shipping_price += good['uniform_exp_sum']; break; | ||
| 357 | - case 2: | ||
| 358 | - if (goods_weight < 0) goods_weight = 0; | ||
| 359 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 360 | - goods_weight += good['weight'] * good['buynum']; | ||
| 361 | - if (weight_free > 0) { | ||
| 362 | - out_of_weight = (weight_free * 1000) - goods_weight; | 351 | + | 
| 352 | + var user_addr=th.data.user_addr; | ||
| 353 | + var req_d = { | ||
| 354 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 355 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 356 | + } | ||
| 357 | + var back_data = null; | ||
| 358 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 359 | + is_json: 1, data: req_d | ||
| 360 | + }).then(rs => { | ||
| 361 | + if (rs.data.code == 0) back_data =rs.data.data; | ||
| 362 | + }); | ||
| 363 | + | ||
| 364 | + var gd_arr_list = []; | ||
| 365 | + gd_arr_list.push(good); | ||
| 366 | + var cut_good_weight = 0; | ||
| 367 | + for (let i in gd_arr_list) { | ||
| 368 | + let item = data[i]; | ||
| 369 | + | ||
| 370 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 371 | + if (item['exp_sum_type'] == 2) { | ||
| 372 | + goods_weight += item['weight'] * item['buynum']; | ||
| 373 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 363 | } | 374 | } | 
| 364 | - break; | ||
| 365 | - case 3: | ||
| 366 | - if (goods_piece < 0) goods_piece = 0; | ||
| 367 | - //累积商品数量 | ||
| 368 | - goods_piece += good['buynum']; break; | 375 | + if (back_data.weight_free > 0) { | 
| 376 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 377 | + } | ||
| 378 | + continue; | ||
| 379 | + | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + switch (item['exp_sum_type']) { | ||
| 383 | + case 1: | ||
| 384 | + //统一运费 | ||
| 385 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 386 | + break; | ||
| 387 | + case 2: | ||
| 388 | + if (goods_weight < 0) goods_weight = 0; | ||
| 389 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 390 | + goods_weight += item['weight'] * item['buynum']; | ||
| 391 | + | ||
| 392 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 393 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 394 | + if (back_data.weight_free > 0) { | ||
| 395 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 396 | + } | ||
| 397 | + } | ||
| 398 | + break; | ||
| 399 | + case 3: | ||
| 400 | + if (goods_piece < 0) goods_piece = 0; | ||
| 401 | + //累积商品数量 | ||
| 402 | + goods_piece += item['buynum']; | ||
| 403 | + break; | ||
| 404 | + } | ||
| 369 | } | 405 | } | 
| 370 | 406 | ||
| 407 | + //如果是正值的时候 | ||
| 408 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 409 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 410 | + | ||
| 411 | + | ||
| 371 | var code = th.data.wu_arr[th.data.index].code; | 412 | var code = th.data.wu_arr[th.data.index].code; | 
| 372 | var shipping_price = | 413 | var shipping_price = | 
| 373 | th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | 414 | th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | 
| @@ -405,7 +446,7 @@ Page({ | @@ -405,7 +446,7 @@ Page({ | ||
| 405 | } | 446 | } | 
| 406 | 447 | ||
| 407 | }); | 448 | }); | 
| 408 | - }); | 449 | + | 
| 409 | }, | 450 | }, | 
| 410 | 451 | ||
| 411 | // -- 支付的下一步 -- | 452 | // -- 支付的下一步 -- | 
packageC/pages/presell/goodsInfo/goodsInfo.js
| @@ -679,6 +679,8 @@ Page({ | @@ -679,6 +679,8 @@ Page({ | ||
| 679 | th.data.fir_def_store = {}; //赋值空对象 | 679 | th.data.fir_def_store = {}; //赋值空对象 | 
| 680 | return false; | 680 | return false; | 
| 681 | } | 681 | } | 
| 682 | + th.setData({has_def:1}) | ||
| 683 | + | ||
| 682 | var ee = JSON.parse(JSON.stringify(e)); | 684 | var ee = JSON.parse(JSON.stringify(e)); | 
| 683 | 685 | ||
| 684 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | 686 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | 
| @@ -3206,6 +3208,11 @@ Page({ | @@ -3206,6 +3208,11 @@ Page({ | ||
| 3206 | var ind = ee.currentTarget.dataset.ind; | 3208 | var ind = ee.currentTarget.dataset.ind; | 
| 3207 | var bconfig = th.data.bconfig; | 3209 | var bconfig = th.data.bconfig; | 
| 3208 | 3210 | ||
| 3211 | + //如果开启了,则不在选择门店 | ||
| 3212 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 3213 | + return false; | ||
| 3214 | + } | ||
| 3215 | + | ||
| 3209 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 3216 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 
| 3210 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 3217 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 3211 | return false; | 3218 | return false; | 
packageC/pages/presell/goodsInfo/goodsInfo.wxml
| @@ -154,7 +154,7 @@ | @@ -154,7 +154,7 @@ | ||
| 154 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 154 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 155 | <view class="fs30" style="color:black;">选择门店</view> | 155 | <view class="fs30" style="color:black;">选择门店</view> | 
| 156 | </view> | 156 | </view> | 
| 157 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 157 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 
| 158 | </view> | 158 | </view> | 
| 159 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 159 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 
| 160 | <view class="flex-space-between address ai_end pdv10"> | 160 | <view class="flex-space-between address ai_end pdv10"> | 
| @@ -602,7 +602,7 @@ | @@ -602,7 +602,7 @@ | ||
| 602 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 602 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 603 | <view class="fs30" style="color:black;">选择门店</view> | 603 | <view class="fs30" style="color:black;">选择门店</view> | 
| 604 | </view> | 604 | </view> | 
| 605 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 605 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 606 | </view> | 606 | </view> | 
| 607 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 607 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 608 | <block wx:else> | 608 | <block wx:else> | 
packageC/pages/presell/pregoodsInfo/goodsInfo.js
| @@ -675,6 +675,9 @@ Page({ | @@ -675,6 +675,9 @@ Page({ | ||
| 675 | th.data.fir_def_store = {}; //赋值空对象 | 675 | th.data.fir_def_store = {}; //赋值空对象 | 
| 676 | return false; | 676 | return false; | 
| 677 | } | 677 | } | 
| 678 | + | ||
| 679 | + th.setData({has_def:1}) | ||
| 680 | + | ||
| 678 | var ee = JSON.parse(JSON.stringify(e)); | 681 | var ee = JSON.parse(JSON.stringify(e)); | 
| 679 | 682 | ||
| 680 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | 683 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | 
| @@ -3174,6 +3177,11 @@ Page({ | @@ -3174,6 +3177,11 @@ Page({ | ||
| 3174 | var ind = ee.currentTarget.dataset.ind; | 3177 | var ind = ee.currentTarget.dataset.ind; | 
| 3175 | var bconfig = th.data.bconfig; | 3178 | var bconfig = th.data.bconfig; | 
| 3176 | 3179 | ||
| 3180 | + //如果开启了,则不在选择门店 | ||
| 3181 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 3182 | + return false; | ||
| 3183 | + } | ||
| 3184 | + | ||
| 3177 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 3185 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 
| 3178 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 3186 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 3179 | return false; | 3187 | return false; | 
packageC/pages/presell/pregoodsInfo/goodsInfo.wxml
| @@ -154,7 +154,7 @@ | @@ -154,7 +154,7 @@ | ||
| 154 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 154 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 155 | <view class="fs30" style="color:black;">选择门店</view> | 155 | <view class="fs30" style="color:black;">选择门店</view> | 
| 156 | </view> | 156 | </view> | 
| 157 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 157 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 
| 158 | </view> | 158 | </view> | 
| 159 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 159 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 
| 160 | <view class="flex-space-between address ai_end pdv10"> | 160 | <view class="flex-space-between address ai_end pdv10"> | 
| @@ -596,7 +596,7 @@ | @@ -596,7 +596,7 @@ | ||
| 596 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 596 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 597 | <view class="fs30" style="color:black;">选择门店</view> | 597 | <view class="fs30" style="color:black;">选择门店</view> | 
| 598 | </view> | 598 | </view> | 
| 599 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 599 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 600 | </view> | 600 | </view> | 
| 601 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 601 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 602 | <block wx:else> | 602 | <block wx:else> | 
pages/cart/cart2/cart2.js
| @@ -1457,8 +1457,7 @@ Page({ | @@ -1457,8 +1457,7 @@ Page({ | ||
| 1457 | //-------------------计算订单价格------------------- | 1457 | //-------------------计算订单价格------------------- | 
| 1458 | calculatePrice: function (t, s) { | 1458 | calculatePrice: function (t, s) { | 
| 1459 | var th = this; | 1459 | var th = this; | 
| 1460 | - to.getConfig2(function (ee) { | ||
| 1461 | - to.getwuliuprice(async function (rs) { | 1460 | + to.getwuliuprice(async function (rs) { | 
| 1462 | wx.showLoading({ title: "处理中." }) | 1461 | wx.showLoading({ title: "处理中." }) | 
| 1463 | //是不是区域包邮 | 1462 | //是不是区域包邮 | 
| 1464 | th.data.is_area_by = 0; | 1463 | th.data.is_area_by = 0; | 
| @@ -1480,24 +1479,7 @@ Page({ | @@ -1480,24 +1479,7 @@ Page({ | ||
| 1480 | var all_order_prom = 0; //所有的订单优惠 | 1479 | var all_order_prom = 0; //所有的订单优惠 | 
| 1481 | 1480 | ||
| 1482 | var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); | 1481 | var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); | 
| 1483 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 1484 | - var free1 = freight_free; | ||
| 1485 | - | ||
| 1486 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 1487 | - var no_ex_id = ee.no_ex_id; | ||
| 1488 | - var no_ex_good = null; | ||
| 1489 | - var by_qc = {}; | ||
| 1490 | var out_of_weight = 0; //超出多少重量 | 1482 | var out_of_weight = 0; //超出多少重量 | 
| 1491 | - if (no_ex_id && freight_free > 0) { | ||
| 1492 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 1493 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 1494 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 1495 | - }).then(res => { | ||
| 1496 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 1497 | - by_qc = res.data.data[0]; | ||
| 1498 | - } | ||
| 1499 | - }) | ||
| 1500 | - }; | ||
| 1501 | var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); | 1483 | var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); | 
| 1502 | 1484 | ||
| 1503 | if (th.data.cartlist && th.data.cartlist.length > 0) { | 1485 | if (th.data.cartlist && th.data.cartlist.length > 0) { | 
| @@ -1646,84 +1628,8 @@ Page({ | @@ -1646,84 +1628,8 @@ Page({ | ||
| 1646 | 1628 | ||
| 1647 | th.data.is_no_past = 1; //不包邮标识符 | 1629 | th.data.is_no_past = 1; //不包邮标识符 | 
| 1648 | 1630 | ||
| 1649 | - var no_ex_good_arr = null; | ||
| 1650 | - //--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额-- | ||
| 1651 | - if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) { | ||
| 1652 | - //如果有设置不包邮区域的时候 | ||
| 1653 | - if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { | ||
| 1654 | - if (th.check_by_area(by_qc.region_list)) { | ||
| 1655 | - freight_free = 0; | ||
| 1656 | - th.data.is_area_by = 1; | ||
| 1657 | - //goods_weight = -1; | ||
| 1658 | - //out_of_weight = 0; | ||
| 1659 | - th.data.is_no_by[pickid] = 1; | ||
| 1660 | - } | ||
| 1661 | - } | ||
| 1662 | - //如果有设置不包邮区商品 | ||
| 1663 | - if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { | ||
| 1664 | - freight_free = 0; | ||
| 1665 | - //goods_weight = -1; | ||
| 1666 | - //out_of_weight = 0; | ||
| 1667 | - //th.data.is_no_by[pickid] = 1; | ||
| 1668 | - no_ex_good = by_qc.goods_list; | ||
| 1669 | - if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); | ||
| 1670 | - } | ||
| 1671 | - } | ||
| 1672 | - | ||
| 1673 | - | ||
| 1674 | - | ||
| 1675 | - var is_in_no_ex_goods_arr = 0; | ||
| 1676 | - var by_g_weight = 0; | ||
| 1677 | - //--------循环计算商品总物流----------- | ||
| 1678 | - for (var jo = 0; jo < item.length; jo++) { | ||
| 1679 | - //----------------如果是选择了物流--------------------- | ||
| 1680 | - if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null) { | ||
| 1681 | - | ||
| 1682 | - //判断是否有设置限制重量包邮,先看商品有没有包邮 | ||
| 1683 | - if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '') == -1) { | ||
| 1684 | - if (!th.data.is_area_by) th.data.free1 = free1; | ||
| 1685 | - //此时是 模板里面没有不包邮商品列表或者是 该商品没有再不包邮商品列表礼包 | ||
| 1686 | - if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { | ||
| 1687 | - if (goods_weight < 0) goods_weight = 0; | ||
| 1688 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 1689 | - goods_weight += item[jo]['weight'] * item[jo]['goods_num']; | ||
| 1690 | - by_g_weight += item[jo]['weight'] * item[jo]['goods_num']; | ||
| 1691 | - | ||
| 1692 | - if (free1 > 0) { | ||
| 1693 | - if (weight_free > 0) { | ||
| 1694 | - out_of_weight = (weight_free * 1000) - by_g_weight; | ||
| 1695 | - } else { | ||
| 1696 | - out_of_weight = -by_g_weight; | ||
| 1697 | - } | ||
| 1698 | - } | ||
| 1699 | - | ||
| 1700 | - } | ||
| 1701 | - } | ||
| 1702 | - //这个是在不包邮列表礼包 | ||
| 1703 | - else if (no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1) { | ||
| 1704 | - is_in_no_ex_goods_arr = 1; | ||
| 1705 | - if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) { | ||
| 1706 | - if (goods_weight < 0) goods_weight = 0; | ||
| 1707 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 1708 | - goods_weight += item[jo]['weight'] * item[jo]['goods_num']; | ||
| 1709 | - } | ||
| 1710 | - | ||
| 1711 | - } | ||
| 1712 | - } | ||
| 1713 | - } | ||
| 1714 | - | ||
| 1715 | - if (free1 > 0) { | ||
| 1716 | - //当商品没有超出的时候 | ||
| 1717 | - if (out_of_weight >= 0) { | ||
| 1718 | - out_of_weight = -by_g_weight; | ||
| 1719 | - } else { | ||
| 1720 | - if (weight_free > 0) out_of_weight = -weight_free * 1000; | ||
| 1721 | - } | ||
| 1722 | - } | ||
| 1723 | - | ||
| 1724 | - //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮 | ||
| 1725 | - if (!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free = free1; | ||
| 1726 | - | 1631 | + var back_data = null; | 
| 1632 | + var quan_no_goods_arr=null; | ||
| 1727 | //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- | 1633 | //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额-- | 
| 1728 | if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) { | 1634 | if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) { | 
| 1729 | //看是不是有调用过包邮券 | 1635 | //看是不是有调用过包邮券 | 
| @@ -1768,104 +1674,118 @@ Page({ | @@ -1768,104 +1674,118 @@ Page({ | ||
| 1768 | } | 1674 | } | 
| 1769 | }) | 1675 | }) | 
| 1770 | } | 1676 | } | 
| 1677 | + | ||
| 1678 | + var user_addr=th.data.user_addr; | ||
| 1679 | + var req_d = { | ||
| 1680 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 1681 | + wuliu:parseFloat(o_price - quan_price).toFixed(2),store_id: os.stoid | ||
| 1682 | + } | ||
| 1683 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 1684 | + is_json: 1, data: req_d | ||
| 1685 | + }).then(rs => { | ||
| 1686 | + if (rs.data.code == 0) back_data =rs.data.data; | ||
| 1687 | + }); | ||
| 1688 | + | ||
| 1771 | } | 1689 | } | 
| 1772 | 1690 | ||
| 1691 | + | ||
| 1773 | //如果是包邮券的时候,要看看券的情况 | 1692 | //如果是包邮券的时候,要看看券的情况 | 
| 1774 | if (quan_no && th.data.using_quan[pickid].isby == 1) { | 1693 | if (quan_no && th.data.using_quan[pickid].isby == 1) { | 
| 1775 | var quan = th.data.using_quan[pickid]; | 1694 | var quan = th.data.using_quan[pickid]; | 
| 1776 | if (!quan.goods_list) { | 1695 | if (!quan.goods_list) { | 
| 1777 | th.data.is_quan_by[pickid] = 1; //专门给券的判断用的 | 1696 | th.data.is_quan_by[pickid] = 1; //专门给券的判断用的 | 
| 1778 | } else { | 1697 | } else { | 
| 1779 | - th.data.is_quan_by[pickid] = 0; | ||
| 1780 | - //看有没有模板的包邮 | ||
| 1781 | - if (no_ex_good) { | ||
| 1782 | - var arr = no_ex_good.split(","); | ||
| 1783 | - var arr2 = quan.goods_list.split(","); | ||
| 1784 | - if (ut.isContained(arr, arr2)) { | ||
| 1785 | - getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); | ||
| 1786 | - th.data.using_quan[pickid] = {}; | ||
| 1787 | - th.setData({ using_quan: th.data.using_quan }) | ||
| 1788 | - return false; | ||
| 1789 | - } | ||
| 1790 | - var n_arr = ut.mergeArray(arr, arr2); | ||
| 1791 | - no_ex_good = n_arr.join(","); | ||
| 1792 | - } else { | ||
| 1793 | - no_ex_good = quan.goods_list; | ||
| 1794 | - } | 1698 | + th.data.is_quan_by[pickid] = 0; | 
| 1699 | + quan_no_goods_arr = quan.goods_list.split(","); | ||
| 1700 | + | ||
| 1795 | } | 1701 | } | 
| 1796 | } else { | 1702 | } else { | 
| 1797 | th.data.is_quan_by[pickid] = 0; //专门给券的判断用的 | 1703 | th.data.is_quan_by[pickid] = 0; //专门给券的判断用的 | 
| 1798 | } | 1704 | } | 
| 1799 | 1705 | ||
| 1800 | - //--------循环计算总价----------- | ||
| 1801 | - for (var j = 0; j < item.length; j++) { | ||
| 1802 | - //如果都包邮,都没必要等级数量了 | ||
| 1803 | - if (th.data.is_quan_by[pickid]) continue; | ||
| 1804 | - //如果是优惠活动是包邮,就不用计算包邮的费用了 | ||
| 1805 | - if (item[j].is_past) continue; | ||
| 1806 | - //是不是不包邮的商品 | ||
| 1807 | - var is_good_no_by = 0; | ||
| 1808 | - if (no_ex_good) { | ||
| 1809 | - is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); | 1706 | + var cut_good_weight=0; | 
| 1707 | + //计算物流价格 | ||
| 1708 | + if (cart_item.exp_type == 0 && th.data.user_addr && !th.data.is_quan_by[pickid]) { | ||
| 1709 | + | ||
| 1710 | + //如果有包邮券的不包邮商品的时候 | ||
| 1711 | + if(quan_no_goods_arr) { | ||
| 1712 | + if (back_data && back_data.no_free_goods) { | ||
| 1713 | + back_data['is_by_all']=1; | ||
| 1714 | + var arr3 = back_data.no_free_goods.filter(item => { | ||
| 1715 | + return quan_no_goods_arr.includes(item) | ||
| 1716 | + }) | ||
| 1717 | + back_data.no_free_goods = null; | ||
| 1718 | + if (arr3.length) { | ||
| 1719 | + back_data.no_free_goods = arr3; | ||
| 1720 | + } | ||
| 1721 | + } | ||
| 1722 | + if (!back_data || !back_data.no_free_goods) { | ||
| 1723 | + if (!back_data) back_data={}; | ||
| 1724 | + back_data['is_by_all']=1; | ||
| 1725 | + back_data['no_free_goods']=quan_no_goods_arr; | ||
| 1726 | + } | ||
| 1810 | } | 1727 | } | 
| 1811 | 1728 | ||
| 1812 | - //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- | ||
| 1813 | - if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && !is_good_no_by) { | ||
| 1814 | - continue; | ||
| 1815 | - } | 1729 | + //--------循环计算总价----------- | 
| 1730 | + for (var j = 0; j < item.length; j++) { | ||
| 1816 | 1731 | ||
| 1817 | - //var no_ex_good_arr = null; | ||
| 1818 | - //if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); | ||
| 1819 | - //----------------如果是选择了物流--------------------- | ||
| 1820 | - if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0) { | ||
| 1821 | - //如果地址不为空 | ||
| 1822 | - if (th.data.user_addr != null) { | ||
| 1823 | - switch (item[j]['exp_sum_type']) { | ||
| 1824 | - case 1: | ||
| 1825 | - //统一运费 | ||
| 1826 | - o_shipping_price += item[j]['uniform_exp_sum']; | ||
| 1827 | - break; | ||
| 1828 | - case 3: | ||
| 1829 | - if (goods_piece < 0) goods_piece = 0; | ||
| 1830 | - //累积商品数量 | ||
| 1831 | - goods_piece += item[j]['goods_num']; | ||
| 1832 | - break; | 1732 | + //如果商品本身是包邮了 | 
| 1733 | + if(item[j].is_free_shipping == 1) continue; | ||
| 1734 | + //如果是优惠活动是包邮,就不用计算包邮的费用了 | ||
| 1735 | + if (item[j].is_past) continue; | ||
| 1736 | + //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- | ||
| 1737 | + if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && th.data.is_quan_by[pickid]) { | ||
| 1738 | + continue; | ||
| 1739 | + } | ||
| 1740 | + | ||
| 1741 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { | ||
| 1742 | + | ||
| 1743 | + if (item[j]['exp_sum_type'] == 2) { | ||
| 1744 | + cut_good_weight += item[j]['weight'] * item[j]['goods_num']; | ||
| 1745 | + goods_weight += item[j]['weight'] * item[j]['goods_num']; | ||
| 1833 | } | 1746 | } | 
| 1747 | + if (back_data.weight_free > 0) { | ||
| 1748 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 1749 | + } | ||
| 1750 | + continue; | ||
| 1751 | + | ||
| 1834 | } | 1752 | } | 
| 1835 | 1753 | ||
| 1754 | + switch (item[j]['exp_sum_type']) { | ||
| 1755 | + case 1: | ||
| 1756 | + //统一运费 | ||
| 1757 | + o_shipping_price += item[j]['uniform_exp_sum']; | ||
| 1758 | + break; | ||
| 1759 | + case 2: | ||
| 1760 | + if (goods_weight < 0) goods_weight = 0; | ||
| 1761 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 1762 | + goods_weight += item[j]['weight'] * item[j]['goods_num']; | ||
| 1836 | 1763 | ||
| 1837 | - if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') == -1) { | ||
| 1838 | - switch (item[j]['exp_sum_type']) { | ||
| 1839 | - case 1: | ||
| 1840 | - //统一运费 | ||
| 1841 | - th.data.cut_o_shipping_price += item[j]['uniform_exp_sum']; | ||
| 1842 | - break; | ||
| 1843 | - case 3: | ||
| 1844 | - //累积商品数量 | ||
| 1845 | - th.data.cut_goods_piece += item[j]['goods_num']; | ||
| 1846 | - break; | ||
| 1847 | - } | 1764 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | 
| 1765 | + cut_good_weight += item[j]['weight'] * item[j]['goods_num']; | ||
| 1766 | + if (back_data.weight_free > 0) { | ||
| 1767 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 1768 | + } | ||
| 1769 | + } | ||
| 1770 | + break; | ||
| 1771 | + case 3: | ||
| 1772 | + if (goods_piece < 0) goods_piece = 0; | ||
| 1773 | + //累积商品数量 | ||
| 1774 | + goods_piece += item[j]['goods_num']; | ||
| 1775 | + break; | ||
| 1848 | } | 1776 | } | 
| 1849 | 1777 | ||
| 1850 | - | ||
| 1851 | - } else { | ||
| 1852 | - /*-- | ||
| 1853 | - if(item[j]['exp_sum_type']==2 && out_of_weight!==0){ | ||
| 1854 | - goods_weight = -1; | ||
| 1855 | - out_of_weight = 0; | ||
| 1856 | - }--*/ | ||
| 1857 | } | 1778 | } | 
| 1858 | - } | ||
| 1859 | 1779 | ||
| 1860 | - //计算物流价格 | ||
| 1861 | - if (cart_item.exp_type == 0) { | ||
| 1862 | - //freight_free=0; //后面不在进行判断 | 1780 | + //如果是正值的时候 | 
| 1781 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 1782 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 1783 | + | ||
| 1863 | var code = ""; | 1784 | var code = ""; | 
| 1864 | if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) | 1785 | if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) | 
| 1865 | code = th.data.wu_arr[cart_item.wind].code; | 1786 | code = th.data.wu_arr[cart_item.wind].code; | 
| 1866 | cart_item.shipping_price = | 1787 | cart_item.shipping_price = | 
| 1867 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 1868 | - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs, pickid); | 1788 | + ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs); | 
| 1869 | 1789 | ||
| 1870 | if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { | 1790 | if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { | 
| 1871 | if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 | 1791 | if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 | 
| @@ -1875,7 +1795,6 @@ Page({ | @@ -1875,7 +1795,6 @@ Page({ | ||
| 1875 | } | 1795 | } | 
| 1876 | 1796 | ||
| 1877 | cart_item.shipping_price = cart_item.shipping_price.toFixed(2); | 1797 | cart_item.shipping_price = cart_item.shipping_price.toFixed(2); | 
| 1878 | - | ||
| 1879 | //总价计算,总价不包含运费 | 1798 | //总价计算,总价不包含运费 | 
| 1880 | cart_item.order_amount = (o_price - quan_price).toFixed(2); | 1799 | cart_item.order_amount = (o_price - quan_price).toFixed(2); | 
| 1881 | cart_item.total_amount = f_o_price.toFixed(2); | 1800 | cart_item.total_amount = f_o_price.toFixed(2); | 
| @@ -2017,7 +1936,6 @@ Page({ | @@ -2017,7 +1936,6 @@ Page({ | ||
| 2017 | wx.hideLoading(); | 1936 | wx.hideLoading(); | 
| 2018 | 1937 | ||
| 2019 | }); | 1938 | }); | 
| 2020 | - }); | ||
| 2021 | }, | 1939 | }, | 
| 2022 | 1940 | ||
| 2023 | set_can_num: function () { | 1941 | set_can_num: function () { | 
| @@ -2089,15 +2007,10 @@ Page({ | @@ -2089,15 +2007,10 @@ Page({ | ||
| 2089 | allpice = good.offline_price * good.buynum; | 2007 | allpice = good.offline_price * good.buynum; | 
| 2090 | } | 2008 | } | 
| 2091 | 2009 | ||
| 2092 | - | ||
| 2093 | - to.getConfig2(function (ee) { | ||
| 2094 | - to.getwuliuprice(async function (rs) { | 2010 | + to.getwuliuprice(async function (rs) { | 
| 2095 | 2011 | ||
| 2096 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 2012 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 
| 2097 | var out_of_weight = null; //超出多少重量 | 2013 | var out_of_weight = null; //超出多少重量 | 
| 2098 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 2099 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 2100 | - var no_ex_id = ee.no_ex_id; | ||
| 2101 | 2014 | ||
| 2102 | //---如果有选择优惠券的情况下--- | 2015 | //---如果有选择优惠券的情况下--- | 
| 2103 | var quan_price = 0, bn_pick = th.data.bn_pick; | 2016 | var quan_price = 0, bn_pick = th.data.bn_pick; | 
| @@ -2123,6 +2036,12 @@ Page({ | @@ -2123,6 +2036,12 @@ Page({ | ||
| 2123 | } | 2036 | } | 
| 2124 | } | 2037 | } | 
| 2125 | 2038 | ||
| 2039 | + var gd_arr_list = []; | ||
| 2040 | + gd_arr_list.push(good); | ||
| 2041 | + if (th.data.buy_now_gift_goods) { | ||
| 2042 | + gd_arr_list = [...gd_arr_list, ...th.data.buy_now_gift_goods]; | ||
| 2043 | + } | ||
| 2044 | + | ||
| 2126 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | 2045 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | 
| 2127 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | 2046 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | 
| 2128 | //看是不是有调用过包邮券 | 2047 | //看是不是有调用过包邮券 | 
| @@ -2145,7 +2064,10 @@ Page({ | @@ -2145,7 +2064,10 @@ Page({ | ||
| 2145 | for (var i in quanlist) { | 2064 | for (var i in quanlist) { | 
| 2146 | var item = quanlist[i]; | 2065 | var item = quanlist[i]; | 
| 2147 | if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | 2066 | if (item.region_list && th.check_by_area(item.region_list)) continue; //如果是不包邮区域 | 
| 2148 | - if (item.goods_list && th.check_by_goods(item.goods_list)) continue; //如果是不包邮商品 | 2067 | + if (item.goods_list) { | 
| 2068 | + var no_goods_arr = item.goods_list.split(","); | ||
| 2069 | + if (ut.isContained(no_goods_arr, gd_arr_list)) continue; //如果是不包邮商品 | ||
| 2070 | + } | ||
| 2149 | arr.push(item); | 2071 | arr.push(item); | 
| 2150 | } | 2072 | } | 
| 2151 | if (arr) { | 2073 | if (arr) { | 
| @@ -2156,83 +2078,116 @@ Page({ | @@ -2156,83 +2078,116 @@ Page({ | ||
| 2156 | }) | 2078 | }) | 
| 2157 | } | 2079 | } | 
| 2158 | 2080 | ||
| 2159 | - switch (good['exp_sum_type']) { | ||
| 2160 | - case 1: | ||
| 2161 | - //统一运费 | ||
| 2162 | - o_shipping_price += good['uniform_exp_sum']; | ||
| 2163 | - break; | ||
| 2164 | - case 2: | ||
| 2165 | - if (goods_weight < 0) goods_weight = 0; | ||
| 2166 | - //dw | ||
| 2167 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 2168 | - goods_weight += good['weight'] * good['buynum']; | ||
| 2169 | - if (weight_free > 0) { | ||
| 2170 | - out_of_weight = (weight_free * 1000) - goods_weight; | 2081 | + var shipping_price =0; | 
| 2082 | + var quan_no_goods_arr=null; | ||
| 2083 | + var is_by_quan=0; | ||
| 2084 | + | ||
| 2085 | + //如果是包邮券的时候,要看看券的情况,判断一下包邮有没有不包邮模板 | ||
| 2086 | + if (quan_no && th.data.using_quan[pickid].isby == 1) { | ||
| 2087 | + var quan = th.data.using_quan[pickid]; | ||
| 2088 | + if (quan.goods_list) { | ||
| 2089 | + quan_no_goods_arr=quan.goods_list.split(","); | ||
| 2090 | + }else{ | ||
| 2091 | + is_by_quan=1; | ||
| 2171 | } | 2092 | } | 
| 2172 | - break; | ||
| 2173 | - case 3: | ||
| 2174 | - if (goods_piece < 0) goods_piece = 0; | ||
| 2175 | - //累积商品数量 | ||
| 2176 | - goods_piece += good['buynum']; | ||
| 2177 | - break; | ||
| 2178 | - } | ||
| 2179 | - | ||
| 2180 | - var code = ""; | ||
| 2181 | - if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | ||
| 2182 | - | ||
| 2183 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 2184 | - | ||
| 2185 | - var no_by_data = null; | ||
| 2186 | - var gift_freight_free = freight_free; | ||
| 2187 | - | 2093 | + } | 
| 2094 | + if(!is_by_quan) { | ||
| 2095 | + var user_addr = th.data.user_addr; | ||
| 2096 | + var req_d = { | ||
| 2097 | + province: user_addr.province, | ||
| 2098 | + city: user_addr.city, | ||
| 2099 | + district: user_addr.district, | ||
| 2100 | + wuliu: parseFloat(parseFloat(allpice) - cut_price - quan_price).toFixed(2), | ||
| 2101 | + store_id: os.stoid | ||
| 2102 | + } | ||
| 2103 | + var back_data = null; | ||
| 2104 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 2105 | + is_json: 1, data: req_d | ||
| 2106 | + }).then(rs => { | ||
| 2107 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 2108 | + }); | ||
| 2188 | 2109 | ||
| 2189 | - //有不包邮区域,且不免运费 | ||
| 2190 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { | ||
| 2191 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 2192 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 2193 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 2194 | - }).then(res => { | ||
| 2195 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 2196 | - no_by_data = res.data.data[0]; | ||
| 2197 | - //如果有设置不包邮区域的时候 | ||
| 2198 | - if (res.data.data[0].region_list) { | ||
| 2199 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 2200 | - freight_free = 0; | ||
| 2201 | - // out_of_weight = 0; | ||
| 2202 | - th.data.is_no_by[th.data.bn_pick] = 1; | 2110 | + //如果有包邮券的不包邮商品的时候 | 
| 2111 | + if(quan_no_goods_arr) { | ||
| 2112 | + if (back_data && back_data.no_free_goods) { | ||
| 2113 | + back_data['is_by_all']=1; | ||
| 2114 | + var arr3 = back_data.no_free_goods.filter(item => { | ||
| 2115 | + return quan_no_goods_arr.includes(item) | ||
| 2116 | + }) | ||
| 2117 | + back_data.no_free_goods = null; | ||
| 2118 | + if (arr3.length) { | ||
| 2119 | + back_data.no_free_goods = arr3; | ||
| 2203 | } | 2120 | } | 
| 2204 | } | 2121 | } | 
| 2205 | - //如果有设置不包邮商品 | ||
| 2206 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 2207 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 2208 | - freight_free = 0; | ||
| 2209 | - // out_of_weight = 0; | ||
| 2210 | - th.data.is_no_by[th.data.bn_pick] = 1; | 2122 | + if (!back_data || !back_data.no_free_goods) { | 
| 2123 | + if (!back_data) back_data={}; | ||
| 2124 | + back_data['is_by_all']=1; | ||
| 2125 | + back_data['no_free_goods']=quan_no_goods_arr; | ||
| 2126 | + } | ||
| 2127 | + } | ||
| 2128 | + | ||
| 2129 | + var cut_good_weight = 0; | ||
| 2130 | + for (let i in gd_arr_list) { | ||
| 2131 | + let item = gd_arr_list[i]; | ||
| 2132 | + | ||
| 2133 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 2134 | + if (item['exp_sum_type'] == 2) { | ||
| 2135 | + goods_weight += item['weight'] * item['buynum']; | ||
| 2136 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 2211 | } | 2137 | } | 
| 2138 | + if (back_data.weight_free > 0) { | ||
| 2139 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 2140 | + } | ||
| 2141 | + continue; | ||
| 2142 | + | ||
| 2143 | + } | ||
| 2144 | + | ||
| 2145 | + switch (item['exp_sum_type']) { | ||
| 2146 | + case 1: | ||
| 2147 | + //统一运费 | ||
| 2148 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 2149 | + break; | ||
| 2150 | + case 2: | ||
| 2151 | + if (goods_weight < 0) goods_weight = 0; | ||
| 2152 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 2153 | + goods_weight += item['weight'] * item['buynum']; | ||
| 2154 | + | ||
| 2155 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 2156 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 2157 | + if (back_data.weight_free > 0) { | ||
| 2158 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 2159 | + } | ||
| 2160 | + } | ||
| 2161 | + break; | ||
| 2162 | + case 3: | ||
| 2163 | + if (goods_piece < 0) goods_piece = 0; | ||
| 2164 | + //累积商品数量 | ||
| 2165 | + goods_piece += item['buynum']; | ||
| 2166 | + break; | ||
| 2212 | } | 2167 | } | 
| 2213 | } | 2168 | } | 
| 2214 | - }) | ||
| 2215 | - } | ||
| 2216 | 2169 | ||
| 2217 | - th.data.is_by[th.data.bn_pick] = 0; | ||
| 2218 | - //--------------开始计算物流------------------ | ||
| 2219 | - var shipping_price = | ||
| 2220 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 2221 | - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs, th.data.bn_pick); | 2170 | + //如果是正值的时候 | 
| 2171 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 2172 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 2222 | 2173 | ||
| 2223 | - //如果有赠品的时候,也要计算赠品的物流费用 | ||
| 2224 | - if (th.data.buy_now_gift_goods) { | ||
| 2225 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, | ||
| 2226 | - parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); | ||
| 2227 | - } | 2174 | + var code = ""; | 
| 2175 | + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | ||
| 2176 | + th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 2177 | + th.data.is_by[th.data.bn_pick] = 0; | ||
| 2228 | 2178 | ||
| 2229 | - if (shipping_price <= 0) { | ||
| 2230 | - th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | ||
| 2231 | - } | 2179 | + //--------------开始计算物流------------------ | 
| 2180 | + shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 2181 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 2232 | 2182 | ||
| 2233 | - shipping_price = parseFloat(shipping_price).toFixed(2); | ||
| 2234 | - var wl_txt = "formData.shipping_price"; | ||
| 2235 | - th.setData({ [wl_txt]: shipping_price, }) | 2183 | + if (shipping_price <= 0) { | 
| 2184 | + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | ||
| 2185 | + } | ||
| 2186 | + } | ||
| 2187 | + | ||
| 2188 | + shipping_price = parseFloat(shipping_price).toFixed(2); | ||
| 2189 | + var wl_txt = "formData.shipping_price"; | ||
| 2190 | + th.setData({[wl_txt]: shipping_price,}) | ||
| 2236 | 2191 | ||
| 2237 | } else { | 2192 | } else { | 
| 2238 | var wl_txt = "formData.shipping_price"; | 2193 | var wl_txt = "formData.shipping_price"; | 
| @@ -2418,7 +2373,7 @@ Page({ | @@ -2418,7 +2373,7 @@ Page({ | ||
| 2418 | wx.hideLoading(); | 2373 | wx.hideLoading(); | 
| 2419 | 2374 | ||
| 2420 | }); | 2375 | }); | 
| 2421 | - }); | 2376 | + | 
| 2422 | }, | 2377 | }, | 
| 2423 | 2378 | ||
| 2424 | requestSubscribe() { | 2379 | requestSubscribe() { | 
| @@ -3263,89 +3218,8 @@ Page({ | @@ -3263,89 +3218,8 @@ Page({ | ||
| 3263 | th.setData({ js_use_money: !th.data.js_use_money }); | 3218 | th.setData({ js_use_money: !th.data.js_use_money }); | 
| 3264 | th.calculatePrice(); | 3219 | th.calculatePrice(); | 
| 3265 | }, | 3220 | }, | 
| 3266 | - //-------------------计算物流--------------- | ||
| 3267 | - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | ||
| 3268 | - goods_piece, user_addr, freight_free, o_price, rs, pickid) { | ||
| 3269 | - var price = 0, th = this; | ||
| 3270 | - price += parseFloat(o_shipping_price); | ||
| 3271 | - //如果是包邮 | ||
| 3272 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { | ||
| 3273 | - return 0; | ||
| 3274 | - } | ||
| 3275 | - if (user_addr == null) { | ||
| 3276 | - return 0; | ||
| 3277 | - } | ||
| 3278 | - //计算物流的config item; | ||
| 3279 | - var item = null; | ||
| 3280 | - //先根据 镇 县 区找计算的config | ||
| 3281 | - item = th.get_wuliu_config(user_addr.district, code, rs); | ||
| 3282 | - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | ||
| 3283 | - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | ||
| 3284 | - if (item == null) item = th.get_wuliu_default(code, rs); | ||
| 3285 | - if (item == null) return o_shipping_price; | ||
| 3286 | - var fw_price = 0, fp_price = 0; | ||
| 3287 | - item = item.config; | ||
| 3288 | - if (item == null) return o_shipping_price; | ||
| 3289 | - | ||
| 3290 | - //------超出重量---------- | ||
| 3291 | - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | ||
| 3292 | - goods_weight = goods_weight + out_of_weight; | ||
| 3293 | - if (goods_weight == 0) goods_weight = -1; | ||
| 3294 | - } | ||
| 3295 | 3221 | ||
| 3296 | 3222 | ||
| 3297 | - //------按重量---------- | ||
| 3298 | - if (goods_weight >= 0 && item['money']) { | ||
| 3299 | - fw_price = parseFloat(item['money']); | ||
| 3300 | - if (goods_weight > item['first_weight']) { | ||
| 3301 | - var fw = goods_weight - item['first_weight']; | ||
| 3302 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 3303 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 3304 | - } | ||
| 3305 | - } | ||
| 3306 | - | ||
| 3307 | - if (th.data.free1 && freight_free <= 0) freight_free = th.data.free1; | ||
| 3308 | - | ||
| 3309 | - | ||
| 3310 | - //当有包邮和不包邮混合在一起的时候,件数要重新计算 | ||
| 3311 | - if (freight_free > 0 && o_price >= freight_free && goods_piece > 0 && th.data.cut_goods_piece) | ||
| 3312 | - goods_piece = goods_piece - th.data.cut_goods_piece; | ||
| 3313 | - //------按件数---------- | ||
| 3314 | - if (goods_piece > 0 && item['piecemoney']) { | ||
| 3315 | - fp_price = parseFloat(item['piecemoney']); | ||
| 3316 | - if (goods_piece > item['first_piece']) { | ||
| 3317 | - var fp = goods_piece - item['first_piece']; | ||
| 3318 | - var m = Math.ceil(fp / item['second_piece']) | ||
| 3319 | - fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 3320 | - } | ||
| 3321 | - } | ||
| 3322 | - //当有包邮和不包邮混合在一起的时候,统一运费要重新计算 | ||
| 3323 | - if (freight_free > 0 && o_price >= freight_free && th.data.cut_o_shipping_price && price > 0) price = price - th.data.cut_o_shipping_price; | ||
| 3324 | - | ||
| 3325 | - var rspice = parseFloat(price + fw_price + fp_price); | ||
| 3326 | - return rspice; | ||
| 3327 | - }, | ||
| 3328 | - | ||
| 3329 | - //------------循环获取config----------- | ||
| 3330 | - get_wuliu_config: function (region_id, code, rs) { | ||
| 3331 | - var item = null, rslist = rs.pageData; | ||
| 3332 | - for (var i = 0; i < rslist.length; i++) { | ||
| 3333 | - if (rslist[i].code == code && rslist[i].region_id == region_id) { | ||
| 3334 | - item = rslist[i]; | ||
| 3335 | - } | ||
| 3336 | - } | ||
| 3337 | - return item; | ||
| 3338 | - }, | ||
| 3339 | - //-------循环获取config,code default------- | ||
| 3340 | - get_wuliu_default: function (code, rs) { | ||
| 3341 | - var item = null, rslist = rs.pageData; | ||
| 3342 | - for (var i = 0; i < rslist.length; i++) { | ||
| 3343 | - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { | ||
| 3344 | - item = rslist[i]; | ||
| 3345 | - } | ||
| 3346 | - } | ||
| 3347 | - return item; | ||
| 3348 | - }, | ||
| 3349 | 3223 | ||
| 3350 | //----------立即购买,选择物流------------- | 3224 | //----------立即购买,选择物流------------- | 
| 3351 | bindPickerChange: function (e) { | 3225 | bindPickerChange: function (e) { | 
| @@ -4332,73 +4206,6 @@ Page({ | @@ -4332,73 +4206,6 @@ Page({ | ||
| 4332 | 4206 | ||
| 4333 | }, | 4207 | }, | 
| 4334 | 4208 | ||
| 4335 | - //计算立即购买赠品的物流费用 | ||
| 4336 | - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { | ||
| 4337 | - var good_arr = this.data.buy_now_gift_goods; | ||
| 4338 | - var goods_weight = -1, goods_piece = -1; | ||
| 4339 | - | ||
| 4340 | - var gift_shipping_price = 0; | ||
| 4341 | - if (shipping_price) { | ||
| 4342 | - gift_shipping_price = shipping_price; | ||
| 4343 | - } | ||
| 4344 | - var th = this; | ||
| 4345 | - var out_of_weight = null; | ||
| 4346 | - | ||
| 4347 | - | ||
| 4348 | - //如果有设置不包邮区域的时候 | ||
| 4349 | - if (no_by_data && no_by_data.region_list) { | ||
| 4350 | - if (th.check_by_area(no_by_data.region_list)) { | ||
| 4351 | - gift_freight_free = 0; | ||
| 4352 | - // out_of_weight = 0 | ||
| 4353 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 4354 | - } | ||
| 4355 | - } | ||
| 4356 | - | ||
| 4357 | - for (var i in good_arr) { | ||
| 4358 | - var good = good_arr[i]; | ||
| 4359 | - switch (good['exp_sum_type']) { | ||
| 4360 | - case 1: | ||
| 4361 | - //统一运费 | ||
| 4362 | - gift_shipping_price += parseFloat(good['uniform_exp_sum']); | ||
| 4363 | - gift_shipping_price += o_shipping_price; | ||
| 4364 | - break; | ||
| 4365 | - case 2: | ||
| 4366 | - if (goods_weight < 0) goods_weight = 0; | ||
| 4367 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 4368 | - goods_weight += good['weight'] * parseInt(good['buynum']); | ||
| 4369 | - if (goods_weight1 > 0) { | ||
| 4370 | - out_of_weight = gift_weight_free - goods_weight; | ||
| 4371 | - //不能调换位置 下面goods_weight会变大 | ||
| 4372 | - goods_weight += goods_weight1; | ||
| 4373 | - } | ||
| 4374 | - break; | ||
| 4375 | - case 3: | ||
| 4376 | - if (goods_piece < 0) goods_piece = 0; | ||
| 4377 | - //累积商品数量 | ||
| 4378 | - goods_piece += parseInt(good['buynum']); | ||
| 4379 | - if (goods_piece1) { | ||
| 4380 | - goods_piece += goods_piece1; | ||
| 4381 | - } | ||
| 4382 | - break; | ||
| 4383 | - } | ||
| 4384 | - | ||
| 4385 | - //如果有设置不包邮商品 | ||
| 4386 | - if (no_by_data && no_by_data.goods_list && gift_freight_free) { | ||
| 4387 | - if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { | ||
| 4388 | - gift_freight_free = 0; | ||
| 4389 | - // out_of_weight = 0 | ||
| 4390 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 4391 | - } | ||
| 4392 | - } | ||
| 4393 | - } | ||
| 4394 | - | ||
| 4395 | - var t_shipping_price = | ||
| 4396 | - this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight, | ||
| 4397 | - goods_piece, user_addr, gift_freight_free, allpice, rs, th.data.bn_pick); | ||
| 4398 | - return t_shipping_price; | ||
| 4399 | - | ||
| 4400 | - }, | ||
| 4401 | - | ||
| 4402 | //从优惠的映射中拿出商品从表的item | 4209 | //从优惠的映射中拿出商品从表的item | 
| 4403 | item_map_get_goods: function (goods_id, map) { | 4210 | item_map_get_goods: function (goods_id, map) { | 
| 4404 | for (var i in map.goods) { | 4211 | for (var i in map.goods) { | 
pages/cart/cart2_inte/cart2_inte.js
| @@ -425,81 +425,85 @@ Page({ | @@ -425,81 +425,85 @@ Page({ | ||
| 425 | var c_txt = "formData.cut_price"; | 425 | var c_txt = "formData.cut_price"; | 
| 426 | th.setData({ [c_txt]: cut_price, }); | 426 | th.setData({ [c_txt]: cut_price, }); | 
| 427 | } | 427 | } | 
| 428 | - to.getConfig2(function (ee) { | ||
| 429 | - to.getwuliuprice(async function (rs) { | 428 | + | 
| 429 | + to.getwuliuprice(async function (rs) { | ||
| 430 | 430 | ||
| 431 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 431 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 
| 432 | var out_of_weight = null; //超出多少重量 | 432 | var out_of_weight = null; //超出多少重量 | 
| 433 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 434 | - var weight_free = ee.weight_free; //多少kg内包邮 | 433 | + | 
| 435 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | 434 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | 
| 436 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | 435 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | 
| 437 | 436 | ||
| 438 | - switch (good['exp_sum_type']) { | ||
| 439 | - case 1: | ||
| 440 | - //统一运费 | ||
| 441 | - o_shipping_price += good['uniform_exp_sum']; break; | ||
| 442 | - case 2: | ||
| 443 | - if (goods_weight < 0) goods_weight = 0; | ||
| 444 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 445 | - goods_weight += good['weight'] * good['buynum']; | ||
| 446 | - if (weight_free > 0) { | ||
| 447 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 448 | - } | ||
| 449 | - break; | ||
| 450 | - case 3: | ||
| 451 | - if (goods_piece < 0) goods_piece = 0; | ||
| 452 | - //累积商品数量 | ||
| 453 | - goods_piece += good['buynum']; break; | ||
| 454 | - } | 437 | + var user_addr=th.data.user_addr; | 
| 438 | + var req_d = { | ||
| 439 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 440 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 441 | + } | ||
| 442 | + var back_data = null; | ||
| 443 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 444 | + is_json: 1, data: req_d | ||
| 445 | + }).then(rs => { | ||
| 446 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 447 | + }); | ||
| 455 | 448 | ||
| 456 | - var code = ""; | ||
| 457 | - if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | ||
| 458 | - var no_ex_id = ee.no_ex_id; | ||
| 459 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 460 | - var no_by_data = null; | ||
| 461 | - var gift_freight_free = freight_free; | ||
| 462 | - //有不包邮区域,且不免运费 | ||
| 463 | - if (no_ex_id && freight_free > 0 && freight_free <= allpice - cut_price) { | ||
| 464 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 465 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 466 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 467 | - }).then(res => { | ||
| 468 | - if (res.data.code == 0) { | ||
| 469 | - no_by_data = res.data.data[0]; | ||
| 470 | - //如果有设置不包邮区域的时候 | ||
| 471 | - if (res.data.data[0].region_list) { | ||
| 472 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 473 | - freight_free = 0; | ||
| 474 | - // out_of_weight = 0; | ||
| 475 | - // weight_free = -1; | ||
| 476 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 477 | - } | 449 | + var gd_arr_list = []; | 
| 450 | + gd_arr_list.push(good); | ||
| 451 | + var cut_good_weight = 0; | ||
| 452 | + for (let i in gd_arr_list) { | ||
| 453 | + let item = gd_arr_list[i]; | ||
| 454 | + | ||
| 455 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { | ||
| 456 | + if (item['exp_sum_type'] == 2) { | ||
| 457 | + goods_weight += item['weight'] * item['buynum']; | ||
| 458 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 459 | + } | ||
| 460 | + if (back_data.weight_free > 0) { | ||
| 461 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 462 | + } | ||
| 463 | + continue; | ||
| 478 | } | 464 | } | 
| 479 | - //如果有设置不包邮商品 | ||
| 480 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 481 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 482 | - freight_free = 0; | ||
| 483 | - // out_of_weight = 0; | ||
| 484 | - // weight_free = -1; | ||
| 485 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 486 | - } | 465 | + | 
| 466 | + switch (item['exp_sum_type']) { | ||
| 467 | + case 1: | ||
| 468 | + //统一运费 | ||
| 469 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 470 | + break; | ||
| 471 | + case 2: | ||
| 472 | + if (goods_weight < 0) goods_weight = 0; | ||
| 473 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 474 | + goods_weight += item['weight'] * item['buynum']; | ||
| 475 | + | ||
| 476 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 477 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 478 | + if (back_data.weight_free > 0) { | ||
| 479 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 480 | + } | ||
| 481 | + } | ||
| 482 | + break; | ||
| 483 | + case 3: | ||
| 484 | + if (goods_piece < 0) goods_piece = 0; | ||
| 485 | + //累积商品数量 | ||
| 486 | + goods_piece += item['buynum']; | ||
| 487 | + break; | ||
| 487 | } | 488 | } | 
| 488 | - } | ||
| 489 | - }) | ||
| 490 | - } | 489 | + } | 
| 491 | 490 | ||
| 492 | - //--------------开始计算物流------------------ | ||
| 493 | - var shipping_price = | ||
| 494 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 495 | - goods_piece, th.data.user_addr, freight_free, allpice - cut_price, rs, th.data.bn_pick); | ||
| 496 | - if (shipping_price <= 0) { | ||
| 497 | - th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | ||
| 498 | - } | 491 | + //如果是正值的时候 | 
| 492 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 493 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 494 | + | ||
| 495 | + var code = ""; | ||
| 496 | + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | ||
| 497 | + //--------------开始计算物流------------------ | ||
| 498 | + var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 499 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 500 | + if (shipping_price <= 0) { | ||
| 501 | + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | ||
| 502 | + } | ||
| 499 | 503 | ||
| 500 | - shipping_price = parseFloat(shipping_price).toFixed(2); | ||
| 501 | - var wl_txt = "formData.shipping_price"; | ||
| 502 | - th.setData({ [wl_txt]: shipping_price, }) | 504 | + shipping_price = parseFloat(shipping_price).toFixed(2); | 
| 505 | + var wl_txt = "formData.shipping_price"; | ||
| 506 | + th.setData({ [wl_txt]: shipping_price, }) | ||
| 503 | 507 | ||
| 504 | } else { | 508 | } else { | 
| 505 | var wl_txt = "formData.shipping_price"; | 509 | var wl_txt = "formData.shipping_price"; | 
| @@ -544,7 +548,7 @@ Page({ | @@ -544,7 +548,7 @@ Page({ | ||
| 544 | wx.hideLoading(); | 548 | wx.hideLoading(); | 
| 545 | 549 | ||
| 546 | }); | 550 | }); | 
| 547 | - }); | 551 | + | 
| 548 | }, | 552 | }, | 
| 549 | 553 | ||
| 550 | //--------------------提交订单----------------------- | 554 | //--------------------提交订单----------------------- | 
| @@ -917,73 +921,6 @@ Page({ | @@ -917,73 +921,6 @@ Page({ | ||
| 917 | th.setData({ js_use_money: !th.data.js_use_money }); | 921 | th.setData({ js_use_money: !th.data.js_use_money }); | 
| 918 | th.calculatePrice(); | 922 | th.calculatePrice(); | 
| 919 | }, | 923 | }, | 
| 920 | - //-------------------计算物流--------------- | ||
| 921 | - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | ||
| 922 | - goods_piece, user_addr, freight_free, o_price, rs, pickid = null) { | ||
| 923 | - var price = 0, th = this; | ||
| 924 | - price += parseFloat(o_shipping_price); | ||
| 925 | - //如果是包邮 | ||
| 926 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } | ||
| 927 | - if (user_addr == null) { return 0; } | ||
| 928 | - //计算物流的config item; | ||
| 929 | - var item = null; | ||
| 930 | - //先根据 镇 县 区找计算的config | ||
| 931 | - item = th.get_wuliu_config(user_addr.district, code, rs); | ||
| 932 | - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | ||
| 933 | - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | ||
| 934 | - if (item == null) item = th.get_wuliu_default(code, rs); | ||
| 935 | - if (item == null) return o_shipping_price; | ||
| 936 | - var fw_price = 0, fp_price = 0; | ||
| 937 | - item = item.config; | ||
| 938 | - if (item == null) return o_shipping_price; | ||
| 939 | - //------按重量---------- | ||
| 940 | - if (goods_weight >= 0 && item['money']) { | ||
| 941 | - fw_price = parseFloat(item['money']); | ||
| 942 | - if (goods_weight > item['first_weight']) { | ||
| 943 | - var fw = goods_weight - item['first_weight']; | ||
| 944 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 945 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 946 | - } | ||
| 947 | - } | ||
| 948 | - //------超出重量---------- | ||
| 949 | - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | ||
| 950 | - fw_price = parseFloat(item['money']); | ||
| 951 | - var out_of_weight = Math.abs(out_of_weight); | ||
| 952 | - if (out_of_weight > item['first_weight']) { | ||
| 953 | - var fw = out_of_weight - item['first_weight']; | ||
| 954 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 955 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 956 | - } | ||
| 957 | - } | ||
| 958 | - //------按件数---------- | ||
| 959 | - if (goods_piece > 0 && item['piecemoney']) { | ||
| 960 | - fp_price = parseFloat(item['piecemoney']); | ||
| 961 | - if (goods_piece > item['first_piece']) { | ||
| 962 | - var fp = goods_piece - item['first_piece']; | ||
| 963 | - var m = Math.ceil(fp / item['second_piece']) | ||
| 964 | - fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 965 | - } | ||
| 966 | - } | ||
| 967 | - var rspice = parseFloat(price + fw_price + fp_price); | ||
| 968 | - return rspice; | ||
| 969 | - }, | ||
| 970 | - | ||
| 971 | - //------------循环获取config----------- | ||
| 972 | - get_wuliu_config: function (region_id, code, rs) { | ||
| 973 | - var item = null, rslist = rs.pageData; | ||
| 974 | - for (var i = 0; i < rslist.length; i++) { | ||
| 975 | - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; } | ||
| 976 | - } | ||
| 977 | - return item; | ||
| 978 | - }, | ||
| 979 | - //-------循环获取config,code default------- | ||
| 980 | - get_wuliu_default: function (code, rs) { | ||
| 981 | - var item = null, rslist = rs.pageData; | ||
| 982 | - for (var i = 0; i < rslist.length; i++) { | ||
| 983 | - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } | ||
| 984 | - } | ||
| 985 | - return item; | ||
| 986 | - }, | ||
| 987 | 924 | ||
| 988 | //----------立即购买,选择物流------------- | 925 | //----------立即购买,选择物流------------- | 
| 989 | bindPickerChange: function (e) { | 926 | bindPickerChange: function (e) { | 
pages/cart/cart2_pt/cart2_pt.js
| 1 | var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"), | 1 | var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"), | 
| 2 | - s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); | 2 | + s = require("../../../utils/util.js"),ut=s, o = require("../../../utils/md5.js"), to = getApp(); | 
| 3 | var oo = t.globalData.setting, os = oo; | 3 | var oo = t.globalData.setting, os = oo; | 
| 4 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 4 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 
| 5 | var util_pay = require("../../../utils/pay.js"); | 5 | var util_pay = require("../../../utils/pay.js"); | 
| @@ -401,84 +401,80 @@ Page({ | @@ -401,84 +401,80 @@ Page({ | ||
| 401 | allpice = parseFloat(allpice).toFixed(2); | 401 | allpice = parseFloat(allpice).toFixed(2); | 
| 402 | var txt = "formData.all_price"; | 402 | var txt = "formData.all_price"; | 
| 403 | th.setData({ [txt]: allpice, }); | 403 | th.setData({ [txt]: allpice, }); | 
| 404 | - console.log(th.data.formData); | ||
| 405 | 404 | ||
| 406 | - to.getConfig2(function (ee) { | ||
| 407 | - to.getwuliuprice(async function (rs) { | 405 | + to.getwuliuprice(async function (rs) { | 
| 408 | console.log('calculatePrice2222'); | 406 | console.log('calculatePrice2222'); | 
| 409 | console.log(rs); | 407 | console.log(rs); | 
| 410 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 408 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 
| 411 | var out_of_weight = null; //超出多少重量 | 409 | var out_of_weight = null; //超出多少重量 | 
| 412 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 413 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 414 | - var no_ex_id = ee.no_ex_id; | ||
| 415 | - var no_ex_good = null; | ||
| 416 | - var by_qc = {}; | ||
| 417 | - if (no_ex_id && freight_free > 0) { | ||
| 418 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 419 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 420 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 421 | - }).then(res => { | ||
| 422 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 423 | - by_qc = res.data.data[0]; | ||
| 424 | - } | ||
| 425 | - }) | ||
| 426 | - }; | 410 | + | 
| 427 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 411 | //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- | 
| 428 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 412 | if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { | 
| 429 | - switch (good['exp_sum_type']) { | ||
| 430 | - case 1: | ||
| 431 | - //统一运费 | ||
| 432 | - o_shipping_price += good['uniform_exp_sum']; break; | ||
| 433 | - case 2: | ||
| 434 | - if (goods_weight < 0) goods_weight = 0; | ||
| 435 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 436 | - goods_weight += good['weight'] * good['buynum']; | ||
| 437 | - if (weight_free > 0) { | ||
| 438 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 439 | - } | ||
| 440 | - break; | ||
| 441 | - case 3: | ||
| 442 | - if (goods_piece < 0) goods_piece = 0; | ||
| 443 | - //累积商品数量 | ||
| 444 | - goods_piece += good['buynum']; break; | ||
| 445 | - } | ||
| 446 | - | ||
| 447 | - console.log(th.data.wu_arr); | ||
| 448 | - var code = th.data.wu_arr[th.data.index].code; | ||
| 449 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 450 | - var no_by_data = null; | ||
| 451 | - //--全部金额-- | ||
| 452 | - //有不包邮区域,且不免运费 | ||
| 453 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) { | ||
| 454 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 455 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 456 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 457 | - }).then(res => { | ||
| 458 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 459 | - no_by_data = res.data.data[0]; | ||
| 460 | - //如果有设置不包邮区域的时候 | ||
| 461 | - if (res.data.data[0].region_list) { | ||
| 462 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 463 | - freight_free = 0; | ||
| 464 | - // out_of_weight = 0; | ||
| 465 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 466 | - } | 413 | + | 
| 414 | + var user_addr=th.data.user_addr; | ||
| 415 | + var req_d = { | ||
| 416 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 417 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 418 | + } | ||
| 419 | + var back_data = null; | ||
| 420 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 421 | + is_json: 1, data: req_d | ||
| 422 | + }).then(rs => { | ||
| 423 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 424 | + }); | ||
| 425 | + | ||
| 426 | + var gd_arr_list = []; | ||
| 427 | + gd_arr_list.push(good); | ||
| 428 | + var cut_good_weight = 0; | ||
| 429 | + for (let i in gd_arr_list) { | ||
| 430 | + let item = gd_arr_list[i]; | ||
| 431 | + | ||
| 432 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 433 | + if (item['exp_sum_type'] == 2) { | ||
| 434 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 435 | + goods_weight += item['weight'] * item['buynum']; | ||
| 436 | + } | ||
| 437 | + if (back_data.weight_free > 0) { | ||
| 438 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 439 | + } | ||
| 440 | + continue; | ||
| 467 | } | 441 | } | 
| 468 | - //如果有设置不包邮商品 | ||
| 469 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 470 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 471 | - freight_free = 0; | ||
| 472 | - // out_of_weight = 0; | ||
| 473 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 474 | - } | 442 | + | 
| 443 | + switch (item['exp_sum_type']) { | ||
| 444 | + case 1: | ||
| 445 | + //统一运费 | ||
| 446 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 447 | + break; | ||
| 448 | + case 2: | ||
| 449 | + if (goods_weight < 0) goods_weight = 0; | ||
| 450 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 451 | + goods_weight += item['weight'] * item['buynum']; | ||
| 452 | + | ||
| 453 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 454 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 455 | + if (back_data.weight_free > 0) { | ||
| 456 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + break; | ||
| 460 | + case 3: | ||
| 461 | + if (goods_piece < 0) goods_piece = 0; | ||
| 462 | + //累积商品数量 | ||
| 463 | + goods_piece += item['buynum']; | ||
| 464 | + break; | ||
| 475 | } | 465 | } | 
| 476 | - } | ||
| 477 | - }) | ||
| 478 | - } | ||
| 479 | - var shipping_price = | ||
| 480 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 481 | - goods_piece, th.data.user_addr, freight_free, allpice, rs,th.data.bn_pick); | 466 | + } | 
| 467 | + | ||
| 468 | + //如果是正值的时候 | ||
| 469 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 470 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 471 | + | ||
| 472 | + | ||
| 473 | + var code = th.data.wu_arr[th.data.index].code; | ||
| 474 | + | ||
| 475 | + //--------------开始计算物流------------------ | ||
| 476 | + var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 477 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 482 | 478 | ||
| 483 | shipping_price = parseFloat(shipping_price).toFixed(2); | 479 | shipping_price = parseFloat(shipping_price).toFixed(2); | 
| 484 | var wl_txt = "formData.shipping_price"; | 480 | var wl_txt = "formData.shipping_price"; | 
| @@ -512,7 +508,7 @@ Page({ | @@ -512,7 +508,7 @@ Page({ | ||
| 512 | } | 508 | } | 
| 513 | 509 | ||
| 514 | }); | 510 | }); | 
| 515 | - }); | 511 | + | 
| 516 | }, | 512 | }, | 
| 517 | //--------------------提交订单----------------------- | 513 | //--------------------提交订单----------------------- | 
| 518 | submitForm: async function (t) { | 514 | submitForm: async function (t) { | 
| @@ -861,74 +857,6 @@ Page({ | @@ -861,74 +857,6 @@ Page({ | ||
| 861 | th.calculatePrice(); | 857 | th.calculatePrice(); | 
| 862 | }, | 858 | }, | 
| 863 | 859 | ||
| 864 | - //-------------------计算物流--------------- | ||
| 865 | - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | ||
| 866 | - goods_piece, user_addr, freight_free, o_price, rs, pickid) { | ||
| 867 | - var price = 0, th = this; | ||
| 868 | - price += parseFloat(o_shipping_price); | ||
| 869 | - //如果是包邮 | ||
| 870 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } | ||
| 871 | - if (user_addr == null) { return 0; } | ||
| 872 | - //计算物流的config item; | ||
| 873 | - var item = null; | ||
| 874 | - //先根据 镇 县 区找计算的config | ||
| 875 | - item = th.get_wuliu_config(user_addr.district, code, rs); | ||
| 876 | - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | ||
| 877 | - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | ||
| 878 | - if (item == null) item = th.get_wuliu_default(code, rs); | ||
| 879 | - if (item == null) return o_shipping_price; | ||
| 880 | - var fw_price = 0, fp_price = 0; | ||
| 881 | - item = item.config; | ||
| 882 | - if (item == null) return o_shipping_price; | ||
| 883 | - //------按重量---------- | ||
| 884 | - if (goods_weight >= 0 && item['money']) { | ||
| 885 | - fw_price = parseFloat(item['money']); | ||
| 886 | - if (goods_weight > item['first_weight']) { | ||
| 887 | - var fw = goods_weight - item['first_weight']; | ||
| 888 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 889 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 890 | - } | ||
| 891 | - } | ||
| 892 | - //------超出重量---------- | ||
| 893 | - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | ||
| 894 | - fw_price = parseFloat(item['money']); | ||
| 895 | - var out_of_weight = Math.abs(out_of_weight); | ||
| 896 | - if (out_of_weight > item['first_weight']) { | ||
| 897 | - var fw = out_of_weight - item['first_weight']; | ||
| 898 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 899 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 900 | - } | ||
| 901 | - } | ||
| 902 | - //------按件数---------- | ||
| 903 | - if (goods_piece > 0) { | ||
| 904 | - fp_price = parseFloat(item['piecemoney']); | ||
| 905 | - if (goods_piece > item['first_piece']) { | ||
| 906 | - var fp = goods_piece - item['first_piece']; | ||
| 907 | - var m = Math.ceil(fp / item['second_piece']) | ||
| 908 | - fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 909 | - } | ||
| 910 | - } | ||
| 911 | - var rspice = parseFloat(price + fw_price + fp_price); | ||
| 912 | - return rspice; | ||
| 913 | - }, | ||
| 914 | - | ||
| 915 | - //------------循环获取config----------- | ||
| 916 | - get_wuliu_config: function (region_id, code, rs) { | ||
| 917 | - var item = null, rslist = rs.pageData; | ||
| 918 | - for (var i = 0; i < rslist.length; i++) { | ||
| 919 | - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; } | ||
| 920 | - } | ||
| 921 | - return item; | ||
| 922 | - }, | ||
| 923 | - //-------循环获取config,code default------- | ||
| 924 | - get_wuliu_default: function (code, rs) { | ||
| 925 | - var item = null, rslist = rs.pageData; | ||
| 926 | - for (var i = 0; i < rslist.length; i++) { | ||
| 927 | - if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { item = rslist[i]; } | ||
| 928 | - } | ||
| 929 | - return item; | ||
| 930 | - }, | ||
| 931 | - | ||
| 932 | //----------立即购买,选择物流------------- | 860 | //----------立即购买,选择物流------------- | 
| 933 | bindPickerChange: function (e) { | 861 | bindPickerChange: function (e) { | 
| 934 | var ind = e.detail.value | 862 | var ind = e.detail.value | 
pages/cart/cart_wk/cart_wk.js
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | var t = getApp(), | 2 | var t = getApp(), | 
| 3 | oo = t.globalData.setting, | 3 | oo = t.globalData.setting, | 
| 4 | os=oo; | 4 | os=oo; | 
| 5 | +var ut=require("../../../utils/util.js"); | ||
| 5 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 6 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 
| 6 | 7 | ||
| 7 | Page({ | 8 | Page({ | 
| @@ -462,155 +463,97 @@ Page({ | @@ -462,155 +463,97 @@ Page({ | ||
| 462 | //----计算物流的钱---- | 463 | //----计算物流的钱---- | 
| 463 | calculate_wuliu() { | 464 | calculate_wuliu() { | 
| 464 | var to = getApp(), th = this; | 465 | var to = getApp(), th = this; | 
| 465 | - to.getConfig2(function (ee) { | ||
| 466 | - to.getwuliuprice(async function (rs) { | 466 | + to.getwuliuprice(async function (rs) { | 
| 467 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; | 467 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; | 
| 468 | var out_of_weight = null; //超出多少重量 | 468 | var out_of_weight = null; //超出多少重量 | 
| 469 | - var no_ex_id = ee.no_ex_id; | ||
| 470 | - var freight_free = ee.freight_free; //全场满多少包邮 | ||
| 471 | - var weight_free = ee.weight_free; //多少kg内包邮 | ||
| 472 | - var no_ex_good = null; | ||
| 473 | - var by_qc = {}; | ||
| 474 | - if (no_ex_id && freight_free > 0) { | ||
| 475 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 476 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 477 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 478 | - }).then(res => { | ||
| 479 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 480 | - by_qc = res.data.data[0]; | ||
| 481 | - } | ||
| 482 | - }) | ||
| 483 | - }; | 469 | + | 
| 470 | + good.buynum=th.data.order.order_goods['goods_num']; | ||
| 471 | + var gd_arr_list = []; | ||
| 472 | + gd_arr_list.push(good); | ||
| 473 | + //--全部金额-- | ||
| 474 | + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; | ||
| 475 | + | ||
| 484 | //-----------当地址不为空,且是物流时,计算物流费用---------- | 476 | //-----------当地址不为空,且是物流时,计算物流费用---------- | 
| 485 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { | 477 | if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { | 
| 486 | - switch (good['exp_sum_type']) { | ||
| 487 | - case 1: | ||
| 488 | - //统一运费 | ||
| 489 | - o_shipping_price += good['uniform_exp_sum']; | ||
| 490 | - break; | ||
| 491 | - case 2: | ||
| 492 | - if (goods_weight < 0) goods_weight = 0; | ||
| 493 | - //累积商品重量 每种商品的重量 * 数量 | ||
| 494 | - goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; | ||
| 495 | - if (weight_free > 0) { | ||
| 496 | - out_of_weight = (weight_free * 1000) - goods_weight; | ||
| 497 | - } | ||
| 498 | - break; | ||
| 499 | - case 3: | ||
| 500 | - if (goods_piece < 0) goods_piece = 0; | ||
| 501 | - //累积商品数量 | ||
| 502 | - goods_piece += th.data.order.order_goods['goods_num']; | ||
| 503 | - break; | ||
| 504 | - } | ||
| 505 | - var code = th.data.wu_arr[th.data.index].code; | ||
| 506 | - th.data.is_no_by[th.data.bn_pick] = 0; | ||
| 507 | - var no_by_data = null; | ||
| 508 | - //--全部金额-- | ||
| 509 | - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; | ||
| 510 | - //有不包邮区域,且不免运费 | ||
| 511 | - if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) { | ||
| 512 | - //-----------获取不包邮区域,不包邮商品------- | ||
| 513 | - await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { | ||
| 514 | - data: { store_id: os.stoid, id: no_ex_id } | ||
| 515 | - }).then(res => { | ||
| 516 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | ||
| 517 | - no_by_data = res.data.data[0]; | ||
| 518 | - //如果有设置不包邮区域的时候 | ||
| 519 | - if (res.data.data[0].region_list) { | ||
| 520 | - if (th.check_by_area(res.data.data[0].region_list)) { | ||
| 521 | - freight_free = 0; | ||
| 522 | - // out_of_weight = 0; | ||
| 523 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 524 | - } | 478 | + | 
| 479 | + var user_addr=th.data.user_addr; | ||
| 480 | + var req_d = { | ||
| 481 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | ||
| 482 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | ||
| 483 | + } | ||
| 484 | + var back_data = null; | ||
| 485 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | ||
| 486 | + is_json: 1, data: req_d | ||
| 487 | + }).then(rs => { | ||
| 488 | + if (rs.data.code == 0) back_data = rs.data.data; | ||
| 489 | + }); | ||
| 490 | + | ||
| 491 | + var cut_good_weight = 0; | ||
| 492 | + for (let i in gd_arr_list) { | ||
| 493 | + let item = gd_arr_list[i]; | ||
| 494 | + | ||
| 495 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { | ||
| 496 | + if (item['exp_sum_type'] == 2) { | ||
| 497 | + goods_weight += item['weight'] * item['buynum']; | ||
| 498 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 499 | + } | ||
| 500 | + if (back_data.weight_free > 0) { | ||
| 501 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 502 | + } | ||
| 503 | + continue; | ||
| 525 | } | 504 | } | 
| 526 | - //如果有设置不包邮商品 | ||
| 527 | - if (res.data.data[0].goods_list && freight_free) { | ||
| 528 | - if (th.check_by_goods(res.data.data[0].goods_list)) { | ||
| 529 | - freight_free = 0; | ||
| 530 | - // out_of_weight = 0; | ||
| 531 | - th.data.is_no_by[th.data.bn_pick] = 1; | ||
| 532 | - } | 505 | + | 
| 506 | + switch (item['exp_sum_type']) { | ||
| 507 | + case 1: | ||
| 508 | + //统一运费 | ||
| 509 | + o_shipping_price += item['uniform_exp_sum']; | ||
| 510 | + break; | ||
| 511 | + case 2: | ||
| 512 | + if (goods_weight < 0) goods_weight = 0; | ||
| 513 | + //累积商品重量 每种商品的重量 * 数量 | ||
| 514 | + goods_weight += item['weight'] * item['buynum']; | ||
| 515 | + | ||
| 516 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | ||
| 517 | + cut_good_weight += item['weight'] * item['buynum']; | ||
| 518 | + if (back_data.weight_free > 0) { | ||
| 519 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | ||
| 520 | + } | ||
| 521 | + } | ||
| 522 | + break; | ||
| 523 | + case 3: | ||
| 524 | + if (goods_piece < 0) goods_piece = 0; | ||
| 525 | + //累积商品数量 | ||
| 526 | + goods_piece += item['buynum']; | ||
| 527 | + break; | ||
| 533 | } | 528 | } | 
| 534 | - } | ||
| 535 | - }) | ||
| 536 | - } | ||
| 537 | - var shipping_price = | ||
| 538 | - th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 539 | - goods_piece, th.data.user_addr, freight_free, allpice, rs,th.data.bn_pick); | ||
| 540 | - var exp_price = parseFloat(shipping_price).toFixed(2); | ||
| 541 | - allpice = parseFloat(exp_price) + parseFloat(allpice); | ||
| 542 | - allpice = allpice.toFixed(2); | 529 | + } | 
| 530 | + | ||
| 531 | + //如果是正值的时候 | ||
| 532 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | ||
| 533 | + else out_of_weight = -back_data.weight_free * 1000; | ||
| 543 | 534 | ||
| 544 | - exp_price = parseFloat(exp_price); | ||
| 545 | - th.setData({ exp_price: exp_price, allpice: allpice }) | 535 | + var code = th.data.wu_arr[th.data.index].code; | 
| 536 | + | ||
| 537 | + //--------------开始计算物流------------------ | ||
| 538 | + var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 539 | + goods_piece, th.data.user_addr, back_data, rs); | ||
| 540 | + | ||
| 541 | + var exp_price = parseFloat(shipping_price).toFixed(2); | ||
| 542 | + allpice = parseFloat(exp_price) + parseFloat(allpice); | ||
| 543 | + allpice = allpice.toFixed(2); | ||
| 544 | + | ||
| 545 | + exp_price = parseFloat(exp_price); | ||
| 546 | + th.setData({ exp_price: exp_price, allpice: allpice }) | ||
| 546 | } else { | 547 | } else { | 
| 547 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 548 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 
| 548 | allpice = allpice.toFixed(2); | 549 | allpice = allpice.toFixed(2); | 
| 549 | th.setData({ exp_price: 0, allpice: allpice }) | 550 | th.setData({ exp_price: 0, allpice: allpice }) | 
| 550 | } | 551 | } | 
| 551 | }); | 552 | }); | 
| 552 | - }); | ||
| 553 | - }, | ||
| 554 | 553 | ||
| 555 | - //----------------计算物流--------------- | ||
| 556 | - calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | ||
| 557 | - goods_piece, user_addr, freight_free, o_price, rs,pickid) { | ||
| 558 | - var price = 0, th = this; | ||
| 559 | - price += parseFloat(o_shipping_price); | ||
| 560 | - //如果是包邮 | ||
| 561 | - if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } | ||
| 562 | - if (user_addr == null) { return 0; } | ||
| 563 | - //计算物流的config item; | ||
| 564 | - var item = null; | ||
| 565 | - //先根据 镇 县 区找计算的config | ||
| 566 | - item = th.get_wuliu_config(user_addr.district, code, rs); | ||
| 567 | - if (item == null) item = th.get_wuliu_config(user_addr.city, code, rs); | ||
| 568 | - if (item == null) item = th.get_wuliu_config(user_addr.province, code, rs); | ||
| 569 | - if (item == null) item = th.get_wuliu_default(code, rs); | ||
| 570 | - if (item == null) return o_shipping_price; | ||
| 571 | - var fw_price = 0, fp_price = 0; | ||
| 572 | - item = item.config; | ||
| 573 | - if (item == null) return o_shipping_price; | ||
| 574 | - //------按重量---------- | ||
| 575 | - if (goods_weight >= 0 && item['money']) { | ||
| 576 | - fw_price = parseFloat(item['money']); | ||
| 577 | - if (goods_weight > item['first_weight']) { | ||
| 578 | - var fw = goods_weight - item['first_weight']; | ||
| 579 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 580 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 581 | - } | ||
| 582 | - } | ||
| 583 | - //------超出重量---------- | ||
| 584 | - if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | ||
| 585 | - fw_price = parseFloat(item['money']); | ||
| 586 | - var out_of_weight = Math.abs(out_of_weight); | ||
| 587 | - if (out_of_weight > item['first_weight']) { | ||
| 588 | - var fw = out_of_weight - item['first_weight']; | ||
| 589 | - var n = Math.ceil(fw / item['second_weight']) | ||
| 590 | - fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 591 | - } | ||
| 592 | - } | ||
| 593 | - //------按件数---------- | ||
| 594 | - if (goods_piece > 0) { | ||
| 595 | - fp_price = parseFloat(item['piecemoney']); | ||
| 596 | - if (goods_piece > item['first_piece']) { | ||
| 597 | - var fp = goods_piece - item['first_piece']; | ||
| 598 | - var m = Math.ceil(fp / item['second_piece']) | ||
| 599 | - fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 600 | - } | ||
| 601 | - } | ||
| 602 | - var rspice = parseFloat(price + fw_price + fp_price); | ||
| 603 | - return rspice; | ||
| 604 | - }, | ||
| 605 | - //------------循环获取config----------- | ||
| 606 | - get_wuliu_config: function (region_id, code, rs) { | ||
| 607 | - var item = null, rslist = rs.pageData; | ||
| 608 | - for (var i = 0; i < rslist.length; i++) { | ||
| 609 | - if (rslist[i].code == code && rslist[i].region_id == region_id) { item = rslist[i]; } | ||
| 610 | - } | ||
| 611 | - return item; | ||
| 612 | }, | 554 | }, | 
| 613 | 555 | ||
| 556 | + | ||
| 614 | //---------------检查是否有收货地址------------------- | 557 | //---------------检查是否有收货地址------------------- | 
| 615 | checkAddressList: function () { | 558 | checkAddressList: function () { | 
| 616 | var t = this; | 559 | var t = this; | 
pages/giftpack/buygiftpack/giftpackbuy.js
| @@ -68,11 +68,21 @@ Page({ | @@ -68,11 +68,21 @@ Page({ | ||
| 68 | 68 | ||
| 69 | }, | 69 | }, | 
| 70 | onLoad: function (options) { | 70 | onLoad: function (options) { | 
| 71 | + var th=this; | ||
| 72 | + | ||
| 71 | this.setData({ | 73 | this.setData({ | 
| 72 | params: options, | 74 | params: options, | 
| 73 | now:Date.parse(new Date()) / 1000, | 75 | now:Date.parse(new Date()) / 1000, | 
| 74 | }) | 76 | }) | 
| 75 | 77 | ||
| 78 | + getApp().getConfig2(function (e) { | ||
| 79 | + var json_d = JSON.parse(e.switch_list); | ||
| 80 | + th.setData({ | ||
| 81 | + bconfig: e, | ||
| 82 | + sys_switch:json_d | ||
| 83 | + }); | ||
| 84 | + }) | ||
| 85 | + | ||
| 76 | }, | 86 | }, | 
| 77 | init() { | 87 | init() { | 
| 78 | var th = this; | 88 | var th = this; | 
| @@ -359,6 +369,11 @@ Page({ | @@ -359,6 +369,11 @@ Page({ | ||
| 359 | var ind = ee.currentTarget.dataset.ind; | 369 | var ind = ee.currentTarget.dataset.ind; | 
| 360 | var bconfig = th.data.bconfig; | 370 | var bconfig = th.data.bconfig; | 
| 361 | 371 | ||
| 372 | + //如果开启了,则不在选择门店 | ||
| 373 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 374 | + return false; | ||
| 375 | + } | ||
| 376 | + | ||
| 362 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 377 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 
| 363 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 378 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 364 | return false; | 379 | return false; | 
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -70,9 +70,20 @@ Page({ | @@ -70,9 +70,20 @@ Page({ | ||
| 70 | openSpecModal:0 | 70 | openSpecModal:0 | 
| 71 | }, | 71 | }, | 
| 72 | onLoad: function (options) { | 72 | onLoad: function (options) { | 
| 73 | + | ||
| 74 | + var th=this; | ||
| 75 | + | ||
| 73 | this.setData({ | 76 | this.setData({ | 
| 74 | params:options, | 77 | params:options, | 
| 75 | }) | 78 | }) | 
| 79 | + | ||
| 80 | + getApp().getConfig2(function (e) { | ||
| 81 | + var json_d = JSON.parse(e.switch_list); | ||
| 82 | + th.setData({ | ||
| 83 | + bconfig: e, | ||
| 84 | + sys_switch:json_d | ||
| 85 | + }); | ||
| 86 | + }) | ||
| 76 | }, | 87 | }, | 
| 77 | init(){ | 88 | init(){ | 
| 78 | let options = this.data?.params; // this.data == null ? undefined:this.data.params | 89 | let options = this.data?.params; // this.data == null ? undefined:this.data.params | 
| @@ -217,6 +228,11 @@ Page({ | @@ -217,6 +228,11 @@ Page({ | ||
| 217 | giftTitle: res.data.data.giftTitle, | 228 | giftTitle: res.data.data.giftTitle, | 
| 218 | default_color: res.data.data.bgcolor | 229 | default_color: res.data.data.bgcolor | 
| 219 | }) | 230 | }) | 
| 231 | + | ||
| 232 | + if(res.data.data.iswarelbtype==1) { | ||
| 233 | + th.setData({iswarelbtype:1}) | ||
| 234 | + } | ||
| 235 | + | ||
| 220 | if (!res.data.data.giftRemark || res.data.data.giftRemark == '') { | 236 | if (!res.data.data.giftRemark || res.data.data.giftRemark == '') { | 
| 221 | th.setData({ | 237 | th.setData({ | 
| 222 | giftRemark: '暂无详情......' | 238 | giftRemark: '暂无详情......' | 
| @@ -606,6 +622,10 @@ Page({ | @@ -606,6 +622,10 @@ Page({ | ||
| 606 | var ind = ee.currentTarget.dataset.ind; | 622 | var ind = ee.currentTarget.dataset.ind; | 
| 607 | var bconfig = th.data.bconfig; | 623 | var bconfig = th.data.bconfig; | 
| 608 | 624 | ||
| 625 | + //如果开启了,则不在选择门店 | ||
| 626 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 627 | + return false; | ||
| 628 | + } | ||
| 609 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 629 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 
| 610 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 630 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 611 | return false; | 631 | return false; | 
pages/giftpack/giftpacklist/giftpacklist.wxml
| @@ -18,13 +18,13 @@ | @@ -18,13 +18,13 @@ | ||
| 18 | </text> | 18 | </text> | 
| 19 | </block> | 19 | </block> | 
| 20 | <block wx:else> | 20 | <block wx:else> | 
| 21 | - <text class="data-v-3a5b7e36" wx:if="{{isBuy==0}}">{{"兑换结束时间:"+giftDate}}</text> | 21 | + <text class="data-v-3a5b7e36" wx:if="{{isBuy==0 && iswarelbtype}}">{{"兑换结束时间:"+giftDate}}</text> | 
| 22 | <text class="data-v-3a5b7e36" wx:else> | 22 | <text class="data-v-3a5b7e36" wx:else> | 
| 23 | {{"活动结束时间:"+giftDate}} | 23 | {{"活动结束时间:"+giftDate}} | 
| 24 | </text> | 24 | </text> | 
| 25 | </block> | 25 | </block> | 
| 26 | </view> | 26 | </view> | 
| 27 | - <view class="top_time data-v-3a5b7e36" wx:if="{{flag == 1}}"> | 27 | + <view class="top_time data-v-3a5b7e36" wx:if="{{flag == 1 && iswarelbtype}}"> | 
| 28 | <text class="data-v-3a5b7e36" wx:if="{{exchangeType == 1}}"> | 28 | <text class="data-v-3a5b7e36" wx:if="{{exchangeType == 1}}"> | 
| 29 | {{"兑换时间:领取后"+exchangeDay+"天内兑换"}} | 29 | {{"兑换时间:领取后"+exchangeDay+"天内兑换"}} | 
| 30 | </text> | 30 | </text> | 
pages/giftpack/mygiftpack/mygiftpack.wxml
| @@ -81,7 +81,8 @@ | @@ -81,7 +81,8 @@ | ||
| 81 | <view class="content_ware_price"> | 81 | <view class="content_ware_price"> | 
| 82 | <text>{{"零售价:¥"+item.giftPosPrice}}</text> | 82 | <text>{{"零售价:¥"+item.giftPosPrice}}</text> | 
| 83 | </view> | 83 | </view> | 
| 84 | - <view class="content_ware_time"> | 84 | + | 
| 85 | + <view class="content_ware_time" wx:if="{{item.iswarelbtype==1}}"> | ||
| 85 | <block wx:if="{{getDate>item.endTime}}"> | 86 | <block wx:if="{{getDate>item.endTime}}"> | 
| 86 | <text>{{"兑换截至日期:"+item.endTime}}</text> | 87 | <text>{{"兑换截至日期:"+item.endTime}}</text> | 
| 87 | </block> | 88 | </block> | 
| @@ -89,6 +90,7 @@ | @@ -89,6 +90,7 @@ | ||
| 89 | <text>{{"距兑换开始时间: "+item.starTime}}</text> | 90 | <text>{{"距兑换开始时间: "+item.starTime}}</text> | 
| 90 | </block> | 91 | </block> | 
| 91 | </view> | 92 | </view> | 
| 93 | + | ||
| 92 | </view> | 94 | </view> | 
| 93 | </view> | 95 | </view> | 
| 94 | <view class="content_box_button" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&orderSn={{item.orderSn}}"> | 96 | <view class="content_box_button" bindtap="navigateTo" data-url="/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&lbId={{item.lbId}}&orderSn={{item.orderSn}}"> | 
pages/giftpack/public/buy_com.js
| @@ -44,6 +44,9 @@ module.exports = { | @@ -44,6 +44,9 @@ module.exports = { | ||
| 44 | th.data.fir_def_store = {}; //赋值空对象 | 44 | th.data.fir_def_store = {}; //赋值空对象 | 
| 45 | return false; | 45 | return false; | 
| 46 | } | 46 | } | 
| 47 | + | ||
| 48 | + th.setData({has_def:1}) | ||
| 49 | + | ||
| 47 | var ee = JSON.parse(JSON.stringify(e)); | 50 | var ee = JSON.parse(JSON.stringify(e)); | 
| 48 | //--定时器推迟一下-- | 51 | //--定时器推迟一下-- | 
| 49 | setTimeout(function () { | 52 | setTimeout(function () { | 
pages/giftpack/public/buy_com.wxml
| @@ -186,7 +186,7 @@ | @@ -186,7 +186,7 @@ | ||
| 186 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 186 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 187 | <view class="fs30" style="color:black;">选择门店</view> | 187 | <view class="fs30" style="color:black;">选择门店</view> | 
| 188 | </view> | 188 | </view> | 
| 189 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 189 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 190 | </view> | 190 | </view> | 
| 191 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 191 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 192 | <block wx:else> | 192 | <block wx:else> | 
pages/goods/goodsInfo/buy_flash_normal.wxml
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | <view class="fs30" style="color:black;">选择门店</view> | 42 | <view class="fs30" style="color:black;">选择门店</view> | 
| 43 | </view> | 43 | </view> | 
| 44 | 44 | ||
| 45 | - <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 45 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 
| 46 | </view> | 46 | </view> | 
| 47 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 47 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 48 | <block wx:else> | 48 | <block wx:else> | 
pages/goods/goodsInfo/buy_integral.wxml
| @@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
| 40 | <view class="fs30" style="color:black;">选择门店</view> | 40 | <view class="fs30" style="color:black;">选择门店</view> | 
| 41 | </view> | 41 | </view> | 
| 42 | 42 | ||
| 43 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 43 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 44 | </view> | 44 | </view> | 
| 45 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 45 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 46 | <block wx:else> | 46 | <block wx:else> | 
pages/goods/goodsInfo/buy_integral_normal.wxml
| @@ -39,17 +39,17 @@ | @@ -39,17 +39,17 @@ | ||
| 39 | <!-- 没有门店的时候 --> | 39 | <!-- 没有门店的时候 --> | 
| 40 | <view class="flex" bindtap="choice_store" wx:else> | 40 | <view class="flex" bindtap="choice_store" wx:else> | 
| 41 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 41 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 42 | - <view class="fs30" style="color:black;">选择门店</view> | 42 | + <view class="fs30" style="color:black;">选择门店</view> | 
| 43 | </view> | 43 | </view> | 
| 44 | 44 | ||
| 45 | - <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 45 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 
| 46 | </view> | 46 | </view> | 
| 47 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 47 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 48 | <block wx:else> | 48 | <block wx:else> | 
| 49 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | 49 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | 
| 50 | <block wx:else> | 50 | <block wx:else> | 
| 51 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 51 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 
| 52 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | 52 | + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2}}">(库存不足)</view> | 
| 53 | </block> | 53 | </block> | 
| 54 | </block> | 54 | </block> | 
| 55 | <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | 55 | <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | 
| @@ -118,7 +118,7 @@ | @@ -118,7 +118,7 @@ | ||
| 118 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | 118 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | 
| 119 | </block> | 119 | </block> | 
| 120 | <block wx:else> | 120 | <block wx:else> | 
| 121 | - <block wx:if="{{data.store_count<=0}}"> | 121 | + <block wx:if="{{def_pick_store && !def_pick_store.CanOutQty}}"> | 
| 122 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | 122 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | 
| 123 | </block> | 123 | </block> | 
| 124 | <block wx:else> | 124 | <block wx:else> | 
pages/goods/goodsInfo/buy_pt.wxml
| @@ -63,10 +63,10 @@ | @@ -63,10 +63,10 @@ | ||
| 63 | <view class="fs28 xc-ash-9f">选择门店</view> | 63 | <view class="fs28 xc-ash-9f">选择门店</view> | 
| 64 | </view> | 64 | </view> | 
| 65 | 65 | ||
| 66 | - <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 66 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> | 
| 67 | </view> | 67 | </view> | 
| 68 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 68 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 
| 69 | - <view class="no_store" wx:elif="{{is_normal && def_pick_store && def_pick_store.CanOutQty<=0}}">(库存不足)</view> | 69 | + <view class="no_store" wx:elif="{{is_normal && def_pick_store && (!def_pick_store.CanOutQty || def_pick_store.CanOutQty<=0)}}">(库存不足)</view> | 
| 70 | <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | 70 | <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | 
| 71 | </view> | 71 | </view> | 
| 72 | <!----商品的属性项目----> | 72 | <!----商品的属性项目----> | 
pages/goods/goodsInfo/goodsInfo.js
| @@ -480,6 +480,8 @@ Page({ | @@ -480,6 +480,8 @@ Page({ | ||
| 480 | th.data.fir_def_store = {}; //赋值空对象 | 480 | th.data.fir_def_store = {}; //赋值空对象 | 
| 481 | return false; | 481 | return false; | 
| 482 | } | 482 | } | 
| 483 | + th.setData({has_def:1}); | ||
| 484 | + | ||
| 483 | var ee = JSON.parse(JSON.stringify(e)); | 485 | var ee = JSON.parse(JSON.stringify(e)); | 
| 484 | //--定时器推迟一下-- | 486 | //--定时器推迟一下-- | 
| 485 | setTimeout(function () { | 487 | setTimeout(function () { | 
| @@ -489,6 +491,9 @@ Page({ | @@ -489,6 +491,9 @@ Page({ | ||
| 489 | ee.is_no_dis = 1; | 491 | ee.is_no_dis = 1; | 
| 490 | } | 492 | } | 
| 491 | 493 | ||
| 494 | + | ||
| 495 | + | ||
| 496 | + | ||
| 492 | var appd = getApp().globalData; | 497 | var appd = getApp().globalData; | 
| 493 | var w_time = setInterval(function () { | 498 | var w_time = setInterval(function () { | 
| 494 | if (that.data.is_get_local_ok == 0) return false; | 499 | if (that.data.is_get_local_ok == 0) return false; | 
| @@ -552,7 +557,7 @@ Page({ | @@ -552,7 +557,7 @@ Page({ | ||
| 552 | var that = this, th = this; | 557 | var that = this, th = this; | 
| 553 | getApp().getConfig2(function (e) { | 558 | getApp().getConfig2(function (e) { | 
| 554 | var sales_rules = e.sales_rules; | 559 | var sales_rules = e.sales_rules; | 
| 555 | - if (sales_rules == 2) { | 560 | + if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 ) { | 
| 556 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { | 561 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { | 
| 557 | var lock = 0, plist = null; | 562 | var lock = 0, plist = null; | 
| 558 | var gd = that.data.fir_goods; | 563 | var gd = that.data.fir_goods; | 
| @@ -3380,10 +3385,10 @@ Page({ | @@ -3380,10 +3385,10 @@ Page({ | ||
| 3380 | //---把数组组装进去--- | 3385 | //---把数组组装进去--- | 
| 3381 | th.deal_pickup(em); | 3386 | th.deal_pickup(em); | 
| 3382 | } else { | 3387 | } else { | 
| 3383 | - th.setData({def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null}) | 3388 | + th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) | 
| 3384 | } | 3389 | } | 
| 3385 | } else { | 3390 | } else { | 
| 3386 | - th.setData({def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null}) | 3391 | + th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) | 
| 3387 | } | 3392 | } | 
| 3388 | }) | 3393 | }) | 
| 3389 | }, | 3394 | }, | 
| @@ -5792,6 +5797,11 @@ Page({ | @@ -5792,6 +5797,11 @@ Page({ | ||
| 5792 | var ind = ee.currentTarget.dataset.ind; | 5797 | var ind = ee.currentTarget.dataset.ind; | 
| 5793 | var bconfig = th.data.bconfig; | 5798 | var bconfig = th.data.bconfig; | 
| 5794 | 5799 | ||
| 5800 | + //如果开启了,则不在选择门店 | ||
| 5801 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 5802 | + return false; | ||
| 5803 | + } | ||
| 5804 | + | ||
| 5795 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 5805 | if (!th.data.only_pk && !th.data.def_pickpu_list) { | 
| 5796 | // getApp().confirmBox("门店库存不足", null, 25000, !1); | 5806 | // getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 5797 | wx.showToast({ | 5807 | wx.showToast({ | 
| @@ -5818,6 +5828,12 @@ Page({ | @@ -5818,6 +5828,12 @@ Page({ | ||
| 5818 | return false; | 5828 | return false; | 
| 5819 | } | 5829 | } | 
| 5820 | 5830 | ||
| 5831 | + //如果开启了,则不在选择门店 | ||
| 5832 | + if(th.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 5833 | + return false; | ||
| 5834 | + } | ||
| 5835 | + | ||
| 5836 | + | ||
| 5821 | 5837 | ||
| 5822 | if (bconfig && bconfig.is_sort_storage) { | 5838 | if (bconfig && bconfig.is_sort_storage) { | 
| 5823 | wx.getLocation({ | 5839 | wx.getLocation({ | 
pages/goods/goodsInfo/goodsInfo.wxml
| @@ -623,13 +623,13 @@ | @@ -623,13 +623,13 @@ | ||
| 623 | </view> | 623 | </view> | 
| 624 | <!-- 门店收货地址 --> | 624 | <!-- 门店收货地址 --> | 
| 625 | <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}"> | 625 | <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}"> | 
| 626 | - <view class="address_frame" bindtap="choice_store" data-ind="0"> | 626 | + <view class="address_frame" bindtap="choice_store" data-ind="0"> | 
| 627 | <view class="flex-vertical-between "> | 627 | <view class="flex-vertical-between "> | 
| 628 | <view class="flex-vertical select_store_height"> | 628 | <view class="flex-vertical select_store_height"> | 
| 629 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 629 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 630 | <view class="fs30" style="color:black;">选择门店</view> | 630 | <view class="fs30" style="color:black;">选择门店</view> | 
| 631 | </view> | 631 | </view> | 
| 632 | - <view class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 632 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red_bb fs26">更多门店<text class="bg_jj"></text></view> | 
| 633 | </view> | 633 | </view> | 
| 634 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 634 | <view wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | 
| 635 | <view class="flex-space-between address ai_end pdv10"> | 635 | <view class="flex-space-between address ai_end pdv10"> | 
| @@ -1243,11 +1243,11 @@ | @@ -1243,11 +1243,11 @@ | ||
| 1243 | </view> | 1243 | </view> | 
| 1244 | </view> | 1244 | </view> | 
| 1245 | <!-- 没有门店的时候 --> | 1245 | <!-- 没有门店的时候 --> | 
| 1246 | - <view class="flex" bindtap="choice_store" wx:else> | 1246 | + <view class="flex" bindtap="choice_store" wx:else> | 
| 1247 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 1247 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | 
| 1248 | <view class="fs30" style="color:black;">选择门店</view> | 1248 | <view class="fs30" style="color:black;">选择门店</view> | 
| 1249 | </view> | 1249 | </view> | 
| 1250 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 1250 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 1251 | </view> | 1251 | </view> | 
| 1252 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 1252 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 
| 1253 | <block wx:else> | 1253 | <block wx:else> | 
pages/team/team_ping/team_ping.js
| @@ -87,7 +87,9 @@ Page({ | @@ -87,7 +87,9 @@ Page({ | ||
| 87 | order = null,//订单数据 | 87 | order = null,//订单数据 | 
| 88 | goods = null,//商品数据 | 88 | goods = null,//商品数据 | 
| 89 | users = null,//会员数据 | 89 | users = null,//会员数据 | 
| 90 | - order_goods=null;//订单商品表 | 90 | + order_goods=null,//订单商品表 | 
| 91 | + team_g=null; | ||
| 92 | + | ||
| 91 | 93 | ||
| 92 | //获取订单表的信息根据活动user_id,pt_prom_id>0 AND pay_time>0 | 94 | //获取订单表的信息根据活动user_id,pt_prom_id>0 AND pay_time>0 | 
| 93 | 95 | ||
| @@ -121,6 +123,15 @@ Page({ | @@ -121,6 +123,15 @@ Page({ | ||
| 121 | order[i].tx=ordertx; | 123 | order[i].tx=ordertx; | 
| 122 | }) | 124 | }) | 
| 123 | 125 | ||
| 126 | + //获取teamgroup中的值 | ||
| 127 | + await getApp().request.promiseGet("/api/weshop/teamgroup/page", { | ||
| 128 | + data: { store_id: os.stoid, listno: order[i].pt_listno,pageSize:1,page:1} | ||
| 129 | + }).then(res => { | ||
| 130 | + team_g = res.data.data.pageData[0] | ||
| 131 | + | ||
| 132 | + }) | ||
| 133 | + | ||
| 134 | + | ||
| 124 | 135 | ||
| 125 | 136 | ||
| 126 | if (order[i].is_zsorder== 4) { | 137 | if (order[i].is_zsorder== 4) { | 
| @@ -132,13 +143,24 @@ Page({ | @@ -132,13 +143,24 @@ Page({ | ||
| 132 | order[i].max_ct_num = num; | 143 | order[i].max_ct_num = num; | 
| 133 | } | 144 | } | 
| 134 | 145 | ||
| 146 | + var head=[]; | ||
| 147 | + if(team_g.is_xuni_ct) { | ||
| 148 | + head=team_g.xuni_head_id.split(","); | ||
| 149 | + order[i].is_xuni_ct=1; | ||
| 150 | + } | ||
| 151 | + | ||
| 135 | var sf_num = order[i].ct_num; | 152 | var sf_num = order[i].ct_num; | 
| 136 | if (order[i].ct_num>=3){ sf_num=3;} | 153 | if (order[i].ct_num>=3){ sf_num=3;} | 
| 137 | sf_num=sf_num-ordertx.length; | 154 | sf_num=sf_num-ordertx.length; | 
| 138 | if(sf_num>0) { | 155 | if(sf_num>0) { | 
| 139 | var arr = []; | 156 | var arr = []; | 
| 140 | for(var j=0;j<sf_num;j++){ | 157 | for(var j=0;j<sf_num;j++){ | 
| 141 | - arr.push(j); | 158 | + if(team_g.is_xuni_ct){ | 
| 159 | + arr.push(head[j]); | ||
| 160 | + }else{ | ||
| 161 | + arr.push(j); | ||
| 162 | + } | ||
| 163 | + | ||
| 142 | } | 164 | } | 
| 143 | order[i].sf_num=arr; | 165 | order[i].sf_num=arr; | 
| 144 | } | 166 | } | 
pages/team/team_ping/team_ping.wxml
| @@ -63,16 +63,9 @@ | @@ -63,16 +63,9 @@ | ||
| 63 | <view class="t-c flex {{item.pt_status==3?'jietitun':''}}"> | 63 | <view class="t-c flex {{item.pt_status==3?'jietitun':''}}"> | 
| 64 | <view>共{{item.order_goods[0].goods_num}}件,</view> | 64 | <view>共{{item.order_goods[0].goods_num}}件,</view> | 
| 65 | <block wx:if="{{item.is_zsorder==4}}"> | 65 | <block wx:if="{{item.is_zsorder==4}}"> | 
| 66 | - <block wx:if="{{item.pt_status==3 || item.pt_status==4 || item.pt_status==5 || item.pt_status==6}}"> | 66 | + | 
| 67 | <view>金额:<text class="xc-wc">¥</text></view> | 67 | <view>金额:<text class="xc-wc">¥</text></view> | 
| 68 | <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount+item.pt_tail_money,2)}}</view> | 68 | <view class='foot-l-wz fs35'>{{filters.toFix(item.user_money+item.order_amount+item.pt_tail_money,2)}}</view> | 
| 69 | - </block> | ||
| 70 | - <block wx:else> | ||
| 71 | - <view class='foot-l-wz fs35' wx:if="item.is_zsorder==4"> | ||
| 72 | - 定金:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view> | ||
| 73 | - <view class='foot-l-wz fs35' wx:else>金额:¥{{filters.toFix(item.order_amount+item.user_money,2)}}</view> | ||
| 74 | - <view class='foot-l-wz2 fs35' wx:if="{{item.pt_tail_money>0}}">尾款:¥{{item.pt_tail_money}}</view> | ||
| 75 | - </block> | ||
| 76 | 69 | ||
| 77 | </block> | 70 | </block> | 
| 78 | <block wx:else> | 71 | <block wx:else> | 
| @@ -91,7 +84,14 @@ | @@ -91,7 +84,14 @@ | ||
| 91 | <view class='foot-l-tx' style="margin-right:20rpx"> | 84 | <view class='foot-l-tx' style="margin-right:20rpx"> | 
| 92 | <view wx:if="{{item.tx}}" style="display: flex"> | 85 | <view wx:if="{{item.tx}}" style="display: flex"> | 
| 93 | <image wx:for="{{item.tx}}" wx:for-item="aitem" src='{{aitem.head_pic}}'></image> | 86 | <image wx:for="{{item.tx}}" wx:for-item="aitem" src='{{aitem.head_pic}}'></image> | 
| 94 | - <image src='{{iurl}}/miniapp/images/shafa.png' wx:for="{{item.sf_num}}"></image> | 87 | + <block wx:if="{{item.is_xuni_ct}}"> | 
| 88 | + <image src='{{iurl}}/miniapp/images/anonymous/anonymous{{item}}.png' wx:for="{{item.sf_num}}"></image> | ||
| 89 | + </block> | ||
| 90 | + <block wx:else> | ||
| 91 | + <image src='{{iurl}}/miniapp/images/shafa.png' wx:for="{{item.sf_num}}"></image> | ||
| 92 | + </block> | ||
| 93 | + | ||
| 94 | + | ||
| 95 | <view class="xc-ellipsis" wx:if="{{item.tx.length>3}}">...</view> | 95 | <view class="xc-ellipsis" wx:if="{{item.tx.length>3}}">...</view> | 
| 96 | </view> | 96 | </view> | 
| 97 | </view> | 97 | </view> | 
pages/team/team_show/team_show.js
| @@ -134,7 +134,8 @@ Page({ | @@ -134,7 +134,8 @@ Page({ | ||
| 134 | 134 | ||
| 135 | var th=this; | 135 | var th=this; | 
| 136 | getApp().getConfig2(function(e) { | 136 | getApp().getConfig2(function(e) { | 
| 137 | - th.setData({ bconfig: e,}); | 137 | + var json_d = JSON.parse(e.switch_list); | 
| 138 | + th.setData({ bconfig: e,sys_switch:json_d}); | ||
| 138 | th.wait_for_store_config(); //获取默认的门店 | 139 | th.wait_for_store_config(); //获取默认的门店 | 
| 139 | }) | 140 | }) | 
| 140 | 141 | ||
| @@ -611,6 +612,8 @@ Page({ | @@ -611,6 +612,8 @@ Page({ | ||
| 611 | th.data.fir_def_store={}; //赋值空对象 | 612 | th.data.fir_def_store={}; //赋值空对象 | 
| 612 | return false; | 613 | return false; | 
| 613 | } | 614 | } | 
| 615 | + | ||
| 616 | + th.setData({has_def:1}) | ||
| 614 | //--定时器推迟一下-- | 617 | //--定时器推迟一下-- | 
| 615 | setTimeout(function () { | 618 | setTimeout(function () { | 
| 616 | if(!th.data.goods) return false; | 619 | if(!th.data.goods) return false; | 
| @@ -1007,7 +1010,13 @@ Page({ | @@ -1007,7 +1010,13 @@ Page({ | ||
| 1007 | choice_store: function(ee) { | 1010 | choice_store: function(ee) { | 
| 1008 | 1011 | ||
| 1009 | var th = this; | 1012 | var th = this; | 
| 1010 | - var bconfig = th.data.bconfig; | 1013 | + var bconfig = th.data.bconfig; | 
| 1014 | + | ||
| 1015 | + //如果开启了,则不在选择门店 | ||
| 1016 | + if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){ | ||
| 1017 | + return false; | ||
| 1018 | + } | ||
| 1019 | + | ||
| 1011 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 1020 | if(!th.data.only_pk && !th.data.def_pickpu_list){ | 
| 1012 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 1021 | getApp().confirmBox("门店库存不足", null, 25000, !1); | 
| 1013 | return false; | 1022 | return false; | 
pages/team/team_show/team_show.wxml
| @@ -229,7 +229,7 @@ | @@ -229,7 +229,7 @@ | ||
| 229 | <view class="fs28 xc-ash-9f">选择门店</view> | 229 | <view class="fs28 xc-ash-9f">选择门店</view> | 
| 230 | </view> | 230 | </view> | 
| 231 | 231 | ||
| 232 | - <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 232 | + <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view> | 
| 233 | 233 | ||
| 234 | 234 | ||
| 235 | </view> | 235 | </view> | 
pages/team/team_success/team_success.js
| @@ -181,6 +181,15 @@ Page({ | @@ -181,6 +181,15 @@ Page({ | ||
| 181 | ordertx = res.data.data.pageData; | 181 | ordertx = res.data.data.pageData; | 
| 182 | }) | 182 | }) | 
| 183 | 183 | ||
| 184 | + var team_g=null; | ||
| 185 | + //获取teamgroup中的值 | ||
| 186 | + await getApp().request.promiseGet("/api/weshop/teamgroup/page", { | ||
| 187 | + data: { store_id: os.stoid, listno: pt_listno,pageSize:1,page:1} | ||
| 188 | + }).then(res => { | ||
| 189 | + team_g = res.data.data.pageData[0] | ||
| 190 | + | ||
| 191 | + }) | ||
| 192 | + | ||
| 184 | 193 | ||
| 185 | var min_price=0; | 194 | var min_price=0; | 
| 186 | //获取活动表的信息根据活动pt_prom_id | 195 | //获取活动表的信息根据活动pt_prom_id | 
| @@ -228,7 +237,7 @@ Page({ | @@ -228,7 +237,7 @@ Page({ | ||
| 228 | 237 | ||
| 229 | //只装5个 | 238 | //只装5个 | 
| 230 | var ordertx2=[],sf_num=0,ct_nun=teamlist.ct_num; | 239 | var ordertx2=[],sf_num=0,ct_nun=teamlist.ct_num; | 
| 231 | - if(max_num){ | 240 | + if(max_num && !team_g.is_xuni_ct){ | 
| 232 | ct_nun=parseInt(max_num); | 241 | ct_nun=parseInt(max_num); | 
| 233 | if (ct_nun < ordertx.length) ct_nun = ordertx.length; | 242 | if (ct_nun < ordertx.length) ct_nun = ordertx.length; | 
| 234 | } | 243 | } | 
| @@ -240,9 +249,23 @@ Page({ | @@ -240,9 +249,23 @@ Page({ | ||
| 240 | ordertx2.push(ordertx[i]); | 249 | ordertx2.push(ordertx[i]); | 
| 241 | } | 250 | } | 
| 242 | 251 | ||
| 252 | + | ||
| 253 | + var head=[]; | ||
| 254 | + if(team_g.is_xuni_ct) { | ||
| 255 | + head=team_g.xuni_head_id.split(","); | ||
| 256 | + order.is_xuni_ct=1; | ||
| 257 | + | ||
| 258 | + this.setData({head:head,}); | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + | ||
| 243 | var sf_arr=[]; | 262 | var sf_arr=[]; | 
| 244 | for (var i=0;i<sf_num;i++){ | 263 | for (var i=0;i<sf_num;i++){ | 
| 245 | - sf_arr.push(i); | 264 | + if(team_g.is_xuni_ct){ | 
| 265 | + sf_arr.push(head[i]); | ||
| 266 | + }else{ | ||
| 267 | + sf_arr.push(i); | ||
| 268 | + } | ||
| 246 | } | 269 | } | 
| 247 | 270 | ||
| 248 | 271 | ||
| @@ -283,6 +306,8 @@ Page({ | @@ -283,6 +306,8 @@ Page({ | ||
| 283 | 306 | ||
| 284 | }) | 307 | }) | 
| 285 | 308 | ||
| 309 | + if(!teamlist.virtual) teamlist.virtual=0; | ||
| 310 | + | ||
| 286 | //--当是成团的时候的操作-- | 311 | //--当是成团的时候的操作-- | 
| 287 | if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ | 312 | if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ | 
| 288 | //设置值 | 313 | //设置值 | 
pages/team/team_success/team_success.wxml
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | </view> | 23 | </view> | 
| 24 | <view class="xc-wc fs24"> | 24 | <view class="xc-wc fs24"> | 
| 25 | <view> | 25 | <view> | 
| 26 | - <view class="">已拼{{teamlist.buy_num}}件</view> | 26 | + <view class="">已拼{{teamlist.buy_num+teamlist.virtual}}件</view> | 
| 27 | <view class="flex xc-valframe t-c"> | 27 | <view class="flex xc-valframe t-c"> | 
| 28 | <view class="xc-frame-img"> | 28 | <view class="xc-frame-img"> | 
| 29 | <image class="picture" src="{{iurl}}/miniapp/images/bai-ren.png"></image> | 29 | <image class="picture" src="{{iurl}}/miniapp/images/bai-ren.png"></image> | 
| @@ -95,8 +95,9 @@ | @@ -95,8 +95,9 @@ | ||
| 95 | <image src='{{item.head_pic}}'></image> | 95 | <image src='{{item.head_pic}}'></image> | 
| 96 | <span wx:if="{{item.is_pt_tz==1}}">团长</span> | 96 | <span wx:if="{{item.is_pt_tz==1}}">团长</span> | 
| 97 | </view> | 97 | </view> | 
| 98 | - <view class='d' wx:for="{{sf_arr}}" wx:if="{{p_status!=2}}"> | ||
| 99 | - <image src='{{iurl}}/miniapp/images/shafa.png'></image> | 98 | + <view class='d' wx:for="{{sf_arr}}"> | 
| 99 | + <image wx:if="{{teamgroup.is_xuni_ct}}" src='{{iurl}}/miniapp/images/anonymous/anonymous{{item}}.png'></image> | ||
| 100 | + <image wx:else src='{{iurl}}/miniapp/images/shafa.png'></image> | ||
| 100 | </view> | 101 | </view> | 
| 101 | 102 | ||
| 102 | <view class='xc-ellipsis-img flex-vertical' wx:if="{{ordertx.length>5}}"> | 103 | <view class='xc-ellipsis-img flex-vertical' wx:if="{{ordertx.length>5}}"> | 
| @@ -143,7 +144,7 @@ | @@ -143,7 +144,7 @@ | ||
| 143 | <!-- 会员团 --> | 144 | <!-- 会员团 --> | 
| 144 | <view class='bodytimecen' wx:if='{{(teamlist.kttype==1 || teamlist.kttype==2) && p_status==2}}'> | 145 | <view class='bodytimecen' wx:if='{{(teamlist.kttype==1 || teamlist.kttype==2) && p_status==2}}'> | 
| 145 | 已经有 | 146 | 已经有 | 
| 146 | - <text class="xc-wc">{{ordertx.length}}</text>人参团, 拼团成功。 | 147 | + <text class="xc-wc">{{ordertx.length>teamlist.ct_num?ordertx.length:teamlist.ct_num}}</text>人参团, 拼团成功。 | 
| 147 | </view> | 148 | </view> | 
| 148 | 149 | ||
| 149 | <!----//旁边直线----> | 150 | <!----//旁边直线----> | 
| @@ -215,6 +216,15 @@ | @@ -215,6 +216,15 @@ | ||
| 215 | </view> | 216 | </view> | 
| 216 | 217 | ||
| 217 | 218 | ||
| 219 | + <view class='zhangxi' hidden="{{hiddenName}}" wx:for="{{head}}" > | ||
| 220 | + <view class='img rel'> | ||
| 221 | + <image src='{{iurl}}/miniapp/images/anonymous/anonymous{{item}}.png'></image>匿名 | ||
| 222 | + </view> | ||
| 223 | + <view class='zssj'>{{filters.format_time(teamgroup.buyenddate,1)}} 参团</view> | ||
| 224 | + <view class="clear"></view> | ||
| 225 | + </view> | ||
| 226 | + | ||
| 227 | + | ||
| 218 | <view class='clear'></view> | 228 | <view class='clear'></view> | 
| 219 | </view> | 229 | </view> | 
| 220 | <view class='clear'></view> | 230 | <view class='clear'></view> | 
utils/util.js
| @@ -514,6 +514,83 @@ function wx_back() { | @@ -514,6 +514,83 @@ function wx_back() { | ||
| 514 | } | 514 | } | 
| 515 | } | 515 | } | 
| 516 | 516 | ||
| 517 | + | ||
| 518 | +//-------------------计算物流--------------- | ||
| 519 | +function calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | ||
| 520 | + goods_piece, user_addr, back_data,rs) { | ||
| 521 | + var price = 0; | ||
| 522 | + price += parseFloat(o_shipping_price); | ||
| 523 | + if (user_addr == null) { | ||
| 524 | + return 0; | ||
| 525 | + } | ||
| 526 | + //如果是包邮 | ||
| 527 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods && out_of_weight >= 0) { | ||
| 528 | + return 0; | ||
| 529 | + } | ||
| 530 | + //计算物流的config item; | ||
| 531 | + var item = null; | ||
| 532 | + | ||
| 533 | + //------------循环获取config----------- | ||
| 534 | + function get_wuliu_config(region_id, code, rs) { | ||
| 535 | + var item = null, rslist = rs.pageData; | ||
| 536 | + for (var i = 0; i < rslist.length; i++) { | ||
| 537 | + if (rslist[i].code == code && rslist[i].region_id == region_id) { | ||
| 538 | + item = rslist[i]; | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + return item; | ||
| 542 | + } | ||
| 543 | + //-------循环获取config,code default------- | ||
| 544 | + function get_wuliu_default(code, rs) { | ||
| 545 | + var item = null, rslist = rs.pageData; | ||
| 546 | + for (var i = 0; i < rslist.length; i++) { | ||
| 547 | + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { | ||
| 548 | + item = rslist[i]; | ||
| 549 | + } | ||
| 550 | + } | ||
| 551 | + return item; | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + //先根据 镇 县 区找计算的config | ||
| 555 | + item = get_wuliu_config(user_addr.district, code, rs); | ||
| 556 | + if (item == null) item = get_wuliu_config(user_addr.city, code, rs); | ||
| 557 | + if (item == null) item = get_wuliu_config(user_addr.province, code, rs); | ||
| 558 | + if (item == null) item = get_wuliu_default(code, rs); | ||
| 559 | + if (item == null) return o_shipping_price; | ||
| 560 | + var fw_price = 0, fp_price = 0; | ||
| 561 | + item = item.config; | ||
| 562 | + if (item == null) return o_shipping_price; | ||
| 563 | + | ||
| 564 | + //------超出重量---------- | ||
| 565 | + if (back_data && back_data.is_by_all && out_of_weight<0){ | ||
| 566 | + goods_weight+=out_of_weight; | ||
| 567 | + if(goods_weight<=0) goods_weight=-1; | ||
| 568 | + } | ||
| 569 | + | ||
| 570 | + //------按重量---------- | ||
| 571 | + if (goods_weight >= 0 && item['money']) { | ||
| 572 | + fw_price = parseFloat(item['money']); | ||
| 573 | + if (goods_weight > item['first_weight']) { | ||
| 574 | + var fw = goods_weight - item['first_weight']; | ||
| 575 | + var n = Math.ceil(fw / item['second_weight']) | ||
| 576 | + fw_price = fw_price + n * parseFloat(item['add_money']); | ||
| 577 | + } | ||
| 578 | + } | ||
| 579 | + | ||
| 580 | + //------按件数---------- | ||
| 581 | + if (goods_piece > 0 && item['piecemoney']) { | ||
| 582 | + fp_price = parseFloat(item['piecemoney']); | ||
| 583 | + if (goods_piece > item['first_piece']) { | ||
| 584 | + var fp = goods_piece - item['first_piece']; | ||
| 585 | + var m = Math.ceil(fp / item['second_piece']) | ||
| 586 | + fp_price = fp_price + m * parseFloat(item['add_piecemoney']); | ||
| 587 | + } | ||
| 588 | + } | ||
| 589 | + | ||
| 590 | + var rspice = parseFloat(price + fw_price + fp_price); | ||
| 591 | + return rspice; | ||
| 592 | +} | ||
| 593 | + | ||
| 517 | module.exports = { | 594 | module.exports = { | 
| 518 | formatTime: function(e, r) { | 595 | formatTime: function(e, r) { | 
| 519 | var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { | 596 | var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { | 
| @@ -627,4 +704,5 @@ module.exports = { | @@ -627,4 +704,5 @@ module.exports = { | ||
| 627 | ajax_ok2:ajax_ok2, //将JS数组对象按其某个键值重组成Map对象 | 704 | ajax_ok2:ajax_ok2, //将JS数组对象按其某个键值重组成Map对象 | 
| 628 | wx_back:wx_back, | 705 | wx_back:wx_back, | 
| 629 | _debounce, | 706 | _debounce, | 
| 707 | + calculatewuliu:calculatewuliu, //计算物流的函数进行抽象 | ||
| 630 | }; | 708 | }; |