diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 87913cd..48812e7 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,//哪里打开的门店列表的控制属性 }, //------初始化加载---------- @@ -678,8 +679,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 +927,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 +1132,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) { @@ -2730,24 +2742,24 @@ Page({ }) }, // 选择门店 - choice_store:function(){ + choice_store:function(ee){ var th=this; + var ind=ee.currentTarget.dataset.ind; 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提示框"); + if (th.data.is_gps == 0) { s.showWarning("请开启GPS定位", null, 1000, !1); } } else { @@ -2759,15 +2771,18 @@ Page({ }) 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(){ @@ -2800,8 +2815,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..ffaa03f 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -43,7 +43,7 @@ - + 视频 @@ -308,7 +308,7 @@ 选择门店 - + 更多门店 @@ -755,7 +755,7 @@ - {{data.goods_name}} + {{sele_g.goods_name}} {{sele_g.shop_price}} {{prom_price}} @@ -788,12 +788,12 @@ - + 选择门店 - + 更多门店 @@ -804,7 +804,7 @@