Commit 2e6231c069268bd055692c573c0b1ebfce791034
Merge branch 'dev_pickup_fu' into dev
Showing
11 changed files
with
309 additions
and
33 deletions
app.js
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
... | ... | @@ -72,6 +72,7 @@ |
72 | 72 | </view> |
73 | 73 | </view> |
74 | 74 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
75 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(配送不匹配)</view> | |
75 | 76 | <view class="no_store" wx:elif="{{is_normal && def_pick_store && def_pick_store.CanOutQty<=0 && !filters.is_virtual_gd(sele_g.is_virtual) }}">(库存不足)</view> |
76 | 77 | <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> |
77 | 78 | </view> |
... | ... | @@ -174,6 +175,11 @@ |
174 | 175 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
175 | 176 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> |
176 | 177 | </block> |
178 | + | |
179 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor && is_normal}}"> | |
180 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
181 | + </block> | |
182 | + | |
177 | 183 | <block wx:else> |
178 | 184 | |
179 | 185 | <!-- 根本就找不到门店 --> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -852,6 +852,7 @@ Page({ |
852 | 852 | ee.is_no_dis = 1; |
853 | 853 | } |
854 | 854 | |
855 | + | |
855 | 856 | var appd = getApp().globalData; |
856 | 857 | var w_time = setInterval(function () { |
857 | 858 | if (that.data.is_get_local_ok == 0) return false; |
... | ... | @@ -2943,6 +2944,11 @@ Page({ |
2943 | 2944 | } |
2944 | 2945 | |
2945 | 2946 | |
2947 | + }else{ | |
2948 | + //只有是普通商品购买的时候,才要给商品赋值指定门店 | |
2949 | + if (is_normal && goodsinfo.pick_group_ids) { | |
2950 | + goodsinfo.pickup_ids = goodsinfo.pick_up_lists; | |
2951 | + } | |
2946 | 2952 | } |
2947 | 2953 | //---如果有活动,不算在一起--- |
2948 | 2954 | if (prom) { |
... | ... | @@ -2954,8 +2960,11 @@ Page({ |
2954 | 2960 | } |
2955 | 2961 | } |
2956 | 2962 | |
2957 | - | |
2958 | 2963 | var item = arrdata[i], gg = ""; |
2964 | + if (goodsinfo.goods_id != g_id && goodsinfo.pick_group_ids ) { | |
2965 | + item.pickup_ids= goodsinfo.pick_up_lists; | |
2966 | + } | |
2967 | + | |
2959 | 2968 | if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; |
2960 | 2969 | if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; |
2961 | 2970 | |
... | ... | @@ -3003,6 +3012,15 @@ Page({ |
3003 | 3012 | var gid = e.currentTarget.dataset.gid; |
3004 | 3013 | var nor = e.currentTarget.dataset.nor; |
3005 | 3014 | |
3015 | + //在切换规格的时候,指定门店不匹配的状态要清理 | |
3016 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3017 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3018 | + that.setData({ | |
3019 | + def_pick_store: th.data.def_pick_store | |
3020 | + }) | |
3021 | + } | |
3022 | + | |
3023 | + | |
3006 | 3024 | var sku_g = this.data.sku_g; |
3007 | 3025 | if (nor) { |
3008 | 3026 | sku_g = this.data.sku_g_pt; |
... | ... | @@ -3221,6 +3239,42 @@ Page({ |
3221 | 3239 | |
3222 | 3240 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
3223 | 3241 | |
3242 | + //-- 如果有指定门店的时候 -- | |
3243 | + if(th.data.sele_g.pickup_ids && th.data.is_normal){ | |
3244 | + | |
3245 | + var ok_arr=[]; | |
3246 | + for (let i in e.data.data.pageData) { | |
3247 | + let ite = e.data.data.pageData[i]; | |
3248 | + //-- 查找一下门店有没有在 -- | |
3249 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3250 | + return e.pickup_id==ite.pickup_id; | |
3251 | + }) | |
3252 | + if(idx>-1){ | |
3253 | + ok_arr.push(ite) | |
3254 | + } | |
3255 | + } | |
3256 | + | |
3257 | + //判断会员的默认的门店是不是匹配指定的门店 | |
3258 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3259 | + //-- 查找一下门店有没有在 -- | |
3260 | + var idx1=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3261 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
3262 | + }) | |
3263 | + | |
3264 | + if(idx1<0){ | |
3265 | + th.data.def_pick_store.is_no_dis_nor=1; | |
3266 | + that.setData({ | |
3267 | + def_pick_store: th.data.def_pick_store | |
3268 | + }) | |
3269 | + } | |
3270 | + } | |
3271 | + | |
3272 | + | |
3273 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
3274 | + e.data.data.total=ok_arr.length; //数组的长度 | |
3275 | + } | |
3276 | + | |
3277 | + | |
3224 | 3278 | var his_cate_num = 0; |
3225 | 3279 | for (let i in e.data.data.pageData) { |
3226 | 3280 | let item = e.data.data.pageData[i]; |
... | ... | @@ -4497,14 +4551,19 @@ Page({ |
4497 | 4551 | if (ind == 1) { |
4498 | 4552 | //如果拼单的sku data是空的,就要先获取一下 |
4499 | 4553 | if (th.data.sku_g_pt) { |
4554 | + | |
4555 | + //要同步指定门店 | |
4556 | + th.set_sele_g(th.data.sku_g_pt); | |
4557 | + | |
4500 | 4558 | th.get_sto(1); |
4501 | 4559 | th.setData({ |
4502 | 4560 | is_normal: ind, |
4503 | 4561 | openSpecModal_pt: 1 |
4504 | 4562 | }); |
4505 | 4563 | } else { |
4506 | - th.get_sto(1); | |
4564 | + | |
4507 | 4565 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
4566 | + th.get_sto(1); | |
4508 | 4567 | th.setData({ |
4509 | 4568 | is_normal: ind, |
4510 | 4569 | openSpecModal_pt: 1 |
... | ... | @@ -7240,5 +7299,17 @@ Page({ |
7240 | 7299 | }, |
7241 | 7300 | |
7242 | 7301 | |
7302 | + //要同步sele_g的指定门店,在有单独购买的时候,积分购和拼团 | |
7303 | + set_sele_g:function (sku_list){ | |
7304 | + var goods_id=this.data.sele_g.goods_id; | |
7305 | + for (var i in sku_list) { | |
7306 | + if(goods_id==sku_list[i].goods_id){ | |
7307 | + this.data.sele_g.pickup_ids=sku_list[i].pickup_ids; | |
7308 | + break; | |
7309 | + } | |
7310 | + } | |
7311 | + } | |
7312 | + | |
7313 | + | |
7243 | 7314 | |
7244 | 7315 | }); | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... | ... | @@ -1370,6 +1370,8 @@ |
1370 | 1370 | <view class="flex-vertical-between butttem5"> |
1371 | 1371 | <view class="flex xc-ash" style="flex-shrink:0;max-width: 62%;"> |
1372 | 1372 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> |
1373 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1374 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(配送不匹配)</text> | |
1373 | 1375 | </view> |
1374 | 1376 | <view> |
1375 | 1377 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> |
... | ... | @@ -1396,6 +1398,8 @@ |
1396 | 1398 | <view class="flex-vertical-between "> |
1397 | 1399 | <view class="flex xc-ash"> |
1398 | 1400 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> |
1401 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1402 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(配送不匹配)</text> | |
1399 | 1403 | </view> |
1400 | 1404 | <view> |
1401 | 1405 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -319,6 +319,7 @@ Page({ |
319 | 319 | }, 800) |
320 | 320 | } |
321 | 321 | }, |
322 | + | |
322 | 323 | //失效单选 |
323 | 324 | inCheck_th_item: async function (e) { |
324 | 325 | console.log('失效单选'); |
... | ... | @@ -336,6 +337,8 @@ Page({ |
336 | 337 | // this.doCheckAll(); |
337 | 338 | |
338 | 339 | }, |
340 | + | |
341 | + | |
339 | 342 | //清空失效宝贝 |
340 | 343 | delInva_all(obj = null) { |
341 | 344 | |
... | ... | @@ -3317,7 +3320,25 @@ Page({ |
3317 | 3320 | var steep = getApp().get_limit_qty(i_arr[j], act.length, 1); |
3318 | 3321 | var py_type = parseInt(i_arr[j].prom_type + ''); |
3319 | 3322 | |
3323 | + //商品只查一次。看一下有没有 | |
3324 | + var gd = null; | |
3325 | + //获取商品信息,包含线下商品ID,指定门店销售的信息 | |
3326 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | |
3327 | + if (res.data.code == 0) gd = res.data.data; | |
3328 | + }) | |
3329 | + | |
3320 | 3330 | if ([0, 3, 5, 7, 10].indexOf(py_type) > -1) { |
3331 | + //如果是指定门店,就要判断 | |
3332 | + if(gd.pick_group_ids){ | |
3333 | + var idx0=gd.pick_up_lists.findIndex(function (e){ | |
3334 | + return e.pickup_id==i_arr[j].pick_id; | |
3335 | + }) | |
3336 | + if(idx0<0){ | |
3337 | + getApp().confirmBox(i_arr[j].goods_name + "的指定门店不匹配"); | |
3338 | + wx.hideLoading(); | |
3339 | + return false; | |
3340 | + } | |
3341 | + } | |
3321 | 3342 | |
3322 | 3343 | if (mo_num > i_arr[j].goods_num) { |
3323 | 3344 | getApp().confirmBox(i_arr[j].goods_name + "的未达到起订数量"); |
... | ... | @@ -3342,16 +3363,12 @@ Page({ |
3342 | 3363 | |
3343 | 3364 | } |
3344 | 3365 | |
3345 | - | |
3346 | 3366 | //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- |
3347 | 3367 | if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].prom_type == 7 || i_arr[j].prom_type == 10 || |
3348 | 3368 | i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { |
3349 | - //--获取商品的线下商品ID-- | |
3350 | 3369 | |
3351 | - var gd = null; | |
3352 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | |
3353 | - if (res.data.code == 0) gd = res.data.data; | |
3354 | - }) | |
3370 | + | |
3371 | + | |
3355 | 3372 | |
3356 | 3373 | //--判断商品是线下库存-- |
3357 | 3374 | var ob = {} | ... | ... |
pages/goods/goodsInfo/buy_com_pop.wxml
... | ... | @@ -57,6 +57,7 @@ |
57 | 57 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
58 | 58 | <block wx:else> |
59 | 59 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
60 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor}}">(配送不匹配)</view> | |
60 | 61 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2}}"> |
61 | 62 | (库存不足) |
62 | 63 | </view> |
... | ... | @@ -112,6 +113,12 @@ |
112 | 113 | 配送不匹配 |
113 | 114 | </view> |
114 | 115 | </block> |
116 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}"> | |
117 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
118 | + 配送不匹配 | |
119 | + </view> | |
120 | + </block> | |
121 | + | |
115 | 122 | <block wx:else> |
116 | 123 | <!-- 根本就找不到门店 --> |
117 | 124 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> | ... | ... |
pages/goods/goodsInfo/buy_pt.wxml
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | <view style="clear: both"></view> |
49 | 49 | <view style="margin-top: 20rpx"> |
50 | - <view class="flex-space-between address ai_end xc-width "> | |
50 | + <view class="flex-space-between address ai_end xc-width "> | |
51 | 51 | |
52 | 52 | <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> |
53 | 53 | <text class="fs30 xc-black3 shop_name {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text> |
... | ... | @@ -65,17 +65,19 @@ |
65 | 65 | |
66 | 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 | 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="{{def_pick_store.is_no_dis_nor && is_normal==1}}">(配送不匹配)</view>--> | |
69 | 70 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> |
70 | 71 | <block wx:else> |
71 | 72 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
72 | 73 | <block wx:else> |
73 | 74 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
75 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal==1}}">(配送不匹配)</view> | |
74 | 76 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && is_normal}}">(库存不足)</view> |
75 | 77 | </block> |
76 | 78 | </block> |
77 | 79 | |
78 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | |
80 | + <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.pickup_name}}">地址:{{def_pick_store.fulladdress}}</view> | |
79 | 81 | </view> |
80 | 82 | <!----商品的属性项目----> |
81 | 83 | <view> |
... | ... | @@ -157,6 +159,11 @@ |
157 | 159 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
158 | 160 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> |
159 | 161 | </block> |
162 | + | |
163 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}"> | |
164 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
165 | + </block> | |
166 | + | |
160 | 167 | <block wx:else> |
161 | 168 | |
162 | 169 | <!-- 根本就找不到门店 --> | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -298,7 +298,6 @@ Page({ |
298 | 298 | getApp().globalData.groupchat_id = t.groupchat_id |
299 | 299 | } |
300 | 300 | |
301 | - | |
302 | 301 | self = this; |
303 | 302 | //检查测肤 |
304 | 303 | getApp().check_skin_face(t, 0, gid); |
... | ... | @@ -855,6 +854,17 @@ Page({ |
855 | 854 | ee.is_no_dis = 1; |
856 | 855 | } |
857 | 856 | |
857 | + //-- 如果有指定门店的时候,pickup_ids是经过判断是不是普通商品后才会有的 -- | |
858 | + if(th.data.sele_g && th.data.sele_g.pickup_ids){ | |
859 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
860 | + return e.pickup_id==ee.pickup_id; | |
861 | + }) | |
862 | + if(idx<0){ | |
863 | + ee.is_no_dis=1; | |
864 | + } | |
865 | + } | |
866 | + | |
867 | + | |
858 | 868 | var appd = getApp().globalData; |
859 | 869 | var w_time = setInterval(function () { |
860 | 870 | if (that.data.is_get_local_ok == 0) return false; |
... | ... | @@ -1103,6 +1113,11 @@ Page({ |
1103 | 1113 | //if (ee.data.prom_type) { |
1104 | 1114 | t.data.data.prom_type = ee.data.prom_type; |
1105 | 1115 | t.data.data.prom_id = ee.data.prom_id; |
1116 | + | |
1117 | + //只有是普通商品的时候,才要给商品赋值指定门店 | |
1118 | + if ([1, 2, 4, 6, 8, 9].indexOf(parseInt(ee.data.prom_type))<0 && t.data.data.pick_up_lists && t.data.data.pick_up_lists.length) { | |
1119 | + t.data.data.pickup_ids = t.data.data.pick_up_lists; | |
1120 | + } | |
1106 | 1121 | //} |
1107 | 1122 | ee.setData({ |
1108 | 1123 | data: t.data.data, |
... | ... | @@ -1110,12 +1125,8 @@ Page({ |
1110 | 1125 | userInfo: getApp().globalData.userInfo |
1111 | 1126 | }); |
1112 | 1127 | |
1113 | - | |
1114 | - | |
1115 | - | |
1116 | 1128 | //获取统一条形码,普通商品和优惠促销的商品 |
1117 | 1129 | if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { |
1118 | - | |
1119 | 1130 | ee.get_sto(); |
1120 | 1131 | ee.get_sku(o.stoid, t.data.data, gid); |
1121 | 1132 | ee.check_has_flash(); |
... | ... | @@ -3052,8 +3063,31 @@ Page({ |
3052 | 3063 | for (var i = 0; i < arrdata.length; i++) { |
3053 | 3064 | var goodsinfo = arrdata[i], |
3054 | 3065 | prom = null; |
3066 | + | |
3055 | 3067 | if (goodsinfo.goods_id != g_id) { |
3056 | 3068 | |
3069 | + | |
3070 | + //要判断一下商品的活动是不是多活动,确定一下商品的prom_type | |
3071 | + var url = '/api/weshop/activitylist/listGoodActInfo2New'; | |
3072 | + var req_d = { | |
3073 | + "store_id": os.stoid, | |
3074 | + "goods_id": goodsinfo.goods_id, | |
3075 | + "user_id": getApp().globalData.user_id, | |
3076 | + } | |
3077 | + var ck_res=await getApp().request.promiseGet("/api/weshop/activitylist/listGoodActInfo2New", { data:req_d }); | |
3078 | + if (ck_res.data.code == 0 && ck_res.data.data && ck_res.data.data.length > 0) { | |
3079 | + var arr = ck_res.data.data; | |
3080 | + //-- 预热也要计算 -- | |
3081 | + var arr2 = arr.filter(function (e) { | |
3082 | + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp()) | |
3083 | + }) | |
3084 | + | |
3085 | + if (arr2.length == 1) { | |
3086 | + goodsinfo.prom_type = arr2[0].prom_type; | |
3087 | + goodsinfo.prom_id = arr2[0].act_id; | |
3088 | + } | |
3089 | + } | |
3090 | + | |
3057 | 3091 | switch (goodsinfo.prom_type) { |
3058 | 3092 | case 1: |
3059 | 3093 | |
... | ... | @@ -3088,20 +3122,36 @@ Page({ |
3088 | 3122 | continue; |
3089 | 3123 | } |
3090 | 3124 | |
3125 | + }else{ | |
3126 | + | |
3127 | + //只有是普通商品的时候,才要给商品赋值指定门店 | |
3128 | + if ([1, 2, 4, 6, 8, 9].indexOf(parseInt(this.data.prom_type)) <0 || is_normal) { | |
3129 | + //如果商品有设置分组 | |
3130 | + if(goodsinfo.pick_group_ids){ | |
3131 | + goodsinfo.pickup_ids = goodsinfo.pick_up_lists; | |
3132 | + } | |
3133 | + } | |
3134 | + | |
3091 | 3135 | } |
3092 | 3136 | //---如果有活动,不算在一起--- |
3093 | 3137 | if (prom) { |
3094 | - if (goodsinfo.prom_type == 1 || goodsinfo.prom_type == 6) { | |
3138 | + if ([1,2,4,6].indexOf(parseInt(goodsinfo.prom_type))>-1) { | |
3095 | 3139 | console.log(prom); |
3096 | - if (prom.is_end == 0 && prom.end_time > now && prom.start_time < now) continue; | |
3140 | + if (prom.is_end == 0 && prom.end_time > now && (prom.start_time < now || (prom.show_time && prom.show_time < now ) ) ) continue; | |
3097 | 3141 | } else { |
3098 | 3142 | continue; |
3099 | 3143 | } |
3100 | 3144 | } |
3145 | + var item = arrdata[i],gg = ""; | |
3146 | + | |
3147 | + if (goodsinfo.goods_id != g_id) { | |
3148 | + //-- 如果商品有设置分组 -- | |
3149 | + if(item.pick_group_ids){ | |
3150 | + item.pickup_ids = item.pick_up_lists; | |
3151 | + } | |
3152 | + } | |
3101 | 3153 | |
3102 | 3154 | |
3103 | - var item = arrdata[i], | |
3104 | - gg = ""; | |
3105 | 3155 | if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; |
3106 | 3156 | if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; |
3107 | 3157 | |
... | ... | @@ -3145,8 +3195,19 @@ Page({ |
3145 | 3195 | |
3146 | 3196 | //-----------选择属性的按钮事件---------- |
3147 | 3197 | sele_spec: function (e) { |
3198 | + | |
3148 | 3199 | var that = this; |
3149 | 3200 | var th = this; |
3201 | + | |
3202 | + //在切换规格的时候,指定门店不匹配的状态要清理 | |
3203 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3204 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3205 | + that.setData({ | |
3206 | + def_pick_store: th.data.def_pick_store | |
3207 | + }) | |
3208 | + } | |
3209 | + | |
3210 | + | |
3150 | 3211 | var gid = e.currentTarget.dataset.gid; |
3151 | 3212 | var nor = e.currentTarget.dataset.nor; |
3152 | 3213 | var user_id = getApp().globalData.user_id; |
... | ... | @@ -3157,6 +3218,11 @@ Page({ |
3157 | 3218 | if (nor) this.data.base_nor = nor; |
3158 | 3219 | } |
3159 | 3220 | |
3221 | + //要把不匹配还原 | |
3222 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3223 | + th.data.def_pick_store.is_no_dis=0; | |
3224 | + th.setData({def_pick_store:th.data.def_pick_store}) | |
3225 | + } | |
3160 | 3226 | |
3161 | 3227 | //普通商品多规格的时候,商品切换 |
3162 | 3228 | if (this.data.base_nor_prom_type) this.data.base_nor_prom_type = parseInt(this.data.base_nor_prom_type); |
... | ... | @@ -3214,7 +3280,10 @@ Page({ |
3214 | 3280 | |
3215 | 3281 | |
3216 | 3282 | |
3217 | - if (nor) that.get_sto(1); | |
3283 | + if (nor) { | |
3284 | + that.set_sele_g(sku_g) | |
3285 | + that.get_sto(1); | |
3286 | + } | |
3218 | 3287 | else that.get_sto(); |
3219 | 3288 | |
3220 | 3289 | |
... | ... | @@ -3427,7 +3496,6 @@ Page({ |
3427 | 3496 | }, |
3428 | 3497 | |
3429 | 3498 | |
3430 | - | |
3431 | 3499 | //---------拿出门店分类和门店------------ |
3432 | 3500 | get_sto(e) { |
3433 | 3501 | console.log('get_sto') |
... | ... | @@ -3473,10 +3541,8 @@ Page({ |
3473 | 3541 | dd.lat = th.data.lat; |
3474 | 3542 | dd.lon = th.data.lon; |
3475 | 3543 | } |
3476 | - clearInterval(timer_get); | |
3477 | - | |
3478 | - | |
3479 | 3544 | |
3545 | + clearInterval(timer_get); | |
3480 | 3546 | |
3481 | 3547 | //如果会员是有默认的门店话 |
3482 | 3548 | if (!th.data.def_pick_store && th.data.fir_def_store && Object.keys(th.data.fir_def_store).length > 0) { |
... | ... | @@ -3495,6 +3561,46 @@ Page({ |
3495 | 3561 | |
3496 | 3562 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
3497 | 3563 | |
3564 | + //-- 如果有指定门店的时候 -- | |
3565 | + if(th.data.sele_g.pickup_ids){ | |
3566 | + | |
3567 | + var ok_arr=[]; | |
3568 | + for (let i in e.data.data.pageData) { | |
3569 | + let ite = e.data.data.pageData[i]; | |
3570 | + //-- 查找一下门店有没有在 -- | |
3571 | + var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3572 | + return e.pickup_id==ite.pickup_id; | |
3573 | + }) | |
3574 | + if(idx>-1){ | |
3575 | + ok_arr.push(ite) | |
3576 | + } | |
3577 | + } | |
3578 | + | |
3579 | + //判断会员的默认的门店是不是匹配指定的门店 | |
3580 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3581 | + | |
3582 | + //-- 查找一下门店有没有在 -- | |
3583 | + var idx1=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3584 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
3585 | + }) | |
3586 | + | |
3587 | + if(idx1<0){ | |
3588 | + th.data.def_pick_store.is_no_dis_nor=1; | |
3589 | + //-- 如果不是活动的普通购买的时候 -- | |
3590 | + if(!th.data.is_normal){ | |
3591 | + th.data.def_pick_store.is_no_dis=1; | |
3592 | + } | |
3593 | + that.setData({ | |
3594 | + def_pick_store: th.data.def_pick_store | |
3595 | + }) | |
3596 | + } | |
3597 | + } | |
3598 | + | |
3599 | + | |
3600 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
3601 | + e.data.data.total=ok_arr.length; //数组的长度 | |
3602 | + } | |
3603 | + | |
3498 | 3604 | var his_cate_num = 0; |
3499 | 3605 | for (let i in e.data.data.pageData) { |
3500 | 3606 | let item = e.data.data.pageData[i]; |
... | ... | @@ -3543,7 +3649,8 @@ Page({ |
3543 | 3649 | }); |
3544 | 3650 | |
3545 | 3651 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- |
3546 | - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
3652 | + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules | |
3653 | + && !th.data.sele_g.whsle_id && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) { | |
3547 | 3654 | setTimeout(function () { |
3548 | 3655 | th.deal_pickup_dline(e); |
3549 | 3656 | }, 800) |
... | ... | @@ -4932,7 +5039,7 @@ Page({ |
4932 | 5039 | }, |
4933 | 5040 | |
4934 | 5041 | //--点击弹起拼单-- |
4935 | - openSpecModel_pt: function (e) { | |
5042 | + openSpecModel_pt:function (e) { | |
4936 | 5043 | |
4937 | 5044 | this.setData({ |
4938 | 5045 | open_ind_store: 4, |
... | ... | @@ -4959,19 +5066,29 @@ Page({ |
4959 | 5066 | |
4960 | 5067 | //如果拼单的sku data是空的,就要先获取一下 |
4961 | 5068 | if (th.data.sku_g_pt) { |
5069 | + | |
5070 | + //要同步指定门店 | |
5071 | + th.set_sele_g(th.data.sku_g_pt); | |
5072 | + | |
4962 | 5073 | th.get_sto(1); |
4963 | 5074 | th.setData({ |
4964 | 5075 | is_normal: ind, |
4965 | 5076 | openSpecModal_pt: 1, |
4966 | 5077 | }); |
4967 | 5078 | } else { |
4968 | - th.get_sto(1); | |
5079 | + | |
4969 | 5080 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
5081 | + | |
5082 | + th.get_sto(1); | |
5083 | + | |
4970 | 5084 | th.setData({ |
4971 | 5085 | is_normal: ind, |
4972 | 5086 | openSpecModal_pt: 1, |
4973 | 5087 | }); |
4974 | 5088 | }); |
5089 | + | |
5090 | + | |
5091 | + | |
4975 | 5092 | } |
4976 | 5093 | if (!th.data.sele_g.whsle_id) th.check_is_youhui(th.data.gid, 1); |
4977 | 5094 | } else { |
... | ... | @@ -7811,18 +7928,25 @@ Page({ |
7811 | 7928 | }, |
7812 | 7929 | |
7813 | 7930 | //-- 积分购普通购买 -- |
7814 | - go_pay_integral_normal: function () { | |
7931 | + go_pay_integral_normal:async function () { | |
7815 | 7932 | |
7816 | 7933 | this.data.g_buy_num = new Map(); |
7817 | 7934 | var th = this; |
7818 | 7935 | if (th.data.sku_g_pt) { |
7936 | + | |
7937 | + //要同步指定门店 | |
7938 | + th.set_sele_g(th.data.sku_g_pt); | |
7939 | + | |
7819 | 7940 | this.get_sto(1) |
7820 | 7941 | this.setData({ |
7821 | 7942 | openSpecModal_inte_normal: 1 |
7822 | 7943 | }); |
7823 | 7944 | } else { |
7824 | - th.get_sto(1); | |
7945 | + | |
7825 | 7946 | th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { |
7947 | + | |
7948 | + th.get_sto(1); | |
7949 | + | |
7826 | 7950 | th.setData({ |
7827 | 7951 | is_normal: 1, |
7828 | 7952 | openSpecModal_inte_normal: 1 |
... | ... | @@ -8450,6 +8574,17 @@ Page({ |
8450 | 8574 | switch_cx_group: function () { |
8451 | 8575 | var pro_pop = this.selectComponent("#pro_pop"); //组件的id |
8452 | 8576 | pro_pop.set_init(0, this.data.cx_prom_group); |
8577 | + }, | |
8578 | + | |
8579 | + //要同步sele_g的指定门店,在有单独购买的时候,积分购和拼团 | |
8580 | + set_sele_g:function (sku_list){ | |
8581 | + var goods_id=this.data.sele_g.goods_id; | |
8582 | + for (var i in sku_list) { | |
8583 | + if(goods_id==sku_list[i].goods_id){ | |
8584 | + this.data.sele_g.pickup_ids=sku_list[i].pickup_ids; | |
8585 | + break; | |
8586 | + } | |
8587 | + } | |
8453 | 8588 | } |
8454 | 8589 | |
8455 | 8590 | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -1632,6 +1632,8 @@ |
1632 | 1632 | <view class="flex xc-ash"> |
1633 | 1633 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
1634 | 1634 | <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> |
1635 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1636 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(配送不匹配)</text> | |
1635 | 1637 | </view> |
1636 | 1638 | </view> |
1637 | 1639 | <view> |
... | ... | @@ -1660,6 +1662,8 @@ |
1660 | 1662 | <view class="flex xc-ash"> |
1661 | 1663 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
1662 | 1664 | <text class="c-red22" wx:if="{{item.is_no_qyt }}">(库存不足)</text> |
1665 | + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> | |
1666 | + <text class="c-red22" wx:if="{{item.is_no_dis_nor && is_normal==1}}">(配送不匹配)</text> | |
1663 | 1667 | </view> |
1664 | 1668 | </view> |
1665 | 1669 | <view> | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -24,12 +24,11 @@ Page({ |
24 | 24 | |
25 | 25 | getApp().getConfig2(function (e) { |
26 | 26 | |
27 | - | |
28 | 27 | th.setData({conf: e,sales_rules:e.sales_rules, userInfo: getApp().globalData.userInfo}); |
29 | 28 | //--- 看后台是不是有开通等级卡 --- |
30 | 29 | if(e.switch_list){ |
31 | 30 | var s_list=JSON.parse(e.switch_list); |
32 | - th.setData({sys_switch: s_list,appoint_pick_keyid:s_list.appoint_pick_keyid}); | |
31 | + th.setData({sys_switch: s_list,appoint_pick_keyid:s_list.appoint_pick_keyid}); | |
33 | 32 | var is_open_offline=s_list.is_pricing_open; |
34 | 33 | var user=getApp().globalData.userInfo; |
35 | 34 | //如果后台有开启等级价的功能 |
... | ... | @@ -450,6 +449,18 @@ Page({ |
450 | 449 | gg = res.data.data; |
451 | 450 | }) |
452 | 451 | |
452 | + //-- 要进行判断指定门店的判断优化,先做普通商品 -- | |
453 | + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){ | |
454 | + var idx0=gg.pick_up_lists.findIndex(function (e){ | |
455 | + return e.pickup_id==order.pickup_id; | |
456 | + }) | |
457 | + if(idx0<0){ | |
458 | + getApp().confirmBox(gg.goods_name + "的指定门店不匹配"); | |
459 | + th.setData({ paying: 0 }); | |
460 | + return false; | |
461 | + } | |
462 | + } | |
463 | + | |
453 | 464 | var limit = gg.viplimited; |
454 | 465 | var store_count = gg.store_count; |
455 | 466 | good.erpwareid = gg.erpwareid; | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -745,7 +745,6 @@ Page({ |
745 | 745 | for (var i in order_goods) { |
746 | 746 | var good = order_goods[i]; |
747 | 747 | |
748 | - | |
749 | 748 | //线下取价功能已经关闭或者过期 |
750 | 749 | if (!th.data.is_open_offline && good.offline_cut > 0) { |
751 | 750 | wx.showModal({ |
... | ... | @@ -764,6 +763,18 @@ Page({ |
764 | 763 | gg = res.data.data; |
765 | 764 | }) |
766 | 765 | |
766 | + //-- 要进行判断指定门店的判断优化,先做普通商品 -- | |
767 | + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){ | |
768 | + var idx0=gg.pick_up_lists.findIndex(function (e){ | |
769 | + return e.pickup_id==order.pickup_id; | |
770 | + }) | |
771 | + if(idx0<0){ | |
772 | + getApp().confirmBox(gg.goods_name + "的指定门店不匹配"); | |
773 | + th.setData({ paying: 0 }); | |
774 | + return false; | |
775 | + } | |
776 | + } | |
777 | + | |
767 | 778 | var limit = gg.viplimited; |
768 | 779 | var store_count = gg.store_count; |
769 | 780 | good.erpwareid = gg.erpwareid; | ... | ... |