Commit f47c7ea25d91dd897e74694069103c4302053c80
1 parent
1729af8e
分销的bug优化
Showing
13 changed files
with
114 additions
and
61 deletions
custom-tab-bar/index.js
... | ... | @@ -14,16 +14,14 @@ Component({ |
14 | 14 | lifetimes: { |
15 | 15 | attached: function() { |
16 | 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 | - | |
17 | + | |
18 | + getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ | |
19 | + var dis=rs.data.data; | |
20 | + if( dis && dis.switch==0){ | |
21 | + th.setData({is_no_distri:1}) | |
22 | + } | |
23 | + }) | |
24 | + | |
27 | 25 | getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ |
28 | 26 | if(res.data.code==0){ |
29 | 27 | var arr = res.data.data.pageData; | ... | ... |
packageA/pages/distribution/card/card.js
packageA/pages/distribution/commision/commision.js
packageA/pages/distribution/goods/goods.js
packageA/pages/distribution/goods/goods.json
packageA/pages/distribution/myteam/myteam.js
packageA/pages/distribution/order/order.js
packageA/pages/distribution/rank/rank.js
packageA/pages/distribution/rookie/rookie.js
packageA/pages/distribution/shop/shop.js
... | ... | @@ -44,6 +44,10 @@ Page({ |
44 | 44 | * 生命周期函数--监听页面加载 |
45 | 45 | */ |
46 | 46 | onLoad: function (options) { |
47 | + | |
48 | + wx.setNavigationBarTitle({ | |
49 | + title: "我的小店", | |
50 | + }); | |
47 | 51 | self = this;//保存全局指针 |
48 | 52 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 |
49 | 53 | self.setData({ |
... | ... | @@ -63,9 +67,9 @@ Page({ |
63 | 67 | success: function (e) { |
64 | 68 | if(e.data.code==0){ |
65 | 69 | self.setData({ |
66 | - userInfo2: e.data.data, | |
70 | + userInfo2:e.data.data, | |
67 | 71 | }); |
68 | - } ; | |
72 | + }; | |
69 | 73 | |
70 | 74 | }, |
71 | 75 | }); | ... | ... |
pages/distribution/distribution.js
... | ... | @@ -24,6 +24,9 @@ Page({ |
24 | 24 | }else{ |
25 | 25 | getApp().goto("/pages/togoin/togoin") //跳到非tabbar页 |
26 | 26 | } |
27 | + wx.setNavigationBarTitle({ | |
28 | + title: "我的分销", | |
29 | + }); | |
27 | 30 | |
28 | 31 | }, |
29 | 32 | |
... | ... | @@ -117,55 +120,74 @@ Page({ |
117 | 120 | |
118 | 121 | //如果不是分销会员的话 |
119 | 122 | 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 | - }); | |
123 | + | |
124 | + var res=null; | |
125 | + await app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
126 | + data: { | |
127 | + storeId: self.data.userInfo.store_id, | |
128 | + userId: self.data.userInfo.user_id, | |
129 | + first_leader: self.data.userInfo.first_leader, | |
130 | + }, | |
131 | + isShowLoading: true, | |
132 | + }).then(function(res1) { | |
133 | + res=res1; | |
134 | + }); | |
135 | + | |
136 | + if(res && res.data.code == 0) { | |
137 | + var data={ | |
138 | + fenxiao: res.data.data, | |
139 | + }; | |
140 | + var goods=null; | |
141 | + var isall_pass=1; | |
142 | + for(var i in res.data.data){ | |
143 | + if(!res.data.data[i].pass){ isall_pass=0; } | |
144 | + if(res.data.data[i].type==3 && res.data.data[i].conditonRemark){ | |
145 | + goods={is_buy:1,url:'/pages/index/index/index'}; | |
146 | + if(res.data.data[i].goods_id){ | |
147 | + goods.url='/pages/goods/goodsInfo/goodsInfo?goods_id='+res.data.data[i].goods_id; | |
148 | + } | |
149 | + break; | |
150 | + } | |
151 | + if(res.data.data[i].type==2){ | |
152 | + if(!res.data.data[i].inviter && getApp().globalData.first_leader){ | |
153 | + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+getApp().globalData.first_leader,{}).then(res=>{ | |
154 | + if(res.data.code==0){ | |
155 | + var user= res.data.data; | |
156 | + if(user.is_distribut==1){ | |
157 | + data.fenxiao[i].inviter=user.mobile; | |
158 | + | |
159 | + self.setData(data); | |
160 | + } | |
161 | + } | |
162 | + }) | |
163 | + } | |
164 | + } | |
165 | + } | |
166 | + if(goods){ | |
167 | + data.buy_goods=goods; | |
168 | + } | |
169 | + self.setData(data); | |
170 | + //如果全部都更新了通过的话 | |
171 | + if(isall_pass){ | |
172 | + wx.showToast({ | |
173 | + title: "全部满足成为分销商", | |
174 | + icon: 'none', | |
175 | + duration: 2000 | |
176 | + }); | |
156 | 177 | //-- 会员的分销的内容要进行存储 -- |
157 | 178 | app.globalData.userInfo.is_distribut=1; |
158 | 179 | wx.setStorageSync("userinfo",app.globalData.userInfo); |
159 | - setTimeout(function(){ | |
160 | - self.getDis_data(); | |
180 | + setTimeout(function(){ | |
181 | + self.getDis_data(); | |
161 | 182 | self.setData({ |
162 | 183 | userInfo: app.globalData.userInfo, |
163 | 184 | }); |
164 | - },2000) | |
165 | - } | |
166 | - } | |
167 | - | |
168 | - }); | |
185 | + },2000) | |
186 | + } | |
187 | + } | |
188 | + | |
189 | + | |
190 | + | |
169 | 191 | }else{ |
170 | 192 | self.getDis_data() |
171 | 193 | } | ... | ... |
pages/distribution/distribution.wxml
... | ... | @@ -102,8 +102,9 @@ |
102 | 102 | <view class="item" wx:if="{{item.type == 2}}"> |
103 | 103 | <view class="left f1"> |
104 | 104 | <view class="icon-container"><text class="iconfont icon-renzheng"></text></view> |
105 | - <view class="flex ali-c"> | |
106 | - <input class="bg-f0 pdh10 input" type="number" value="{{item.inviter ? item.inviter:''}}" placeholder="请输入推荐人手机号码" disabled="{{item.pass}}" bindinput="getInput"/> | |
105 | + <view class="flex ali-c"> | |
106 | + <text wx:if="{{item.inviter}}">{{item.inviter}}</text> | |
107 | + <input wx:else class="bg-f0 pdh10 input" type="number" value="{{item.inviter ? item.inviter:''}}" placeholder="请输入推荐人手机号码" disabled="{{item.pass}}" bindinput="getInput"/> | |
107 | 108 | <view class="verify" wx:if="{{!item.pass}}" bindtap="verify" data-index="{{index}}" data-pass="{{item.pass}}">验证</view> |
108 | 109 | </view> |
109 | 110 | </view> | ... | ... |
pages/togoin/togoin.js
... | ... | @@ -22,8 +22,8 @@ Page({ |
22 | 22 | } |
23 | 23 | var th=this; |
24 | 24 | app.getConfig(function (e) { |
25 | - e.store_logo=th.data.imghots+e.store_logo; | |
26 | - th.setData({ store: e,store_logo:e.store_logo}); | |
25 | + var logo=th.data.imghots+e.store_logo; | |
26 | + th.setData({ store: e,store_logo:logo}); | |
27 | 27 | }) |
28 | 28 | }, |
29 | 29 | //绑定手机号 | ... | ... |