Commit 08981e0baa74fbaf049c50db3b1ac3da13a8a872
1 parent
961ce8e2
天天拼团的卡项的优化
Showing
3 changed files
with
83 additions
and
36 deletions
packageA/pages/serviceCard_pd/goodsInfo/buy_pt.wxml
| ... | ... | @@ -54,7 +54,8 @@ |
| 54 | 54 | |
| 55 | 55 | <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view> |
| 56 | 56 | </view> |
| 57 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 57 | + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(该店不可售)</view> | |
| 58 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_act}}">(该店不可售)</view> | |
| 58 | 59 | <view class="no_store" wx:elif="{{is_normal && def_pick_store && def_pick_store.CanOutQty<=0}}">(库存不足)</view> |
| 59 | 60 | <view class="fs24 xc-ash-9f xc-distance-top" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> |
| 60 | 61 | </view> |
| ... | ... | @@ -187,9 +188,12 @@ |
| 187 | 188 | <block wx:else> |
| 188 | 189 | <!-- 根本就找不到门店 --> |
| 189 | 190 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
| 190 | - <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
| 191 | - </block> | |
| 192 | - <block wx:else> | |
| 191 | + <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
| 192 | + </block> | |
| 193 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}"> | |
| 194 | + <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
| 195 | + </block> | |
| 196 | + <block wx:else> | |
| 193 | 197 | <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view> |
| 194 | 198 | </block> |
| 195 | 199 | </block> | ... | ... |
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
| ... | ... | @@ -354,17 +354,18 @@ Page({ |
| 354 | 354 | if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) |
| 355 | 355 | var ee = JSON.parse(JSON.stringify(e)); |
| 356 | 356 | //--定时器推迟一下-- |
| 357 | - setTimeout(function () { | |
| 358 | - if (!th.data.data) return false; | |
| 359 | - var ser_card = th.data.data; | |
| 360 | - //--如果默认门店不在等级卡的默认们店以内 | |
| 361 | - if (ser_card.storageId != null && ser_card.storageId != "" && ser_card.storageId.indexOf(ee.keyid) == -1) { | |
| 362 | - ee.is_no_dis = 1; | |
| 363 | - } | |
| 364 | 357 | |
| 365 | 358 | var appd = getApp().globalData; |
| 366 | 359 | var w_time = setInterval(function () { |
| 367 | 360 | if (that.data.is_get_local_ok == 0) return false; |
| 361 | + | |
| 362 | + if (!th.data.data) return false; | |
| 363 | + var ser_card = th.data.data; | |
| 364 | + //--如果默认门店不在等级卡的默认们店以内 | |
| 365 | + if (ser_card.storageId != null && ser_card.storageId != "" && ser_card.storageId.indexOf(ee.keyid) == -1) { | |
| 366 | + ee.is_no_dis = 1; | |
| 367 | + } | |
| 368 | + | |
| 368 | 369 | clearInterval(w_time); |
| 369 | 370 | var distance = null; |
| 370 | 371 | var e = JSON.parse(JSON.stringify(ee)); |
| ... | ... | @@ -429,7 +430,7 @@ Page({ |
| 429 | 430 | } |
| 430 | 431 | } |
| 431 | 432 | }, 500) |
| 432 | - }, 700) | |
| 433 | + | |
| 433 | 434 | |
| 434 | 435 | }); |
| 435 | 436 | |
| ... | ... | @@ -1219,6 +1220,8 @@ Page({ |
| 1219 | 1220 | var th = this, that = this; |
| 1220 | 1221 | var timer_get = setInterval(function () { |
| 1221 | 1222 | if (th.data.is_get_local_ok == 0) return false; |
| 1223 | + if (!th.data.fir_def_store) return false; | |
| 1224 | + | |
| 1222 | 1225 | var i = getApp().request; |
| 1223 | 1226 | if (!th.data.data) return false; |
| 1224 | 1227 | var dd = { |
| ... | ... | @@ -1272,31 +1275,67 @@ Page({ |
| 1272 | 1275 | } |
| 1273 | 1276 | } |
| 1274 | 1277 | |
| 1275 | - //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
| 1276 | - if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
| 1277 | - th.setData({ | |
| 1278 | - def_pick_store: e.data.data.pageData[0], | |
| 1279 | - sto_sele_name: e.data.data.pageData[0].pickup_name, | |
| 1280 | - sto_sele_id: e.data.data.pageData[0].pickup_id, | |
| 1281 | - sto_sele_distr: e.data.data.pageData[0].distr_type, | |
| 1282 | - sto_sele_keyid: e.data.data.pageData[0].keyid, | |
| 1283 | - }); | |
| 1284 | - th.data.fir_def_store = e.data.data.pageData[0]; | |
| 1285 | - } | |
| 1278 | + //如果有秒杀的指定门店 | |
| 1279 | + if(th.data.prom_type==6 && th.data.prom_act && th.data.prom_act.pick_up_lists && e.data.data.pageData.length){ | |
| 1280 | + var pick_up_lists=th.data.prom_act.pick_up_lists; | |
| 1281 | + for (var kq = 0; kq < e.data.data.pageData.length; kq++) { | |
| 1282 | + var it0=e.data.data.pageData[kq]; | |
| 1283 | + var idx0=pick_up_lists.findIndex(function (e){ | |
| 1284 | + return e.pickup_id==it0.pickup_id; | |
| 1285 | + }) | |
| 1286 | + if (idx0<0) { | |
| 1287 | + //删除 | |
| 1288 | + e.data.data.pageData.splice(kq--, 1); | |
| 1289 | + } | |
| 1290 | + } | |
| 1286 | 1291 | |
| 1287 | - //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
| 1288 | - if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
| 1289 | - for (var k = 0; k < e.data.data.pageData.length; k++) { | |
| 1290 | - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
| 1291 | - e.data.data.pageData.splice(k, 1); //删除 | |
| 1292 | - break; | |
| 1292 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}'){ | |
| 1293 | + //-- 查找一下门店有没有在 -- | |
| 1294 | + var idx1=pick_up_lists.findIndex(function (e){ | |
| 1295 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
| 1296 | + }) | |
| 1297 | + if(idx1<0){ | |
| 1298 | + //如果是秒杀的指定门店,就要设置秒杀的 | |
| 1299 | + th.data.def_pick_store.is_no_dis_act=1; | |
| 1300 | + that.setData({ | |
| 1301 | + def_pick_store: th.data.def_pick_store | |
| 1302 | + }) | |
| 1293 | 1303 | } |
| 1294 | 1304 | } |
| 1295 | - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 1305 | + | |
| 1296 | 1306 | } |
| 1297 | 1307 | |
| 1298 | - th.setData({all_pick_list: e.data.data.pageData}); | |
| 1299 | - th.deal_pickup(e); | |
| 1308 | + //-- 如果门店过滤后,还会是数量 -- | |
| 1309 | + if(e.data.data.pageData.length) { | |
| 1310 | + | |
| 1311 | + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
| 1312 | + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
| 1313 | + th.setData({ | |
| 1314 | + def_pick_store: e.data.data.pageData[0], | |
| 1315 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
| 1316 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
| 1317 | + sto_sele_distr: e.data.data.pageData[0].distr_type, | |
| 1318 | + sto_sele_keyid: e.data.data.pageData[0].keyid, | |
| 1319 | + }); | |
| 1320 | + th.data.fir_def_store = e.data.data.pageData[0]; | |
| 1321 | + } | |
| 1322 | + | |
| 1323 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
| 1324 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
| 1325 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | |
| 1326 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
| 1327 | + e.data.data.pageData.splice(k, 1); //删除 | |
| 1328 | + break; | |
| 1329 | + } | |
| 1330 | + } | |
| 1331 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 1332 | + } | |
| 1333 | + | |
| 1334 | + th.setData({all_pick_list: e.data.data.pageData}); | |
| 1335 | + th.deal_pickup(e); | |
| 1336 | + }else{ | |
| 1337 | + wx.hideLoading(); | |
| 1338 | + } | |
| 1300 | 1339 | }, 800) |
| 1301 | 1340 | |
| 1302 | 1341 | } | ... | ... |
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -224,7 +224,8 @@ |
| 224 | 224 | <block wx:else> |
| 225 | 225 | <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(未找到门店)</view> |
| 226 | 226 | <block wx:else> |
| 227 | - <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 227 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(该店不可售)</view> | |
| 228 | + <view class="no_store" wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}">(该店不可售)</view> | |
| 228 | 229 | </block> |
| 229 | 230 | </block> |
| 230 | 231 | |
| ... | ... | @@ -670,8 +671,9 @@ |
| 670 | 671 | <view class="flex xc-ash" style="flex-shrink:0;max-width: 62%;" > |
| 671 | 672 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
| 672 | 673 | <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> |
| 673 | - <text class="no_store">(配送不匹配)</text> | |
| 674 | + <text class="no_store">(该店不可售)</text> | |
| 674 | 675 | </block> |
| 676 | + <text wx:elif="{{item.is_no_dis_act}}" class="no_store">(该店不可售)</text> | |
| 675 | 677 | </view> |
| 676 | 678 | </view> |
| 677 | 679 | <view> |
| ... | ... | @@ -700,8 +702,9 @@ |
| 700 | 702 | <view class="flex xc-ash"> |
| 701 | 703 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
| 702 | 704 | <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> |
| 703 | - <text class="no_store">(配送不匹配)</text> | |
| 705 | + <text class="no_store">(该店不可售)</text> | |
| 704 | 706 | </block> |
| 707 | + <text wx:elif="{{item.is_no_dis_act}}" class="no_store">(该店不可售)</text> | |
| 705 | 708 | </view> |
| 706 | 709 | </view> |
| 707 | 710 | <view> |
| ... | ... | @@ -732,8 +735,9 @@ |
| 732 | 735 | <view class="flex xc-ash"> |
| 733 | 736 | <view class="fs28 xc-black3 address_name">{{item.pickup_name}} |
| 734 | 737 | <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> |
| 735 | - <text class="no_store">(配送不匹配)</text> | |
| 738 | + <text class="no_store">(该店不可售)</text> | |
| 736 | 739 | </block> |
| 740 | + <text wx:elif="{{item.is_no_dis_act}}" class="no_store">(该店不可售)</text> | |
| 737 | 741 | </view> |
| 738 | 742 | </view> |
| 739 | 743 | <view> | ... | ... |