diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 31f1f81..48e4f5f 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -231,13 +231,13 @@ Page({ comments_no_more:0, get_c:0, //获取评价是不是成 is_collect_load:0, //是不是处理 + is_newsales_rules:0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存 + sales_rules:1, //默认是线上销售 }, //------初始化加载---------- onLoad: function(t) { - - wx.setNavigationBarTitle({ title: "商品详情", }) @@ -251,14 +251,13 @@ Page({ if (gid == undefined || gid == null || gid == "") { gid = decodeURIComponent(t.scene); } - ee.setData({ - gid: gid - }); + ee.setData({ gid: gid}); //----获取系统参数----- getApp().getConfig2(function(e) { ee.setData({ - bconfig: e + bconfig: e, + sales_rules:e.sales_rules }); if (e.categoryset.indexOf("," + 1 + ",") != -1) { @@ -280,7 +279,8 @@ Page({ var json_d = JSON.parse(e.switch_list); ee.setData({ store_config: e, - is_closecoupon: json_d.is_closecoupon + is_closecoupon: json_d.is_closecoupon, + is_newsales_rules:json_d.is_newsales_rules }); ee.init(gid); //------几人评价------- @@ -339,21 +339,65 @@ Page({ //获取用户的默认门店 getApp().get_user_store(function(e) { if(!e) return false; + var appd=getApp().globalData; var w_time = setInterval(function() { if (that.data.is_get_local_ok == 0) return false; + clearInterval(w_time); var distance = null; - if (that.data.lat != null && e.distance == undefined) { - //distance=Math.sqrt((e.lat-th.data.lat)*(e.lat-th.data.lat)+(e.lon-th.data.lon)* (e.lon-th.data.lon)); - var distance = ut.getDistance(e.lat, th.data.lat, e.lon, th.data.lon); - e.distance = distance; - } - if (e) that.setData({ - def_pick_store: e, - sto_sele_name: e.pickup_name, - sto_sele_id: e.pickup_id, - sto_sele_distr: e.distr_type - }) - clearInterval(w_time); + + //如果有开启近距离的话,同时距离优不一样了 + if (that.data.lat != null) { + //如果经纬度有变化的话 + if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + }else{ + //要用接口是获取距离,js的计算不准 + getApp().request.get("/api/weshop/pickup/list",{ + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon}, + success:function (res) { + if(res.data.code==0){ + e=res.data.data.pageData[0]; + if (e){ + appd.pk_store=e; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + } + + + + } + } + }) + } + + //e.distance = distance; + appd.lat=that.data.lat; + appd.lon=that.data.lon; + + }else{ + if (e) { + e.distance = null; + that.setData({ + def_pick_store: e, + sto_sele_name: e.pickup_name, + sto_sele_id: e.pickup_id, + sto_sele_distr: e.distr_type + }) + } + + + } + + }, 500) }); @@ -1356,6 +1400,12 @@ Page({ } e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 } + + //--获取线下库存-- + if(this.data.sales_rules){ + + } + //单总量超出5个的时候 if (e.data.data.total > 5) { diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index 3d9d51c..883a9e4 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -838,6 +838,11 @@ Page({ }); getApp().goto(url); }, + + //--点击分享事件--- + onShareAppMessage: function(t) { + return o.share; + }, }); \ No newline at end of file