Commit f2daf8fd91ce1e59ad249df177a79e9d9ade781b
1 parent
2f148450
分销测试返回的bug修复
Showing
10 changed files
with
360 additions
and
221 deletions
components/goods_list/goods_list.js
... | ... | @@ -33,48 +33,55 @@ Component({ |
33 | 33 | methods: { |
34 | 34 | init: function () { |
35 | 35 | var th = this; |
36 | + if(!getApp().globalData.user_id) return false; | |
36 | 37 | getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { |
37 | 38 | isShowLoading:false, |
38 | 39 | success: function (e) { |
39 | - getApp().globalData.userInfo = e.data.data; | |
40 | - getApp().getConfig2(function (e) { | |
41 | - var swithc_list = e.switch_list; | |
42 | - var sw_arr = JSON.parse(swithc_list); | |
43 | - //---如果后台有开等级卡的开关--- | |
44 | - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | |
45 | - th.setData({ | |
46 | - rank_switch: true | |
47 | - }); | |
48 | - //---回调卡的列表--- | |
49 | - th.getPlusCardType(function (ob) { | |
50 | - th.setData({ | |
51 | - card_list: ob.card_list | |
52 | - }); | |
53 | - var ti = setInterval(function () { | |
54 | - var user = getApp().globalData.userInfo; | |
55 | - if (!user) return false; | |
56 | - clearInterval(ti); | |
57 | - if (user.card_field && user['card_expiredate']) { | |
58 | - var str = user['card_expiredate'].replace(/-/g, '/'); | |
59 | - var end = new Date(str); | |
60 | - end = Date.parse(end) / 1000; | |
61 | - var now = ut.gettimestamp(); | |
62 | - //--- 判断是等级会员,且在有效期范围内 --- | |
63 | - if (user.card_field && now < end) { | |
64 | - var card_name = ob.name_map.get(user.card_field); | |
65 | - if (card_name.length > 4) card_name = card_name.substring(0, 8); | |
66 | - th.setData({ | |
67 | - card_field: user.card_field, | |
68 | - card_name: card_name, | |
69 | - card_list: ob.card_list | |
70 | - }); | |
71 | - } | |
72 | - } | |
73 | - }, 500) | |
74 | - }) | |
75 | - } | |
76 | - }) | |
77 | - } | |
40 | + if(e.code==0 && e.data && e.data.data){ | |
41 | + getApp().globalData.userInfo = e.data.data; | |
42 | + getApp().getConfig2(function (e) { | |
43 | + var swithc_list = e.switch_list; | |
44 | + var sw_arr = JSON.parse(swithc_list); | |
45 | + //---如果后台有开等级卡的开关--- | |
46 | + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | |
47 | + th.setData({ | |
48 | + rank_switch: true | |
49 | + }); | |
50 | + //---回调卡的列表--- | |
51 | + th.getPlusCardType(function (ob) { | |
52 | + th.setData({ | |
53 | + card_list: ob.card_list | |
54 | + }); | |
55 | + var ti = setInterval(function () { | |
56 | + var user = getApp().globalData.userInfo; | |
57 | + if (!user) return false; | |
58 | + clearInterval(ti); | |
59 | + if (user.card_field && user['card_expiredate']) { | |
60 | + var str = user['card_expiredate'].replace(/-/g, '/'); | |
61 | + var end = new Date(str); | |
62 | + end = Date.parse(end) / 1000; | |
63 | + var now = ut.gettimestamp(); | |
64 | + //--- 判断是等级会员,且在有效期范围内 --- | |
65 | + if (user.card_field && now < end) { | |
66 | + var card_name = ob.name_map.get(user.card_field); | |
67 | + if (card_name.length > 4) card_name = card_name.substring(0, 8); | |
68 | + th.setData({ | |
69 | + card_field: user.card_field, | |
70 | + card_name: card_name, | |
71 | + card_list: ob.card_list | |
72 | + }); | |
73 | + } | |
74 | + } | |
75 | + }, 500) | |
76 | + }) | |
77 | + } | |
78 | + }) | |
79 | + | |
80 | + } | |
81 | + | |
82 | + | |
83 | + | |
84 | + } | |
78 | 85 | }) |
79 | 86 | }, |
80 | 87 | // get_list: function () { | ... | ... |
custom-tab-bar/index.js
... | ... | @@ -12,7 +12,31 @@ Component({ |
12 | 12 | |
13 | 13 | |
14 | 14 | lifetimes: { |
15 | - attached: function() { | |
15 | + attached: function() { | |
16 | + var th=this; | |
17 | + | |
18 | + getApp().getConfig2(function(){ | |
19 | + var e = getApp().globalData.config2; | |
20 | + var json_d = JSON.parse(e.switch_list); | |
21 | + if(!json_d.distribut_switch){ | |
22 | + th.setData({is_no_distri:1}) | |
23 | + } | |
24 | + }) | |
25 | + | |
26 | + | |
27 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ | |
28 | + if(res.data.code==0){ | |
29 | + var arr = res.data.data.pageData; | |
30 | + if (arr.length > 0) { | |
31 | + var item=arr[0]; | |
32 | + if(item.is_sy==0){ | |
33 | + var now = Date.parse(new Date());now = now / 1000; | |
34 | + if(item.end_time<now) th.setData({is_no_distri:1}) | |
35 | + } | |
36 | + } | |
37 | + } | |
38 | + }) | |
39 | + | |
16 | 40 | |
17 | 41 | //购物车显示商品金额 |
18 | 42 | this.setData({cartGoodsNum:getApp().globalData.cartGoodsNum}); |
... | ... | @@ -58,6 +82,7 @@ Component({ |
58 | 82 | backgroundColor: data.bkcolor, |
59 | 83 | fontcolor_sele: data.fontcolor_sele, |
60 | 84 | fontcolor:data.fontcolor, |
85 | + is_custum:1 | |
61 | 86 | }) |
62 | 87 | |
63 | 88 | }, | ... | ... |
custom-tab-bar/index.wxml
1 | 1 | <!-- 如果是自定义的话 --> |
2 | 2 | <view class="main_bar" style=" background: {{backgroundColor}}; font-size: 23rpx;"> |
3 | - <block wx:for="{{list}}" wx:for-index="idx"> | |
4 | - <view data-url="{{item.weappurl}}" bindtap="nav_goto" class="tabbar_item" data-act="{{active==idx?1:0}}" | |
5 | - style="width:{{100 / list.length}}%;color: {{active==idx?fontcolor_sele:fontcolor}};"> | |
6 | - <view wx:if="{{item.nav_name=='购物车'}}" class="cart_num" >{{cartGoodsNum}} </view> | |
7 | - <view class="tab_img" style="margin-top: 6rpx;"> | |
8 | - <view class="nav_imgage" style="background-image: url({{active==idx?item.src_sele:item.src}});"></view> | |
9 | - </view> | |
10 | - <view style="height:20px;line-height:15px; margin-top: 2rpx;"> | |
11 | - {{item.nav_name}} | |
12 | - </view> | |
13 | - </view> | |
3 | + <block wx:for="{{list}}" wx:for-index="idx"> | |
4 | + <block wx:if="{{item.nav_name!='分销' || is_custum}}"> | |
5 | + <view data-url="{{item.weappurl}}" bindtap="nav_goto" class="tabbar_item" data-act="{{active==idx?1:0}}" | |
6 | + style="width:{{100 / list.length}}%;color: {{active==idx?fontcolor_sele:fontcolor}};"> | |
7 | + <view wx:if="{{item.nav_name=='购物车'}}" class="cart_num" >{{cartGoodsNum}} </view> | |
8 | + <view class="tab_img" style="margin-top: 6rpx;"> | |
9 | + <view class="nav_imgage" style="background-image: url({{active==idx?item.src_sele:item.src}});"></view> | |
10 | + </view> | |
11 | + <view style="height:20px;line-height:15px; margin-top: 2rpx;"> | |
12 | + {{item.nav_name}} | |
13 | + </view> | |
14 | + </view> | |
15 | + </block> | |
16 | + <!-- 是分销商,且不是自定义,且可以显示 --> | |
17 | + <block wx:if="{{item.nav_name=='分销' && !is_custum && !is_no_distri}}"> | |
18 | + <view data-url="{{item.weappurl}}" bindtap="nav_goto" class="tabbar_item" data-act="{{active==idx?1:0}}" | |
19 | + style="width:{{100 / list.length}}%;color: {{active==idx?fontcolor_sele:fontcolor}};"> | |
20 | + <view class="tab_img" style="margin-top: 6rpx;"> | |
21 | + <view class="nav_imgage" style="background-image: url({{active==idx?item.src_sele:item.src}});"></view> | |
22 | + </view> | |
23 | + <view style="height:20px;line-height:15px; margin-top: 2rpx;"> | |
24 | + {{item.nav_name}} | |
25 | + </view> | |
26 | + </view> | |
27 | + </block> | |
14 | 28 | </block> |
15 | 29 | </view > |
16 | 30 | |
17 | 31 | |
18 | 32 | |
19 | - | |
20 | - | |
21 | - | |
22 | 33 | |
23 | 34 | \ No newline at end of file | ... | ... |
custom-tab-bar/index.wxss
pages/distribution/distribution.js
1 | 1 | // packageA//pages/distribution/main/main.js |
2 | 2 | const app = getApp(); |
3 | -let self = null; | |
3 | +let self = null, os = app.globalData.setting; | |
4 | +var regeneratorRuntime = require('../../utils/runtime.js'); | |
4 | 5 | |
5 | 6 | Page({ |
6 | 7 | |
... | ... | @@ -8,124 +9,186 @@ Page({ |
8 | 9 | * 页面的初始数据 |
9 | 10 | */ |
10 | 11 | data: { |
11 | - | |
12 | + buy_goods:null, | |
12 | 13 | }, |
13 | 14 | |
14 | 15 | /** |
15 | 16 | * 生命周期函数--监听页面加载 |
16 | 17 | */ |
17 | 18 | onLoad: function (options) { |
18 | - self = this;//保存全局指针 | |
19 | - | |
20 | - app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
19 | + self = this;//保存全局指针 | |
20 | + if(app.globalData.userInfo) { | |
21 | 21 | self.setData({ |
22 | - userInfo: data, | |
22 | + userInfo: app.globalData.userInfo, | |
23 | 23 | }); |
24 | - }); | |
25 | - | |
24 | + }else{ | |
25 | + getApp().goto("/pages/togoin/togoin") //跳到非tabbar页 | |
26 | + } | |
27 | + | |
26 | 28 | }, |
27 | 29 | |
28 | 30 | /** |
29 | 31 | * 生命周期函数--监听页面初次渲染完成 |
30 | 32 | */ |
31 | 33 | onReady: function () { |
32 | - | |
34 | + var self=this; | |
35 | + // 广告banner | |
36 | + app.request.promiseGet("/api/weshop/ad/page", { | |
37 | + data: { | |
38 | + pid: 401, | |
39 | + enabled: 1, | |
40 | + store_id: app.globalData.setting.stoid, | |
41 | + } | |
42 | + }).then(res => { | |
43 | + if(res.data.code == 0 && res.data.data) { | |
44 | + let item = res.data.data.pageData[0]; | |
45 | + if(item && item.ad_code) { | |
46 | + self.setData({ | |
47 | + ad_img: item.ad_code, | |
48 | + }); | |
49 | + }; | |
50 | + }; | |
51 | + }); | |
33 | 52 | }, |
34 | 53 | |
35 | 54 | /** |
36 | 55 | * 生命周期函数--监听页面显示 |
37 | 56 | */ |
38 | - onShow: function () { | |
39 | - console.log('onshow'); | |
40 | - let url = '/api/weshop/users/distribut/getMoney'; | |
41 | - if(app.globalData.userInfo) { | |
42 | - if(!this.data.isLogin) { | |
43 | - this.setData({ | |
44 | - userInfo: app.globalData.userInfo, | |
45 | - imghost: app.globalData.setting.imghost, | |
46 | - isLogin: true, | |
47 | - }); | |
48 | - | |
49 | - // 请求数据 | |
50 | - app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { | |
51 | - success: function(res) { | |
52 | - console.log('success~~`', self.data.userInfo); | |
53 | - if(res.data.code == 0) { | |
57 | + onShow: function () { | |
58 | + var self=this,userinfo=app.globalData.userInfo; | |
59 | + if(!app.globalData.userInfo){ | |
60 | + return false; | |
61 | + } | |
62 | + //-- 会员实时的信息获取 -- | |
63 | + getApp().promiseGet("/api/weshop/users/get/" + userinfo.store_id + "/" + userinfo.user_id,{}).then(res=>{ | |
64 | + if(res.data.code!=0){ | |
65 | + wx.showToast({ | |
66 | + title: "获取会员失败", | |
67 | + icon: 'none', | |
68 | + duration: 2000 | |
69 | + }); | |
70 | + return false; | |
71 | + } | |
54 | 72 | |
55 | - self.setData({ | |
56 | - data: res.data.data, | |
57 | - }); | |
58 | - | |
59 | - // 广告banner | |
60 | - app.request.promiseGet("/api/weshop/ad/page", { | |
61 | - data: { | |
62 | - pid: 401, | |
63 | - enabled: 1, | |
64 | - store_id: app.globalData.setting.stoid, | |
65 | - } | |
66 | - }).then(res => { | |
67 | - if(res.data.code == 0 && res.data.data) { | |
68 | - let item = res.data.data.pageData[0]; | |
69 | - if(item && item.ad_code) { | |
70 | - self.setData({ | |
71 | - ad_img: item.ad_code, | |
72 | - }); | |
73 | - }; | |
74 | - }; | |
75 | - }); | |
76 | - | |
77 | - } else { | |
78 | - // if(!res.data.data.is_distribut) {//如果不是分销商:0不是,1是 | |
79 | - | |
80 | - app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
81 | - data: { | |
82 | - storeId: self.data.userInfo.store_id, | |
83 | - userId: self.data.userInfo.user_id, | |
84 | - first_leader: self.data.userInfo.first_leader, | |
85 | - }, | |
86 | - isShowLoading: true, | |
87 | - }).then(function(res) { | |
88 | - console.log('!!!===>', res); | |
89 | - if(res.data.code == 0) { | |
90 | - self.setData({ | |
91 | - fenxiao: res.data.data, | |
92 | - }); | |
93 | - } else { | |
94 | - self.setData({ | |
95 | - msg: res.data.msg, | |
96 | - }); | |
97 | - } | |
98 | - | |
99 | - }); | |
100 | - | |
101 | - | |
102 | - | |
103 | - }; | |
104 | - }, | |
105 | - | |
106 | - }); | |
107 | - | |
73 | + userinfo=res.data.data; | |
74 | + self.setData({ | |
75 | + userInfo: userinfo, | |
76 | + imghost: app.globalData.setting.imghost, | |
77 | + }); | |
78 | + app.globalData.userInfo=userinfo; | |
79 | + wx.setStorageSync("userinfo",userinfo); | |
80 | + //-- 获取分销的内容 -- | |
81 | + self.show_dis(); | |
82 | + }) | |
108 | 83 | |
109 | - }; | |
110 | - }; | |
111 | - | |
112 | - | |
113 | 84 | }, |
114 | - | |
115 | - /** | |
116 | - * 生命周期函数--监听页面隐藏 | |
117 | - */ | |
118 | - onHide: function () { | |
119 | - | |
85 | + | |
86 | + //-- 优化小程序没有开启或者过期没有必要再调用程序 --- | |
87 | + show_dis:async function(){ | |
88 | + var isok=1,self=this; | |
89 | + await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | |
90 | + var dis=rs.data.data; | |
91 | + if( dis && dis.switch==0){ | |
92 | + self.setData({err_word:"商家暂时未开启分享,敬请期待"}); | |
93 | + isok=0; | |
94 | + } | |
95 | + | |
96 | + }) | |
97 | + | |
98 | + if(!isok) return false; | |
99 | + await getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=2",{}).then(rs=>{ | |
100 | + if(rs.data.code==0){ | |
101 | + var arr = rs.data.data.pageData; | |
102 | + if (arr.length > 0) { | |
103 | + var item=arr[0]; | |
104 | + if(item.is_sy==0){ | |
105 | + var now = Date.parse(new Date());now = now / 1000; | |
106 | + if(item.end_time<now) { | |
107 | + self.setData({err_word:"分销功能已过期,请联系商家进行升级"});isok=0; | |
108 | + } | |
109 | + } | |
110 | + }else{ | |
111 | + self.setData({err_word:"请联系商家进行购买分销功能"}); | |
112 | + isok=0; | |
113 | + } | |
114 | + } | |
115 | + }) | |
116 | + if(!isok) return false; | |
117 | + | |
118 | + //如果不是分销会员的话 | |
119 | + if(!app.globalData.userInfo['is_distribut']){ | |
120 | + app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
121 | + data: { | |
122 | + storeId: self.data.userInfo.store_id, | |
123 | + userId: self.data.userInfo.user_id, | |
124 | + first_leader: self.data.userInfo.first_leader, | |
125 | + }, | |
126 | + isShowLoading: true, | |
127 | + }).then(function(res) { | |
128 | + console.log('!!!===>', res); | |
129 | + if(res.data.code == 0) { | |
130 | + var data={ | |
131 | + fenxiao: res.data.data, | |
132 | + }; | |
133 | + var goods=null; | |
134 | + var isall_pass=1; | |
135 | + for(var i in res.data.data){ | |
136 | + if(!res.data.data[i].pass){ isall_pass=0; } | |
137 | + if(res.data.data[i].type==3 && res.data.data[i].conditonRemark){ | |
138 | + goods={is_buy:1,url:'/pages/index/index/index'}; | |
139 | + if(res.data.data[i].goods_id){ | |
140 | + goods.url='/pages/goods/goodsInfo/goodsInfo?goods_id='+res.data.data[i].goods_id; | |
141 | + } | |
142 | + break; | |
143 | + } | |
144 | + } | |
145 | + if(goods){ | |
146 | + data.buy_goods=goods; | |
147 | + } | |
148 | + self.setData(data); | |
149 | + //如果全部都更新了通过的话 | |
150 | + if(isall_pass){ | |
151 | + wx.showToast({ | |
152 | + title: "全部满足成为分销商", | |
153 | + icon: 'none', | |
154 | + duration: 2000 | |
155 | + }); | |
156 | + //-- 会员的分销的内容要进行存储 -- | |
157 | + app.globalData.userInfo.is_distribut=1; | |
158 | + wx.setStorageSync("userinfo",app.globalData.userInfo); | |
159 | + setTimeout(function(){ | |
160 | + self.getDis_data(); | |
161 | + self.setData({ | |
162 | + userInfo: app.globalData.userInfo, | |
163 | + }); | |
164 | + },2000) | |
165 | + } | |
166 | + } | |
167 | + | |
168 | + }); | |
169 | + }else{ | |
170 | + self.getDis_data() | |
171 | + } | |
172 | + | |
120 | 173 | }, |
121 | - | |
122 | - /** | |
123 | - * 生命周期函数--监听页面卸载 | |
124 | - */ | |
125 | - onUnload: function () { | |
126 | - | |
174 | + | |
175 | + //-- 获取会员分销的金额的内容 -- | |
176 | + getDis_data:function(){ | |
177 | + var self=this; | |
178 | + let url = '/api/weshop/users/distribut/getMoney'; | |
179 | + // 请求数据 | |
180 | + app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { | |
181 | + success: function(res) { | |
182 | + if(res.data.code == 0) { | |
183 | + self.setData({ | |
184 | + data: res.data.data, | |
185 | + }); | |
186 | + } | |
187 | + }, | |
188 | + }); | |
127 | 189 | }, |
128 | 190 | |
191 | + | |
129 | 192 | /** |
130 | 193 | * 页面相关事件处理函数--监听用户下拉动作 |
131 | 194 | */ |
... | ... | @@ -134,13 +197,6 @@ Page({ |
134 | 197 | }, |
135 | 198 | |
136 | 199 | /** |
137 | - * 页面上拉触底事件的处理函数 | |
138 | - */ | |
139 | - onReachBottom: function () { | |
140 | - | |
141 | - }, | |
142 | - | |
143 | - /** | |
144 | 200 | * 用户点击右上角分享 |
145 | 201 | */ |
146 | 202 | onShareAppMessage: function () { |
... | ... | @@ -160,9 +216,7 @@ Page({ |
160 | 216 | console.log(url); |
161 | 217 | app.goto(url); |
162 | 218 | }, |
163 | - | |
164 | 219 | |
165 | - | |
166 | 220 | /** |
167 | 221 | * 获取输入框 |
168 | 222 | */ |
... | ... | @@ -171,14 +225,15 @@ Page({ |
171 | 225 | inputValue: e.detail.value, |
172 | 226 | }); |
173 | 227 | }, |
174 | - | |
175 | - | |
228 | + | |
176 | 229 | /** |
177 | 230 | * 验证 |
178 | 231 | */ |
179 | 232 | verify(e) { |
180 | 233 | let pass = e.target.dataset.pass; |
234 | + let index = e.target.dataset.index; | |
181 | 235 | let mobile = 0; |
236 | + var th=this; | |
182 | 237 | if(this.data.inputValue) { |
183 | 238 | mobile = this.data.inputValue; |
184 | 239 | if(!pass) { |
... | ... | @@ -188,32 +243,33 @@ Page({ |
188 | 243 | userId: self.data.userInfo.user_id, |
189 | 244 | mobile: mobile, |
190 | 245 | }, |
191 | - success: function (res) { | |
192 | - if(res.code = -1) { | |
193 | - wx.showToast({ | |
194 | - title: res.data.msg, | |
195 | - icon: 'none', | |
196 | - duration: 2000 | |
197 | - }); | |
198 | - }; | |
199 | - console.log('!!!===>', res); | |
200 | - | |
201 | - if(res.data.msg == '绑定上下级关系成功!') { | |
202 | - app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
203 | - data: { | |
204 | - storeId: self.data.userInfo.store_id, | |
205 | - userId: self.data.userInfo.user_id, | |
206 | - first_leader: self.data.userInfo.first_leader, | |
207 | - }, | |
208 | - isShowLoading: true, | |
209 | - }).then(function(res) { | |
210 | - console.log('!!!===>', res); | |
211 | - self.setData({ | |
212 | - fenxiao: res.data.data, | |
213 | - }); | |
214 | - }); | |
215 | - }; | |
216 | - | |
246 | + success: function (res) { | |
247 | + var showtxt=res.data.msg; | |
248 | + if(res.data.data.indexOf('已成为分销商')!=-1){ | |
249 | + showtxt="成功成为分销商"; | |
250 | + var txt="fenxiao["+index+"].pass"; | |
251 | + var txt2="data.is_distribut"; | |
252 | + setTimeout(function(){ | |
253 | + th.setData({[txt]:1,[txt2]:1}) | |
254 | + th.getDis_data(); | |
255 | + },1500) | |
256 | + | |
257 | + } | |
258 | + if(res.data.data.indexOf('验证成功')!=-1){ | |
259 | + var txt="fenxiao["+index+"].pass"; | |
260 | + th.setData({[txt]:1}) | |
261 | + } | |
262 | + if(res.data.data.indexOf('绑定上下级关系成功')!=-1){ | |
263 | + var txt="fenxiao["+index+"].pass"; | |
264 | + th.setData({[txt]:1}) | |
265 | + } | |
266 | + | |
267 | + wx.showToast({ | |
268 | + title: showtxt, | |
269 | + icon: 'none', | |
270 | + duration: 1500 | |
271 | + }); | |
272 | + | |
217 | 273 | } |
218 | 274 | }); |
219 | 275 | |
... | ... | @@ -227,4 +283,8 @@ Page({ |
227 | 283 | }; |
228 | 284 | |
229 | 285 | }, |
286 | + | |
287 | + go_login(){ | |
288 | + getApp().goto("/pages/togoin/togoin") //跳到非tabbar页 | |
289 | + } | |
230 | 290 | }) |
231 | 291 | \ No newline at end of file | ... | ... |
pages/distribution/distribution.wxml
1 | 1 | <wxs src="../../utils/filter.wxs" module="filter"></wxs> |
2 | + | |
3 | +<block wx:if="{{ userInfo}}" > | |
2 | 4 | <view class="main"> |
3 | 5 | <!-- 头像 --> |
4 | 6 | <view class="avatar-container t-c pdv40"> |
... | ... | @@ -70,24 +72,30 @@ |
70 | 72 | <view class="fs24 pdt10">新手必看</view> |
71 | 73 | </view> |
72 | 74 | </view> |
75 | + | |
76 | + <!-- 如果分销没有开启或者过期 --> | |
77 | + <block wx:if="{{err_word}}"> | |
78 | + <view class="t-c pd20 title">提示<text class="iconfont icon-close" bindtap="goto" data-url="/pages/user/index/index"></text></view> | |
79 | + <view class="t-c pd20"> | |
80 | + <image src="{{imghost + 'miniapp/images/user/nodistribut.png'}}" class="img"/> | |
81 | + <view class="fs28 pdt40">{{err_word}}</view> | |
82 | + </view> | |
83 | + <!-- 遮罩 --> | |
84 | + <view class="mask"></view> | |
85 | + </block> | |
73 | 86 | <!-- 分销商验证 --> |
74 | - <!-- <view class="popup" wx:if="{{!1}}"> --> | |
75 | - <view class="popup" wx:if="{{!data.is_distribut}}"> | |
76 | - <block wx:if="{{msg}}"> | |
77 | - <view class="t-c pd20 title">提示<text class="iconfont icon-close" bindtap="goto" data-url="/pages/user/index/index"></text></view> | |
78 | - <view class="t-c pd20"> | |
79 | - <image src="{{imghost + 'miniapp/images/user/nodistribut.png'}}" class="img"/> | |
80 | - <view class="fs28 pdt40">{{msg}}</view> | |
81 | - </view> | |
82 | - </block> | |
83 | - <block wx:else> | |
87 | + <block wx:elif="{{userInfo && !userInfo.is_distribut}}"> | |
88 | + <view class="popup"> | |
84 | 89 | <view class="t-c pd20 title">分销规则说明<text class="iconfont icon-close" bindtap="goto" data-url="/pages/user/index/index"></text></view> |
85 | 90 | <view wx:if="{{fenxiao}}"> |
86 | 91 | <block wx:for="{{fenxiao}}"> |
87 | 92 | <view class="item" wx:if="{{item.type == 1}}"> |
88 | 93 | <view class="left f1"> |
89 | 94 | <view class="icon-container"><text class="iconfont icon-huiyuan1"></text></view> |
90 | - <view>仅限PLUS卡({{item.conditonRemark}})的会员, <text class="c-red" bindtap="goto" data-url="/pages/user/cardinfo/cardinfo">立即升级</text></view> | |
95 | + <view>仅限PLUS卡({{item.conditonRemark}})的会员, | |
96 | + <text wx:if="{{item.pass}}" class="c-red" bindtap="goto" data-url="/pages/user/cardinfo/cardinfo">PLUS详情</text> | |
97 | + <text wx:else class="c-red" bindtap="goto" data-url="/pages/user/plus/plus">立即升级</text> | |
98 | + </view> | |
91 | 99 | </view> |
92 | 100 | <text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text> |
93 | 101 | </view> |
... | ... | @@ -96,7 +104,7 @@ |
96 | 104 | <view class="icon-container"><text class="iconfont icon-renzheng"></text></view> |
97 | 105 | <view class="flex ali-c"> |
98 | 106 | <input class="bg-f0 pdh10 input" type="number" value="{{item.inviter ? item.inviter:''}}" placeholder="请输入推荐人手机号码" disabled="{{item.pass}}" bindinput="getInput"/> |
99 | - <view class="verify" wx:if="{{!item.pass}}" bindtap="verify" data-pass="{{item.pass}}">验证</view> | |
107 | + <view class="verify" wx:if="{{!item.pass}}" bindtap="verify" data-index="{{index}}" data-pass="{{item.pass}}">验证</view> | |
100 | 108 | </view> |
101 | 109 | </view> |
102 | 110 | <text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text> |
... | ... | @@ -104,7 +112,7 @@ |
104 | 112 | <view class="item" wx:if="{{item.type == 3}}"> |
105 | 113 | <view class="left f1"> |
106 | 114 | <view class="icon-container"><text class="iconfont icon-gouwu"></text></view> |
107 | - <text>{{item.conditonRemark}}</text> | |
115 | + <text>{{item.conditonRemark==null?'直接成为分销商':item.conditonRemark}}</text> | |
108 | 116 | </view> |
109 | 117 | <text class="iconfont {{item.pass ? 'icon-yes c-red':'icon-yuanquan c-c7'}}"></text> |
110 | 118 | </view> |
... | ... | @@ -116,15 +124,21 @@ |
116 | 124 | </view> |
117 | 125 | </view> |
118 | 126 | |
119 | - <view class="t-c pd20 fs30 bdt co-red bold" bindtap="goto" data-url="/pages/index/index/index">去购买</view> | |
120 | - </view> | |
121 | - </block> | |
122 | - | |
123 | - | |
124 | - <!-- <view class="t-c pd20 fs30 bdt co-red bold">确定</view> --> | |
127 | + <view wx:if="{{buy_goods}}" class="t-c pd20 fs30 bdt co-red bold" bindtap="goto" data-url="{{buy_goods.url}}">去购买</view> | |
128 | + </view> | |
125 | 129 | </view> |
126 | 130 | <!-- 遮罩 --> |
127 | - <!-- <view class="mask" wx:if="{{!1}}"></view> --> | |
128 | - <view class="mask" wx:if="{{!data.is_distribut}}"></view> | |
131 | + <view class="mask"></view> | |
132 | + </block> | |
133 | + | |
129 | 134 | </view> |
135 | +</block> | |
130 | 136 | |
137 | +<block wx:else> | |
138 | + <view class="flex jc-center bg-white ai_c t-c" style="position: absolute; width: 100%; height: 100%;"> | |
139 | + <view> | |
140 | + <view>您还未登录,请先授权登录!</view> | |
141 | + <view style="margin-top: 200rpx;"><text bindtap="go_login" class="btn fs35">去授权</text></view> | |
142 | + </view> | |
143 | + </view> | |
144 | +</block> | |
131 | 145 | \ No newline at end of file | ... | ... |
pages/distribution/distribution.wxss
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -309,8 +309,7 @@ Page({ |
309 | 309 | } |
310 | 310 | ee.setData({ gid: gid}); |
311 | 311 | if(first_leader){ |
312 | - console.log("log---".first_leader); | |
313 | - | |
312 | + console.log("log---".first_leader); | |
314 | 313 | getApp().globalData.first_leader=first_leader; |
315 | 314 | //调用接口判断是不是会员 |
316 | 315 | getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ |
... | ... | @@ -2420,6 +2419,7 @@ Page({ |
2420 | 2419 | if(pkno.indexOf(item.pickup_no)<0) |
2421 | 2420 | pkno.push(item.pickup_no); |
2422 | 2421 | } |
2422 | + pkno.sort(); | |
2423 | 2423 | var pkno_str=pkno.join(","); |
2424 | 2424 | var o_plist=e.data.data.pageData; |
2425 | 2425 | var new_list=[]; | ... | ... |
pages/user/index/index.js
... | ... | @@ -63,8 +63,16 @@ Page({ |
63 | 63 | getApp().request.promiseGet("/api/weshop/userTool/page?pageSize=100", { |
64 | 64 | }).then(res => { |
65 | 65 | if(res.data.code==0 ){ |
66 | - var d_list=res.data.data.pageData; | |
67 | - th.setData({user_tool:d_list}); | |
66 | + var d_list=res.data.data.pageData; | |
67 | + getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | |
68 | + var dis=rs.data.data; | |
69 | + for(var i in d_list){ | |
70 | + if(d_list[i].name=='我的分销' && dis && dis.switch==0){ | |
71 | + d_list.splice(i,1); | |
72 | + } | |
73 | + } | |
74 | + th.setData({user_tool:d_list}); | |
75 | + }) | |
68 | 76 | } |
69 | 77 | }) |
70 | 78 | this.birthday(); |
... | ... | @@ -307,10 +315,8 @@ Page({ |
307 | 315 | getApp().getConfig2(function(e) { |
308 | 316 | var t_swi = e.switch_list; |
309 | 317 | if (t_swi) t_swi = JSON.parse(t_swi) |
310 | - if(t_swi){ | |
311 | - var user_tool=[]; | |
312 | - if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); | |
313 | - th.setData({sys_switch:t_swi,c_list:user_tool}); | |
318 | + if(t_swi){ | |
319 | + th.setData({sys_switch:t_swi}); | |
314 | 320 | } |
315 | 321 | |
316 | 322 | |
... | ... | @@ -338,11 +344,17 @@ Page({ |
338 | 344 | } |
339 | 345 | } |
340 | 346 | }) |
341 | - | |
342 | - | |
343 | 347 | //th.requestRecommend(); |
344 | - | |
345 | 348 | } |
349 | + | |
350 | + var t_swi= getApp().globalData.config2.switch_list | |
351 | + if (t_swi){ | |
352 | + t_swi = JSON.parse(t_swi); | |
353 | + var user_tool=[]; | |
354 | + if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); | |
355 | + th.setData({c_list:user_tool}) | |
356 | + } | |
357 | + | |
346 | 358 | |
347 | 359 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id |
348 | 360 | goods_list.init(); | ... | ... |
utils/auth.js
... | ... | @@ -32,12 +32,20 @@ module.exports = { |
32 | 32 | login_fir: function (e, o, n) { |
33 | 33 | |
34 | 34 | var a = this.app(), app = a, i = this; |
35 | - | |
36 | 35 | var userinfo= wx.getStorageSync("userinfo"); |
37 | 36 | if(userinfo){ |
38 | - a.globalData.userInfo=userinfo; | |
39 | - a.globalData.user_id=userinfo.user_id; | |
40 | - "function" == typeof n && n(a.globalData.userInfo, a.globalData.wechatUser); | |
37 | + //--生成会员 -- | |
38 | + getApp().promiseGet("/api/weshop/users/get/" + userinfo.store_id + "/" + userinfo.user_id,{}).then(res=>{ | |
39 | + if(res.data.code==0){ | |
40 | + //更新会员 | |
41 | + userinfo= e.data.data; | |
42 | + a.globalData.userInfo=userinfo; | |
43 | + a.globalData.user_id=userinfo.user_id; | |
44 | + wx.setStorageSync("userinfo",userinfo); | |
45 | + | |
46 | + "function" == typeof n && n(a.globalData.userInfo, a.globalData.wechatUser); | |
47 | + } | |
48 | + }) | |
41 | 49 | return true; |
42 | 50 | } |
43 | 51 | ... | ... |