Commit 8b08d82cac914fc52a57488d56c999c7565c2312
1 parent
12bee1c4
app 获取用的默认门店
Showing
1 changed file
with
39 additions
and
5 deletions
app.js
... | ... | @@ -13,19 +13,20 @@ App({ |
13 | 13 | config2: null, |
14 | 14 | code: null, |
15 | 15 | heigth:0, |
16 | - user_id: 5682068,// 4379287,// null,// 5682068, | |
16 | + user_id:null, //1032493, | |
17 | 17 | buy_now:null, |
18 | 18 | picklist:null, //门店列表 |
19 | 19 | wuliuprice: null, //物流价格表 |
20 | 20 | wuliu: null, //物流公司 |
21 | 21 | baddr:null, |
22 | - mobile: null, //记录手机 | |
23 | - getu:null, //记录会员信息 | |
22 | + mobile: null, //记录手机 | |
23 | + getu:null, //记录会员信息 | |
24 | 24 | sessionKey: null,//记录会员信息 |
25 | 25 | openid: null, //记录会员信息 |
26 | 26 | |
27 | - to_group:null, //参团传递的数据 | |
28 | - wxapp_buy_obj:null,//微信小程序购买的Object | |
27 | + to_group:null, //参团传递的数据 | |
28 | + wxapp_buy_obj:null, //微信小程序购买的Object | |
29 | + pk_store:null, //选择的门店 | |
29 | 30 | |
30 | 31 | }, |
31 | 32 | auth: o, |
... | ... | @@ -287,6 +288,39 @@ App({ |
287 | 288 | var warn = that.selectComponent("#warn"); //组件的id |
288 | 289 | warn.open(word,type); |
289 | 290 | return 1; |
291 | + }, | |
292 | + | |
293 | + //获取会员门店 | |
294 | + get_user_store:function (func) | |
295 | + { | |
296 | + var th=this; | |
297 | + //---空会员的情况--- | |
298 | + if(!th.globalData.userInfo){ | |
299 | + return func(null); | |
300 | + } | |
301 | + if(!this.globalData.pk_store){ | |
302 | + var pick_id=0; | |
303 | + //先找一个会员是否有设置默认的地址 | |
304 | + if(th.globalData.userInfo.def_pickup_id){ | |
305 | + pick_id= th.globalData.userInfo.def_pickup_id | |
306 | + } | |
307 | + //查找会员的注册的地址 | |
308 | + else if(th.globalData.userInfo.pickup_id){ | |
309 | + pick_id= th.globalData.userInfo.pickup_id | |
310 | + } | |
311 | + //---如果会员没有设置默认门店,同时也没有再注册的时候选择门店-- | |
312 | + if(pick_id==0) return func(null); | |
313 | + //获取用户注册时候的门店 | |
314 | + th.request.get("/api/weshop/pickup/get/"+os.stoid+"/"+this.globalData.userInfo.pickup_id,{ | |
315 | + data:{}, | |
316 | + success:function (res) { | |
317 | + th.globalData.pk_store=res.data.data; | |
318 | + func(th.globalData.pk_store); | |
319 | + } | |
320 | + }) | |
321 | + }else{ | |
322 | + func(this.globalData.pk_store); | |
323 | + } | |
290 | 324 | } |
291 | 325 | |
292 | 326 | }); | ... | ... |