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 | 15 | * 生命周期函数--监听页面加载 |
16 | 16 | */ |
17 | 17 | onLoad: function (options) { |
18 | - self = this;//保存全局指针 | |
18 | + self = this;//保存全局指针 | |
19 | + | |
19 | 20 | app.isLogin().then(function(data) {//进入页面前已经授权登录成功 |
20 | 21 | self.setData({ |
21 | 22 | userInfo: data, |
22 | 23 | }); |
23 | 24 | }); |
25 | + | |
24 | 26 | }, |
25 | 27 | |
26 | 28 | /** |
... | ... | @@ -34,8 +36,8 @@ Page({ |
34 | 36 | * 生命周期函数--监听页面显示 |
35 | 37 | */ |
36 | 38 | onShow: function () { |
39 | + console.log('onshow'); | |
37 | 40 | let url = '/api/weshop/users/distribut/getMoney'; |
38 | - | |
39 | 41 | if(app.globalData.userInfo) { |
40 | 42 | if(!this.data.isLogin) { |
41 | 43 | this.setData({ |
... | ... | @@ -43,10 +45,11 @@ Page({ |
43 | 45 | imghost: app.globalData.setting.imghost, |
44 | 46 | isLogin: true, |
45 | 47 | }); |
46 | - console.log('userinfo', this.data.userInfo); | |
48 | + | |
47 | 49 | // 请求数据 |
48 | 50 | app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { |
49 | 51 | success: function(res) { |
52 | + console.log('success~~`', self.data.userInfo); | |
50 | 53 | if(res.data.code == 0){ |
51 | 54 | |
52 | 55 | self.setData({ |
... | ... | @@ -61,7 +64,6 @@ Page({ |
61 | 64 | storeId: self.data.userInfo.store_id, |
62 | 65 | userId: self.data.userInfo.user_id, |
63 | 66 | first_leader: self.data.userInfo.first_leader, |
64 | - // first_leader: '', | |
65 | 67 | }, |
66 | 68 | isShowLoading: true, |
67 | 69 | }).then(function(res) { |
... | ... | @@ -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 | 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 | 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 | 195 | } else { |
239 | 196 | wx.showToast({ | ... | ... |
packageA/pages/distribution/shop/shop.js
... | ... | @@ -28,11 +28,15 @@ Page({ |
28 | 28 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 |
29 | 29 | pageNum: 1, // 当前页数 |
30 | 30 | |
31 | + | |
31 | 32 | rank_switch: false, |
32 | 33 | card_field: "", |
33 | 34 | card_name: "", |
34 | 35 | max_card_field: "", |
35 | 36 | card_list: null |
37 | + | |
38 | + isAll: true, | |
39 | + | |
36 | 40 | }, |
37 | 41 | |
38 | 42 | /** |
... | ... | @@ -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 | 135 | app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { |
124 | 136 | data: self.data.currentQuery, |
... | ... | @@ -265,7 +277,13 @@ Page({ |
265 | 277 | * 页面上拉触底事件的处理函数 |
266 | 278 | */ |
267 | 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 | 535 | |
518 | 536 | if(isInit) {// 第一次加载 |
519 | 537 | self.setData({ |
520 | - list: res.data.data | |
538 | + list: res.data.data, | |
521 | 539 | }); |
522 | 540 | } else { |
523 | 541 | self.setData({ |
... | ... | @@ -584,10 +602,10 @@ Page({ |
584 | 602 | } else { |
585 | 603 | url = e.currentTarget.dataset.url; |
586 | 604 | } |
587 | - console.log(url); | |
588 | 605 | app.goto(url); |
589 | 606 | }, |
590 | 607 | |
608 | + | |
591 | 609 | //--- 获取卡类列表 --- |
592 | 610 | getPlusCardType: function (func) { |
593 | 611 | var storid = os.stoid; |
... | ... | @@ -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 | 699 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/shop/shop.wxml
... | ... | @@ -19,11 +19,11 @@ |
19 | 19 | |
20 | 20 | |
21 | 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 | 24 | <view>全部商品</view> |
25 | 25 | </view> |
26 | - <view class="pdv20 pdh40"> | |
26 | + <view class="pdv20 pdh40 {{!isAll ? 'selected':''}}" bindtap="clickNew"> | |
27 | 27 | <view class="fs30">{{filter.show_default(newList.total)}}</view> |
28 | 28 | <view>新品</view> |
29 | 29 | </view> |
... | ... | @@ -349,19 +349,10 @@ |
349 | 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 | 353 | </view> |
354 | + | |
355 | + | |
356 | + | |
357 | + | |
358 | + | ... | ... |