Commit 27a76a60dd727119ba7de6dc9aaca877fbe77592
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
16 changed files
with
158 additions
and
68 deletions
app.js
... | ... | @@ -92,8 +92,15 @@ App({ |
92 | 92 | if(!app.globalData.userInfo){ |
93 | 93 | var user = wx.getStorageSync("userinfo"); |
94 | 94 | if (user && user.user_id){ |
95 | - app.globalData.userInfo=wx.getStorageSync("userinfo"); | |
96 | - app.globalData.user_id= app.globalData.userInfo.user_id; | |
95 | + //--生成会员 -- | |
96 | + app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id,{}).then(res=>{ | |
97 | + if(res.data.code==0){ | |
98 | + user=res.data.data; | |
99 | + app.globalData.userInfo=user; | |
100 | + app.globalData.user_id= user.user_id; | |
101 | + wx.setStorageSync("userinfo",user); | |
102 | + } | |
103 | + }) | |
97 | 104 | } |
98 | 105 | } |
99 | 106 | wx.getSystemInfo({ |
... | ... | @@ -561,7 +568,11 @@ App({ |
561 | 568 | this.globalData.room_id=null; //关闭要把房间号关闭 |
562 | 569 | this.globalData.room_goods_id=null; //关闭要把物流清空 |
563 | 570 | this.globalData.config2=null; //清除config2的缓存 |
564 | - this.globalData.config=null; //清除config的缓存 | |
571 | + this.globalData.config=null; //清除config的缓存 | |
572 | + this.globalData.gr_index=0; //商品分组的序列 | |
573 | + for(var i = 1; i < 50; i++) { | |
574 | + clearInterval(i); | |
575 | + } | |
565 | 576 | }, |
566 | 577 | |
567 | 578 | clear_word:function (word) { | ... | ... |
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/goods/categoryList/categoryList.js
... | ... | @@ -91,8 +91,15 @@ Page({ |
91 | 91 | |
92 | 92 | onLoad: function(tt) { |
93 | 93 | var that = this; |
94 | + var first_leader=tt.first_leader; | |
95 | + if(first_leader){ | |
96 | + //-- user_id代过来免登录 -- | |
97 | + getApp().globalData.first_leader=first_leader; | |
98 | + } | |
99 | + | |
100 | + | |
94 | 101 | that.get_brand(); |
95 | - | |
102 | + | |
96 | 103 | clearInterval(that.data.timer); |
97 | 104 | that.setData({ countDownNum: 3, stylePage: 1 }); |
98 | 105 | |
... | ... | @@ -570,8 +577,19 @@ Page({ |
570 | 577 | }, |
571 | 578 | //---------分享配置-------- |
572 | 579 | onShareAppMessage: function (e) { |
580 | + | |
581 | + url="pages/goods/categoryList/categoryList"; | |
582 | + var userInfo=getApp().globalData.userInfo; | |
583 | + //是分销商才带 | |
584 | + if(userInfo){ | |
585 | + url+="?first_leader="+userInfo.user_id; | |
586 | + } | |
587 | + console.log("--分类分享---分享--"); | |
588 | + console.log(url); | |
589 | + | |
573 | 590 | return { |
574 | - title: "商品分类", | |
591 | + title: "商品分类", | |
592 | + path:url, | |
575 | 593 | } |
576 | 594 | }, |
577 | 595 | //图片失败,默认图片 | ... | ... |
pages/index/index/index.js
... | ... | @@ -592,11 +592,19 @@ Page({ |
592 | 592 | url+="?first_leader="+userInfo.user_id; |
593 | 593 | } |
594 | 594 | console.log("---首页---分享--"); |
595 | - console.log(url); | |
595 | + var title="商城首页" | |
596 | + //分享 | |
597 | + if(getApp().globalData.config.store_name){ | |
598 | + title=getApp().globalData.config.store_name; | |
599 | + }else if(getApp().globalData.setting.appName){ | |
600 | + title=getApp().globalData.setting.appName; | |
601 | + } | |
602 | + | |
596 | 603 | var ob={ |
597 | 604 | title: getApp().globalData.config.store_name, |
598 | 605 | path:url, |
599 | - }; | |
606 | + }; | |
607 | + console.log(ob); | |
600 | 608 | return ob; |
601 | 609 | }, |
602 | 610 | ... | ... |
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 | //绑定手机号 | ... | ... |