Commit 5cf136a357bf811a114f5f4fb7759c34f323abb4

Authored by yvan.ni
1 parent 0ba290c3

搭配,参团时的门店匹配的bug修复

packageA/pages/prom_list/prom_list.js
@@ -40,12 +40,16 @@ Page({ @@ -40,12 +40,16 @@ Page({
40 g_buy_num: null, 40 g_buy_num: null,
41 sele_collocation:null, 41 sele_collocation:null,
42 42
  43 + room_id:0, //房间号
43 }, 44 },
44 45
45 //------初始化加载---------- 46 //------初始化加载----------
46 onLoad: function(t) { 47 onLoad: function(t) {
47 var goods_id=t.goods_id; 48 var goods_id=t.goods_id;
  49 + var room_id=t.room_id;
48 this.setData({gid:goods_id}); 50 this.setData({gid:goods_id});
  51 +
  52 + if(room_id) this.data.room_id=room_id; //房间号要存起来
49 var ee=this,th=ee,that=ee; 53 var ee=this,th=ee,that=ee;
50 var first_leader=t.first_leader; 54 var first_leader=t.first_leader;
51 if(first_leader){ 55 if(first_leader){
@@ -89,9 +93,16 @@ Page({ @@ -89,9 +93,16 @@ Page({
89 var appd=getApp().globalData; 93 var appd=getApp().globalData;
90 var w_time = setInterval(function() { 94 var w_time = setInterval(function() {
91 if (that.data.is_get_local_ok == 0) return false; 95 if (that.data.is_get_local_ok == 0) return false;
  96 + if (!that.data.data) return false;
92 clearInterval(w_time); 97 clearInterval(w_time);
93 var distance = null; 98 var distance = null;
94 var e=JSON.parse(JSON.stringify(ee)); 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 if (that.data.lat != null) { 108 if (that.data.lat != null) {
@@ -405,7 +416,15 @@ Page({ @@ -405,7 +416,15 @@ Page({
405 th.data.sele_collocation[jj]['guide_type']=newd['guide_type']; 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 if (th.data.data.prom_type != 5) { 430 if (th.data.data.prom_type != 5) {
@@ -624,6 +643,16 @@ Page({ @@ -624,6 +643,16 @@ Page({
624 collocationList[i].is_collocation=1; 643 collocationList[i].is_collocation=1;
625 if(!th.data.sele_collocation) th.data.sele_collocation=new Array(); 644 if(!th.data.sele_collocation) th.data.sele_collocation=new Array();
626 th.data.sele_collocation.push(collocationList[i]); 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 if(!th.data.sele_collocation){ 658 if(!th.data.sele_collocation){
@@ -694,9 +723,21 @@ Page({ @@ -694,9 +723,21 @@ Page({
694 var th = this,that=this; 723 var th = this,that=this;
695 var timer_get = setInterval(function() { 724 var timer_get = setInterval(function() {
696 if (th.data.is_get_local_ok == 0) return false; 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 i = getApp().request; 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 if (g_distr_type != 0) { 741 if (g_distr_type != 0) {
701 dd = { 742 dd = {
702 store_id: o.stoid, 743 store_id: o.stoid,
@@ -1164,7 +1205,7 @@ Page({ @@ -1164,7 +1205,7 @@ Page({
1164 is_gps: 1 1205 is_gps: 1
1165 }); 1206 });
1166 //th.onShow(); 1207 //th.onShow();
1167 - //th.get_sto(); 1208 + th.get_sto();
1168 }, 1209 },
1169 fail: function(res) { 1210 fail: function(res) {
1170 //th.onShow(); 1211 //th.onShow();
@@ -1187,6 +1228,7 @@ Page({ @@ -1187,6 +1228,7 @@ Page({
1187 }) 1228 })
1188 }else{ 1229 }else{
1189 th.data.is_get_local_ok = 1; 1230 th.data.is_get_local_ok = 1;
  1231 + th.get_sto();
1190 } 1232 }
1191 1233
1192 if(ind!=undefined && ind!=null ){ 1234 if(ind!=undefined && ind!=null ){
@@ -1574,11 +1616,49 @@ Page({ @@ -1574,11 +1616,49 @@ Page({
1574 _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; 1616 _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
1575 this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; 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 set_sele:function (e) { 1627 set_sele:function (e) {
  1628 + var th=this;
1579 var index=e.currentTarget.dataset.ind; 1629 var index=e.currentTarget.dataset.ind;
1580 var set=e.currentTarget.dataset.set; 1630 var set=e.currentTarget.dataset.set;
1581 var text="collocationList["+index+"].sele"; 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 var ob={}; 1662 var ob={};
1583 ob[text]= parseInt(set); 1663 ob[text]= parseInt(set);
1584 this.setData(ob); 1664 this.setData(ob);
packageA/pages/prom_list/prom_list.wxml
@@ -115,7 +115,8 @@ @@ -115,7 +115,8 @@
115 <block wx:else> 115 <block wx:else>
116 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 116 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
117 <block wx:else> 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 </block> 120 </block>
120 </block> 121 </block>
121 122
@@ -177,6 +178,11 @@ @@ -177,6 +178,11 @@
177 <block wx:if="{{data.store_count<=0}}"> 178 <block wx:if="{{data.store_count<=0}}">
178 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> 179 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
179 </block> 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 <block wx:else> 186 <block wx:else>
181 <view bindtap="addCart"data-openSpecModal_ind="2" 187 <view bindtap="addCart"data-openSpecModal_ind="2"
182 class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> 188 class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
packageA/pages/prom_list/prom_list.wxss
@@ -357,4 +357,9 @@ @@ -357,4 +357,9 @@
357 border-bottom: 1px solid #eee; 357 border-bottom: 1px solid #eee;
358 padding-bottom: 15px; 358 padding-bottom: 15px;
359 margin-bottom:40rpx; 359 margin-bottom:40rpx;
360 - }  
361 \ No newline at end of file 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 \ No newline at end of file 367 \ No newline at end of file
pages/cart/cart2/cart2.js
@@ -693,7 +693,9 @@ Page({ @@ -693,7 +693,9 @@ Page({
693 if(gg.prom_type==5){ 693 if(gg.prom_type==5){
694 t.data.data.prom_id = gg.prom_id ; 694 t.data.data.prom_id = gg.prom_id ;
695 t.data.data.prom_type =5; 695 t.data.data.prom_type =5;
696 - 696 + if(gg.room_id){
  697 + t.data.data.room_id=gg.room_id;
  698 + }
697 //--主商品要有导购id和导购类型-- 699 //--主商品要有导购id和导购类型--
698 if(gg.guide_id){ 700 if(gg.guide_id){
699 t.data.data.guide_id=gg.guide_id; 701 t.data.data.guide_id=gg.guide_id;
@@ -707,6 +709,16 @@ Page({ @@ -707,6 +709,16 @@ Page({
707 var narr=JSON.parse(JSON.stringify(gg.collocation_goods)); 709 var narr=JSON.parse(JSON.stringify(gg.collocation_goods));
708 710
709 narr.push(t.data.data); 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 var ie = { 722 var ie = {
711 pickup_id: gg.pick_id, pname: gg.pick_name, goods: narr, exp_type: et, wind: m_wind, distr_t: distr_t, 723 pickup_id: gg.pick_id, pname: gg.pick_name, goods: narr, exp_type: et, wind: m_wind, distr_t: distr_t,
712 goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; 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,7 +4894,13 @@ Page({
4894 4894
4895 //----跳转到搭配购买---- 4895 //----跳转到搭配购买----
4896 go_prom_list:function () { 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,7 +449,7 @@
449 <block wx:else> 449 <block wx:else>
450 <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 450 <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
451 <block wx:else> 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 <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> 453 <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
454 </block> 454 </block>
455 </block> 455 </block>
pages/team/team_show/team_show.js
@@ -88,6 +88,9 @@ Page({ @@ -88,6 +88,9 @@ Page({
88 lon: null, //经度 88 lon: null, //经度
89 89
90 is_get_local_ok: 0, //获取坐标是否完成 90 is_get_local_ok: 0, //获取坐标是否完成
  91 +
  92 + sort_store: 0, //门店分类
  93 + choice_sort_store: 0, //选择分类门店
91 94
92 }, 95 },
93 onLoad: function(options) { 96 onLoad: function(options) {
@@ -575,8 +578,9 @@ Page({ @@ -575,8 +578,9 @@ Page({
575 var g_distr_type=th.data.goods.distr_type; 578 var g_distr_type=th.data.goods.distr_type;
576 //--如果默认门店的配送方式不对,就不能被选择-- 579 //--如果默认门店的配送方式不对,就不能被选择--
577 if(ee.distr_type!=0 && g_distr_type!=0 && ee.distr_type!=g_distr_type ){ 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 var appd=getApp().globalData; 586 var appd=getApp().globalData;
@@ -1017,6 +1021,7 @@ Page({ @@ -1017,6 +1021,7 @@ Page({
1017 this.setData({ 1021 this.setData({
1018 store: 1, 1022 store: 1,
1019 yijian: false, 1023 yijian: false,
  1024 + choice_sort_store:0
1020 }) 1025 })
1021 1026
1022 }, 1027 },
@@ -1104,8 +1109,9 @@ Page({ @@ -1104,8 +1109,9 @@ Page({
1104 } 1109 }
1105 clearInterval(timer_get); 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,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 for (var k = 0; k < e.data.data.pageData.length; k++) { 1137 for (var k = 0; k < e.data.data.pageData.length; k++) {
1132 if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { 1138 if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
1133 e.data.data.pageData.splice(k, 1); //删除 1139 e.data.data.pageData.splice(k, 1); //删除
@@ -1306,6 +1312,9 @@ Page({ @@ -1306,6 +1312,9 @@ Page({
1306 } 1312 }
1307 } 1313 }
1308 }, 1314 },
  1315 +
  1316 +
  1317 +
1309 //---选择分类门店--- 1318 //---选择分类门店---
1310 choice_sort_store: function(e) { 1319 choice_sort_store: function(e) {
1311 var index = e.currentTarget.dataset.index; 1320 var index = e.currentTarget.dataset.index;
@@ -1316,7 +1325,7 @@ Page({ @@ -1316,7 +1325,7 @@ Page({
1316 sort_store: 0, 1325 sort_store: 0,
1317 choice_sort_store: 1, 1326 choice_sort_store: 1,
1318 sec_sto: item, 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,6 +233,7 @@
233 233
234 234
235 </view> 235 </view>
  236 + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view>
236 <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view> 237 <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view>
237 238
238 </view> 239 </view>
@@ -264,7 +265,8 @@ @@ -264,7 +265,8 @@
264 </view> 265 </view>
265 266
266 <view class="pt_qd"> 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 </view> 270 </view>
269 271
270 </view> 272 </view>
@@ -278,7 +280,7 @@ @@ -278,7 +280,7 @@
278 <view class="mongolia-layer" bindtap="close_popup"></view> 280 <view class="mongolia-layer" bindtap="close_popup"></view>
279 <view class="popup-frame"> 281 <view class="popup-frame">
280 <block wx:if="{{sort_store==0}}"> 282 <block wx:if="{{sort_store==0}}">
281 - <!-- 头部 标题 --> 283 + <!-- 头部 标题 -->
282 <view class="popup-top flex-space-between"> 284 <view class="popup-top flex-space-between">
283 <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text> 285 <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
284 <view> 286 <view>
@@ -392,19 +394,14 @@ @@ -392,19 +394,14 @@
392 394
393 <block wx:else> 395 <block wx:else>
394 <view class="popup-top flex-space-between"> 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 <view> 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 </view> 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 <view class="sort-store flex-vertical-between" > 405 <view class="sort-store flex-vertical-between" >
409 <view class="fs30" di>{{item.name}}</view> 406 <view class="fs30" di>{{item.name}}</view>
410 <view class="black_rights-frame"> 407 <view class="black_rights-frame">
@@ -413,7 +410,7 @@ @@ -413,7 +410,7 @@
413 </view> 410 </view>
414 </view> 411 </view>
415 412
416 - </view> 413 + </view>
417 </block> 414 </block>
418 </view> 415 </view>
419 </block> 416 </block>
pages/team/team_show/team_show.wxss
@@ -2172,3 +2172,5 @@ page { @@ -2172,3 +2172,5 @@ page {
2172 height: 30rpx; 2172 height: 30rpx;
2173 border: 1rpx solid #999; 2173 border: 1rpx solid #999;
2174 } 2174 }
  2175 +
  2176 +.no_store{color:#d60021; font-size: 26rpx;}