Commit b75e17a029eec95ea058b09db8fae163cf51287a
1 parent
22911483
1、only_pk.length && !only_pk.length 的优化
2、商品的指定门店的优化
Showing
5 changed files
with
57 additions
and
52 deletions
pages/goods/goodsInfo/buy_com_pop.wxml
| ... | ... | @@ -129,7 +129,7 @@ | 
| 129 | 129 | <block wx:else> | 
| 130 | 130 | |
| 131 | 131 | |
| 132 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
| 132 | + <block wx:if="{{only_pk && !only_pk.length}}"> | |
| 133 | 133 | <view class="spec-cart-btn fs32" data-action="add" | 
| 134 | 134 | style="background-color: #dcdcdc;color: #999;">库存不足 | 
| 135 | 135 | </view> | ... | ... | 
pages/goods/goodsInfo/buy_integral.wxml
| ... | ... | @@ -93,7 +93,7 @@ | 
| 93 | 93 | <block wx:else> | 
| 94 | 94 | |
| 95 | 95 | |
| 96 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
| 96 | + <block wx:if="{{only_pk && !only_pk.length}}"> | |
| 97 | 97 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | 
| 98 | 98 | </block> | 
| 99 | 99 | <block wx:else> | ... | ... | 
pages/goods/goodsInfo/buy_pt.wxml
| ... | ... | @@ -174,7 +174,7 @@ | 
| 174 | 174 | <block wx:else> | 
| 175 | 175 | |
| 176 | 176 | |
| 177 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
| 177 | + <block wx:if="{{only_pk && !only_pk.length}}"> | |
| 178 | 178 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | 
| 179 | 179 | </block> | 
| 180 | 180 | <block wx:else> | ... | ... | 
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -3703,66 +3703,71 @@ Page({ | 
| 3703 | 3703 | def_pick_store: th.data.def_pick_store | 
| 3704 | 3704 | }) | 
| 3705 | 3705 | } | 
| 3706 | - | |
| 3707 | 3706 | } | 
| 3708 | 3707 | |
| 3709 | - var his_cate_num = 0; | |
| 3710 | - for (let i in e.data.data.pageData) { | |
| 3711 | - let item = e.data.data.pageData[i]; | |
| 3712 | - if (item.category_id > 0) { | |
| 3713 | - his_cate_num = 1; | |
| 3714 | - } | |
| 3715 | - if (getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { | |
| 3716 | - e.data.data.pageData[i].CanOutQty = 100000; | |
| 3708 | + //过滤后门店数量还是要大于0 | |
| 3709 | + if(e.data.data.pageData.length > 0) { | |
| 3710 | + | |
| 3711 | + var his_cate_num = 0; | |
| 3712 | + for (let i in e.data.data.pageData) { | |
| 3713 | + let item = e.data.data.pageData[i]; | |
| 3714 | + if (item.category_id > 0) { | |
| 3715 | + his_cate_num = 1; | |
| 3716 | + } | |
| 3717 | + if (getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { | |
| 3718 | + e.data.data.pageData[i].CanOutQty = 100000; | |
| 3719 | + } | |
| 3717 | 3720 | } | 
| 3718 | - } | |
| 3719 | 3721 | |
| 3720 | - e.his_cate_num = his_cate_num; | |
| 3722 | + e.his_cate_num = his_cate_num; | |
| 3721 | 3723 | |
| 3722 | - if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}' && | |
| 3723 | - getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { | |
| 3724 | - th.setData({ | |
| 3725 | - 'def_pick_store.CanOutQty': 100000 | |
| 3726 | - }) | |
| 3727 | - } | |
| 3724 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}' && | |
| 3725 | + getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { | |
| 3726 | + th.setData({ | |
| 3727 | + 'def_pick_store.CanOutQty': 100000 | |
| 3728 | + }) | |
| 3729 | + } | |
| 3728 | 3730 | |
| 3729 | - //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
| 3730 | - if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
| 3731 | - th.setData({ | |
| 3732 | - def_pick_store: e.data.data.pageData[0], | |
| 3733 | - sto_sele_name: e.data.data.pageData[0].pickup_name, | |
| 3734 | - sto_sele_id: e.data.data.pageData[0].pickup_id, | |
| 3735 | - sto_sele_distr: e.data.data.pageData[0].distr_type | |
| 3736 | - }); | |
| 3737 | - th.data.fir_def_store = e.data.data.pageData[0]; | |
| 3738 | - } | |
| 3731 | + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
| 3732 | + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
| 3733 | + th.setData({ | |
| 3734 | + def_pick_store: e.data.data.pageData[0], | |
| 3735 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
| 3736 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
| 3737 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
| 3738 | + }); | |
| 3739 | + th.data.fir_def_store = e.data.data.pageData[0]; | |
| 3740 | + } | |
| 3739 | 3741 | |
| 3740 | - //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
| 3741 | - if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
| 3742 | - for (var k = 0; k < e.data.data.pageData.length; k++) { | |
| 3743 | - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
| 3744 | - e.data.data.pageData.splice(k, 1); //删除 | |
| 3745 | - break; | |
| 3742 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
| 3743 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
| 3744 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | |
| 3745 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
| 3746 | + e.data.data.pageData.splice(k, 1); //删除 | |
| 3747 | + break; | |
| 3748 | + } | |
| 3746 | 3749 | } | 
| 3750 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 3747 | 3751 | } | 
| 3748 | - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 3749 | - } | |
| 3750 | 3752 | |
| 3751 | 3753 | |
| 3752 | - th.setData({ | |
| 3753 | - all_pick_list: e.data.data.pageData | |
| 3754 | - }); | |
| 3754 | + th.setData({ | |
| 3755 | + all_pick_list: e.data.data.pageData | |
| 3756 | + }); | |
| 3755 | 3757 | |
| 3756 | - //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- | |
| 3757 | - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules | |
| 3758 | - && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
| 3759 | - setTimeout(function () { | |
| 3760 | - th.deal_pickup_dline(e); | |
| 3761 | - }, 800) | |
| 3762 | - } else { | |
| 3763 | - setTimeout(function () { | |
| 3764 | - th.deal_pickup(e); //--普通门店排版-- | |
| 3765 | - }, 800) | |
| 3758 | + //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- | |
| 3759 | + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules | |
| 3760 | + && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
| 3761 | + setTimeout(function () { | |
| 3762 | + th.deal_pickup_dline(e); | |
| 3763 | + }, 800) | |
| 3764 | + } else { | |
| 3765 | + setTimeout(function () { | |
| 3766 | + th.deal_pickup(e); //--普通门店排版-- | |
| 3767 | + }, 800) | |
| 3768 | + } | |
| 3769 | + }else{ | |
| 3770 | + wx.hideLoading(); | |
| 3766 | 3771 | } | 
| 3767 | 3772 | } else { | 
| 3768 | 3773 | wx.hideLoading(); | ... | ... | 
pages/goods/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -1426,7 +1426,7 @@ | 
| 1426 | 1426 | </view> | 
| 1427 | 1427 | </block> | 
| 1428 | 1428 | <block wx:else> | 
| 1429 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
| 1429 | + <block wx:if="{{only_pk && !only_pk.length}}"> | |
| 1430 | 1430 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | 
| 1431 | 1431 | 库存不足 | 
| 1432 | 1432 | </view> | ... | ... | 
