Commit 5933451d050bf07a9b8fa7f753464127f6752a77
Merge branch 'qa' into 'master'
Qa See merge request !313
Showing
7 changed files
with
204 additions
and
6 deletions
pages/getphone/getphone.js
0 → 100644
1 | +var t = require("../../utils/common.js");var os=getApp().globalData.setting; | |
2 | +Page({ | |
3 | + data:{ | |
4 | + store:null, | |
5 | + imghots: os.imghost, | |
6 | + }, | |
7 | + | |
8 | + onLoad: function (options) { | |
9 | + //--判断是否有接受到邀请人的ID-- | |
10 | + if(options.first_leader){ | |
11 | + this.setData({first_leader:options.first_leader}); | |
12 | + } | |
13 | + }, | |
14 | + onShow:function(){ | |
15 | + var th=this,app = getApp(); | |
16 | + var sessionKey = getApp().globalData.sessionKey; | |
17 | + var openid = getApp().globalData.openid; | |
18 | + | |
19 | + if (openid == "" || openid == null) { | |
20 | + | |
21 | + if (getApp().globalData.userInfo) | |
22 | + openid = getApp().globalData.userInfo.weapp_openid; | |
23 | + } | |
24 | + var r = getApp().globalData.getu; | |
25 | + | |
26 | + if (openid == "" || openid == null || r==null ){ | |
27 | + getApp().globalData.user_id=null; | |
28 | + getApp().globalData.userInfo=null; | |
29 | + console.log("openid"); | |
30 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) | |
31 | + return false; | |
32 | + } | |
33 | + var user_info=getApp().globalData.userInfo; | |
34 | + console.log("getphone"); | |
35 | + | |
36 | + if(user_info!=null && user_info.mobile!=undefined && user_info.mobile!="" && user_info.mobile!=null){ | |
37 | + wx.navigateBack({ | |
38 | + delta: 1 | |
39 | + }) | |
40 | + } | |
41 | + | |
42 | + app.getConfig(function(e){ | |
43 | + th.setData({ store:e}); | |
44 | + }) | |
45 | + }, | |
46 | + | |
47 | + getphone: function(e) { | |
48 | + var that = this; | |
49 | + var app=getApp(),a=app; | |
50 | + //此处授权得到userInfo | |
51 | + console.log("getphone"); | |
52 | + | |
53 | + e=e.detail; | |
54 | + console.log(e); | |
55 | + //接下来写业务代码登录 | |
56 | + //最后,记得返回刚才的页面 | |
57 | + if (e.encryptedData==undefined){ | |
58 | + /*--- | |
59 | + wx.navigateTo({ | |
60 | + url: '/pages/user/binding_info/binding_info', | |
61 | + })--*/ | |
62 | + return app.my_warnning("登录需要授权手机号码!", 0, that); | |
63 | + return false; | |
64 | + } | |
65 | + var r=getApp().globalData.getu; | |
66 | + var sessionKey = getApp().globalData.sessionKey; | |
67 | + var openid = getApp().globalData.openid; | |
68 | + | |
69 | + console.log(sessionKey,openid); | |
70 | + that.save_the_data(r,e,sessionKey,openid) | |
71 | + | |
72 | + }, | |
73 | + | |
74 | + save_the_data:function (r,e,sessionKey,openid) { | |
75 | + var app=getApp(),a=app,th=this; | |
76 | + var dd = { | |
77 | + oauth: "miniapp", | |
78 | + nickname: r.nickName, | |
79 | + head_pic: r.avatarUrl, | |
80 | + sex: r.gender, | |
81 | + terminal: "miniapp", | |
82 | + sessionKey: sessionKey, | |
83 | + openid:openid, | |
84 | + encryptedData: e.encryptedData, | |
85 | + iv: e.iv, | |
86 | + store_id: getApp().globalData.setting.stoid, | |
87 | + }; | |
88 | + //--如果有邀请人的时候-- | |
89 | + if(th.data.first_leader){ | |
90 | + dd.first_leader=th.data.first_leader; | |
91 | + } | |
92 | + | |
93 | + console.log(dd); | |
94 | + app.request.get("/api/weshop/users/thirdLogin", { | |
95 | + data: dd, | |
96 | + success: function (e) { | |
97 | + console.log("thirdLogin"); | |
98 | + console.log(e); | |
99 | + if (e.data.code == 0) { | |
100 | + app.globalData.user_id = e.data.data.user_id; | |
101 | + } else { | |
102 | + return app.showWarning("授权登入失败!"+e.data.msg); | |
103 | + } | |
104 | + | |
105 | + wx.setStorageSync("userinfo",e.data.data); | |
106 | + wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); | |
107 | + wx.navigateBack({ delta: 1}) | |
108 | + | |
109 | + }, | |
110 | + failStatus: function (t) { | |
111 | + /*--- | |
112 | + return "100" === t.data.result ? (i.goHome(), wx.navigateTo({ | |
113 | + url: "/pages/user/binding_info/binding_info?nickName=" + r.nickName + "&userHeadPic=" + r.avatarUrl | |
114 | + }), !1) : (i.clearAuth(), i.alertLoginErrorAndGoHome(t.data.msg), a.request.post("/api/user/logout", { | |
115 | + isShowLoading: !1, | |
116 | + data: { | |
117 | + token: a.request.getToken() | |
118 | + }, | |
119 | + failStatus: function () { | |
120 | + return !1; | |
121 | + } | |
122 | + }), !1);--*/ | |
123 | + return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | |
124 | + }, | |
125 | + fail: function (t) { | |
126 | + return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | |
127 | + } | |
128 | + }); | |
129 | + }, | |
130 | + | |
131 | + cancle_bind: function () { | |
132 | + getApp().goto('/pages/user/index/index'); | |
133 | + } | |
134 | + | |
135 | + | |
136 | + | |
137 | +}); | ... | ... |
pages/getphone/getphone.json
0 → 100644
pages/getphone/getphone.wxml
0 → 100644
1 | +<view class="all_page"> | |
2 | + <view class="content"> | |
3 | + <view><image class='logo' src="{{imghots+store.store_logo}}"> </image></view> | |
4 | + <view class="title">{{store.store_name}}</view> | |
5 | + <view>{{store.store_desc}}</view> | |
6 | + <button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getphone">绑定会员</button> | |
7 | + <text class="btn2" bindtap="cancle_bind">暂不绑定</text> | |
8 | + </view> | |
9 | +</view> | |
10 | +<warn id="warn"></warn> | |
0 | 11 | \ No newline at end of file | ... | ... |
pages/getphone/getphone.wxss
0 → 100644
1 | +.all_page{ | |
2 | + position: fixed; | |
3 | + height: 100%; | |
4 | + width: 100%; | |
5 | + background: #fff; | |
6 | + justify-content: center;/*水平居中*/ | |
7 | +} | |
8 | +.all_page .content{ | |
9 | + font-size: 30rpx; | |
10 | + text-align: center; | |
11 | + height: 400px; | |
12 | + width: 100%; | |
13 | + position: absolute; | |
14 | + top: 50%; | |
15 | + margin-top:-200px; | |
16 | +} | |
17 | +.logo{width: 140rpx; height: 140rpx; border-radius:50% } | |
18 | +.all_page .content .title{ | |
19 | + font-size: 36rpx; margin: 20rpx 0 | |
20 | +} | |
21 | + | |
22 | +.all_page .btn{ | |
23 | + height: 80rpx; | |
24 | + line-height: 80rpx; | |
25 | + width: 580rpx; | |
26 | + background: #fc661f; | |
27 | + color:#fff; | |
28 | + font-size: 32rpx; | |
29 | + margin-top: 100rpx; | |
30 | + border-radius: 5rpx; | |
31 | +} | |
32 | +.all_page .btn2{ | |
33 | + height: 80rpx; | |
34 | + line-height: 80rpx; | |
35 | + width: 580rpx; | |
36 | + color:#999; | |
37 | + font-size: 32rpx; | |
38 | + border-radius: 5rpx; | |
39 | + margin-top: 10rpx; | |
40 | +} | |
0 | 41 | \ No newline at end of file | ... | ... |
pages/user/index/index.js
... | ... | @@ -107,6 +107,7 @@ Page({ |
107 | 107 | rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { |
108 | 108 | success: function(su) { |
109 | 109 | var data = su.data.data; |
110 | + if(!data) data={}; | |
110 | 111 | data.cashcount = parseInt(data.cashcount); |
111 | 112 | s.setData({ |
112 | 113 | udata: data, | ... | ... |
pages/user/userinfo/userinfo.js
... | ... | @@ -38,7 +38,7 @@ Page({ |
38 | 38 | sort_store: 0, //门店分类 |
39 | 39 | sec_sto: "", |
40 | 40 | more_store: 0, //选择门店 |
41 | - choice_sort_store: 1, //选择分类门店 | |
41 | + choice_sort_store: 0, //选择分类门店 | |
42 | 42 | more_store: 0, //选择门店 |
43 | 43 | lat: null, //维度 |
44 | 44 | lon: null, //经度 |
... | ... | @@ -280,7 +280,7 @@ Page({ |
280 | 280 | pageSize: 300 |
281 | 281 | } |
282 | 282 | th.setData({ |
283 | - sort_store: 1 | |
283 | + sort_store: 0 | |
284 | 284 | }); |
285 | 285 | var i = getApp().request; |
286 | 286 | //如果有距离的话 |
... | ... | @@ -625,8 +625,12 @@ Page({ |
625 | 625 | req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { |
626 | 626 | success: function(src) { |
627 | 627 | var a = src.data.data; |
628 | - var time = util.formatTime(a.reg_time, "'Y/M/D"); | |
629 | - var birthday = util.formatTime(a.birthday, "'Y/M/D"); | |
628 | + | |
629 | + if(!a) a={}; | |
630 | + var time ="",birthday =""; | |
631 | + if(a && a.reg_time) util.formatTime(a.reg_time, "'Y/M/D"); | |
632 | + if(a && a.birthday) util.formatTime(a.birthday, "'Y/M/D"); | |
633 | + | |
630 | 634 | a.reg_time = time; |
631 | 635 | a.birthday = birthday |
632 | 636 | e.setData({ | ... | ... |
pages/user/userinfo/userinfo.wxml
... | ... | @@ -274,9 +274,9 @@ |
274 | 274 | <!-- 门店列表,最外层的门店列表,一开始 --> |
275 | 275 | <view class="store-list"> |
276 | 276 | <!--如果还没有点击更多门店的时候 --> |
277 | - <block wx:if="{{choice_sort_store==0}}"> | |
277 | + <block wx:if="{{choice_sort_store==0}}"> | |
278 | 278 | <!-- 需要for循环 --> |
279 | - <block wx:if="is_show_sto_cat==1"> | |
279 | + <block wx:if="{{is_show_sto_cat==1}}"> | |
280 | 280 | <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}"> |
281 | 281 | <view class="store flex-vertical"> |
282 | 282 | <!-- 需要点击事件 --> | ... | ... |