diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 146e7de..feb0965 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -224,6 +224,7 @@ Page({ is_get_local_ok:0,//获取坐标是否完成 region_name:"门店分类",//区域的名字 is_gps:1, + open_ind_store:0,//哪里打开的门店列表的控制属性 }, //------初始化加载---------- @@ -256,28 +257,7 @@ Page({ supportPageScroll: !0 }); - if(e.is_sort_storage){ - wx.getLocation({ - type: 'wgs84', - success: function (res) { - th.data.lat=res.latitude; - th.data.lon=res.longitude; - th.data.is_get_local_ok=1; - }, - fail: function (res) { - - if (res.errCode == 2) { - th.setData({ is_gps: 0 }); - } else { - th.setData({ is_gps: "3" }); - } - - th.data.is_get_local_ok=1; - } - }) - }else{ - th.data.is_get_local_ok=1; - } + }) @@ -302,6 +282,32 @@ Page({ },500) }) + + if (e.is_sort_storage) { + wx.getLocation({ + type: 'wgs84', + success: function (res) { + th.data.lat = res.latitude; + th.data.lon = res.longitude; + th.data.is_get_local_ok = 1; + }, + fail: function (res) { + if (res.errCode == 2) { + th.setData({ is_gps: 0 }); + if (th.data.is_gps == 0) { + s.showWarning("请开启GPS定位", null, 3800000, !1); + } + + } else { + th.setData({ is_gps: "3" }); + } + + th.data.is_get_local_ok = 1; + } + }) + } else { + th.data.is_get_local_ok = 1; + } }, @@ -678,8 +684,10 @@ Page({ }, //------------加入购物车-------------- - addCart: function(t) { + addCart: function(t) { var th=this; + var ind = t.currentTarget.dataset.openSpecModal_ind; + th.setData({open_ind_store: ind}); //如果是秒杀的话,要看redis够不够 if(this.data.prom_type==1){ this.getactLen(function (num) { @@ -924,8 +932,10 @@ Page({ }); }, openSpecModel: function(t) { + var open_store = t.currentTarget.dataset.ind; + console.log(t,"加入购物车头",open_store); this.setData({ - store: 0, choice_sort_store: 0, sort_store: 0 + store: 0, choice_sort_store: 0, sort_store: 0, open_ind_store: open_store, }) //--先判断会员状态-- var user_info=getApp().globalData.userInfo; @@ -1127,7 +1137,14 @@ Page({ //-----------选择属性的按钮事件---------- sele_spec: function(e) { - var gid = e.target.dataset.gid; + var gid = e.currentTarget.dataset.gid; + var sku_g = this.data.sku_g; + var item = null; + for (var i in sku_g) { + if (sku_g[i].goods_id == gid) { item = sku_g[i]; break } + } + if (item) this.setData({ sele_g: item, gid: gid }); + }, //---------拿出门店分类和门店------------ get_sto(e) { @@ -2674,6 +2691,7 @@ Page({ tt(); }, fail: function (res) { + ee.data.share_goods_img= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 tt(); } @@ -2729,25 +2747,28 @@ Page({ }) }, // 选择门店 - choice_store:function(){ + choice_store:function(ee){ var th=this; + var ind=ee.currentTarget.dataset.ind; + var bconfig = th.data.bconfig; + console.log("男士水水水水水", bconfig); + if (bconfig.is_sort_storage){ wx.getLocation({ type: 'wgs84', success: function (res) { - console.log("GPS成功的回调是上面"); + th.data.lat = res.latitude; th.data.lon = res.longitude; th.data.is_get_local_ok = 1; th.setData({ is_gps: 1 }); + th.onShow(); }, fail: function (res) { - console.log("GPS失败的回调"); + th.onShow(); if (res.errCode == 2) { - console.log("GPS失败的回调22222222222222222"); th.setData({ is_gps: 0 }); - if (this.data.is_gps == 0) { - console.log(this.data.is_gps, "GPS提示框"); - s.showWarning("请开启GPS定位", null, 1000, !1); + if (th.data.is_gps == 0) { + s.showWarning("请开启GPS定位", null, 25000, !1); } } else { th.setData({ is_gps: "3" }); @@ -2756,17 +2777,20 @@ Page({ th.data.is_get_local_ok = 1; } }) - + } this.setData({ + open_ind_store: ind, store:1, openSpecModal: !1, openSpecModal_pt: !1 }) }, //关闭选择门店 -close_popup:function(){ +close_popup:function(e){ + this.setData({ - store: 0, choice_sort_store: 0,sort_store:0}) + store: 0, choice_sort_store: 0, sort_store: 0 + }) }, //选择更多门店 more_store:function(){ @@ -2799,8 +2823,32 @@ close_popup:function(){ }, //确定def_pick为选择的门店 - sure_pick:function () { + sure_pick:function (e) { var th=this; var item=null; + var openindstore = e.currentTarget.dataset.openindstore; + console.log("加入购物车 还是立即购买,商品主页", openindstore); + if (openindstore == 1) { + console.log("加入购物车 ", openindstore); + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, }); + } else if (openindstore == 2) { + console.log("立即购买 ", openindstore); + th.setData({ + openSpecModal: !0, + openSpecModal_ind: openindstore, }); + } else { + console.log("商品主页", openindstore); + th.setData({ + store: 0, choice_sort_store: 0, sort_store: 0 + }) + } + + + + + + if(th.data.choice_sort_store==0 ){ var index=th.data.fir_pick_index; if(th.data.is_show_sto_cat==1){ diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index a55916a..b11c4dd 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -43,7 +43,7 @@ - + 视频 @@ -308,7 +308,7 @@ 选择门店 - + 更多门店 @@ -320,7 +320,7 @@ {{def_pick_store.pickup_name}} - + 距离:{{filters.toFix(def_pick_store.distance,0)}}m @@ -755,7 +755,7 @@ - {{data.goods_name}} + {{sele_g.goods_name}} {{sele_g.shop_price}} {{prom_price}} @@ -782,18 +782,18 @@ {{def_pick_store.pickup_name}} - + 距离:{{filters.toFix(def_pick_store.distance,0)}}m - + 选择门店 - + 更多门店 @@ -804,7 +804,7 @@ - 距离:{{filters.toFix(item.distance,0)}}m + 距离:{{filters.toFix(item.distance,0)}}m 地址:{{item.fulladdress}} @@ -1112,7 +1112,7 @@ {{item.pickup_name}} - 距离:{{filters.toFix(item.distance,0)}}m + 距离:{{filters.toFix(item.distance,0)}}m 地址:{{item.fulladdress}} @@ -1138,7 +1138,7 @@ {{item.pickup_name}} - 距离:{{filters.toFix(item.distance,0)}}m + 距离:{{filters.toFix(item.distance,0)}}m 地址:{{item.fulladdress}} @@ -1152,7 +1152,8 @@ - 确定 + 确定 设为默认 diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss index f8e3711..f448b31 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxss +++ b/pages/goods/goodsInfo/goodsInfo.wxss @@ -2348,7 +2348,7 @@ height: 70%; } .store-list .store_choose{ width: 100%; - height: 125rpx; + height: 120rpx; line-height: 125rpx; border-bottom: 1rpx solid #eee; @@ -2361,10 +2361,10 @@ padding-left: 20rpx; } .xc-hook{ - width: 33rpx; - height: 33rpx; + width: 35rpx; + height: 35rpx; transform: rotate(-145deg); -line-height: 35rpx; +line-height: 37rpx; text-align: center; } .xc-hooks{ @@ -2392,7 +2392,7 @@ line-height: 30rpx; .store-bottom{ width: 85%; margin: auto; - height: 90rpx; + height: 97rpx; } @@ -2411,10 +2411,8 @@ line-height: 30rpx; } .store-bottom-frame{ width: 95%; - border-top: 3rpx solid #eee; margin: auto; - margin-top: 10rpx; - + } /* 门店分类列表 */ .sort_store_list{