Commit 5cf136a357bf811a114f5f4fb7759c34f323abb4
1 parent
0ba290c3
搭配,参团时的门店匹配的bug修复
Showing
9 changed files
with
146 additions
and
29 deletions
packageA/pages/prom_list/prom_list.js
| ... | ... | @@ -40,12 +40,16 @@ Page({ |
| 40 | 40 | g_buy_num: null, |
| 41 | 41 | sele_collocation:null, |
| 42 | 42 | |
| 43 | + room_id:0, //房间号 | |
| 43 | 44 | }, |
| 44 | 45 | |
| 45 | 46 | //------初始化加载---------- |
| 46 | 47 | onLoad: function(t) { |
| 47 | 48 | var goods_id=t.goods_id; |
| 49 | + var room_id=t.room_id; | |
| 48 | 50 | this.setData({gid:goods_id}); |
| 51 | + | |
| 52 | + if(room_id) this.data.room_id=room_id; //房间号要存起来 | |
| 49 | 53 | var ee=this,th=ee,that=ee; |
| 50 | 54 | var first_leader=t.first_leader; |
| 51 | 55 | if(first_leader){ |
| ... | ... | @@ -89,9 +93,16 @@ Page({ |
| 89 | 93 | var appd=getApp().globalData; |
| 90 | 94 | var w_time = setInterval(function() { |
| 91 | 95 | if (that.data.is_get_local_ok == 0) return false; |
| 96 | + if (!that.data.data) return false; | |
| 92 | 97 | clearInterval(w_time); |
| 93 | 98 | var distance = null; |
| 94 | 99 | var e=JSON.parse(JSON.stringify(ee)); |
| 100 | + | |
| 101 | + if(th.data.data) var g_distr_type=th.data.data.distr_type; | |
| 102 | + e.is_no_dis=0; | |
| 103 | + if(e.distr_type!=0 && g_distr_type!=0 && e.distr_type!=g_distr_type ){ | |
| 104 | + e.is_no_dis=1; | |
| 105 | + } | |
| 95 | 106 | |
| 96 | 107 | //如果有开启近距离的话,同时距离优不一样了 |
| 97 | 108 | if (that.data.lat != null) { |
| ... | ... | @@ -405,7 +416,15 @@ Page({ |
| 405 | 416 | th.data.sele_collocation[jj]['guide_type']=newd['guide_type']; |
| 406 | 417 | } |
| 407 | 418 | } |
| 408 | - | |
| 419 | + | |
| 420 | + //-- 如果有房间号的时候 -- | |
| 421 | + if(th.data.room_id){ | |
| 422 | + newd['room_id']=th.data.room_id; | |
| 423 | + for(var nn in th.data.sele_collocation ){ | |
| 424 | + th.data.sele_collocation[nn]['room_id']=newd['room_id']; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + | |
| 409 | 428 | |
| 410 | 429 | //-----如果是秒杀,团购,积分购,拼团----- |
| 411 | 430 | if (th.data.data.prom_type != 5) { |
| ... | ... | @@ -624,6 +643,16 @@ Page({ |
| 624 | 643 | collocationList[i].is_collocation=1; |
| 625 | 644 | if(!th.data.sele_collocation) th.data.sele_collocation=new Array(); |
| 626 | 645 | th.data.sele_collocation.push(collocationList[i]); |
| 646 | + | |
| 647 | + var the_dis_t=collocationList[i].distr_type; | |
| 648 | + //如果有默认门店的判断门店匹配情况 | |
| 649 | + if(th.data.def_pick_store && th.data.def_pick_store.distr_type!=0 && the_dis_t!=0 && the_dis_t!=th.data.def_pick_store.distr_type ){ | |
| 650 | + th.data.def_pick_store.is_no_dis=1; | |
| 651 | + th.setData({def_pick_store:th.data.def_pick_store}); | |
| 652 | + }else{ | |
| 653 | + th.data.def_pick_store.is_no_dis=0; | |
| 654 | + th.setData({def_pick_store:th.data.def_pick_store}); | |
| 655 | + } | |
| 627 | 656 | } |
| 628 | 657 | } |
| 629 | 658 | if(!th.data.sele_collocation){ |
| ... | ... | @@ -694,9 +723,21 @@ Page({ |
| 694 | 723 | var th = this,that=this; |
| 695 | 724 | var timer_get = setInterval(function() { |
| 696 | 725 | if (th.data.is_get_local_ok == 0) return false; |
| 697 | - var dd = null, | |
| 726 | + var dd = null, | |
| 727 | + c_list=th.data.collocationList, | |
| 698 | 728 | i = getApp().request; |
| 699 | - var g_distr_type = th.data.data.distr_type; | |
| 729 | + var g_distr_type = th.data.data.distr_type; | |
| 730 | + var collocationList=th.data.collocationList; | |
| 731 | + | |
| 732 | + //获取所有的门店 | |
| 733 | + if(g_distr_type==0 && collocationList ){ | |
| 734 | + for(var i in collocationList){ | |
| 735 | + if(collocationList[i].sele && collocationList[i].distr_type>0){ | |
| 736 | + g_distr_type=collocationList[i].distr_type; | |
| 737 | + } | |
| 738 | + } | |
| 739 | + } | |
| 740 | + | |
| 700 | 741 | if (g_distr_type != 0) { |
| 701 | 742 | dd = { |
| 702 | 743 | store_id: o.stoid, |
| ... | ... | @@ -1164,7 +1205,7 @@ Page({ |
| 1164 | 1205 | is_gps: 1 |
| 1165 | 1206 | }); |
| 1166 | 1207 | //th.onShow(); |
| 1167 | - //th.get_sto(); | |
| 1208 | + th.get_sto(); | |
| 1168 | 1209 | }, |
| 1169 | 1210 | fail: function(res) { |
| 1170 | 1211 | //th.onShow(); |
| ... | ... | @@ -1187,6 +1228,7 @@ Page({ |
| 1187 | 1228 | }) |
| 1188 | 1229 | }else{ |
| 1189 | 1230 | th.data.is_get_local_ok = 1; |
| 1231 | + th.get_sto(); | |
| 1190 | 1232 | } |
| 1191 | 1233 | |
| 1192 | 1234 | if(ind!=undefined && ind!=null ){ |
| ... | ... | @@ -1574,11 +1616,49 @@ Page({ |
| 1574 | 1616 | _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; |
| 1575 | 1617 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; |
| 1576 | 1618 | }, |
| 1619 | + //判断来个商品的配送的方式是不是一致 | |
| 1620 | + check_men_dian(g1,g2){ | |
| 1621 | + if(g1.distr_type!=0 && g2.distr_type!=0 && g1.distr_type!=g2.distr_type){ | |
| 1622 | + return 0; | |
| 1623 | + } | |
| 1624 | + return 1; | |
| 1625 | + }, | |
| 1577 | 1626 | |
| 1578 | 1627 | set_sele:function (e) { |
| 1628 | + var th=this; | |
| 1579 | 1629 | var index=e.currentTarget.dataset.ind; |
| 1580 | 1630 | var set=e.currentTarget.dataset.set; |
| 1581 | 1631 | var text="collocationList["+index+"].sele"; |
| 1632 | + | |
| 1633 | + //判断门店匹配不匹配 | |
| 1634 | + var click_item=this.data.collocationList[index]; | |
| 1635 | + var c_list=this.data.collocationList; | |
| 1636 | + if(set==1){ | |
| 1637 | + //-- 选择的商品的门店配送方式和主商品比较 -- | |
| 1638 | + if(!th.check_men_dian(click_item,th.data.data)){ | |
| 1639 | + wx.showToast({ | |
| 1640 | + title: "商品的配送方式不一致", | |
| 1641 | + icon: 'none', | |
| 1642 | + duration: 2000 | |
| 1643 | + }) | |
| 1644 | + return false; | |
| 1645 | + } | |
| 1646 | + //-- 判断从商品 -- | |
| 1647 | + for(var ij in this.data.collocationList){ | |
| 1648 | + if(this.data.collocationList[ij].sele){ | |
| 1649 | + if(!th.check_men_dian(click_item,this.data.collocationList[ij])){ | |
| 1650 | + wx.showToast({ | |
| 1651 | + title: "商品的配送方式不一致", | |
| 1652 | + icon: 'none', | |
| 1653 | + duration: 2000 | |
| 1654 | + }) | |
| 1655 | + return false; | |
| 1656 | + } | |
| 1657 | + } | |
| 1658 | + } | |
| 1659 | + | |
| 1660 | + } | |
| 1661 | + | |
| 1582 | 1662 | var ob={}; |
| 1583 | 1663 | ob[text]= parseInt(set); |
| 1584 | 1664 | this.setData(ob); | ... | ... |
packageA/pages/prom_list/prom_list.wxml
| ... | ... | @@ -115,7 +115,8 @@ |
| 115 | 115 | <block wx:else> |
| 116 | 116 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
| 117 | 117 | <block wx:else> |
| 118 | - <view wx:if="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
| 118 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 119 | + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
| 119 | 120 | </block> |
| 120 | 121 | </block> |
| 121 | 122 | |
| ... | ... | @@ -177,6 +178,11 @@ |
| 177 | 178 | <block wx:if="{{data.store_count<=0}}"> |
| 178 | 179 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> |
| 179 | 180 | </block> |
| 181 | + | |
| 182 | + <block wx:elif="{{def_pick_store && def_pick_store.is_no_dis}}"> | |
| 183 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">立即购买</view> | |
| 184 | + </block> | |
| 185 | + | |
| 180 | 186 | <block wx:else> |
| 181 | 187 | <view bindtap="addCart"data-openSpecModal_ind="2" |
| 182 | 188 | class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> | ... | ... |
packageA/pages/prom_list/prom_list.wxss
| ... | ... | @@ -357,4 +357,9 @@ |
| 357 | 357 | border-bottom: 1px solid #eee; |
| 358 | 358 | padding-bottom: 15px; |
| 359 | 359 | margin-bottom:40rpx; |
| 360 | - } | |
| 361 | 360 | \ No newline at end of file |
| 361 | + } | |
| 362 | + | |
| 363 | + .join-cart>view.no_store { | |
| 364 | + width: 58%; background-color: #adadad; | |
| 365 | + } | |
| 366 | +.no_store{color:#d60021; font-size: 26rpx;} | |
| 362 | 367 | \ No newline at end of file | ... | ... |
pages/cart/cart2/cart2.js
| ... | ... | @@ -693,7 +693,9 @@ Page({ |
| 693 | 693 | if(gg.prom_type==5){ |
| 694 | 694 | t.data.data.prom_id = gg.prom_id ; |
| 695 | 695 | t.data.data.prom_type =5; |
| 696 | - | |
| 696 | + if(gg.room_id){ | |
| 697 | + t.data.data.room_id=gg.room_id; | |
| 698 | + } | |
| 697 | 699 | //--主商品要有导购id和导购类型-- |
| 698 | 700 | if(gg.guide_id){ |
| 699 | 701 | t.data.data.guide_id=gg.guide_id; |
| ... | ... | @@ -707,6 +709,16 @@ Page({ |
| 707 | 709 | var narr=JSON.parse(JSON.stringify(gg.collocation_goods)); |
| 708 | 710 | |
| 709 | 711 | narr.push(t.data.data); |
| 712 | + | |
| 713 | + for(var hi in narr){ | |
| 714 | + var dis_t=narr[hi].distr_type; | |
| 715 | + if(dis_t==2){ | |
| 716 | + th.setData({ is_all_zt:0}); | |
| 717 | + break; | |
| 718 | + } | |
| 719 | + } | |
| 720 | + | |
| 721 | + | |
| 710 | 722 | var ie = { |
| 711 | 723 | pickup_id: gg.pick_id, pname: gg.pick_name, goods: narr, exp_type: et, wind: m_wind, distr_t: distr_t, |
| 712 | 724 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -4894,7 +4894,13 @@ Page({ |
| 4894 | 4894 | |
| 4895 | 4895 | //----跳转到搭配购买---- |
| 4896 | 4896 | go_prom_list:function () { |
| 4897 | - wx.navigateTo({ url: "../../../packageA/pages/prom_list/prom_list?goods_id="+this.data.gid, }) | |
| 4897 | + | |
| 4898 | + var url= "../../../packageA/pages/prom_list/prom_list?goods_id="+this.data.gid; | |
| 4899 | + var room_id= getApp().globalData.room_id; | |
| 4900 | + if(room_id && this.data.gid==getApp().globalData.room_goods_id){ | |
| 4901 | + url+="&room_id="+room_id; | |
| 4902 | + } | |
| 4903 | + wx.navigateTo({ url: url,}) | |
| 4898 | 4904 | }, |
| 4899 | 4905 | |
| 4900 | 4906 | //---检查有没有优惠活动--- | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -449,7 +449,7 @@ |
| 449 | 449 | <block wx:else> |
| 450 | 450 | <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
| 451 | 451 | <block wx:else> |
| 452 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 452 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 453 | 453 | <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> |
| 454 | 454 | </block> |
| 455 | 455 | </block> | ... | ... |
pages/team/team_show/team_show.js
| ... | ... | @@ -88,6 +88,9 @@ Page({ |
| 88 | 88 | lon: null, //经度 |
| 89 | 89 | |
| 90 | 90 | is_get_local_ok: 0, //获取坐标是否完成 |
| 91 | + | |
| 92 | + sort_store: 0, //门店分类 | |
| 93 | + choice_sort_store: 0, //选择分类门店 | |
| 91 | 94 | |
| 92 | 95 | }, |
| 93 | 96 | onLoad: function(options) { |
| ... | ... | @@ -575,8 +578,9 @@ Page({ |
| 575 | 578 | var g_distr_type=th.data.goods.distr_type; |
| 576 | 579 | //--如果默认门店的配送方式不对,就不能被选择-- |
| 577 | 580 | if(ee.distr_type!=0 && g_distr_type!=0 && ee.distr_type!=g_distr_type ){ |
| 578 | - th.data.fir_def_store={}; //赋值空对象 | |
| 579 | - return false; | |
| 581 | + //th.data.fir_def_store={}; //赋值空对象 | |
| 582 | + //return false; | |
| 583 | + ee.is_no_dis=1; | |
| 580 | 584 | } |
| 581 | 585 | |
| 582 | 586 | var appd=getApp().globalData; |
| ... | ... | @@ -1017,6 +1021,7 @@ Page({ |
| 1017 | 1021 | this.setData({ |
| 1018 | 1022 | store: 1, |
| 1019 | 1023 | yijian: false, |
| 1024 | + choice_sort_store:0 | |
| 1020 | 1025 | }) |
| 1021 | 1026 | |
| 1022 | 1027 | }, |
| ... | ... | @@ -1104,8 +1109,9 @@ Page({ |
| 1104 | 1109 | } |
| 1105 | 1110 | clearInterval(timer_get); |
| 1106 | 1111 | |
| 1107 | - if(th.data.def_pick_store && g_distr_type!=0 && th.data.def_pick_store.distr_type!=0 && th.data.def_pick_store.distr_type!=g_distr_type ){ | |
| 1108 | - th.setData({def_pick_store:null}); | |
| 1112 | + //如果会员是有默认的门店话 | |
| 1113 | + if(!th.data.def_pick_store && th.data.fir_def_store){ | |
| 1114 | + th.setData({def_pick_store:th.data.fir_def_store}); | |
| 1109 | 1115 | } |
| 1110 | 1116 | |
| 1111 | 1117 | //----------获取门店---------------- |
| ... | ... | @@ -1127,7 +1133,7 @@ Page({ |
| 1127 | 1133 | } |
| 1128 | 1134 | |
| 1129 | 1135 | //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- |
| 1130 | - if (th.data.def_pick_store && (th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){ | |
| 1136 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}'){ | |
| 1131 | 1137 | for (var k = 0; k < e.data.data.pageData.length; k++) { |
| 1132 | 1138 | if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { |
| 1133 | 1139 | e.data.data.pageData.splice(k, 1); //删除 |
| ... | ... | @@ -1306,6 +1312,9 @@ Page({ |
| 1306 | 1312 | } |
| 1307 | 1313 | } |
| 1308 | 1314 | }, |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1309 | 1318 | //---选择分类门店--- |
| 1310 | 1319 | choice_sort_store: function(e) { |
| 1311 | 1320 | var index = e.currentTarget.dataset.index; |
| ... | ... | @@ -1316,7 +1325,7 @@ Page({ |
| 1316 | 1325 | sort_store: 0, |
| 1317 | 1326 | choice_sort_store: 1, |
| 1318 | 1327 | sec_sto: item, |
| 1319 | - sec_pick_index: 0 | |
| 1328 | + sec_pick_index: 0, | |
| 1320 | 1329 | }); |
| 1321 | 1330 | }, |
| 1322 | 1331 | ... | ... |
pages/team/team_show/team_show.wxml
| ... | ... | @@ -233,6 +233,7 @@ |
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | </view> |
| 236 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
| 236 | 237 | <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view> |
| 237 | 238 | |
| 238 | 239 | </view> |
| ... | ... | @@ -264,7 +265,8 @@ |
| 264 | 265 | </view> |
| 265 | 266 | |
| 266 | 267 | <view class="pt_qd"> |
| 267 | - <view bindtap="go_pay" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view> | |
| 268 | + <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn spec-buy w100" data-action="buy" style="background-color: #dcdcdc;color: #999;">确定</view> | |
| 269 | + <view wx:else bindtap="go_pay" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view> | |
| 268 | 270 | </view> |
| 269 | 271 | |
| 270 | 272 | </view> |
| ... | ... | @@ -278,7 +280,7 @@ |
| 278 | 280 | <view class="mongolia-layer" bindtap="close_popup"></view> |
| 279 | 281 | <view class="popup-frame"> |
| 280 | 282 | <block wx:if="{{sort_store==0}}"> |
| 281 | - <!-- 头部 标题 --> | |
| 283 | + <!-- 头部 标题 --> | |
| 282 | 284 | <view class="popup-top flex-space-between"> |
| 283 | 285 | <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text> |
| 284 | 286 | <view> |
| ... | ... | @@ -392,19 +394,14 @@ |
| 392 | 394 | |
| 393 | 395 | <block wx:else> |
| 394 | 396 | <view class="popup-top flex-space-between"> |
| 395 | - <text class="fs32 nearby_store">门店分类选择</text> | |
| 396 | - <view> | |
| 397 | + <text class="fs32 nearby_store">门店分类选择</text> | |
| 397 | 398 | <view> |
| 398 | - <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon> | |
| 399 | + <view><icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon></view> | |
| 400 | + <view class="felx choose_mores" bindtap="returns"><text class="fs26 red-co">返回--{{sort_store}}</text></view> | |
| 399 | 401 | </view> |
| 400 | - <view class="felx choose_mores" bindtap="returns"> | |
| 401 | - <text class="fs26 red-co">返回</text> | |
| 402 | - </view> | |
| 403 | - </view> | |
| 404 | - </view> | |
| 405 | - <view class="sort_store_list"> | |
| 406 | - | |
| 407 | - <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
| 402 | + </view> | |
| 403 | + <view class="sort_store_list"> | |
| 404 | + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}"> | |
| 408 | 405 | <view class="sort-store flex-vertical-between" > |
| 409 | 406 | <view class="fs30" di>{{item.name}}</view> |
| 410 | 407 | <view class="black_rights-frame"> |
| ... | ... | @@ -413,7 +410,7 @@ |
| 413 | 410 | </view> |
| 414 | 411 | </view> |
| 415 | 412 | |
| 416 | - </view> | |
| 413 | + </view> | |
| 417 | 414 | </block> |
| 418 | 415 | </view> |
| 419 | 416 | </block> | ... | ... |