Commit e58833ba726e69b17ddcec9d18824de111593a0f
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
# Conflicts: # packageA/pages/distribution/shop/shop.js
Showing
4 changed files
with
91 additions
and
73 deletions
packageA/pages/distribution/main/main.js
@@ -15,12 +15,14 @@ Page({ | @@ -15,12 +15,14 @@ Page({ | ||
15 | * 生命周期函数--监听页面加载 | 15 | * 生命周期函数--监听页面加载 |
16 | */ | 16 | */ |
17 | onLoad: function (options) { | 17 | onLoad: function (options) { |
18 | - self = this;//保存全局指针 | 18 | + self = this;//保存全局指针 |
19 | + | ||
19 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | 20 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 |
20 | self.setData({ | 21 | self.setData({ |
21 | userInfo: data, | 22 | userInfo: data, |
22 | }); | 23 | }); |
23 | }); | 24 | }); |
25 | + | ||
24 | }, | 26 | }, |
25 | 27 | ||
26 | /** | 28 | /** |
@@ -34,8 +36,8 @@ Page({ | @@ -34,8 +36,8 @@ Page({ | ||
34 | * 生命周期函数--监听页面显示 | 36 | * 生命周期函数--监听页面显示 |
35 | */ | 37 | */ |
36 | onShow: function () { | 38 | onShow: function () { |
39 | + console.log('onshow'); | ||
37 | let url = '/api/weshop/users/distribut/getMoney'; | 40 | let url = '/api/weshop/users/distribut/getMoney'; |
38 | - | ||
39 | if(app.globalData.userInfo) { | 41 | if(app.globalData.userInfo) { |
40 | if(!this.data.isLogin) { | 42 | if(!this.data.isLogin) { |
41 | this.setData({ | 43 | this.setData({ |
@@ -43,10 +45,11 @@ Page({ | @@ -43,10 +45,11 @@ Page({ | ||
43 | imghost: app.globalData.setting.imghost, | 45 | imghost: app.globalData.setting.imghost, |
44 | isLogin: true, | 46 | isLogin: true, |
45 | }); | 47 | }); |
46 | - console.log('userinfo', this.data.userInfo); | 48 | + |
47 | // 请求数据 | 49 | // 请求数据 |
48 | app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { | 50 | app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { |
49 | success: function(res) { | 51 | success: function(res) { |
52 | + console.log('success~~`', self.data.userInfo); | ||
50 | if(res.data.code == 0){ | 53 | if(res.data.code == 0){ |
51 | 54 | ||
52 | self.setData({ | 55 | self.setData({ |
@@ -61,7 +64,6 @@ Page({ | @@ -61,7 +64,6 @@ Page({ | ||
61 | storeId: self.data.userInfo.store_id, | 64 | storeId: self.data.userInfo.store_id, |
62 | userId: self.data.userInfo.user_id, | 65 | userId: self.data.userInfo.user_id, |
63 | first_leader: self.data.userInfo.first_leader, | 66 | first_leader: self.data.userInfo.first_leader, |
64 | - // first_leader: '', | ||
65 | }, | 67 | }, |
66 | isShowLoading: true, | 68 | isShowLoading: true, |
67 | }).then(function(res) { | 69 | }).then(function(res) { |
@@ -74,19 +76,14 @@ Page({ | @@ -74,19 +76,14 @@ Page({ | ||
74 | // }; | 76 | // }; |
75 | }; | 77 | }; |
76 | }, | 78 | }, |
77 | - fail: function() { | ||
78 | - | ||
79 | - }, | 79 | + |
80 | }); | 80 | }); |
81 | 81 | ||
82 | - // this.getData('/api/weshop/users/distribut/getMoney', { | ||
83 | - // store_id: app.globalData.setting.stoid, | ||
84 | - // user_id: app.globalData.user_id, | ||
85 | - // }); | ||
86 | 82 | ||
87 | }; | 83 | }; |
88 | }; | 84 | }; |
89 | 85 | ||
86 | + | ||
90 | }, | 87 | }, |
91 | 88 | ||
92 | /** | 89 | /** |
@@ -138,34 +135,7 @@ Page({ | @@ -138,34 +135,7 @@ Page({ | ||
138 | app.goto(url); | 135 | app.goto(url); |
139 | }, | 136 | }, |
140 | 137 | ||
141 | - /** | ||
142 | - * 请求数据 | ||
143 | - */ | ||
144 | - // getData(url, data) { | ||
145 | - | ||
146 | - // app.request.get(url + '/' + data.store_id + '/' + data.user_id, { | ||
147 | - // success: function(res) { | ||
148 | - // if(res.data.code == 0){ | ||
149 | - // // console.log('success',res.data.data.is_distribut); | ||
150 | - // if(res.data.data.is_distribut) {//如果是分销商 | ||
151 | - // self.setData({ | ||
152 | - // data: res.data.data, | ||
153 | - // }); | ||
154 | - // } else {//如果不是分销商 | ||
155 | - | ||
156 | - // }; | ||
157 | - // }else{ | ||
158 | - // wx.showToast({ | ||
159 | - // title: "网络繁忙,请重试", | ||
160 | - // icon: 'none', | ||
161 | - // duration: 2000 | ||
162 | - // }) | ||
163 | - // } | ||
164 | - // }, | ||
165 | - // fail: function() {}, | ||
166 | - // }); | ||
167 | - | ||
168 | - // }, | 138 | + |
169 | 139 | ||
170 | /** | 140 | /** |
171 | * 获取输入框 | 141 | * 获取输入框 |
@@ -221,19 +191,6 @@ Page({ | @@ -221,19 +191,6 @@ Page({ | ||
221 | } | 191 | } |
222 | }); | 192 | }); |
223 | 193 | ||
224 | - // app.request.promisePost('/api/weshop/users/distribut/updateUserRecommender', { | ||
225 | - // data: { | ||
226 | - // storeId: self.data.userInfo.store_id, | ||
227 | - // userId: self.data.userInfo.user_id, | ||
228 | - // mobile: mobile, | ||
229 | - // }, | ||
230 | - // isShowLoading: true, | ||
231 | - // }).then(function(res) { | ||
232 | - // console.log('!!!===>', res); | ||
233 | - // self.setData({ | ||
234 | - // fenxiao: res.data.data, | ||
235 | - // }); | ||
236 | - // }); | ||
237 | } | 194 | } |
238 | } else { | 195 | } else { |
239 | wx.showToast({ | 196 | wx.showToast({ |
packageA/pages/distribution/shop/shop.js
@@ -28,11 +28,15 @@ Page({ | @@ -28,11 +28,15 @@ Page({ | ||
28 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | 28 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 |
29 | pageNum: 1, // 当前页数 | 29 | pageNum: 1, // 当前页数 |
30 | 30 | ||
31 | + | ||
31 | rank_switch: false, | 32 | rank_switch: false, |
32 | card_field: "", | 33 | card_field: "", |
33 | card_name: "", | 34 | card_name: "", |
34 | max_card_field: "", | 35 | max_card_field: "", |
35 | card_list: null | 36 | card_list: null |
37 | + | ||
38 | + isAll: true, | ||
39 | + | ||
36 | }, | 40 | }, |
37 | 41 | ||
38 | /** | 42 | /** |
@@ -118,7 +122,15 @@ Page({ | @@ -118,7 +122,15 @@ Page({ | ||
118 | }); | 122 | }); |
119 | 123 | ||
120 | // 请求数据 | 124 | // 请求数据 |
121 | - this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | 125 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop', { |
126 | + data: this.data.currentQuery, | ||
127 | + }).then(res => { | ||
128 | + self.setData({ | ||
129 | + list: res.data.data, | ||
130 | + total: res.data.data.total, | ||
131 | + }); | ||
132 | + }); | ||
133 | + | ||
122 | // 新品 | 134 | // 新品 |
123 | app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | 135 | app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { |
124 | data: self.data.currentQuery, | 136 | data: self.data.currentQuery, |
@@ -265,7 +277,13 @@ Page({ | @@ -265,7 +277,13 @@ Page({ | ||
265 | * 页面上拉触底事件的处理函数 | 277 | * 页面上拉触底事件的处理函数 |
266 | */ | 278 | */ |
267 | onReachBottom: function () { | 279 | onReachBottom: function () { |
268 | - this.scrollToLower('/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | 280 | + let url = ''; |
281 | + if(this.data.isAll) { | ||
282 | + url = '/api/weshop/users/distribut/pagemyshop'; | ||
283 | + } else { | ||
284 | + url = '/api/weshop/users/distribut/pagemyshop?type=2'; | ||
285 | + }; | ||
286 | + this.scrollToLower(url, this.data.currentQuery); | ||
269 | }, | 287 | }, |
270 | 288 | ||
271 | /** | 289 | /** |
@@ -517,7 +535,7 @@ Page({ | @@ -517,7 +535,7 @@ Page({ | ||
517 | 535 | ||
518 | if(isInit) {// 第一次加载 | 536 | if(isInit) {// 第一次加载 |
519 | self.setData({ | 537 | self.setData({ |
520 | - list: res.data.data | 538 | + list: res.data.data, |
521 | }); | 539 | }); |
522 | } else { | 540 | } else { |
523 | self.setData({ | 541 | self.setData({ |
@@ -584,10 +602,10 @@ Page({ | @@ -584,10 +602,10 @@ Page({ | ||
584 | } else { | 602 | } else { |
585 | url = e.currentTarget.dataset.url; | 603 | url = e.currentTarget.dataset.url; |
586 | } | 604 | } |
587 | - console.log(url); | ||
588 | app.goto(url); | 605 | app.goto(url); |
589 | }, | 606 | }, |
590 | 607 | ||
608 | + | ||
591 | //--- 获取卡类列表 --- | 609 | //--- 获取卡类列表 --- |
592 | getPlusCardType: function (func) { | 610 | getPlusCardType: function (func) { |
593 | var storid = os.stoid; | 611 | var storid = os.stoid; |
@@ -629,4 +647,52 @@ Page({ | @@ -629,4 +647,52 @@ Page({ | ||
629 | }) | 647 | }) |
630 | }, | 648 | }, |
631 | 649 | ||
650 | + | ||
651 | + /** | ||
652 | + * 点击全部 | ||
653 | + */ | ||
654 | + clickAll() { | ||
655 | + let data = this.data.currentQuery; | ||
656 | + | ||
657 | + if(data.page) delete data.page; | ||
658 | + if(data.orderField) delete data.orderField; | ||
659 | + if(data.orderType) delete data.orderType; | ||
660 | + if(data.key) delete data.key; | ||
661 | + | ||
662 | + this.setData({ | ||
663 | + pageNum: 1, | ||
664 | + noMore: false, | ||
665 | + isAll: true, | ||
666 | + }); | ||
667 | + | ||
668 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | ||
669 | + }, | ||
670 | + | ||
671 | + /** | ||
672 | + * 点击新品 | ||
673 | + */ | ||
674 | + clickNew() { | ||
675 | + let data = this.data.currentQuery; | ||
676 | + | ||
677 | + if(data.page) delete data.page; | ||
678 | + if(data.orderField) delete data.orderField; | ||
679 | + if(data.orderType) delete data.orderType; | ||
680 | + if(data.key) delete data.key; | ||
681 | + | ||
682 | + this.setData({ | ||
683 | + pageNum: 1, | ||
684 | + noMore: false, | ||
685 | + isAll: false, | ||
686 | + }); | ||
687 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | ||
688 | + data: data, | ||
689 | + }).then(res => { | ||
690 | + self.setData({ | ||
691 | + list: res.data.data, | ||
692 | + }); | ||
693 | + }); | ||
694 | + }, | ||
695 | + | ||
696 | + | ||
697 | + | ||
632 | }) | 698 | }) |
633 | \ No newline at end of file | 699 | \ No newline at end of file |
packageA/pages/distribution/shop/shop.wxml
@@ -19,11 +19,11 @@ | @@ -19,11 +19,11 @@ | ||
19 | 19 | ||
20 | 20 | ||
21 | <view class="flex t-c fs24 f1 jc_fe"> | 21 | <view class="flex t-c fs24 f1 jc_fe"> |
22 | - <view class="pdv20 pdh40"> | ||
23 | - <view class="fs30">{{filter.show_default(list.total)}}</view> | 22 | + <view class="pdv20 pdh40 {{isAll ? 'selected':''}}" bindtap="clickAll"> |
23 | + <view class="fs30">{{filter.show_default(total)}}</view> | ||
24 | <view>全部商品</view> | 24 | <view>全部商品</view> |
25 | </view> | 25 | </view> |
26 | - <view class="pdv20 pdh40"> | 26 | + <view class="pdv20 pdh40 {{!isAll ? 'selected':''}}" bindtap="clickNew"> |
27 | <view class="fs30">{{filter.show_default(newList.total)}}</view> | 27 | <view class="fs30">{{filter.show_default(newList.total)}}</view> |
28 | <view>新品</view> | 28 | <view>新品</view> |
29 | </view> | 29 | </view> |
@@ -349,19 +349,10 @@ | @@ -349,19 +349,10 @@ | ||
349 | </view> | 349 | </view> |
350 | 350 | ||
351 | 351 | ||
352 | - | ||
353 | - | ||
354 | - | ||
355 | - <!-- <view class="bottomBar flex pd20 jc_sb fs26 ai-center"> | ||
356 | - <view> | ||
357 | - <label class="flex ai-center"> | ||
358 | - <checkbox/>全选 | ||
359 | - </label> | ||
360 | - </view> | ||
361 | - <view class="pd20 btn" wx:if="{{options.index == 0}}">一键上架</view> | ||
362 | - <view class="pd20 btn" wx:else>一键下架</view> | ||
363 | - </view> --> | ||
364 | - | ||
365 | - | ||
366 | 352 | ||
367 | </view> | 353 | </view> |
354 | + | ||
355 | + | ||
356 | + | ||
357 | + | ||
358 | + |