Commit a5121a3266b4208b81cf84f705a70e8e6271eb53
1 parent
bdaed009
分销功能
Showing
36 changed files
with
5020 additions
and
0 deletions
packageA/pages/distribution/card/card.js
0 → 100644
1 | +// packageA//pages/distribution/card/card.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + isLogin: false, | |
12 | + }, | |
13 | + | |
14 | + /** | |
15 | + * 生命周期函数--监听页面加载 | |
16 | + */ | |
17 | + onLoad: function (options) { | |
18 | + self = this;//保存全局指针 | |
19 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
20 | + self.setData({ | |
21 | + userInfo: data, | |
22 | + }); | |
23 | + }); | |
24 | + }, | |
25 | + | |
26 | + /** | |
27 | + * 生命周期函数--监听页面初次渲染完成 | |
28 | + */ | |
29 | + onReady: function () { | |
30 | + | |
31 | + }, | |
32 | + | |
33 | + /** | |
34 | + * 生命周期函数--监听页面显示 | |
35 | + */ | |
36 | + onShow: function () { | |
37 | + if(app.globalData.userInfo) { | |
38 | + if(!this.data.isLogin) { | |
39 | + this.setData({ | |
40 | + userInfo: app.globalData.userInfo, | |
41 | + imghost: app.globalData.setting.imghost, | |
42 | + isLogin: true, | |
43 | + }); | |
44 | + // 请求数据 | |
45 | + wx.getImageInfo({ | |
46 | + src: 'https://test-weshop.xinda100.cn/api/wx/open/app/user/getWeAppEwm/1?sceneValue=6519836&pageValue=pages/index/index/index', | |
47 | + success (res) { | |
48 | + self.setData({ | |
49 | + img: res.path, | |
50 | + }); | |
51 | + } | |
52 | + }); | |
53 | + | |
54 | + }; | |
55 | + }; | |
56 | + }, | |
57 | + | |
58 | + /** | |
59 | + * 生命周期函数--监听页面隐藏 | |
60 | + */ | |
61 | + onHide: function () { | |
62 | + | |
63 | + }, | |
64 | + | |
65 | + /** | |
66 | + * 生命周期函数--监听页面卸载 | |
67 | + */ | |
68 | + onUnload: function () { | |
69 | + | |
70 | + }, | |
71 | + | |
72 | + /** | |
73 | + * 页面相关事件处理函数--监听用户下拉动作 | |
74 | + */ | |
75 | + onPullDownRefresh: function () { | |
76 | + | |
77 | + }, | |
78 | + | |
79 | + /** | |
80 | + * 页面上拉触底事件的处理函数 | |
81 | + */ | |
82 | + onReachBottom: function () { | |
83 | + | |
84 | + }, | |
85 | + | |
86 | + /** | |
87 | + * 用户点击右上角分享 | |
88 | + */ | |
89 | + onShareAppMessage: function () { | |
90 | + | |
91 | + }, | |
92 | + | |
93 | +}) | |
0 | 94 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/card/card.json
0 → 100644
packageA/pages/distribution/card/card.wxml
0 → 100644
1 | +<view class="main"> | |
2 | + | |
3 | + <view class="panel"> | |
4 | + <view class="flex ai-center"> | |
5 | + <view><image class="avatar" src="{{userInfo.head_pic}}"/></view> | |
6 | + <view class="pdl20"> | |
7 | + <view class="fs30 bold">{{userInfo.nickname}}</view> | |
8 | + <view class="fs26">{{userInfo.mobile}}</view> | |
9 | + </view> | |
10 | + </view> | |
11 | + | |
12 | + | |
13 | + | |
14 | + <view class="t-c"> | |
15 | + <view class="pdt40 pdb20 fs28"> | |
16 | + <view>扫码进入我的小店</view> | |
17 | + <view>现在就一起欢乐购吧~</view> | |
18 | + </view> | |
19 | + <view class="pdv20"> | |
20 | + <image class="qrCode" src="{{img}}"/> | |
21 | + </view> | |
22 | + <view class="c-a fs24 pdv20">长按识别小程序码,即可买买买~</view> | |
23 | + </view> | |
24 | + | |
25 | + </view> | |
26 | + | |
27 | + | |
28 | + | |
29 | +</view> | |
0 | 30 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/card/card.wxss
0 → 100644
1 | +page, | |
2 | +.main { | |
3 | + width: 100%; | |
4 | + height: 100%; | |
5 | +} | |
6 | + | |
7 | +.main { | |
8 | + position: relative; | |
9 | + background-image: linear-gradient(-225deg,#F8C9CF,#F76275); | |
10 | +} | |
11 | + | |
12 | +.panel { | |
13 | + position: absolute; | |
14 | + top: 50%; | |
15 | + left: 50%; | |
16 | + transform: translate(-50%, -50%); | |
17 | + border-radius: 20rpx; | |
18 | + background-color: #fff; | |
19 | + padding: 60rpx; | |
20 | + width: 60%; | |
21 | +} | |
22 | + | |
23 | +.avatar { | |
24 | + background-color: #eee; | |
25 | + border-radius: 50%; | |
26 | + width: 120rpx; | |
27 | + height: 120rpx; | |
28 | +} | |
29 | + | |
30 | + | |
31 | +.qrCode-container { | |
32 | + /* width: 400rpx; | |
33 | + height: 400rpx; */ | |
34 | + /* margin: 0 auto; */ | |
35 | +} | |
36 | +.qrCode { | |
37 | + display: block; | |
38 | + width: 400rpx; | |
39 | + height: 400rpx; | |
40 | + margin: 0 auto; | |
41 | +} | |
0 | 42 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/commision/commision.js
0 → 100644
1 | +// packageA//pages/distribution/commision/commision.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + isHiddenDropdown: true,//控制下拉菜单显隐 | |
12 | + dropdownArr: ['综合','未付款','已付款','待分成','已分成','已取消'], | |
13 | + statusArr: ['未付款', '已付款', '等待分成', '已分成', '已取消'], | |
14 | + currentSelect: '',//记录当前下拉菜单选中项 | |
15 | + isInputFocus: false,//记录搜索输入框是否聚焦 | |
16 | + inputVal: '',//记录搜索输入框的内容 | |
17 | + isSort: false,//控制排序开关状态,true开启排序 | |
18 | + isDescending: false, //isDescending降序,ascending升序 | |
19 | + currentQuery: null,//保存当前请求参数 | |
20 | + | |
21 | + list: null, | |
22 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
23 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
24 | + pageNum: 1, // 当前页数 | |
25 | + }, | |
26 | + | |
27 | + /** | |
28 | + * 生命周期函数--监听页面加载 | |
29 | + */ | |
30 | + onLoad: function (options) { | |
31 | + this.setData({ | |
32 | + currentSelect: this.data.dropdownArr[0], | |
33 | + }); | |
34 | + | |
35 | + self = this;//保存全局指针 | |
36 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
37 | + self.setData({ | |
38 | + userInfo: data, | |
39 | + }); | |
40 | + }); | |
41 | + // 判断会员是否授权登录, | |
42 | + // 没有登录则跳转到登录页, | |
43 | + // 已登录则设置已登录状态,请求加载签到数据 | |
44 | + // isLogin记录登录状态 | |
45 | + // app.isLogin().then(function(data) { | |
46 | + // console.log('data', data); | |
47 | + // // 1.登录成功 | |
48 | + // self.setData({ | |
49 | + // isLogin: true, | |
50 | + // userInfo: data, | |
51 | + // currentQuery: { | |
52 | + // store_id: app.globalData.setting.stoid, | |
53 | + // user_id: app.globalData.user_id, | |
54 | + // }, | |
55 | + // }); | |
56 | + // // 2.请求数据 | |
57 | + // self.getData(true, '/api/weshop/rebateLog/commissionlist', self.data.currentQuery); | |
58 | + | |
59 | + // }); | |
60 | + }, | |
61 | + | |
62 | + /** | |
63 | + * 生命周期函数--监听页面初次渲染完成 | |
64 | + */ | |
65 | + onReady: function () { | |
66 | + | |
67 | + }, | |
68 | + | |
69 | + /** | |
70 | + * 生命周期函数--监听页面显示 | |
71 | + */ | |
72 | + onShow: function () { | |
73 | + | |
74 | + if(app.globalData.userInfo) { | |
75 | + if(!this.data.isLogin) { | |
76 | + this.setData({ | |
77 | + userInfo: app.globalData.userInfo, | |
78 | + imghost: app.globalData.setting.imghost, | |
79 | + currentQuery: { | |
80 | + store_id: app.globalData.setting.stoid, | |
81 | + user_id: app.globalData.user_id, | |
82 | + }, | |
83 | + isLogin: true, | |
84 | + }); | |
85 | + | |
86 | + // 请求数据 | |
87 | + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); | |
88 | + | |
89 | + }; | |
90 | + }; | |
91 | + | |
92 | + | |
93 | + // if(app.globalData.userInfo instanceof Object) { | |
94 | + // this.setData({ | |
95 | + // userInfo: app.globalData.userInfo, | |
96 | + // imghost: app.globalData.setting.imghost, | |
97 | + // currentQuery: { | |
98 | + // store_id: app.globalData.setting.stoid, | |
99 | + // user_id: app.globalData.user_id, | |
100 | + // }, | |
101 | + // }); | |
102 | + // // 检测从登录页返回后的登录状态 | |
103 | + // if(this.data.isLogin) { | |
104 | + // // 初次就授权登录 | |
105 | + // return; | |
106 | + // } else { | |
107 | + // // 初次未授权登录,过后才授权 | |
108 | + // this.setData({ | |
109 | + // isLogin: true | |
110 | + // }); | |
111 | + // // 请求数据 | |
112 | + // this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); | |
113 | + // }; | |
114 | + // }; | |
115 | + }, | |
116 | + | |
117 | + /** | |
118 | + * 生命周期函数--监听页面隐藏 | |
119 | + */ | |
120 | + onHide: function () { | |
121 | + | |
122 | + }, | |
123 | + | |
124 | + /** | |
125 | + * 生命周期函数--监听页面卸载 | |
126 | + */ | |
127 | + onUnload: function () { | |
128 | + | |
129 | + }, | |
130 | + | |
131 | + /** | |
132 | + * 页面相关事件处理函数--监听用户下拉动作 | |
133 | + */ | |
134 | + onPullDownRefresh: function () { | |
135 | + | |
136 | + }, | |
137 | + | |
138 | + /** | |
139 | + * 页面上拉触底事件的处理函数 | |
140 | + */ | |
141 | + onReachBottom: function () { | |
142 | + this.scrollToLower('/api/weshop/rebateLog/commissionlist', this.data.currentQuery); | |
143 | + }, | |
144 | + | |
145 | + /** | |
146 | + * 用户点击右上角分享 | |
147 | + */ | |
148 | + onShareAppMessage: function () { | |
149 | + | |
150 | + }, | |
151 | + | |
152 | + /** | |
153 | + * 点击下拉菜单 | |
154 | + */ | |
155 | + clickDropdown() { | |
156 | + this.setData({ | |
157 | + isHiddenDropdown: !this.data.isHiddenDropdown, | |
158 | + }); | |
159 | + }, | |
160 | + | |
161 | + /** | |
162 | + * 点击遮罩层 | |
163 | + */ | |
164 | + clickMask() { | |
165 | + this.setData({ | |
166 | + isHiddenDropdown: true, | |
167 | + }); | |
168 | + }, | |
169 | + | |
170 | + /** | |
171 | + * 选择下拉菜单项 | |
172 | + */ | |
173 | + selectDropdown(e) { | |
174 | + let status = null; | |
175 | + let currentIndex = e.target.dataset.index; | |
176 | + let data = this.data.currentQuery; | |
177 | + | |
178 | + if(data.status) {//清除status | |
179 | + delete data.status; | |
180 | + }; | |
181 | + if(data.page && data.page != 1) {//清除page | |
182 | + delete data.page; | |
183 | + }; | |
184 | + if(data.orderField) {//清除orderField | |
185 | + delete data.orderField; | |
186 | + }; | |
187 | + if(data.orderType) {//清除orderType | |
188 | + delete data.orderType; | |
189 | + }; | |
190 | + if(data.key) {//清除搜索输入框 | |
191 | + delete data.key; | |
192 | + }; | |
193 | + | |
194 | + if(currentIndex != 0) { | |
195 | + status = currentIndex - 1; | |
196 | + data.status = status; | |
197 | + }; | |
198 | + | |
199 | + this.setData({ | |
200 | + list: null, //清空列表 | |
201 | + isSort: false,//关闭排序 | |
202 | + isDescending: false, | |
203 | + noMore: false, | |
204 | + pageNum: 1, | |
205 | + isHiddenDropdown: true, | |
206 | + currentSelect: this.data.dropdownArr[currentIndex], | |
207 | + currentQuery: data,//保存当前请求参数 | |
208 | + inputVal: '', | |
209 | + }); | |
210 | + | |
211 | + this.getData(true, '/api/weshop/rebateLog/commissionlist', data); | |
212 | + }, | |
213 | + | |
214 | + /** | |
215 | + * 搜索输入框聚焦 | |
216 | + */ | |
217 | + inputFocus() { | |
218 | + this.setData({ | |
219 | + isInputFocus: true, | |
220 | + }); | |
221 | + }, | |
222 | + | |
223 | + /** | |
224 | + * 搜索输入框失焦 | |
225 | + */ | |
226 | + inputBlur() { | |
227 | + this.setData({ | |
228 | + isInputFocus: false, | |
229 | + }); | |
230 | + }, | |
231 | + | |
232 | + /** | |
233 | + * 搜索输入框输入内容 | |
234 | + */ | |
235 | + input(e) { | |
236 | + this.data.inputVal = e.detail.value; | |
237 | + }, | |
238 | + | |
239 | + /** | |
240 | + * 搜索输入框清空内容 | |
241 | + */ | |
242 | + inputClear() { | |
243 | + let inputVal = this.data.inputVal; | |
244 | + if(inputVal) { | |
245 | + this.setData({ | |
246 | + inputVal: '', | |
247 | + }); | |
248 | + }; | |
249 | + }, | |
250 | + | |
251 | + /** | |
252 | + * 点击搜索 | |
253 | + */ | |
254 | + search() { | |
255 | + let data = { | |
256 | + store_id: app.globalData.setting.stoid, | |
257 | + user_id: app.globalData.user_id, | |
258 | + }; | |
259 | + if(this.data.inputVal) { | |
260 | + data.key = this.data.inputVal; | |
261 | + }; | |
262 | + this.setData({ | |
263 | + currentQuery: data, | |
264 | + currentSelect: this.data.dropdownArr[0], | |
265 | + }); | |
266 | + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); | |
267 | + }, | |
268 | + | |
269 | + /** | |
270 | + * 点击佣金排序 | |
271 | + */ | |
272 | + clickSort() { | |
273 | + let orderType = ''; | |
274 | + let data = this.data.currentQuery; | |
275 | + | |
276 | + if(!this.data.isHiddenDropdown) { | |
277 | + this.setData({ | |
278 | + isHiddenDropdown: true, | |
279 | + }); | |
280 | + }; | |
281 | + | |
282 | + | |
283 | + if(data.page && data.page != 1) {//清除page | |
284 | + delete data.page; | |
285 | + }; | |
286 | + if(data.orderType) {//清除orderType | |
287 | + delete data.orderType; | |
288 | + }; | |
289 | + if(data.key) {//清除搜索输入框 | |
290 | + delete data.key; | |
291 | + }; | |
292 | + | |
293 | + if(this.data.isDescending) { | |
294 | + orderType = 'desc'; | |
295 | + } else { | |
296 | + orderType = 'asc'; | |
297 | + }; | |
298 | + data.orderField = 'money'; | |
299 | + data.orderType = orderType; | |
300 | + | |
301 | + this.setData({ | |
302 | + list: null, | |
303 | + noMore: false, | |
304 | + pageNum: 1, | |
305 | + isSort: true, | |
306 | + isDescending: !this.data.isDescending, | |
307 | + currentQuery: data, | |
308 | + }); | |
309 | + this.getData(true, '/api/weshop/rebateLog/commissionlist', this.data.currentQuery); | |
310 | + }, | |
311 | + | |
312 | + /** | |
313 | + * 请求数据 | |
314 | + */ | |
315 | + getData: function(isInit, url, data) { | |
316 | + app.request.promiseGet(url, { | |
317 | + data: data, | |
318 | + isShowLoading: true, | |
319 | + }) | |
320 | + .then(function(res) { | |
321 | + // console.log('1121', res.data.code); | |
322 | + if(res.data.code == 0) { | |
323 | + | |
324 | + self.setData({ | |
325 | + isLoading: false | |
326 | + }); | |
327 | + | |
328 | + if(isInit) {// 第一次加载 | |
329 | + self.setData({ | |
330 | + list: res.data.data | |
331 | + }); | |
332 | + } else { | |
333 | + self.setData({ | |
334 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
335 | + }); | |
336 | + }; | |
337 | + | |
338 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
339 | + self.setData({ | |
340 | + noMore: true | |
341 | + }); | |
342 | + }; | |
343 | + | |
344 | + } else { | |
345 | + self.setData({ | |
346 | + 'list.pageData': [] | |
347 | + }); | |
348 | + }; | |
349 | + | |
350 | + }) | |
351 | + .catch(function(err) { | |
352 | + console.log('出错拉!!!!',err); | |
353 | + self.setData({ | |
354 | + 'list.pageData': [] | |
355 | + }); | |
356 | + }); | |
357 | + }, | |
358 | + | |
359 | + | |
360 | + // 上拉加载 | |
361 | + scrollToLower(url, requestData) { | |
362 | + // 数据总量 | |
363 | + let total = this.data.list.total; | |
364 | + // 单页最大数据量 | |
365 | + let pageSize = this.data.list.pageSize; | |
366 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
367 | + if((total != 0)&&(total <= pageSize)) { | |
368 | + this.setData({ | |
369 | + noMore: true | |
370 | + }); | |
371 | + }; | |
372 | + | |
373 | + if(!this.data.isLoading && !this.data.noMore) { | |
374 | + this.setData({ | |
375 | + isLoading: true, | |
376 | + pageNum: this.data.pageNum + 1 | |
377 | + }); | |
378 | + requestData.page = this.data.pageNum; | |
379 | + this.getData(false, url, requestData); | |
380 | + }; | |
381 | + }, | |
382 | +}) | |
0 | 383 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/commision/commision.json
0 → 100644
packageA/pages/distribution/commision/commision.wxml
0 → 100644
1 | +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | |
2 | +<view> | |
3 | + <view class="head"> | |
4 | + <!-- 搜索 --> | |
5 | + <view class="flex ai-center fs26 bg-white pd20"> | |
6 | + <view class="input-container f1"> | |
7 | + <input class="input" type="text" value="{{inputVal}}" placeholder="请输入会员手机号码/昵称" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input"/> | |
8 | + <text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text> | |
9 | + <!-- 搜索输入框聚焦时显示关闭按钮,否则隐藏关闭按钮 --> | |
10 | + </view> | |
11 | + <view class="pd20 c-red" bindtap="search">搜索</view> | |
12 | + </view> | |
13 | + <!-- 条件筛选 --> | |
14 | + <view class="pr bg-white pdh20 pdb20"> | |
15 | + <view class="flex fs26 t-c"> | |
16 | + <view class="f1 line {{isHiddenDropdown ? '':'active'}}" bindtap="clickDropdown">{{currentSelect}}<text class="iconfont {{isHiddenDropdown ? 'icon-xia':'icon-shang'}} pdl10"></text></view> | |
17 | + <view class="f1" bindtap="clickSort">佣金 | |
18 | + <text class="iconfont icon-sort2 c-c7" wx:if="{{!isSort}}"></text> | |
19 | + <text class="t-icon t-icon-sort-up pdl10 {{!isDescending ? 'reverse':''}}" wx:else></text> | |
20 | + </view> | |
21 | + </view> | |
22 | + <view class="dropdown fs26" hidden="{{isHiddenDropdown}}" bindtap="selectDropdown"> | |
23 | + <view class="pd20" wx:for="{{dropdownArr}}" data-index="{{index}}" hover-class="hover">{{item}}</view> | |
24 | + </view> | |
25 | + </view> | |
26 | + <view class="mask" hidden="{{isHiddenDropdown}}" bindtap="clickMask"></view> | |
27 | + </view> | |
28 | + | |
29 | + | |
30 | + <view class="pd20"> | |
31 | + <view class="item fs26" wx:for="{{list.pageData}}"> | |
32 | + <view class="flex jc_sb pd20 bdb"> | |
33 | + <view class="time">{{filter.format_time(item.create_time, 1)}}</view> | |
34 | + <view class="c-red">{{filter.status(item.status, statusArr)}}</view> | |
35 | + </view> | |
36 | + <view class="pd20"><text class="c-a fs24">订单号:</text>{{item.order_sn}}</view> | |
37 | + <view class="flex t-c"> | |
38 | + <view class="pd20 w33"> | |
39 | + <view class="c-a fs24">订单金额</view> | |
40 | + <view class="pdt10 ellipsis-1"><text class="money">{{item.goods_price}}</text></view> | |
41 | + </view> | |
42 | + <view class="pd20 w33 md"> | |
43 | + <view class="c-a fs24">分成金额</view> | |
44 | + <view class="pdt10 ellipsis-1"><text class="money">{{item.money}}</text></view> | |
45 | + </view> | |
46 | + <view class="pd20 w33"> | |
47 | + <view class="c-a fs24">购买者</view> | |
48 | + <view class="pdt10 ellipsis-1"><text>{{item.nickname}}</text></view> | |
49 | + </view> | |
50 | + </view> | |
51 | + </view> | |
52 | + </view> | |
53 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> | |
54 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
55 | + | |
56 | +</view> | |
0 | 57 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/commision/commision.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.input-container { | |
6 | + position: relative; | |
7 | + background-color: #f0f0f0; | |
8 | + border-radius: 6rpx; | |
9 | +} | |
10 | +.input-container::before { | |
11 | + content: '\e618'; | |
12 | + font-family: iconfont; | |
13 | + position: absolute; | |
14 | + top: 50%; | |
15 | + left: 16rpx; | |
16 | + transform: translateY(-40%); | |
17 | + color: #aaa; | |
18 | +} | |
19 | +.input-container .icon-guanbi { | |
20 | + position: absolute; | |
21 | + top: 50%; | |
22 | + right: 16rpx; | |
23 | + transform: translateY(-40%); | |
24 | + font-size: 28rpx; | |
25 | + color: #aaa; | |
26 | + padding: 10rpx; | |
27 | + z-index: 2; | |
28 | +} | |
29 | +.input { | |
30 | + padding: 10rpx 50rpx; | |
31 | +} | |
32 | + | |
33 | +.time::before { | |
34 | + content: '\e64c'; | |
35 | + font-family: iconfont; | |
36 | + padding-right: 10rpx; | |
37 | + color: #FF6768; | |
38 | +} | |
39 | + | |
40 | +.icon-xia, | |
41 | +.icon-shang { | |
42 | + font-size: 16rpx; | |
43 | +} | |
44 | +.icon-sort2 { | |
45 | + font-size: 24rpx; | |
46 | +} | |
47 | + | |
48 | +.line { | |
49 | + position: relative; | |
50 | +} | |
51 | +.line::after { | |
52 | + content: ''; | |
53 | + position: absolute; | |
54 | + right: 0; | |
55 | + background-color: #f4f4f4; | |
56 | + width: 2rpx; | |
57 | + height: 30rpx; | |
58 | + top: 50%; | |
59 | + transform: translateY(-50%); | |
60 | +} | |
61 | + | |
62 | +.item { | |
63 | + border-radius: 12rpx; | |
64 | + background-color: white; | |
65 | +} | |
66 | + | |
67 | +.item ~ .item { | |
68 | + margin-top: 20rpx; | |
69 | +} | |
70 | + | |
71 | +.money { | |
72 | + /* word-break: break-all; | |
73 | + word-wrap: break-word; */ | |
74 | +} | |
75 | + | |
76 | +.money::before { | |
77 | + content: '¥'; | |
78 | + font-size: 22rpx; | |
79 | +} | |
80 | + | |
81 | +.md { | |
82 | + position: relative; | |
83 | +} | |
84 | +.md::before, | |
85 | +.md::after { | |
86 | + content: ''; | |
87 | + position: absolute; | |
88 | + top: 50%; | |
89 | + transform: translateY(-50%); | |
90 | + width: 2rpx; | |
91 | + height: 40%; | |
92 | + background-color: #f4f4f4; | |
93 | +} | |
94 | +.md::before { | |
95 | + left: 0; | |
96 | +} | |
97 | +.md::after { | |
98 | + right: 0; | |
99 | +} | |
100 | + | |
101 | +.noMore { | |
102 | + padding: 20rpx; | |
103 | + color: #bbb; | |
104 | + text-align: center; | |
105 | + font-size: 26rpx; | |
106 | + background-color: transparent !important; | |
107 | +} | |
108 | + | |
109 | +.head { | |
110 | + position: sticky; | |
111 | + top: 0; | |
112 | + z-index: 1; | |
113 | +} | |
114 | + | |
115 | +.dropdown { | |
116 | + border-top: 2rpx solid #f8f8f8; | |
117 | + position: absolute; | |
118 | + width: 100%; | |
119 | + top: 54rpx; | |
120 | + left: 0; | |
121 | + background-color: white; | |
122 | + z-index: 1; | |
123 | +} | |
124 | + | |
125 | + | |
126 | +.active { | |
127 | + color: #FF6768; | |
128 | + font-weight: bold; | |
129 | + position: relative; | |
130 | +} | |
131 | + | |
132 | + | |
133 | +.mask { | |
134 | + position: fixed; | |
135 | + width: 100%; | |
136 | + height: 100%; | |
137 | + background-color: rgba(0,0,0,.5); | |
138 | +} | |
139 | + | |
140 | +.hover { | |
141 | + background-color: #eee; | |
142 | +} | |
143 | + | |
144 | +.t-icon-sort-up { | |
145 | + width: 12px; | |
146 | + height: 12px; | |
147 | + position: relative; | |
148 | + top: 2rpx; | |
149 | + right: 0; | |
150 | + background-repeat: no-repeat; | |
151 | + box-sizing: border-box; | |
152 | +} | |
153 | + | |
154 | +.t-icon-sort-up.reverse { | |
155 | + transform: rotateZ(-180deg); | |
156 | +} | |
157 | + | |
158 | + | |
159 | + | ... | ... |
packageA/pages/distribution/goods/goods.js
0 → 100644
1 | +// packageA//pages/distribution/commision/commision.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + isInputFocus: false,//记录搜索输入框是否聚焦 | |
12 | + inputVal: '',//记录搜索输入框的内容 | |
13 | + isSort: false,//控制排序开关状态,true开启排序 | |
14 | + isDescending: false, //isDescending降序,ascending升序 | |
15 | + | |
16 | + | |
17 | + tabArr: [], | |
18 | + currentTabIndex: 0, | |
19 | + isShowRow: false,//控制视图切换状态 | |
20 | + isHiddenDropdown: true,//控制筛选下拉菜单显隐 | |
21 | + | |
22 | + list: null, | |
23 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
24 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
25 | + pageNum: 1, // 当前页数 | |
26 | + | |
27 | + isCheckAll: false, //记录是否全选 | |
28 | + currentQuery: { | |
29 | + store_id: app.globalData.setting.stoid, | |
30 | + }, | |
31 | + }, | |
32 | + | |
33 | + /** | |
34 | + * 生命周期函数--监听页面加载 | |
35 | + */ | |
36 | + onLoad: function (options) { | |
37 | + self = this;//保存全局指针 | |
38 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
39 | + self.setData({ | |
40 | + userInfo: data, | |
41 | + }); | |
42 | + }); | |
43 | + | |
44 | + | |
45 | + //动态设置标题:0选择商品,1上架商品 | |
46 | + let title = ''; | |
47 | + let tabArr = []; | |
48 | + if(options.index == 0) { | |
49 | + title = '选择上架商品'; | |
50 | + tabArr = ['最新','销量','评论','价格']; | |
51 | + } else { | |
52 | + title = '选择下架商品'; | |
53 | + tabArr = ['已选','必营','销量','价格']; | |
54 | + }; | |
55 | + wx.setNavigationBarTitle({ | |
56 | + title, | |
57 | + }); | |
58 | + this.setData({ | |
59 | + options, | |
60 | + tabArr, | |
61 | + }); | |
62 | + | |
63 | + | |
64 | + | |
65 | + | |
66 | + }, | |
67 | + | |
68 | + /** | |
69 | + * 生命周期函数--监听页面初次渲染完成 | |
70 | + */ | |
71 | + onReady: function () { | |
72 | + | |
73 | + }, | |
74 | + | |
75 | + /** | |
76 | + * 生命周期函数--监听页面显示 | |
77 | + */ | |
78 | + onShow: function () { | |
79 | + let url = '/api/weshop/goods/page'; | |
80 | + let currentQuery = this.data.currentQuery; | |
81 | + if(app.globalData.userInfo) { | |
82 | + if(!this.data.isLogin) { | |
83 | + this.setData({ | |
84 | + userInfo: app.globalData.userInfo, | |
85 | + imghost: app.globalData.setting.imghost, | |
86 | + isLogin: true, | |
87 | + 'currentQuery.user_id': app.globalData.user_id, | |
88 | + }); | |
89 | + | |
90 | + if(this.data.options.index == 0) {//上架商品 | |
91 | + // 请求数据 | |
92 | + currentQuery.is_mainshow = 1; | |
93 | + currentQuery.isonsale = 1; | |
94 | + // url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; | |
95 | + // this.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', this.data.currentQuery); | |
96 | + } else {//下架商品 | |
97 | + currentQuery.searchtype = 1; | |
98 | + // url = '/api/weshop/goods/page?dis_type=1'; | |
99 | + // this.getData(true, '/api/weshop/goods/page?dis_type=1', this.data.currentQuery); | |
100 | + }; | |
101 | + currentQuery.dis_type = 1; | |
102 | + this.getData(true, url, currentQuery); | |
103 | + | |
104 | + // 加载筛选条件:国别 | |
105 | + app.request.promiseGet('/api/weshop/goods/listGroupnation', { | |
106 | + data: currentQuery, | |
107 | + // isShowLoading: true, | |
108 | + }).then(function(res) { | |
109 | + console.log('nation=====>', res.data.data); | |
110 | + self.setData({ | |
111 | + nationList: res.data.data, | |
112 | + }); | |
113 | + }); | |
114 | + // 加载筛选条件:品牌 | |
115 | + app.request.promiseGet('/api/weshop/goods/listGroupbrand', { | |
116 | + data: currentQuery, | |
117 | + // isShowLoading: true, | |
118 | + }).then(function(res) { | |
119 | + console.log('brand=====>', res.data.data); | |
120 | + self.setData({ | |
121 | + brandList: res.data.data, | |
122 | + }); | |
123 | + }); | |
124 | + }; | |
125 | + }; | |
126 | + }, | |
127 | + | |
128 | + /** | |
129 | + * 生命周期函数--监听页面隐藏 | |
130 | + */ | |
131 | + onHide: function () { | |
132 | + | |
133 | + }, | |
134 | + | |
135 | + /** | |
136 | + * 生命周期函数--监听页面卸载 | |
137 | + */ | |
138 | + onUnload: function () { | |
139 | + | |
140 | + }, | |
141 | + | |
142 | + /** | |
143 | + * 页面相关事件处理函数--监听用户下拉动作 | |
144 | + */ | |
145 | + onPullDownRefresh: function () { | |
146 | + | |
147 | + }, | |
148 | + | |
149 | + /** | |
150 | + * 页面上拉触底事件的处理函数 | |
151 | + */ | |
152 | + onReachBottom: function () { | |
153 | + let data = this.data.currentQuery; | |
154 | + let options = this.data.options; | |
155 | + let url = ''; | |
156 | + | |
157 | + if(options.index == 0) { | |
158 | + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; | |
159 | + } else { | |
160 | + url = '/api/weshop/goods/page'; | |
161 | + }; | |
162 | + | |
163 | + | |
164 | + this.scrollToLower(url, data, function() { | |
165 | + let items = self.data.list.pageData; | |
166 | + let values = self.data.checkedArr; | |
167 | + let isCheckAll = self.data.isCheckAll; | |
168 | + | |
169 | + if(items.length == values.length) { | |
170 | + if(!isCheckAll) { | |
171 | + isCheckAll = !isCheckAll; | |
172 | + }; | |
173 | + } else { | |
174 | + if(isCheckAll) { | |
175 | + isCheckAll = !isCheckAll; | |
176 | + }; | |
177 | + }; | |
178 | + | |
179 | + self.setData({ | |
180 | + isCheckAll, | |
181 | + }); | |
182 | + }); | |
183 | + | |
184 | + }, | |
185 | + | |
186 | + /** | |
187 | + * 用户点击右上角分享 | |
188 | + */ | |
189 | + onShareAppMessage: function () { | |
190 | + | |
191 | + }, | |
192 | + | |
193 | + /** | |
194 | + * 点击下拉菜单 | |
195 | + */ | |
196 | + clickDropdown() { | |
197 | + this.setData({ | |
198 | + isHiddenDropdown: !this.data.isHiddenDropdown, | |
199 | + }); | |
200 | + }, | |
201 | + | |
202 | + /** | |
203 | + * 点击遮罩层 | |
204 | + */ | |
205 | + clickMask() { | |
206 | + this.setData({ | |
207 | + isHiddenDropdown: true, | |
208 | + }); | |
209 | + }, | |
210 | + | |
211 | + /** | |
212 | + * 选择下拉菜单项 | |
213 | + */ | |
214 | + selectDropdown(e) { | |
215 | + let currentIndex = e.target.dataset.index; | |
216 | + this.setData({ | |
217 | + isHiddenDropdown: true, | |
218 | + currentSelect: this.data.dropdownArr[currentIndex], | |
219 | + }); | |
220 | + }, | |
221 | + | |
222 | + /** | |
223 | + * 搜索输入框聚焦 | |
224 | + */ | |
225 | + inputFocus() { | |
226 | + this.setData({ | |
227 | + isInputFocus: true, | |
228 | + }); | |
229 | + }, | |
230 | + | |
231 | + /** | |
232 | + * 搜索输入框失焦 | |
233 | + */ | |
234 | + inputBlur() { | |
235 | + this.setData({ | |
236 | + isInputFocus: false, | |
237 | + }); | |
238 | + }, | |
239 | + | |
240 | + /** | |
241 | + * 搜索输入框输入内容 | |
242 | + */ | |
243 | + input(e) { | |
244 | + this.data.inputVal = e.detail.value; | |
245 | + }, | |
246 | + | |
247 | + /** | |
248 | + * 搜索输入框清空内容 | |
249 | + */ | |
250 | + inputClear() { | |
251 | + let inputVal = this.data.inputVal; | |
252 | + console.log('input', inputVal); | |
253 | + if(inputVal) { | |
254 | + this.setData({ | |
255 | + inputVal: '', | |
256 | + }); | |
257 | + }; | |
258 | + }, | |
259 | + | |
260 | + /** | |
261 | + * 点击搜索 | |
262 | + */ | |
263 | + search(callback) { | |
264 | + let url = ''; | |
265 | + let data = this.data.currentQuery; | |
266 | + if(data.orderField) delete data.orderField; | |
267 | + if(data.orderType) delete data.orderType; | |
268 | + if(this.data.inputVal) { | |
269 | + data.key = this.data.inputVal; | |
270 | + }; | |
271 | + if(this.data.isHiddenDropdown) { | |
272 | + if(data.nation_id) delete data.nation_id; | |
273 | + if(data.brand_id) delete data.brand_id; | |
274 | + if(data.startprice) delete data.startprice; | |
275 | + if(data.endprice) delete data.endprice; | |
276 | + }; | |
277 | + this.setData({ | |
278 | + list: null, | |
279 | + currentTabIndex: 5 | |
280 | + }); | |
281 | + // console.log('data', data); | |
282 | + | |
283 | + | |
284 | + if(this.data.options.index == 0) {//上架商品 | |
285 | + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; | |
286 | + } else {//下架商品 | |
287 | + data.dis_type = 1; | |
288 | + url = '/api/weshop/goods/page?searchtype=1'; | |
289 | + }; | |
290 | + this.getData(true, url, data) | |
291 | + .then(function() { | |
292 | + callback(); | |
293 | + }); | |
294 | + }, | |
295 | + | |
296 | + /** | |
297 | + * 点击排序 | |
298 | + */ | |
299 | + clickSort() { | |
300 | + let data = this.data.currentQuery; | |
301 | + if(!this.data.isSort) { | |
302 | + this.setData({ | |
303 | + isSort: true, | |
304 | + }); | |
305 | + } else { | |
306 | + this.setData({ | |
307 | + isDescending: !this.data.isDescending, | |
308 | + }); | |
309 | + }; | |
310 | + if(this.data.isDescending) { | |
311 | + data.orderType = 'desc'; | |
312 | + } else { | |
313 | + data.orderType = 'asc'; | |
314 | + }; | |
315 | + }, | |
316 | + | |
317 | + /** | |
318 | + * 点击视图切换按钮 | |
319 | + */ | |
320 | + change() { | |
321 | + this.setData({ | |
322 | + isShowRow: !this.data.isShowRow | |
323 | + }); | |
324 | + }, | |
325 | + | |
326 | + /** | |
327 | + * 点击Tab | |
328 | + */ | |
329 | + clickTab(e) { | |
330 | + let url = ''; | |
331 | + let isSort = this.data.isSort; | |
332 | + let data = this.data.currentQuery; | |
333 | + let isDescending = this.data.isDescending; | |
334 | + let currentIndex = e.target.dataset.index; | |
335 | + let options = this.data.options; | |
336 | + | |
337 | + if(currentIndex != 3) { | |
338 | + if(isSort) { | |
339 | + isSort = false; | |
340 | + }; | |
341 | + if(isDescending) { | |
342 | + isDescending = false; | |
343 | + }; | |
344 | + }; | |
345 | + if(data.page) delete data.page; | |
346 | + if(data.key) delete data.key; | |
347 | + | |
348 | + this.setData({ | |
349 | + currentTabIndex: currentIndex, | |
350 | + isSort, | |
351 | + isDescending, | |
352 | + list: null, | |
353 | + noMore: false, | |
354 | + pageNum: 1, | |
355 | + isCheckAll: false, //清除全选状态 | |
356 | + }); | |
357 | + | |
358 | + switch(currentIndex) { | |
359 | + case 0: { | |
360 | + if(data.orderField) delete data.orderField; | |
361 | + if(data.orderType) delete data.orderType; | |
362 | + if(options.index == 1) {//下架:已选 | |
363 | + data.searchtype = 1; | |
364 | + data.dis_type = 1; | |
365 | + }; | |
366 | + break; | |
367 | + }; | |
368 | + case 1: { | |
369 | + if(options.index == 0) {//上架:销量排序 | |
370 | + if(data.orderType) delete data.orderType; | |
371 | + data.orderField = 'sales_sum'; | |
372 | + } else {//下架:必营 | |
373 | + if(data.searchtype) delete data.searchtype; | |
374 | + if(data.orderField) delete data.orderField; | |
375 | + if(data.orderType) delete data.orderType; | |
376 | + data.dis_type = 0; | |
377 | + }; | |
378 | + break; | |
379 | + }; | |
380 | + case 2: { | |
381 | + if(options.index == 0) {//上架:评论排序 | |
382 | + if(data.orderType) delete data.orderType; | |
383 | + data.orderField = 'comment_count'; | |
384 | + } else {//下架:销量排序 | |
385 | + if(data.orderType) delete data.orderType; | |
386 | + data.orderField = 'sales_sum'; | |
387 | + data.dis_type = 1; | |
388 | + data.searchtype = 1; | |
389 | + }; | |
390 | + break; | |
391 | + }; | |
392 | + case 3: { | |
393 | + data.orderField = 'shop_price'; | |
394 | + data.dis_type = 1; | |
395 | + break; | |
396 | + }; | |
397 | + }; | |
398 | + | |
399 | + if(options.index == 0) { | |
400 | + url = '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1'; | |
401 | + } else { | |
402 | + url = '/api/weshop/goods/page'; | |
403 | + }; | |
404 | + this.getData(true, url, data); | |
405 | + }, | |
406 | + | |
407 | + /** | |
408 | + * 点击筛选 | |
409 | + */ | |
410 | + clickFilter() { | |
411 | + this.setData({ | |
412 | + isHiddenDropdown: !this.data.isHiddenDropdown, | |
413 | + }); | |
414 | + }, | |
415 | + | |
416 | + /** | |
417 | + * 点击遮罩层,关闭筛选下拉菜单 | |
418 | + */ | |
419 | + clickMask() { | |
420 | + if(!this.data.isHiddenDropdown) { | |
421 | + this.setData({ | |
422 | + isHiddenDropdown: true, | |
423 | + }); | |
424 | + } | |
425 | + }, | |
426 | + | |
427 | + /** | |
428 | + * promiseGet请求数据 | |
429 | + */ | |
430 | + getData: function(isInit, url, data) { | |
431 | + return new Promise(function(resolve, reject) { | |
432 | + | |
433 | + app.request.promiseGet(url, { | |
434 | + data: data, | |
435 | + isShowLoading: true, | |
436 | + }) | |
437 | + .then(function(res) { | |
438 | + // console.log('1121', res.data.code); | |
439 | + if(res.data.code == 0) { | |
440 | + | |
441 | + self.setData({ | |
442 | + isLoading: false | |
443 | + }); | |
444 | + | |
445 | + if(isInit) {// 第一次加载 | |
446 | + self.setData({ | |
447 | + list: res.data.data | |
448 | + }); | |
449 | + } else { | |
450 | + self.setData({ | |
451 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
452 | + }); | |
453 | + }; | |
454 | + | |
455 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
456 | + self.setData({ | |
457 | + noMore: true | |
458 | + }); | |
459 | + }; | |
460 | + | |
461 | + } else { | |
462 | + self.setData({ | |
463 | + 'list.pageData': [] | |
464 | + }); | |
465 | + }; | |
466 | + resolve(); | |
467 | + }) | |
468 | + .catch(function(err) { | |
469 | + console.log('出错拉!!!!',err); | |
470 | + self.setData({ | |
471 | + 'list.pageData': [] | |
472 | + }); | |
473 | + }); | |
474 | + | |
475 | + }); | |
476 | + | |
477 | + }, | |
478 | + | |
479 | + | |
480 | + /** | |
481 | + * 上拉加载数据 | |
482 | + */ | |
483 | + scrollToLower(url, requestData, callback) { | |
484 | + // 数据总量 | |
485 | + let total = this.data.list.total; | |
486 | + // 单页最大数据量 | |
487 | + let pageSize = this.data.list.pageSize; | |
488 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
489 | + if((total != 0)&&(total <= pageSize)) { | |
490 | + this.setData({ | |
491 | + noMore: true | |
492 | + }); | |
493 | + }; | |
494 | + | |
495 | + if(!this.data.isLoading && !this.data.noMore) { | |
496 | + this.setData({ | |
497 | + isLoading: true, | |
498 | + pageNum: this.data.pageNum + 1 | |
499 | + }); | |
500 | + requestData.page = this.data.pageNum; | |
501 | + | |
502 | + this.getData(false, url, requestData) | |
503 | + .then(function() { | |
504 | + callback(); | |
505 | + }); | |
506 | + }; | |
507 | + }, | |
508 | + | |
509 | + /** | |
510 | + * 点击多选框 | |
511 | + */ | |
512 | + checkboxChange(e) { | |
513 | + // 全选的情况下,取消选择某个单项,全选状态取消 | |
514 | + // 手动选择所有单项,全选状态点亮 | |
515 | + let items = this.data.list.pageData; | |
516 | + let values = e.detail.value; | |
517 | + let isCheckAll = this.data.isCheckAll; | |
518 | + | |
519 | + if(items.length == values.length) { | |
520 | + if(!isCheckAll) { | |
521 | + isCheckAll = !isCheckAll; | |
522 | + }; | |
523 | + } else { | |
524 | + if(isCheckAll) { | |
525 | + isCheckAll = !isCheckAll; | |
526 | + }; | |
527 | + }; | |
528 | + | |
529 | + this.setData({ | |
530 | + isCheckAll, | |
531 | + checkedArr: values, | |
532 | + }); | |
533 | + // console.log('选择的数组1',values); | |
534 | + }, | |
535 | + | |
536 | + /** | |
537 | + * 全选 | |
538 | + */ | |
539 | + clickCheckAll(e) { | |
540 | + let checkedArr = []; | |
541 | + let items = this.data.list.pageData; | |
542 | + for(let i = 0, length = items.length; i < length; i++) { | |
543 | + items[i].checked = !this.data.isCheckAll; | |
544 | + if(items[i].checked) { | |
545 | + checkedArr.push(items[i].goods_id); | |
546 | + }; | |
547 | + }; | |
548 | + this.setData({ | |
549 | + 'list.pageData': items, | |
550 | + isCheckAll: !this.data.isCheckAll, | |
551 | + checkedArr, | |
552 | + }); | |
553 | + // console.log('选择的数组',checkedArr); | |
554 | + }, | |
555 | + | |
556 | + /** | |
557 | + * 处理多选的e.detail.value | |
558 | + */ | |
559 | + handleValues(arr) { | |
560 | + if(arr) { | |
561 | + let newArr = []; | |
562 | + arr.forEach(function(item, index) { | |
563 | + newArr.push({'goods_id': item}); | |
564 | + }); | |
565 | + // console.log('newArr', newArr); | |
566 | + return newArr; | |
567 | + }; | |
568 | + }, | |
569 | + | |
570 | + /** | |
571 | + * 一键上架 | |
572 | + */ | |
573 | + putOn() { | |
574 | + let checkedArr = this.data.checkedArr; | |
575 | + let checkedList = this.handleValues(checkedArr); | |
576 | + | |
577 | + app.request.promisePost('/api/weshop/users/distribut/UpGoods', { | |
578 | + is_json: true, | |
579 | + data: { | |
580 | + storeId: app.globalData.setting.stoid, | |
581 | + userId: app.globalData.user_id, | |
582 | + goods: checkedList, | |
583 | + }, | |
584 | + }).then(function() { | |
585 | + self.setData({ | |
586 | + isCheckAll: false, | |
587 | + }); | |
588 | + self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery); | |
589 | + }); | |
590 | + }, | |
591 | + | |
592 | + /** | |
593 | + * 一键下架 | |
594 | + */ | |
595 | + pullOff() { | |
596 | + let data = { | |
597 | + storeId: app.globalData.setting.stoid, | |
598 | + userId: app.globalData.user_id, | |
599 | + }; | |
600 | + let isCheckAll = this.data.isCheckAll; | |
601 | + | |
602 | + if(isCheckAll) { | |
603 | + // console.log('全选啦~'); | |
604 | + data.type = 1; | |
605 | + } else { | |
606 | + let checkedArr = this.data.checkedArr; | |
607 | + let checkedList = this.handleValues(checkedArr); | |
608 | + data.goods = checkedList; | |
609 | + }; | |
610 | + | |
611 | + app.request.promisePost('/api/weshop/users/distribut/DownGoods', { | |
612 | + is_json: true, | |
613 | + data: data, | |
614 | + }).then(function() { | |
615 | + // console.log('data', self.data.currentQuery); | |
616 | + self.setData({ | |
617 | + isCheckAll: false, | |
618 | + }); | |
619 | + self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery); | |
620 | + }); | |
621 | + }, | |
622 | + | |
623 | + /** | |
624 | + * 点击跳转 | |
625 | + */ | |
626 | + goto(e) { | |
627 | + let url = ''; | |
628 | + if(e.target.dataset.name == 'checkbox') { | |
629 | + return; | |
630 | + } else { | |
631 | + if(e.target.dataset.url) { | |
632 | + url = e.target.dataset.url; | |
633 | + } else { | |
634 | + url = e.currentTarget.dataset.url; | |
635 | + } | |
636 | + app.goto(url); | |
637 | + }; | |
638 | + }, | |
639 | + | |
640 | + | |
641 | + /** | |
642 | + * 筛选:选择 | |
643 | + */ | |
644 | + select(e) { | |
645 | + let currentIndex = e.target.dataset.index; | |
646 | + let name = e.target.dataset.name; | |
647 | + let id = e.target.dataset.id; | |
648 | + let currentQuery = this.data.currentQuery; | |
649 | + | |
650 | + switch(name) { | |
651 | + case 'nation': { | |
652 | + this.setData({ | |
653 | + nationIndex: currentIndex, | |
654 | + }); | |
655 | + currentQuery.nation_id = id; | |
656 | + break; | |
657 | + }; | |
658 | + case 'brand': { | |
659 | + this.setData({ | |
660 | + brandIndex: currentIndex, | |
661 | + }); | |
662 | + currentQuery.brand_id = id; | |
663 | + break; | |
664 | + }; | |
665 | + }; | |
666 | + | |
667 | + }, | |
668 | + | |
669 | + | |
670 | + /** | |
671 | + * 筛选:获取价格区间 | |
672 | + */ | |
673 | + getPrice(e) { | |
674 | + let isMax = e.target.dataset.ismax; | |
675 | + let price = e.detail.value; | |
676 | + let currentQuery = this.data.currentQuery; | |
677 | + | |
678 | + if(isMax == 0) { | |
679 | + currentQuery.startprice = price; | |
680 | + } else { | |
681 | + currentQuery.endprice = price; | |
682 | + }; | |
683 | + }, | |
684 | + | |
685 | + /** | |
686 | + * 筛选:点击确定 | |
687 | + */ | |
688 | + startFilter() { | |
689 | + let data = this.data.currentQuery; | |
690 | + let startprice = parseFloat(data.startprice); | |
691 | + let endprice = parseFloat(data.endprice); | |
692 | + | |
693 | + // 如果筛选条件为空,按确定按钮不发送请求 | |
694 | + if(!data.nation_id && !data.brand_id && !startprice && !endprice && !this.data.inputVal) { | |
695 | + this.setData({ | |
696 | + isHiddenDropdown: true, | |
697 | + }); | |
698 | + return; | |
699 | + }; | |
700 | + | |
701 | + if(startprice && endprice) { | |
702 | + if(startprice > endprice) { | |
703 | + wx.showToast({ | |
704 | + title: '最低价不能高于最高价', | |
705 | + icon: 'none', | |
706 | + duration: 2000 | |
707 | + }); | |
708 | + return; | |
709 | + }; | |
710 | + }; | |
711 | + if(!this.data.inputVal) { | |
712 | + if(data.key) delete data.key; | |
713 | + }; | |
714 | + | |
715 | + this.search(function() { | |
716 | + self.setData({ | |
717 | + isHiddenDropdown: true, | |
718 | + }); | |
719 | + }); | |
720 | + }, | |
721 | + | |
722 | + /** | |
723 | + * 筛选:重置 | |
724 | + */ | |
725 | + reset() { | |
726 | + let data = this.data.currentQuery; | |
727 | + | |
728 | + if(data.nation_id) delete data.nation_id; | |
729 | + if(data.brand_id) delete data.brand_id; | |
730 | + if(data.startprice) delete data.startprice; | |
731 | + if(data.endprice) delete data.endprice; | |
732 | + if(data.key) delete data.key; | |
733 | + | |
734 | + this.setData({ | |
735 | + nationIndex: null, | |
736 | + brandIndex: null, | |
737 | + price: null, | |
738 | + inputVal: null, | |
739 | + }); | |
740 | + } | |
741 | +}) | |
0 | 742 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/goods/goods.json
0 → 100644
packageA/pages/distribution/goods/goods.wxml
0 → 100644
1 | +<view> | |
2 | + <view class="head pr"> | |
3 | + <!-- 搜索 --> | |
4 | + <view class="flex ai-center fs26 bg-white pd20"> | |
5 | + <view class="input-container f1"> | |
6 | + <input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" confirm-type="search" bindconfirm="search"/> | |
7 | + <text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text> | |
8 | + <!-- 搜索输入框聚焦时显示关闭按钮,否则隐藏关闭按钮 --> | |
9 | + </view> | |
10 | + <view class="pd20 filter {{isHiddenDropdown ? '':'c-red'}}" bindtap="clickFilter">筛选</view> | |
11 | + | |
12 | + <view class="dropdown {{isHiddenDropdown ? '':'show'}}" hidden="{{isHiddenDropdown}}"> | |
13 | + <view class="dropdown-wrapper"> | |
14 | + <view class="pd20 bsbb"> | |
15 | + <view class="pdb20">国家</view> | |
16 | + <view class="flex wrap t-c" bindtap="select"> | |
17 | + <view class="w25 pdt20" wx:for="{{nationList}}"><text class="label {{nationIndex == index ? 'selected':''}}" data-id="{{item.nation_id}}" data-name="nation" data-index="{{index}}">{{item.name}}</text></view> | |
18 | + </view> | |
19 | + </view> | |
20 | + <view class="pd20 bsbb" > | |
21 | + <view class="pdb20">品牌</view> | |
22 | + <view class="flex wrap t-c" bindtap="select"> | |
23 | + <view class="w25 pdt20" wx:for="{{brandList}}"><text class="label {{brandIndex == index ? 'selected':''}}" data-id="{{item.brand_id}}" data-name="brand" data-index="{{index}}">{{item.name}}</text></view> | |
24 | + </view> | |
25 | + </view> | |
26 | + <view class="pd20 bsbb"> | |
27 | + <view class="pdb20">价格区间</view> | |
28 | + <view class="flex t-c ai-center jc-center"> | |
29 | + <view class="w30 pdh20"><input type="number" value="{{price}}" placeholder="最低价" class="input-price" bindinput="getPrice" data-ismax="0"/></view> | |
30 | + <view class="mgh20">-</view> | |
31 | + <view class="w30 pdh20"><input type="number" value="{{price}}" placeholder="最高价" class="input-price" bindinput="getPrice" data-ismax="1"/></view> | |
32 | + <!-- <view class="w25 pdt20"><text class="label">品牌一</text></view> --> | |
33 | + </view> | |
34 | + </view> | |
35 | + <!-- <view> | |
36 | + <view class="pd20 bold">价格</view> | |
37 | + <view class="flex"> | |
38 | + <view>价格一</view> | |
39 | + <view>价格二</view> | |
40 | + <view>价格三</view> | |
41 | + </view> | |
42 | + </view> --> | |
43 | + </view> | |
44 | + <view class="flex t-c"> | |
45 | + <view class="pd30 f1 bg-f0" bindtap="reset">重置</view> | |
46 | + <view class="pd30 f1 l-red white" bindtap="startFilter">确定</view> | |
47 | + </view> | |
48 | + </view> | |
49 | + <view class="mask" bindtap="clickMask"></view> | |
50 | + </view> | |
51 | + | |
52 | + | |
53 | + <view class="flex t-c fs26 bg-white bdb" bindtap="clickTab"> | |
54 | + <block wx:for="{{tabArr}}"> | |
55 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}">{{item}}</view> | |
56 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort"> | |
57 | + {{item}}<text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}" data-index="{{index}}"></text> | |
58 | + <text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" data-index="{{index}}" wx:else></text> | |
59 | + </view> | |
60 | + </block> | |
61 | + <view class="f1 pd20" catchtap="change"> | |
62 | + <text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text> | |
63 | + </view> | |
64 | + </view> | |
65 | + | |
66 | + </view> | |
67 | + | |
68 | + | |
69 | + <view class="content"> | |
70 | + <checkbox-group class="fs26" wx:if="{{isShowRow}}" bindchange="checkboxChange"> | |
71 | + <view class="item bg-white flex ai-center pd20" wx:for="{{list.pageData}}"> | |
72 | + <!-- <label> | |
73 | + | |
74 | + </label> --> | |
75 | + <checkbox value="{{item.goods_id}}" checked="{{item.checked}}"/> | |
76 | + <view class="flex pdl10" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
77 | + <view class="pdr20"><image class="img" src="{{imghost + item.original_img}}" lazy-load/></view> | |
78 | + <view class="flex fdc jc_sb"> | |
79 | + <view class="ellipsis-2">{{item.goods_name}}</view> | |
80 | + <view> | |
81 | + <view class="money fs32 c-red">1.00</view> | |
82 | + <view class="fs24 c-a">分成金额:<text class="money c-red">{{item.commission}}</text></view> | |
83 | + </view> | |
84 | + </view> | |
85 | + </view> | |
86 | + </view> | |
87 | + </checkbox-group> | |
88 | + | |
89 | + <checkbox-group class="fs26 flex pd20 wrap" catchchange="checkboxChange" wx:else> | |
90 | + <view class="item2 bg-white" wx:for="{{list.pageData}}" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
91 | + <image class="img2" src="{{imghost + item.original_img}}" mode="aspectFit" lazy-load/> | |
92 | + <view class="pd20 fs26 flex jc_sb fdc f1"> | |
93 | + <view class="ellipsis-2">{{item.goods_name}}</view> | |
94 | + <view class="flex ai-center jc_sb pdt20"> | |
95 | + <checkbox value="{{item.goods_id}}" checked="{{item.checked}}" data-name="checkbox"/> | |
96 | + <view class="t-r"> | |
97 | + <view class="money c-red fs32">1.00</view> | |
98 | + <view class="c-a">分成金额:<text class="money c-red">{{item.commission}}</text></view> | |
99 | + </view> | |
100 | + </view> | |
101 | + </view> | |
102 | + </view> | |
103 | + </checkbox-group> | |
104 | + | |
105 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 || list == null}}"></nodata> | |
106 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
107 | + </view> | |
108 | + | |
109 | + | |
110 | + | |
111 | + | |
112 | + | |
113 | + <view class="bottomBar flex pd20 jc_sb fs26 ai-center"> | |
114 | + <!-- <view> --> | |
115 | + <label class="flex ai-center" bindtap="clickCheckAll"> | |
116 | + <checkbox checked="{{isCheckAll}}"/>全选 | |
117 | + </label> | |
118 | + <!-- </view> --> | |
119 | + <view class="pd20 btn" wx:if="{{options.index == 0}}" bindtap="putOn">一键上架</view> | |
120 | + <view class="pd20 btn" wx:else bindtap="pullOff">一键下架</view> | |
121 | + </view> | |
122 | + | |
123 | + | |
124 | + | |
125 | +</view> | ... | ... |
packageA/pages/distribution/goods/goods.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.input-container { | |
6 | + position: relative; | |
7 | + background-color: #f0f0f0; | |
8 | + border-radius: 6rpx; | |
9 | +} | |
10 | +.input-container::before { | |
11 | + content: '\e618'; | |
12 | + font-family: iconfont; | |
13 | + position: absolute; | |
14 | + top: 50%; | |
15 | + left: 16rpx; | |
16 | + transform: translateY(-40%); | |
17 | + color: #aaa; | |
18 | +} | |
19 | +.input-container .icon-guanbi { | |
20 | + position: absolute; | |
21 | + top: 50%; | |
22 | + right: 16rpx; | |
23 | + transform: translateY(-40%); | |
24 | + font-size: 28rpx; | |
25 | + color: #aaa; | |
26 | + padding: 10rpx; | |
27 | + z-index: 2; | |
28 | +} | |
29 | +.input { | |
30 | + padding: 10rpx 50rpx; | |
31 | +} | |
32 | + | |
33 | +.time::before { | |
34 | + content: '\e64c'; | |
35 | + font-family: iconfont; | |
36 | + padding-right: 10rpx; | |
37 | + color: #FF6768; | |
38 | +} | |
39 | + | |
40 | +.icon-xia, | |
41 | +.icon-shang { | |
42 | + font-size: 16rpx; | |
43 | +} | |
44 | +.icon-sort2 { | |
45 | + font-size: 24rpx; | |
46 | +} | |
47 | + | |
48 | +/* .line { | |
49 | + position: relative; | |
50 | +} | |
51 | +.line::after { | |
52 | + content: ''; | |
53 | + position: absolute; | |
54 | + right: 0; | |
55 | + background-color: #f4f4f4; | |
56 | + width: 2rpx; | |
57 | + height: 30rpx; | |
58 | + top: 50%; | |
59 | + transform: translateY(-50%); | |
60 | +} */ | |
61 | + | |
62 | +/* .item { | |
63 | + border-radius: 12rpx; | |
64 | + background-color: white; | |
65 | +} */ | |
66 | + | |
67 | +/* .item ~ .item { | |
68 | + margin-top: 20rpx; | |
69 | +} */ | |
70 | + | |
71 | +.money { | |
72 | + /* word-break: break-all; | |
73 | + word-wrap: break-word; */ | |
74 | +} | |
75 | + | |
76 | +.money::before { | |
77 | + content: '¥'; | |
78 | + font-size: 22rpx; | |
79 | +} | |
80 | + | |
81 | +.md { | |
82 | + position: relative; | |
83 | +} | |
84 | +.md::before, | |
85 | +.md::after { | |
86 | + content: ''; | |
87 | + position: absolute; | |
88 | + top: 50%; | |
89 | + transform: translateY(-50%); | |
90 | + width: 2rpx; | |
91 | + height: 40%; | |
92 | + background-color: #f4f4f4; | |
93 | +} | |
94 | +.md::before { | |
95 | + left: 0; | |
96 | +} | |
97 | +.md::after { | |
98 | + right: 0; | |
99 | +} | |
100 | + | |
101 | +.noMore { | |
102 | + padding: 20rpx; | |
103 | + color: #bbb; | |
104 | + text-align: center; | |
105 | + font-size: 26rpx; | |
106 | + background-color: transparent !important; | |
107 | +} | |
108 | + | |
109 | +.head { | |
110 | + position: sticky; | |
111 | + top: 0; | |
112 | + z-index: 1; | |
113 | +} | |
114 | + | |
115 | +.dropdown { | |
116 | + border-top: 2rpx solid #f8f8f8; | |
117 | + position: absolute; | |
118 | + width: 100%; | |
119 | + top: 54rpx; | |
120 | + left: 0; | |
121 | + background-color: white; | |
122 | + z-index: 1; | |
123 | +} | |
124 | + | |
125 | + | |
126 | +.active { | |
127 | + color: #FF6768; | |
128 | + font-weight: bold; | |
129 | + position: relative; | |
130 | +} | |
131 | + | |
132 | +.active::after { | |
133 | + content: ''; | |
134 | + width: 30%; | |
135 | + height: 2rpx; | |
136 | + background-color: #FF6768; | |
137 | + position: absolute; | |
138 | + left: 0; | |
139 | + right: 0; | |
140 | + bottom: 0; | |
141 | + margin: 0 auto; | |
142 | +} | |
143 | + | |
144 | + | |
145 | +.mask { | |
146 | + position: fixed; | |
147 | + width: 100%; | |
148 | + height: 100%; | |
149 | + background-color: rgba(0,0,0,.5); | |
150 | +} | |
151 | + | |
152 | +.hover { | |
153 | + background-color: #eee; | |
154 | +} | |
155 | + | |
156 | +.t-icon-sort-up { | |
157 | + width: 12px; | |
158 | + height: 12px; | |
159 | + position: relative; | |
160 | + top: 2rpx; | |
161 | + right: 0; | |
162 | + background-repeat: no-repeat; | |
163 | + box-sizing: border-box; | |
164 | +} | |
165 | + | |
166 | +.t-icon-sort-up.reverse { | |
167 | + transform: rotateZ(-180deg); | |
168 | +} | |
169 | + | |
170 | + | |
171 | + | |
172 | + | |
173 | +.img { | |
174 | + width: 240rpx; | |
175 | + height: 240rpx; | |
176 | + background-color: #eee; | |
177 | +} | |
178 | + | |
179 | +.img2 { | |
180 | + display: block; | |
181 | + width: 100%; | |
182 | + height: 340rpx; | |
183 | + /* height: auto; */ | |
184 | + /* width: 200rpx; | |
185 | + height: 200rpx; */ | |
186 | + background-color: white; | |
187 | +} | |
188 | + | |
189 | + | |
190 | +/*checkbox 整体大小 */ | |
191 | +checkbox { | |
192 | + /* width: 240rpx; | |
193 | + height: 90rpx; */ | |
194 | +} | |
195 | +/*checkbox 选项框大小 */ | |
196 | +checkbox .wx-checkbox-input { | |
197 | + width: 34rpx; | |
198 | + height: 34rpx; | |
199 | + border-radius: 50%; | |
200 | + | |
201 | +} | |
202 | +/*checkbox选中后样式 */ | |
203 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked { | |
204 | + background-color: #FF6768; | |
205 | + border-color: #FF6768; | |
206 | + /* color: white; */ | |
207 | +} | |
208 | +/*checkbox选中后图标样式 */ | |
209 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { | |
210 | + width: 34rpx; | |
211 | + height: 34rpx; | |
212 | + line-height: 34rpx; | |
213 | + text-align: center; | |
214 | + font-size: 24rpx; | |
215 | + color: #fff; | |
216 | + background: transparent; | |
217 | + transform: translate(-50%, -50%) scale(1); | |
218 | + -webkit-transform: translate(-50%, -50%) scale(1); | |
219 | +} | |
220 | + | |
221 | +.bottomBar { | |
222 | + box-sizing: border-box; | |
223 | + position: fixed; | |
224 | + bottom: 0; | |
225 | + width: 100%; | |
226 | + background-color: white; | |
227 | + border-radius: 20rpx 20rpx 0 0; | |
228 | +} | |
229 | + | |
230 | +.btn { | |
231 | + color: white; | |
232 | + background-color: #FF6768; | |
233 | + border-radius: 6rpx; | |
234 | +} | |
235 | + | |
236 | +/* .item { | |
237 | + border-radius: 10rpx; | |
238 | +} */ | |
239 | + | |
240 | +.item2 { | |
241 | + width: calc((100% - 20rpx)/2); | |
242 | + box-sizing: border-box; | |
243 | + border-radius: 12rpx; | |
244 | + overflow: hidden; | |
245 | + margin-bottom: 20rpx; | |
246 | + display: flex; | |
247 | + flex-direction: column; | |
248 | +} | |
249 | + | |
250 | +.item2:nth-child(even) { | |
251 | + margin-left: 20rpx; | |
252 | +} | |
253 | + | |
254 | +.content { | |
255 | + padding-bottom: 110rpx; | |
256 | +} | |
257 | + | |
258 | +.dropdown { | |
259 | + position: absolute; | |
260 | + left: 0; | |
261 | + top: 114rpx; | |
262 | + width: 100%; | |
263 | + background-color: white; | |
264 | + box-sizing: border-box; | |
265 | +} | |
266 | + | |
267 | +.label { | |
268 | + display: inline-block; | |
269 | + padding: 5rpx 20rpx; | |
270 | + color: #aaa; | |
271 | + border: 2rpx solid #eee; | |
272 | + background-color: #f8f8f8; | |
273 | + border-radius: 6rpx; | |
274 | + box-sizing: border-box; | |
275 | + text-align: center; | |
276 | +} | |
277 | + | |
278 | + | |
279 | +.mask { | |
280 | + display: none; | |
281 | + position: fixed; | |
282 | + left: 0; | |
283 | + right: 0; | |
284 | + top: 0; | |
285 | + bottom: 0; | |
286 | + background-color: rgba(0,0,0,.5); | |
287 | + z-index: -1; | |
288 | +} | |
289 | + | |
290 | +.bsbb { | |
291 | + box-sizing: border-box; | |
292 | +} | |
293 | + | |
294 | +.l-red { | |
295 | + background-image: linear-gradient(-225deg, #FF6060, #FF6768); | |
296 | +} | |
297 | + | |
298 | +.bgf0 { | |
299 | + background-color: #f0f0f0; | |
300 | +} | |
301 | + | |
302 | +.filter::after { | |
303 | + content: '\e68a'; | |
304 | + font-family: iconfont; | |
305 | +} | |
306 | + | |
307 | +.dropdown.show ~ .mask { | |
308 | + display: block; | |
309 | +} | |
310 | + | |
311 | +.input-price { | |
312 | + background-color: #f0f0f0; | |
313 | + border-radius: 30rpx; | |
314 | + height: 60rpx; | |
315 | +} | |
316 | + | |
317 | +.dropdown-wrapper { | |
318 | + max-height: 1000rpx; | |
319 | + overflow-y: auto; | |
320 | +} | |
321 | + | |
322 | +.label.selected { | |
323 | + color: #FF6768; | |
324 | + border: 2rpx solid #FF6768; | |
325 | +} | |
326 | + | |
327 | + | |
328 | + | ... | ... |
packageA/pages/distribution/main/main.js
0 → 100644
1 | +// packageA//pages/distribution/main/main.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + | |
12 | + }, | |
13 | + | |
14 | + /** | |
15 | + * 生命周期函数--监听页面加载 | |
16 | + */ | |
17 | + onLoad: function (options) { | |
18 | + self = this;//保存全局指针 | |
19 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
20 | + self.setData({ | |
21 | + userInfo: data, | |
22 | + }); | |
23 | + }); | |
24 | + }, | |
25 | + | |
26 | + /** | |
27 | + * 生命周期函数--监听页面初次渲染完成 | |
28 | + */ | |
29 | + onReady: function () { | |
30 | + | |
31 | + }, | |
32 | + | |
33 | + /** | |
34 | + * 生命周期函数--监听页面显示 | |
35 | + */ | |
36 | + onShow: function () { | |
37 | + let url = '/api/weshop/users/distribut/getMoney'; | |
38 | + | |
39 | + if(app.globalData.userInfo) { | |
40 | + if(!this.data.isLogin) { | |
41 | + this.setData({ | |
42 | + userInfo: app.globalData.userInfo, | |
43 | + imghost: app.globalData.setting.imghost, | |
44 | + isLogin: true, | |
45 | + }); | |
46 | + console.log('userinfo', this.data.userInfo); | |
47 | + // 请求数据 | |
48 | + app.request.get(url + '/' + this.data.userInfo.store_id + '/' + this.data.userInfo.user_id, { | |
49 | + success: function(res) { | |
50 | + if(res.data.code == 0){ | |
51 | + | |
52 | + self.setData({ | |
53 | + data: res.data.data, | |
54 | + }); | |
55 | + | |
56 | + } else { | |
57 | + // if(!res.data.data.is_distribut) {//如果不是分销商:0不是,1是 | |
58 | + | |
59 | + app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
60 | + data: { | |
61 | + storeId: self.data.userInfo.store_id, | |
62 | + userId: self.data.userInfo.user_id, | |
63 | + first_leader: self.data.userInfo.first_leader, | |
64 | + // first_leader: '', | |
65 | + }, | |
66 | + isShowLoading: true, | |
67 | + }).then(function(res) { | |
68 | + console.log('!!!===>', res); | |
69 | + self.setData({ | |
70 | + fenxiao: res.data.data, | |
71 | + }); | |
72 | + }); | |
73 | + | |
74 | + // }; | |
75 | + }; | |
76 | + }, | |
77 | + fail: function() { | |
78 | + | |
79 | + }, | |
80 | + }); | |
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 | + | |
87 | + }; | |
88 | + }; | |
89 | + | |
90 | + }, | |
91 | + | |
92 | + /** | |
93 | + * 生命周期函数--监听页面隐藏 | |
94 | + */ | |
95 | + onHide: function () { | |
96 | + | |
97 | + }, | |
98 | + | |
99 | + /** | |
100 | + * 生命周期函数--监听页面卸载 | |
101 | + */ | |
102 | + onUnload: function () { | |
103 | + | |
104 | + }, | |
105 | + | |
106 | + /** | |
107 | + * 页面相关事件处理函数--监听用户下拉动作 | |
108 | + */ | |
109 | + onPullDownRefresh: function () { | |
110 | + | |
111 | + }, | |
112 | + | |
113 | + /** | |
114 | + * 页面上拉触底事件的处理函数 | |
115 | + */ | |
116 | + onReachBottom: function () { | |
117 | + | |
118 | + }, | |
119 | + | |
120 | + /** | |
121 | + * 用户点击右上角分享 | |
122 | + */ | |
123 | + onShareAppMessage: function () { | |
124 | + | |
125 | + }, | |
126 | + | |
127 | + /** | |
128 | + * 点击跳转 | |
129 | + */ | |
130 | + goto(e) { | |
131 | + let url = ''; | |
132 | + if(e.target.dataset.url) { | |
133 | + url = e.target.dataset.url; | |
134 | + } else { | |
135 | + url = e.currentTarget.dataset.url; | |
136 | + } | |
137 | + console.log(url); | |
138 | + app.goto(url); | |
139 | + }, | |
140 | + | |
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 | + // }, | |
169 | + | |
170 | + /** | |
171 | + * 获取输入框 | |
172 | + */ | |
173 | + getInput(e) { | |
174 | + this.setData({ | |
175 | + inputValue: e.detail.value, | |
176 | + }); | |
177 | + }, | |
178 | + | |
179 | + | |
180 | + /** | |
181 | + * 验证 | |
182 | + */ | |
183 | + verify(e) { | |
184 | + let pass = e.target.dataset.pass; | |
185 | + let mobile = 0; | |
186 | + if(this.data.inputValue) { | |
187 | + mobile = this.data.inputValue; | |
188 | + if(!pass) { | |
189 | + app.request.put('/api/weshop/users/distribut/updateUserRecommender', { | |
190 | + data: { | |
191 | + storeId: self.data.userInfo.store_id, | |
192 | + userId: self.data.userInfo.user_id, | |
193 | + mobile: mobile, | |
194 | + }, | |
195 | + success: function (res) { | |
196 | + if(res.code = -1) { | |
197 | + wx.showToast({ | |
198 | + title: res.data.msg, | |
199 | + icon: 'none', | |
200 | + duration: 2000 | |
201 | + }); | |
202 | + }; | |
203 | + console.log('!!!===>', res); | |
204 | + | |
205 | + if(res.data.msg == '绑定上下级关系成功!') { | |
206 | + app.request.promiseGet('/api/weshop/users/distribut/getIsDistribut', { | |
207 | + data: { | |
208 | + storeId: self.data.userInfo.store_id, | |
209 | + userId: self.data.userInfo.user_id, | |
210 | + first_leader: self.data.userInfo.first_leader, | |
211 | + }, | |
212 | + isShowLoading: true, | |
213 | + }).then(function(res) { | |
214 | + console.log('!!!===>', res); | |
215 | + self.setData({ | |
216 | + fenxiao: res.data.data, | |
217 | + }); | |
218 | + }); | |
219 | + }; | |
220 | + | |
221 | + } | |
222 | + }); | |
223 | + | |
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 | + } | |
238 | + } else { | |
239 | + wx.showToast({ | |
240 | + title: '手机号码不能为空', | |
241 | + icon: 'none', | |
242 | + duration: 2000 | |
243 | + }); | |
244 | + }; | |
245 | + | |
246 | + }, | |
247 | +}) | |
0 | 248 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/main/main.json
0 → 100644
packageA/pages/distribution/main/main.wxml
0 → 100644
1 | +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | |
2 | +<view class="main"> | |
3 | + <!-- 头像 --> | |
4 | + <view class="avatar-container t-c pdv40"> | |
5 | + <view class="pdb20"> | |
6 | + <image class="avatar" src="{{userInfo.head_pic}}"/> | |
7 | + </view> | |
8 | + <view class="fs26"><text class="nickname">{{filter.show_default(userInfo.nickname)}}</text></view> | |
9 | + </view> | |
10 | + <!-- 金额 --> | |
11 | + <view> | |
12 | + <view class="flex ai-center jc_sb pd2622 bdb arrow-r" bindtap="goto"> | |
13 | + <view><text class="iconfont icon-jine pdr10 ctb"></text>可提现金额</view> | |
14 | + <view class="ctb money" data-url="/pages/user/member/menber">{{filter.show_default(data.user_money)}}</view> | |
15 | + </view> | |
16 | + | |
17 | + <view class="flex jc_sa t-c"> | |
18 | + <view class="pd20 f1"> | |
19 | + <view class="money fs40">{{filter.show_default(data.today_money)}}</view> | |
20 | + <view class="fs24 pdt10 cb">今日收入</view> | |
21 | + </view> | |
22 | + <view class="pd20 f1"> | |
23 | + <view class="money fs40">{{filter.show_default(data.sales_volume)}}</view> | |
24 | + <view class="fs24 pdt10 cb">总销售额</view> | |
25 | + </view> | |
26 | + <view class="pd20 f1"> | |
27 | + <view class="money fs40">{{filter.show_default(data.distribut_money)}}</view> | |
28 | + <view class="fs24 pdt10 cb">累计佣金</view> | |
29 | + </view> | |
30 | + </view> | |
31 | + </view> | |
32 | + <!-- 商品 --> | |
33 | + <view class="flex t-c mgv20 fs30" bindtap="goto"> | |
34 | + <view class="f1 pd20 line" data-url="/packageA/pages/distribution/goods/goods?index=0"><text class="iconfont icon-shangjia pdr10 cf79"></text>上架商品</view> | |
35 | + <view class="f1 pd20" data-url="/packageA/pages/distribution/goods/goods?index=1"><text class="iconfont icon-xiajia pdr10 c29f"></text>下架商品</view> | |
36 | + </view> | |
37 | + <!-- 图标列表 --> | |
38 | + <view class="flex wrap pdv20"> | |
39 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/order/order"> | |
40 | + <view class="circle bgBlue"><text class="iconfont icon-order fs40"></text></view> | |
41 | + <view class="fs24 pdt10">分销订单</view> | |
42 | + </view> | |
43 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/rank/rank"> | |
44 | + <view class="circle bgRed"><text class="iconfont icon-paihangbang fs40"></text></view> | |
45 | + <view class="fs24 pdt10">分销排行</view> | |
46 | + </view> | |
47 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/myteam/myteam"> | |
48 | + <view class="circle bgPink"><text class="iconfont icon-tuandui fs40"></text></view> | |
49 | + <view class="fs24 pdt10">我的团队</view> | |
50 | + </view> | |
51 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/commision/commision"> | |
52 | + <view class="circle bgRed"><text class="iconfont icon-yongjin fs40"></text></view> | |
53 | + <view class="fs24 pdt10">佣金明细</view> | |
54 | + </view> | |
55 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/card/card"> | |
56 | + <view class="circle bgPurple"><text class="iconfont icon-mingpian fs40"></text></view> | |
57 | + <view class="fs24 pdt10">我的名片</view> | |
58 | + </view> | |
59 | + <view class="pd20 t-c w25"> | |
60 | + <view class="circle bgYellow" bindtap="goto" data-url="/pages/user/index/index"><text class="iconfont icon-huiyuan fs40"></text></view> | |
61 | + <view class="fs24 pdt10">会员中心</view> | |
62 | + </view> | |
63 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/shop/shop"> | |
64 | + <view class="circle bgBlue"><text class="iconfont icon-shop fs40"></text></view> | |
65 | + <view class="fs24 pdt10">我的小店</view> | |
66 | + </view> | |
67 | + <view class="pd20 t-c w25" bindtap="goto" data-url="/packageA/pages/distribution/rookie/rookie"> | |
68 | + <view class="circle bgGreen"><text class="iconfont icon-xinshouyindao fs40"></text></view> | |
69 | + <view class="fs24 pdt10">新手必看</view> | |
70 | + </view> | |
71 | + </view> | |
72 | + <!-- 分销商验证 --> | |
73 | + <!-- <view class="popup" wx:if="{{!1}}"> --> | |
74 | + <view class="popup" wx:if="{{!data.is_distribut}}"> | |
75 | + <!-- <view class="t-c pd20 title">分销规则说明<text class="iconfont icon-close"></text></view> --> | |
76 | + <view class="t-c pd20 title">分销规则说明</view> | |
77 | + <view wx:if="{{fenxiao}}"> | |
78 | + <block wx:for="{{fenxiao}}"> | |
79 | + <view class="item" wx:if="{{item.type == 1}}"> | |
80 | + <view class="left f1"> | |
81 | + <view class="icon-container"><text class="iconfont icon-huiyuan1"></text></view> | |
82 | + <view>仅限PLUS卡({{item.conditonRemark}})的会员, <text class="c-red" bindtap="goto" data-url="/pages/user/cardinfo/cardinfo">立即升级</text></view> | |
83 | + </view> | |
84 | + <text class="iconfont {{item.pass ? 'icon-yes c-green':'icon-guanbi c-red2'}}"></text> | |
85 | + </view> | |
86 | + <view class="item" wx:if="{{item.type == 2}}"> | |
87 | + <view class="left f1"> | |
88 | + <view class="icon-container"><text class="iconfont icon-renzheng"></text></view> | |
89 | + <view class="flex ali-c"> | |
90 | + <input class="bg-f0 pdh10 input" type="number" value="{{item.inviter ? item.inviter:''}}" placeholder="请输入推荐人手机号码" disabled="{{item.pass}}" bindinput="getInput"/> | |
91 | + <view class="verify" wx:if="{{!item.pass}}" bindtap="verify" data-pass="{{item.pass}}">验证</view> | |
92 | + </view> | |
93 | + </view> | |
94 | + <text class="iconfont {{item.pass ? 'icon-yes c-green':'icon-guanbi c-red2'}}"></text> | |
95 | + </view> | |
96 | + <view class="item" wx:if="{{item.type == 3}}"> | |
97 | + <view class="left f1"> | |
98 | + <view class="icon-container"><text class="iconfont icon-gouwu"></text></view> | |
99 | + <text>{{item.conditonRemark}}</text> | |
100 | + </view> | |
101 | + <text class="iconfont {{item.pass ? 'icon-yes c-green':'icon-guanbi c-red2'}}"></text> | |
102 | + </view> | |
103 | + </block> | |
104 | + <view class="item" data-url="1"> | |
105 | + <view class="left f1"> | |
106 | + <view class="icon-container"><text class="iconfont icon-yongjin"></text></view> | |
107 | + <text>成功成为分销商,分享商品给好友即可获得相应收益</text> | |
108 | + </view> | |
109 | + </view> | |
110 | + | |
111 | + </view> | |
112 | + <view class="t-c pd20 fs30 bdt co-red bold" bindtap="goto" data-url="/pages/index/index/index">立即去购买</view> | |
113 | + <!-- <view class="t-c pd20 fs30 bdt co-red bold">确定</view> --> | |
114 | + </view> | |
115 | + <!-- 遮罩 --> | |
116 | + <!-- <view class="mask" wx:if="{{!1}}"></view> --> | |
117 | + <view class="mask" wx:if="{{!data.is_distribut}}"></view> | |
118 | +</view> | |
119 | + | ... | ... |
packageA/pages/distribution/main/main.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.main > view { | |
6 | + background-color: white; | |
7 | +} | |
8 | + | |
9 | +.avatar-container { | |
10 | + padding-top: 60rpx; | |
11 | + padding-bottom: 60rpx; | |
12 | + background: url(https://mshopimg.yolipai.net/miniapp/images/user_index_powder.jpg) no-repeat 100% 100%; | |
13 | + /* background-size: 100%; */ | |
14 | +} | |
15 | + | |
16 | +.avatar { | |
17 | + width: 160rpx; | |
18 | + height: 160rpx; | |
19 | + border-radius: 50%; | |
20 | + background-color: #eee; | |
21 | +} | |
22 | + | |
23 | +.nickname { | |
24 | + display: inline-block; | |
25 | + background-color: rgba(0,0,0,.5); | |
26 | + padding: 4rpx 20rpx; | |
27 | + color: white; | |
28 | + border-radius: 24rpx; | |
29 | +} | |
30 | + | |
31 | +.pd2622 { | |
32 | + padding: 20rpx 60rpx 20rpx 20rpx; | |
33 | +} | |
34 | + | |
35 | +.money::before { | |
36 | + content: '¥'; | |
37 | + font-size: 24rpx; | |
38 | +} | |
39 | + | |
40 | +/* .bdb { | |
41 | + border-bottom: 2rpx solid #f8f8f8; | |
42 | +} */ | |
43 | + | |
44 | +.arrow-r { | |
45 | + /* display: relative; */ | |
46 | +} | |
47 | + | |
48 | +.arrow-r::after { | |
49 | + font-family: iconfont; | |
50 | + content: '\e61f'; | |
51 | + position: absolute; | |
52 | + right: 20rpx; | |
53 | + color: #ddd; | |
54 | +} | |
55 | +.line { | |
56 | + position: relative; | |
57 | +} | |
58 | +.line::after { | |
59 | + content: ''; | |
60 | + position: absolute; | |
61 | + right: 0; | |
62 | + background-color: #f8f8f8; | |
63 | + width: 2rpx; | |
64 | + height: 30rpx; | |
65 | + top: 50%; | |
66 | + transform: translateY(-50%); | |
67 | +} | |
68 | + | |
69 | +.circle { | |
70 | + width: 80rpx; | |
71 | + height: 80rpx; | |
72 | + line-height: 80rpx; | |
73 | + border-radius: 50%; | |
74 | + color: white; | |
75 | + margin: 0 auto; | |
76 | + background-color: red; | |
77 | +} | |
78 | + | |
79 | +.fs40 { | |
80 | + font-size: 40rpx; | |
81 | +} | |
82 | + | |
83 | + | |
84 | +.bgBlue { | |
85 | + background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%); | |
86 | +} | |
87 | +.bgPink { | |
88 | + background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%); | |
89 | +} | |
90 | +.bgRed { | |
91 | + background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%); | |
92 | +} | |
93 | +.bgYellow { | |
94 | + background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%); | |
95 | +} | |
96 | +.bgGreen { | |
97 | + background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%); | |
98 | +} | |
99 | +.bgPurple { | |
100 | + background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%); | |
101 | +} | |
102 | + | |
103 | +.mask { | |
104 | + position: fixed; | |
105 | + top: 0; | |
106 | + left: 0; | |
107 | + width: 100%; | |
108 | + height: 100%; | |
109 | + background-color: rgba(0,0,0,.5) !important; | |
110 | +} | |
111 | + | |
112 | +.popup { | |
113 | + position: fixed; | |
114 | + z-index: 1; | |
115 | + top: 50%; | |
116 | + left: 50%; | |
117 | + transform: translate(-50%, -50%); | |
118 | + width: 90%; | |
119 | + border-radius: 12rpx; | |
120 | + overflow: hidden; | |
121 | +} | |
122 | + | |
123 | +.icon-container { | |
124 | + border-radius: 50%; | |
125 | + background-color: #FCEA0D; | |
126 | + width: 50rpx; | |
127 | + line-height: 50rpx; | |
128 | + height: 50rpx; | |
129 | + text-align: center; | |
130 | + font-size: 28rpx !important; | |
131 | + margin-right: 10rpx; | |
132 | + flex-shrink: 0; | |
133 | +} | |
134 | + | |
135 | +.item { | |
136 | + padding: 20rpx; | |
137 | + display: flex; | |
138 | + align-items: center; | |
139 | + font-size: 26rpx; | |
140 | + position: relative; | |
141 | +} | |
142 | + | |
143 | +.title { | |
144 | + background-image: linear-gradient( 135deg, #FF6768 10%, #EA5455 100%); | |
145 | + color: white; | |
146 | + font-size: 28rpx; | |
147 | + position: relative; | |
148 | +} | |
149 | + | |
150 | +.icon-close { | |
151 | + position: absolute; | |
152 | + right: 20rpx; | |
153 | + color: white; | |
154 | +} | |
155 | + | |
156 | +.verify { | |
157 | + color: white; | |
158 | + background-color: #FF6768; | |
159 | + padding: 0 20rpx; | |
160 | + border-radius: 6rpx; | |
161 | + display: flex; | |
162 | + align-items: center; | |
163 | + margin-left: 10rpx; | |
164 | +} | |
165 | + | |
166 | +.input { | |
167 | + border-radius: 6rpx; | |
168 | + height: 50rpx; | |
169 | +} | |
170 | + | |
171 | +.item ~ .item .left::before { | |
172 | + content: ''; | |
173 | + position: absolute; | |
174 | + left: 45rpx; | |
175 | + top: -45rpx; | |
176 | + width: 2rpx; | |
177 | + height: 100%; | |
178 | + background: linear-gradient(to bottom, #eee, #eee 8rpx, transparent 8rpx, transparent); | |
179 | + background-size: 100% 16rpx; | |
180 | + z-index: -1; | |
181 | +} | |
182 | + | |
183 | +.left { | |
184 | + display: flex; | |
185 | + align-items: center; | |
186 | + padding-right: 20rpx; | |
187 | +} | |
188 | + | |
189 | + | |
190 | +/*checkbox 整体大小 */ | |
191 | +checkbox { | |
192 | + /* width: 240rpx; | |
193 | + height: 90rpx; */ | |
194 | +} | |
195 | +/*checkbox 选项框大小 */ | |
196 | +checkbox .wx-checkbox-input { | |
197 | + width: 34rpx; | |
198 | + height: 34rpx; | |
199 | + border-radius: 50%; | |
200 | + | |
201 | +} | |
202 | +/*checkbox选中后样式 */ | |
203 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked { | |
204 | + background-color: #FF6768; | |
205 | + border-color: #FF6768; | |
206 | + /* color: white; */ | |
207 | +} | |
208 | +/*checkbox选中后图标样式 */ | |
209 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { | |
210 | + width: 34rpx; | |
211 | + height: 34rpx; | |
212 | + line-height: 34rpx; | |
213 | + text-align: center; | |
214 | + font-size: 24rpx; | |
215 | + color: #fff; | |
216 | + background: transparent; | |
217 | + transform: translate(-50%, -50%) scale(1); | |
218 | + -webkit-transform: translate(-50%, -50%) scale(1); | |
219 | +} | |
220 | + | |
221 | +.item:not(:last-of-type) { | |
222 | + display: flex; | |
223 | + justify-content: space-between; | |
224 | +} | |
225 | + | |
226 | + | ... | ... |
packageA/pages/distribution/myteam/myteam.js
0 → 100644
1 | +// packageA//pages/distribution/myteam/myteam.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + tabArr: ['A级分销','B级分销','C级分销'], | |
12 | + currentTabIndex: 0, //记录当前点击的Tab索引 | |
13 | + | |
14 | + list: null, | |
15 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
16 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
17 | + pageNum: 1, // 当前页数 | |
18 | + }, | |
19 | + | |
20 | + /** | |
21 | + * 生命周期函数--监听页面加载 | |
22 | + */ | |
23 | + onLoad: function (options) { | |
24 | + self = this;//保存全局指针 | |
25 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
26 | + self.setData({ | |
27 | + userInfo: data, | |
28 | + }); | |
29 | + }); | |
30 | + // 判断会员是否授权登录, | |
31 | + // 没有登录则跳转到登录页, | |
32 | + // 已登录则设置已登录状态,请求加载签到数据 | |
33 | + // isLogin记录登录状态 | |
34 | + // app.isLogin().then(function(data) { | |
35 | + // console.log('data', data); | |
36 | + // // 1.登录成功 | |
37 | + // self.setData({ | |
38 | + // isLogin: true, | |
39 | + // userInfo: data, | |
40 | + // }); | |
41 | + // // 2.请求数据 | |
42 | + // // 默认请求A级分销 | |
43 | + // self.getData(true, '/api/weshop/users/distribut/teamlist', { | |
44 | + // store_id: app.globalData.setting.stoid, | |
45 | + // user_id: app.globalData.user_id, | |
46 | + // level: 1, | |
47 | + // }); | |
48 | + // // 默认请求佣金用户排行 | |
49 | + // // this.get('/api/weshop/users/distribut/rankingUser', { | |
50 | + // // store_id: app.globalData.setting.stoid, | |
51 | + // // user_id: app.globalData.user_id, | |
52 | + // // }); | |
53 | + | |
54 | + // }); | |
55 | + }, | |
56 | + | |
57 | + /** | |
58 | + * 生命周期函数--监听页面初次渲染完成 | |
59 | + */ | |
60 | + onReady: function () { | |
61 | + | |
62 | + }, | |
63 | + | |
64 | + /** | |
65 | + * 生命周期函数--监听页面显示 | |
66 | + */ | |
67 | + onShow: function () { | |
68 | + if(app.globalData.userInfo) { | |
69 | + if(!this.data.isLogin) { | |
70 | + this.setData({ | |
71 | + userInfo: app.globalData.userInfo, | |
72 | + imghost: app.globalData.setting.imghost, | |
73 | + isLogin: true, | |
74 | + }); | |
75 | + | |
76 | + // 请求数据 | |
77 | + // 默认请求A级分销 | |
78 | + this.getData(true, '/api/weshop/users/distribut/teamlist', { | |
79 | + store_id: app.globalData.setting.stoid, | |
80 | + user_id: app.globalData.user_id, | |
81 | + level: 1, | |
82 | + }); | |
83 | + | |
84 | + }; | |
85 | + }; | |
86 | + | |
87 | + | |
88 | + // if(app.globalData.userInfo instanceof Object) { | |
89 | + // this.setData({ | |
90 | + // userInfo: app.globalData.userInfo, | |
91 | + // imghost: app.globalData.setting.imghost, | |
92 | + // }); | |
93 | + // // 检测从登录页返回后的登录状态 | |
94 | + // if(this.data.isLogin) { | |
95 | + // // 初次就授权登录 | |
96 | + // return; | |
97 | + // } else { | |
98 | + // // 初次未授权登录,过后才授权 | |
99 | + // this.setData({ | |
100 | + // isLogin: true | |
101 | + // }); | |
102 | + // // 请求数据 | |
103 | + // // 默认请求A级分销 | |
104 | + // this.getData(true, '/api/weshop/users/distribut/teamlist', { | |
105 | + // store_id: app.globalData.setting.stoid, | |
106 | + // user_id: app.globalData.user_id, | |
107 | + // level: 1, | |
108 | + // }); | |
109 | + // // 默认请求佣金用户排行 | |
110 | + // // this.get('/api/weshop/users/distribut/rankingUser', { | |
111 | + // // store_id: app.globalData.setting.stoid, | |
112 | + // // user_id: app.globalData.user_id, | |
113 | + // // }); | |
114 | + // }; | |
115 | + // }; | |
116 | + }, | |
117 | + | |
118 | + /** | |
119 | + * 生命周期函数--监听页面隐藏 | |
120 | + */ | |
121 | + onHide: function () { | |
122 | + | |
123 | + }, | |
124 | + | |
125 | + /** | |
126 | + * 生命周期函数--监听页面卸载 | |
127 | + */ | |
128 | + onUnload: function () { | |
129 | + | |
130 | + }, | |
131 | + | |
132 | + /** | |
133 | + * 页面相关事件处理函数--监听用户下拉动作 | |
134 | + */ | |
135 | + onPullDownRefresh: function () { | |
136 | + | |
137 | + }, | |
138 | + | |
139 | + /** | |
140 | + * 页面上拉触底事件的处理函数 | |
141 | + */ | |
142 | + onReachBottom: function () { | |
143 | + this.scrollToLower('/api/weshop/users/distribut/teamlist', { | |
144 | + store_id: app.globalData.setting.stoid, | |
145 | + user_id: app.globalData.user_id, | |
146 | + level: currentIndex + 1, | |
147 | + }); | |
148 | + }, | |
149 | + | |
150 | + /** | |
151 | + * 用户点击右上角分享 | |
152 | + */ | |
153 | + onShareAppMessage: function () { | |
154 | + | |
155 | + }, | |
156 | + | |
157 | + /** | |
158 | + * 点击Tab项 | |
159 | + */ | |
160 | + clickTab(e) { | |
161 | + let currentIndex = e.target.dataset.index; | |
162 | + | |
163 | + this.setData({ | |
164 | + currentTabIndex: currentIndex, | |
165 | + list: null, //清空列表 | |
166 | + noMore: false, | |
167 | + pageNum: 1, | |
168 | + }); | |
169 | + | |
170 | + this.getData(true, '/api/weshop/users/distribut/teamlist', { | |
171 | + store_id: app.globalData.setting.stoid, | |
172 | + user_id: app.globalData.user_id, | |
173 | + level: currentIndex + 1, | |
174 | + }); | |
175 | + }, | |
176 | + | |
177 | + /** | |
178 | + * get请求数据 | |
179 | + */ | |
180 | + // get(url, data) { | |
181 | + // app.request.get(url + '/' + data.store_id + '/' + data.user_id, { | |
182 | + // success: function(res) { | |
183 | + // if(res.data.code == 0){ | |
184 | + // console.log('success',res.data.data); | |
185 | + // self.setData({ | |
186 | + // userRanking: res.data.data, | |
187 | + // }); | |
188 | + // }else{ | |
189 | + // wx.showToast({ | |
190 | + // title: "网络繁忙,请重试", | |
191 | + // icon: 'none', | |
192 | + // duration: 2000 | |
193 | + // }) | |
194 | + // } | |
195 | + // }, | |
196 | + // fail: function() {}, | |
197 | + // }); | |
198 | + // }, | |
199 | + | |
200 | + | |
201 | + /** | |
202 | + * promiseGet请求数据 | |
203 | + */ | |
204 | + getData: function(isInit, url, data) { | |
205 | + app.request.promiseGet(url, { | |
206 | + data: data, | |
207 | + isShowLoading: true, | |
208 | + }) | |
209 | + .then(function(res) { | |
210 | + // console.log('1121', res.data.code); | |
211 | + if(res.data.code == 0) { | |
212 | + | |
213 | + self.setData({ | |
214 | + isLoading: false | |
215 | + }); | |
216 | + | |
217 | + if(isInit) {// 第一次加载 | |
218 | + self.setData({ | |
219 | + list: res.data.data | |
220 | + }); | |
221 | + } else { | |
222 | + self.setData({ | |
223 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
224 | + }); | |
225 | + }; | |
226 | + | |
227 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
228 | + self.setData({ | |
229 | + noMore: true | |
230 | + }); | |
231 | + }; | |
232 | + | |
233 | + } else { | |
234 | + self.setData({ | |
235 | + 'list.pageData': [] | |
236 | + }); | |
237 | + }; | |
238 | + | |
239 | + }) | |
240 | + .catch(function(err) { | |
241 | + console.log('出错拉!!!!',err); | |
242 | + self.setData({ | |
243 | + 'list.pageData': [] | |
244 | + }); | |
245 | + }); | |
246 | + }, | |
247 | + | |
248 | + | |
249 | + // 上拉加载 | |
250 | + scrollToLower(url, requestData) { | |
251 | + // 数据总量 | |
252 | + let total = this.data.list.total; | |
253 | + // 单页最大数据量 | |
254 | + let pageSize = this.data.list.pageSize; | |
255 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
256 | + if((total != 0)&&(total <= pageSize)) { | |
257 | + this.setData({ | |
258 | + noMore: true | |
259 | + }); | |
260 | + }; | |
261 | + | |
262 | + if(!this.data.isLoading && !this.data.noMore) { | |
263 | + this.setData({ | |
264 | + isLoading: true, | |
265 | + pageNum: this.data.pageNum + 1 | |
266 | + }); | |
267 | + requestData.page = this.data.pageNum; | |
268 | + this.getData(false, url, requestData); | |
269 | + }; | |
270 | + }, | |
271 | + | |
272 | +}) | |
0 | 273 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/myteam/myteam.json
0 → 100644
packageA/pages/distribution/myteam/myteam.wxml
0 → 100644
1 | +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | |
2 | +<view class="main"> | |
3 | + <view class="tab-head flex t-c bdb fs26" bindtap="clickTab"> | |
4 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" wx:for="{{tabArr}}" data-index="{{index}}">{{item}}</view> | |
5 | + </view> | |
6 | + | |
7 | + <view class="tab-content"> | |
8 | + <view class="flex jc_sb pd20 ai-center" wx:for="{{list.pageData}}"> | |
9 | + <view class="flex ai-center"> | |
10 | + <view class="pdr20"><image class="avatar" src="{{item.head_pic}}"/></view> | |
11 | + <view> | |
12 | + <view>{{item.nickname}}</view> | |
13 | + <view class="fs24 c-a">{{filter.format_time(item.reg_time)}}</view> | |
14 | + </view> | |
15 | + </view> | |
16 | + <view class="c-red fs26 money">{{item.distribut_money}}</view> | |
17 | + </view> | |
18 | + | |
19 | + | |
20 | + </view> | |
21 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> | |
22 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
23 | +</view> | ... | ... |
packageA/pages/distribution/myteam/myteam.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.main > view { | |
6 | + background-color: white; | |
7 | +} | |
8 | + | |
9 | +.active { | |
10 | + color: #FF6768; | |
11 | + font-weight: bold; | |
12 | + position: relative; | |
13 | +} | |
14 | + | |
15 | +.active::after { | |
16 | + content: ''; | |
17 | + position: absolute; | |
18 | + bottom: 0; | |
19 | + left: 50%; | |
20 | + transform: translateX(-50%); | |
21 | + width: 50%; | |
22 | + height: 4rpx; | |
23 | + background-color: #FF6768; | |
24 | +} | |
25 | + | |
26 | +.avatar { | |
27 | + width: 120rpx; | |
28 | + height: 120rpx; | |
29 | + border-radius: 50%; | |
30 | + background-color: #eee; | |
31 | +} | |
32 | + | |
33 | +.c-a { | |
34 | + color: #aaa; | |
35 | +} | |
36 | + | |
37 | +.noMore { | |
38 | + padding: 20rpx; | |
39 | + color: #bbb; | |
40 | + text-align: center; | |
41 | + font-size: 26rpx; | |
42 | + background-color: transparent !important; | |
43 | +} | |
44 | + | |
45 | +.tab-head { | |
46 | + position: fixed; | |
47 | + width: 100%; | |
48 | + top: 0; | |
49 | +} | |
50 | + | |
51 | +.tab-content { | |
52 | + box-sizing: border-box; | |
53 | + padding-top: 76rpx; | |
54 | +} | |
55 | + | |
56 | +.money::before { | |
57 | + content: '¥'; | |
58 | + font-size: 22rpx; | |
59 | +} | |
0 | 60 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/order/order.js
0 → 100644
1 | +// packageA//pages/distribution/myteam/myteam.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + tabArr: ['未付款','已付款','已完成'], | |
12 | + statusArr: ['未付款','已付款','等待分成(已收货)','已完成'], | |
13 | + commisionArr: ['一级分成','二级分成','三级分成'], | |
14 | + currentTabIndex: 0, //记录当前点击的Tab索引 | |
15 | + imghost: '', | |
16 | + status: 0, | |
17 | + | |
18 | + list: null, | |
19 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
20 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
21 | + pageNum: 1, // 当前页数 | |
22 | + }, | |
23 | + | |
24 | + /** | |
25 | + * 生命周期函数--监听页面加载 | |
26 | + */ | |
27 | + onLoad: function (options) { | |
28 | + self = this;//保存全局指针 | |
29 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
30 | + self.setData({ | |
31 | + userInfo: data, | |
32 | + }); | |
33 | + }); | |
34 | + | |
35 | + // 判断会员是否授权登录, | |
36 | + // 没有登录则跳转到登录页, | |
37 | + // 已登录则设置已登录状态,请求加载签到数据 | |
38 | + // isLogin记录登录状态 | |
39 | + // app.isLogin().then(function(data) { | |
40 | + // console.log('data', data); | |
41 | + // // 1.登录成功 | |
42 | + // self.setData({ | |
43 | + // isLogin: true, | |
44 | + // userInfo: data, | |
45 | + // }); | |
46 | + // // 2.请求数据 | |
47 | + // // status: 0=未付款 1=已付款 3=已完成, 默认加载0 | |
48 | + // app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { | |
49 | + // data: { | |
50 | + // store_id: app.globalData.setting.stoid, | |
51 | + // user_id: app.globalData.user_id, | |
52 | + // status: 0, | |
53 | + // }, | |
54 | + // isShowLoading: true, | |
55 | + // }).then(function(res) { | |
56 | + // self.setData({ | |
57 | + // list: res.data.data, | |
58 | + // }); | |
59 | + // }); | |
60 | + // }); | |
61 | + }, | |
62 | + | |
63 | + /** | |
64 | + * 生命周期函数--监听页面初次渲染完成 | |
65 | + */ | |
66 | + onReady: function () { | |
67 | + | |
68 | + }, | |
69 | + | |
70 | + /** | |
71 | + * 生命周期函数--监听页面显示 | |
72 | + */ | |
73 | + onShow: function () { | |
74 | + if(app.globalData.userInfo) { | |
75 | + if(!this.data.isLogin) { | |
76 | + this.setData({ | |
77 | + userInfo: app.globalData.userInfo, | |
78 | + imghost: app.globalData.setting.imghost, | |
79 | + isLogin: true, | |
80 | + }); | |
81 | + | |
82 | + // 请求数据 | |
83 | + app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { | |
84 | + data: { | |
85 | + store_id: app.globalData.setting.stoid, | |
86 | + user_id: app.globalData.user_id, | |
87 | + status: 0, | |
88 | + }, | |
89 | + isShowLoading: true, | |
90 | + }).then(function(res) { | |
91 | + self.setData({ | |
92 | + list: res.data.data, | |
93 | + }); | |
94 | + }); | |
95 | + | |
96 | + }; | |
97 | + }; | |
98 | + | |
99 | + | |
100 | + }, | |
101 | + | |
102 | + /** | |
103 | + * 生命周期函数--监听页面隐藏 | |
104 | + */ | |
105 | + onHide: function () { | |
106 | + | |
107 | + }, | |
108 | + | |
109 | + /** | |
110 | + * 生命周期函数--监听页面卸载 | |
111 | + */ | |
112 | + onUnload: function () { | |
113 | + | |
114 | + }, | |
115 | + | |
116 | + /** | |
117 | + * 页面相关事件处理函数--监听用户下拉动作 | |
118 | + */ | |
119 | + onPullDownRefresh: function () { | |
120 | + | |
121 | + }, | |
122 | + | |
123 | + /** | |
124 | + * 页面上拉触底事件的处理函数 | |
125 | + */ | |
126 | + onReachBottom: function () { | |
127 | + this.scrollToLower('/api/weshop/rebateLog/pageOrder', { | |
128 | + store_id: app.globalData.setting.stoid, | |
129 | + user_id: app.globalData.user_id, | |
130 | + status: this.data.status, | |
131 | + }); | |
132 | + }, | |
133 | + | |
134 | + /** | |
135 | + * 用户点击右上角分享 | |
136 | + */ | |
137 | + onShareAppMessage: function () { | |
138 | + | |
139 | + }, | |
140 | + | |
141 | + /** | |
142 | + * 点击跳转 | |
143 | + */ | |
144 | + goto(e) { | |
145 | + let url = ''; | |
146 | + if(e.target.dataset.url) { | |
147 | + url = e.target.dataset.url; | |
148 | + } else { | |
149 | + url = e.currentTarget.dataset.url; | |
150 | + } | |
151 | + app.goto(url); | |
152 | + }, | |
153 | + | |
154 | + /** | |
155 | + * 点击Tab项 | |
156 | + */ | |
157 | + clickTab(e) { | |
158 | + if(this.data.isLogin) { | |
159 | + | |
160 | + let status = 0; | |
161 | + let currentIndex = e.target.dataset.index; | |
162 | + | |
163 | + switch(currentIndex) { | |
164 | + case 0: { | |
165 | + status = 0; | |
166 | + break; | |
167 | + }; | |
168 | + case 1: { | |
169 | + status = 1; | |
170 | + break; | |
171 | + }; | |
172 | + case 2: { | |
173 | + status = 3; | |
174 | + break; | |
175 | + }; | |
176 | + }; | |
177 | + | |
178 | + this.setData({ | |
179 | + list: null, //清空列表 | |
180 | + noMore: false, | |
181 | + pageNum: 1, | |
182 | + currentTabIndex: currentIndex, | |
183 | + status, | |
184 | + }); | |
185 | + | |
186 | + app.request.promiseGet('/api/weshop/rebateLog/pageOrder', { | |
187 | + data: { | |
188 | + store_id: app.globalData.setting.stoid, | |
189 | + user_id: app.globalData.user_id, | |
190 | + status, | |
191 | + }, | |
192 | + isShowLoading: true, | |
193 | + }).then(function(res) { | |
194 | + self.setData({ | |
195 | + list: res.data.data, | |
196 | + }); | |
197 | + }); | |
198 | + | |
199 | + } | |
200 | + | |
201 | + }, | |
202 | + | |
203 | + /** | |
204 | + * 请求数据 | |
205 | + */ | |
206 | + getData: function(isInit, url, data) { | |
207 | + app.request.promiseGet(url, { | |
208 | + data: data, | |
209 | + isShowLoading: true, | |
210 | + }) | |
211 | + .then(function(res) { | |
212 | + // console.log('1121', res.data.code); | |
213 | + if(res.data.code == 0) { | |
214 | + | |
215 | + self.setData({ | |
216 | + isLoading: false | |
217 | + }); | |
218 | + | |
219 | + if(isInit) {// 第一次加载 | |
220 | + self.setData({ | |
221 | + list: res.data.data | |
222 | + }); | |
223 | + } else { | |
224 | + self.setData({ | |
225 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
226 | + }); | |
227 | + }; | |
228 | + | |
229 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
230 | + self.setData({ | |
231 | + noMore: true | |
232 | + }); | |
233 | + }; | |
234 | + | |
235 | + } else { | |
236 | + self.setData({ | |
237 | + 'list.pageData': [] | |
238 | + }); | |
239 | + }; | |
240 | + | |
241 | + }) | |
242 | + .catch(function(err) { | |
243 | + console.log('出错拉!!!!',err); | |
244 | + self.setData({ | |
245 | + 'list.pageData': [] | |
246 | + }); | |
247 | + }); | |
248 | + }, | |
249 | + | |
250 | + | |
251 | + // 上拉加载 | |
252 | + scrollToLower(url, requestData) { | |
253 | + // 数据总量 | |
254 | + let total = this.data.list.total; | |
255 | + // 单页最大数据量 | |
256 | + let pageSize = this.data.list.pageSize; | |
257 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
258 | + if((total != 0)&&(total <= pageSize)) { | |
259 | + this.setData({ | |
260 | + noMore: true | |
261 | + }); | |
262 | + }; | |
263 | + | |
264 | + if(!this.data.isLoading && !this.data.noMore) { | |
265 | + this.setData({ | |
266 | + isLoading: true, | |
267 | + pageNum: this.data.pageNum + 1 | |
268 | + }); | |
269 | + requestData.page = this.data.pageNum; | |
270 | + this.getData(false, url, requestData); | |
271 | + }; | |
272 | + }, | |
273 | + | |
274 | + | |
275 | +}) | |
0 | 276 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/order/order.json
0 → 100644
packageA/pages/distribution/order/order.wxml
0 → 100644
1 | +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | |
2 | +<view class="main"> | |
3 | + <view class="tab-head flex t-c bdb fs26" bindtap="clickTab"> | |
4 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" wx:for="{{tabArr}}" data-index="{{index}}">{{item}}</view> | |
5 | + </view> | |
6 | + | |
7 | + <view class="tab-content"> | |
8 | + <view class="fs26 item" wx:for="{{list.pageData}}"> | |
9 | + <view class="flex ai-center jc_sb pd20 bdb"> | |
10 | + <view class="flex ai-center"> | |
11 | + <image class="avatar" src="{{item.head_pic}}" wx:if="{{item.head_pic}}"/> | |
12 | + <text class="iconfont icon-ren" wx:else></text> | |
13 | + <text class="pdl10">{{item.nickname}}</text> | |
14 | + </view> | |
15 | + <view class="c-a">{{filter.status(item.status, statusArr)}}</view> | |
16 | + </view> | |
17 | + <view class="flex jc_sb ai-center pd20" wx:for="{{item.goods}}" wx:for-item="it" bindtap="goto" data-url="{{'/pages/goods/goodsInfo/goodsInfo?goods_id' + item.goods}}"> | |
18 | + <view class="flex pdr20"> | |
19 | + <view class="pdr20"><image class="img" src="{{imghost + it.original_img}}" lazy-load/></view> | |
20 | + <view class="fs24"> | |
21 | + <view class="ellipsis-2">{{it.goods_name}}</view> | |
22 | + <view class="c-a pdt20">规格:<text style="color: black;">{{it.goods_price}}</text></view> | |
23 | + <view wx:if="{{item.dis_moshi == 1}}"> | |
24 | + <view class="c-a pdr10">最新佣金比例:<text class="c-red">{{filter.toFix(it.commission/it.goods_price*100, 1)}}%</text></view> | |
25 | + <view class="c-a">佣金:<text class="money c-red">{{it.commission}}</text></view> | |
26 | + </view> | |
27 | + <view class="c-a pdt10" wx:else>{{filter.status((item.level-1), commisionArr)}}:<text class="money c-red">{{it.commission}}</text></view> | |
28 | + </view> | |
29 | + </view> | |
30 | + <view><text class="money c-red">{{it.goods_price}}</text></view> | |
31 | + </view> | |
32 | + <view class="flex jc_sb pd20 ai-center fs24 bdt"> | |
33 | + <view> | |
34 | + <view><text class="c-a">订单号:</text>{{item.order_sn}}</view> | |
35 | + <view class="c-a fs24 pdt10">{{filter.format_time(item.create_time, 1)}}</view> | |
36 | + </view> | |
37 | + <view class="c-red">获得分成:<text class="money fs32">{{item.money}}</text></view> | |
38 | + </view> | |
39 | + </view> | |
40 | + </view> | |
41 | + | |
42 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> | |
43 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
44 | +</view> | ... | ... |
packageA/pages/distribution/order/order.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.main > view { | |
6 | + /* background-color: white; */ | |
7 | +} | |
8 | + | |
9 | +.active { | |
10 | + color: #FF6768; | |
11 | + font-weight: bold; | |
12 | + position: relative; | |
13 | +} | |
14 | + | |
15 | +.active::after { | |
16 | + content: ''; | |
17 | + position: absolute; | |
18 | + bottom: 0; | |
19 | + left: 50%; | |
20 | + transform: translateX(-50%); | |
21 | + width: 50%; | |
22 | + height: 4rpx; | |
23 | + background-color: #FF6768; | |
24 | +} | |
25 | + | |
26 | +.avatar { | |
27 | + display: block; | |
28 | + width: 60rpx; | |
29 | + height: 60rpx; | |
30 | + background-color: #eee; | |
31 | + border-radius: 50%; | |
32 | +} | |
33 | + | |
34 | +.img { | |
35 | + display: block; | |
36 | + width: 200rpx; | |
37 | + height: 200rpx; | |
38 | + background-color: #eee; | |
39 | +} | |
40 | + | |
41 | + | |
42 | + | |
43 | + | |
44 | + | |
45 | +.money::before { | |
46 | + content: '¥'; | |
47 | + font-size: 22rpx; | |
48 | +} | |
49 | + | |
50 | +.noMore { | |
51 | + padding: 20rpx; | |
52 | + color: #bbb; | |
53 | + text-align: center; | |
54 | + font-size: 26rpx; | |
55 | + background-color: transparent !important; | |
56 | +} | |
57 | + | |
58 | +.tab-head { | |
59 | + position: fixed; | |
60 | + width: 100%; | |
61 | + top: 0; | |
62 | +} | |
63 | + | |
64 | +.tab-content { | |
65 | + box-sizing: border-box; | |
66 | + padding: 96rpx 20rpx 20rpx 20rpx; | |
67 | +} | |
68 | + | |
69 | +.tab-head, | |
70 | +.item { | |
71 | + background-color: white; | |
72 | +} | |
73 | + | |
74 | +.item { | |
75 | + border-radius: 12rpx; | |
76 | +} | |
77 | + | |
78 | +.item ~ .item { | |
79 | + margin-top: 20rpx; | |
80 | +} | |
81 | + | |
82 | +.icon-ren { | |
83 | + font-size: 60rpx; | |
84 | + line-height: 60rpx; | |
85 | + color: #ccc; | |
86 | +} | |
0 | 87 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/rank/rank.js
0 → 100644
1 | +// packageA//pages/distribution/rank/rank.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + currentTabIndex:0, | |
12 | + tabArr:['佣金排行','下线排行'], | |
13 | + | |
14 | + list: null, | |
15 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
16 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
17 | + pageNum: 1, // 当前页数 | |
18 | + }, | |
19 | + | |
20 | + /** | |
21 | + * 生命周期函数--监听页面加载 | |
22 | + */ | |
23 | + onLoad: function (options) { | |
24 | + self = this;//保存全局指针 | |
25 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
26 | + self.setData({ | |
27 | + userInfo: data, | |
28 | + }); | |
29 | + }); | |
30 | + // 判断会员是否授权登录, | |
31 | + // 没有登录则跳转到登录页, | |
32 | + // 已登录则设置已登录状态,请求加载签到数据 | |
33 | + // isLogin记录登录状态 | |
34 | + // app.isLogin().then(function(data) { | |
35 | + // console.log('data', data); | |
36 | + // // 1.登录成功 | |
37 | + // self.setData({ | |
38 | + // isLogin: true, | |
39 | + // userInfo: data, | |
40 | + // }); | |
41 | + // // 2.请求数据 | |
42 | + // // 默认请求佣金排行列表 | |
43 | + // self.getData(true, '/api/weshop/users/distribut/rankinglist', { | |
44 | + // store_id: app.globalData.setting.stoid, | |
45 | + // }); | |
46 | + // // 默认请求佣金用户排行 | |
47 | + // self.get('/api/weshop/users/distribut/rankingUser', { | |
48 | + // store_id: app.globalData.setting.stoid, | |
49 | + // user_id: app.globalData.user_id, | |
50 | + // }); | |
51 | + | |
52 | + // }); | |
53 | + }, | |
54 | + | |
55 | + /** | |
56 | + * 生命周期函数--监听页面初次渲染完成 | |
57 | + */ | |
58 | + onReady: function () { | |
59 | + | |
60 | + }, | |
61 | + | |
62 | + /** | |
63 | + * 生命周期函数--监听页面显示 | |
64 | + */ | |
65 | + onShow: function () { | |
66 | + if(app.globalData.userInfo) { | |
67 | + if(!this.data.isLogin) { | |
68 | + this.setData({ | |
69 | + userInfo: app.globalData.userInfo, | |
70 | + imghost: app.globalData.setting.imghost, | |
71 | + isLogin: true, | |
72 | + }); | |
73 | + | |
74 | + // 请求数据 | |
75 | + // 默认请求佣金排行列表 | |
76 | + this.getData(true, '/api/weshop/users/distribut/rankinglist', { | |
77 | + store_id: app.globalData.setting.stoid, | |
78 | + }); | |
79 | + // 默认请求佣金用户排行 | |
80 | + this.get('/api/weshop/users/distribut/rankingUser', { | |
81 | + store_id: app.globalData.setting.stoid, | |
82 | + user_id: app.globalData.user_id, | |
83 | + }); | |
84 | + | |
85 | + }; | |
86 | + }; | |
87 | + | |
88 | + | |
89 | + // if(app.globalData.userInfo instanceof Object) { | |
90 | + // this.setData({ | |
91 | + // userInfo: app.globalData.userInfo, | |
92 | + // imghost: app.globalData.setting.imghost, | |
93 | + // }); | |
94 | + // // 检测从登录页返回后的登录状态 | |
95 | + // if(this.data.isLogin) { | |
96 | + // // 初次就授权登录 | |
97 | + // return; | |
98 | + // } else { | |
99 | + // // 初次未授权登录,过后才授权 | |
100 | + // this.setData({ | |
101 | + // isLogin: true | |
102 | + // }); | |
103 | + // // 请求数据 | |
104 | + // // 默认请求佣金排行列表 | |
105 | + // this.getData(true, '/api/weshop/users/distribut/rankinglist', { | |
106 | + // store_id: app.globalData.setting.stoid, | |
107 | + // }); | |
108 | + // // 默认请求佣金用户排行 | |
109 | + // this.get('/api/weshop/users/distribut/rankingUser', { | |
110 | + // store_id: app.globalData.setting.stoid, | |
111 | + // user_id: app.globalData.user_id, | |
112 | + // }); | |
113 | + // }; | |
114 | + // }; | |
115 | + }, | |
116 | + | |
117 | + /** | |
118 | + * 生命周期函数--监听页面隐藏 | |
119 | + */ | |
120 | + onHide: function () { | |
121 | + | |
122 | + }, | |
123 | + | |
124 | + /** | |
125 | + * 生命周期函数--监听页面卸载 | |
126 | + */ | |
127 | + onUnload: function () { | |
128 | + | |
129 | + }, | |
130 | + | |
131 | + /** | |
132 | + * 页面相关事件处理函数--监听用户下拉动作 | |
133 | + */ | |
134 | + onPullDownRefresh: function () { | |
135 | + | |
136 | + }, | |
137 | + | |
138 | + /** | |
139 | + * 页面上拉触底事件的处理函数 | |
140 | + */ | |
141 | + onReachBottom: function () { | |
142 | + this.scrollToLower(this.data.listUrl, { | |
143 | + store_id: app.globalData.setting.stoid, | |
144 | + }); | |
145 | + }, | |
146 | + | |
147 | + /** | |
148 | + * 用户点击右上角分享 | |
149 | + */ | |
150 | + onShareAppMessage: function () { | |
151 | + | |
152 | + }, | |
153 | + | |
154 | + /** | |
155 | + * 点击Tab | |
156 | + */ | |
157 | + clickTab(e) { | |
158 | + let currentIndex = e.target.dataset.index; | |
159 | + let listUrl = '';//排行列表 | |
160 | + let userUrl = '';//用户当前排名 | |
161 | + | |
162 | + | |
163 | + if(currentIndex == 0) { | |
164 | + listUrl = '/api/weshop/users/distribut/rankinglist'; | |
165 | + userUrl = '/api/weshop/users/distribut/rankingUser'; | |
166 | + } else { | |
167 | + listUrl = '/api/weshop/users/distribut/underlinglist'; | |
168 | + userUrl = '/api/weshop/users/distribut/underlingUser'; | |
169 | + }; | |
170 | + | |
171 | + this.setData({ | |
172 | + list: null, //清空列表 | |
173 | + noMore: false, | |
174 | + pageNum: 1, | |
175 | + currentTabIndex: currentIndex, | |
176 | + listUrl, | |
177 | + userUrl, | |
178 | + }); | |
179 | + | |
180 | + // 请求排行列表 | |
181 | + this.getData(true, listUrl, { | |
182 | + store_id: app.globalData.setting.stoid, | |
183 | + }); | |
184 | + | |
185 | + // 请求用户排行 | |
186 | + this.get(userUrl, { | |
187 | + store_id: app.globalData.setting.stoid, | |
188 | + user_id: app.globalData.user_id, | |
189 | + }); | |
190 | + }, | |
191 | + | |
192 | + | |
193 | + /** | |
194 | + * get请求数据 | |
195 | + */ | |
196 | + get(url, data) { | |
197 | + app.request.get(url + '/' + data.store_id + '/' + data.user_id, { | |
198 | + success: function(res) { | |
199 | + if(res.data.code == 0){ | |
200 | + console.log('success',res.data.data); | |
201 | + self.setData({ | |
202 | + userRanking: res.data.data, | |
203 | + }); | |
204 | + }else{ | |
205 | + wx.showToast({ | |
206 | + title: "网络繁忙,请重试", | |
207 | + icon: 'none', | |
208 | + duration: 2000 | |
209 | + }) | |
210 | + } | |
211 | + }, | |
212 | + fail: function() {}, | |
213 | + }); | |
214 | + }, | |
215 | + | |
216 | + | |
217 | + /** | |
218 | + * promiseGet请求数据 | |
219 | + */ | |
220 | + getData: function(isInit, url, data) { | |
221 | + app.request.promiseGet(url, { | |
222 | + data: data, | |
223 | + isShowLoading: true, | |
224 | + }) | |
225 | + .then(function(res) { | |
226 | + // console.log('1121', res.data.code); | |
227 | + if(res.data.code == 0) { | |
228 | + | |
229 | + self.setData({ | |
230 | + isLoading: false | |
231 | + }); | |
232 | + | |
233 | + if(isInit) {// 第一次加载 | |
234 | + self.setData({ | |
235 | + list: res.data.data | |
236 | + }); | |
237 | + } else { | |
238 | + self.setData({ | |
239 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
240 | + }); | |
241 | + }; | |
242 | + | |
243 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
244 | + self.setData({ | |
245 | + noMore: true | |
246 | + }); | |
247 | + }; | |
248 | + | |
249 | + } else { | |
250 | + self.setData({ | |
251 | + 'list.pageData': [] | |
252 | + }); | |
253 | + }; | |
254 | + | |
255 | + }) | |
256 | + .catch(function(err) { | |
257 | + console.log('出错拉!!!!',err); | |
258 | + self.setData({ | |
259 | + 'list.pageData': [] | |
260 | + }); | |
261 | + }); | |
262 | + }, | |
263 | + | |
264 | + | |
265 | + // 上拉加载 | |
266 | + scrollToLower(url, requestData) { | |
267 | + // 数据总量 | |
268 | + let total = this.data.list.total; | |
269 | + // 单页最大数据量 | |
270 | + let pageSize = this.data.list.pageSize; | |
271 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
272 | + if((total != 0)&&(total <= pageSize)) { | |
273 | + this.setData({ | |
274 | + noMore: true | |
275 | + }); | |
276 | + }; | |
277 | + | |
278 | + if(!this.data.isLoading && !this.data.noMore) { | |
279 | + this.setData({ | |
280 | + isLoading: true, | |
281 | + pageNum: this.data.pageNum + 1 | |
282 | + }); | |
283 | + requestData.page = this.data.pageNum; | |
284 | + this.getData(false, url, requestData); | |
285 | + }; | |
286 | + }, | |
287 | +}) | |
0 | 288 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/rank/rank.json
0 → 100644
packageA/pages/distribution/rank/rank.wxml
0 → 100644
1 | +<view> | |
2 | + <view> | |
3 | + <view class="flex jc_sb pd bg-red ai-center"> | |
4 | + <view> | |
5 | + <view class="t1">排行榜</view> | |
6 | + <view class="t2 pdt10 pdr40" wx:if="{{userRanking.rownum == 1}}">恭喜您当前排名第一!</view> | |
7 | + <view class="t2 pdt10 pdr40" wx:elif="{{userRanking.distribut_money}}">您距离前一名还差<text class="money">{{userRanking.mindistribut_money - userRanking.distribut_money}}</text></view> | |
8 | + <view class="t2 pdt10 pdr40" wx:else>好好努力,天天向上!</view> | |
9 | + </view> | |
10 | + <view><image class="badge" src="../../../images/badge.png"/></view> | |
11 | + </view> | |
12 | + | |
13 | + <view class="tab-head flex t-c bg-red2 fs26"> | |
14 | + <view class="tab-head-item pd20 f1 {{currentTabIndex == index ? 'active':''}}" wx:for="{{tabArr}}" bindtap="clickTab" data-index="{{index}}">{{item}}</view> | |
15 | + </view> | |
16 | + | |
17 | + <view class="pd20 flex ai-center fs26 arrow-r bdb"> | |
18 | + <view class="pdr20"><image class="avatar" src="{{userInfo.head_pic}}"/></view> | |
19 | + <view> | |
20 | + <view class="fs30">{{userInfo.nickname}}</view> | |
21 | + <view class="pdt10 c-a" wx:if="{{currentTabIndex == 0}}">当前排名:<text class="c-red fs32">{{userRanking.rownum}}</text>,获得佣金:<text class="money c-red fs32">{{userRanking.distribut_money}}</text></view> | |
22 | + <view class="pdt10 c-a" wx:else>当前排名:<text class="c-red fs32">{{userRanking.rownum}}</text>,下线人数:<text class="c-red fs32">{{userRanking.underling_number}}</text></view> | |
23 | + </view> | |
24 | + </view> | |
25 | + </view> | |
26 | + | |
27 | + <view class="tab-content"> | |
28 | + <view class="flex ai-center pd20 fs26" wx:for="{{list.pageData}}"> | |
29 | + <view class="badge2-container pd20"> | |
30 | + <image wx:if="{{index < 3}}" src="../../../images/no{{index + 1}}.png" class="badge2" data-num="{{index+1}}"/> | |
31 | + <text wx:else>{{index + 1}}</text> | |
32 | + </view> | |
33 | + <view class="pdr20"><image class="avatar2" src="{{item.head_pic}}"/></view> | |
34 | + <view> | |
35 | + <view class="fs30">{{item.nickname}}</view> | |
36 | + <view class="pdt10 c-a" wx:if="{{currentTabIndex == 0}}">获得佣金:<text class="money c-red fs32">{{item.distribut_money}}</text></view> | |
37 | + <view class="pdt10 c-a" wx:else>下线人数:<text class="c-red">{{item.underling_number}}</text></view> | |
38 | + </view> | |
39 | + </view> | |
40 | + </view> | |
41 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
42 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 || list == null}}"></nodata> | |
43 | +</view> | |
0 | 44 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/rank/rank.wxss
0 → 100644
1 | +.badge { | |
2 | + width: 260rpx; | |
3 | + height: 180rpx; | |
4 | +} | |
5 | + | |
6 | +.pd { | |
7 | + padding: 100rpx 40rpx 70rpx 40rpx; | |
8 | +} | |
9 | + | |
10 | +.bg-red { | |
11 | + background-color: #FF6666; | |
12 | +} | |
13 | + | |
14 | +.bg-red2 { | |
15 | + background-color: #FF5758; | |
16 | +} | |
17 | + | |
18 | +.t1 { | |
19 | + font-family: '微软雅黑'; | |
20 | + font-size: 60rpx; | |
21 | + font-weight: bold; | |
22 | + color: white; | |
23 | +} | |
24 | + | |
25 | +.t2 { | |
26 | + font-size: 28rpx; | |
27 | + font-weight: bold; | |
28 | + color: rgba(255,255,255,.6); | |
29 | +} | |
30 | + | |
31 | +.money::before { | |
32 | + content: '¥'; | |
33 | + font-size: 22rpx; | |
34 | +} | |
35 | + | |
36 | +.active { | |
37 | + color: white; | |
38 | + font-weight: bold; | |
39 | +} | |
40 | + | |
41 | +.tab-head { | |
42 | + color: rgba(255,255,255,.5); | |
43 | +} | |
44 | + | |
45 | +.tab-head-item { | |
46 | + position: relative; | |
47 | +} | |
48 | +.tab-head-item.active::after { | |
49 | + content: ''; | |
50 | + position: absolute; | |
51 | + bottom: 0; | |
52 | + left: 0; | |
53 | + right: 0; | |
54 | + margin: 0 auto; | |
55 | + width: 0; | |
56 | + height: 0; | |
57 | + border: 12rpx solid; | |
58 | + border-color: transparent transparent #ffffff transparent; | |
59 | +} | |
60 | + | |
61 | +.avatar, | |
62 | +.avatar2 { | |
63 | + | |
64 | + border-radius: 50%; | |
65 | + background-color: #eee; | |
66 | +} | |
67 | + | |
68 | +.avatar { | |
69 | + width: 140rpx; | |
70 | + height: 140rpx; | |
71 | +} | |
72 | + | |
73 | +.avatar2 { | |
74 | + width: 120rpx; | |
75 | + height: 120rpx; | |
76 | +} | |
77 | + | |
78 | + | |
79 | +.arrow-r::after { | |
80 | + font-family: iconfont; | |
81 | + content: '\e61f'; | |
82 | + position: absolute; | |
83 | + right: 20rpx; | |
84 | + color: #ccc; | |
85 | +} | |
86 | + | |
87 | +.bdb { | |
88 | + border-bottom: 20rpx solid #f0f0f0; | |
89 | +} | |
90 | + | |
91 | +.badge2-container { | |
92 | + /* margin: auto; */ | |
93 | + width: 56rpx; | |
94 | + text-align: center; | |
95 | + font-size: 32rpx; | |
96 | + /* box-sizing: border-box; */ | |
97 | +} | |
98 | + | |
99 | +.badge2 { | |
100 | + width: 56rpx; | |
101 | + height: 76rpx; | |
102 | + position: relative; | |
103 | +} | |
104 | + | |
105 | +.badge2::after { | |
106 | + content: attr(data-num); | |
107 | + color: white; | |
108 | + font-weight: bold; | |
109 | + text-align: center; | |
110 | + position: absolute; | |
111 | + left: 0; | |
112 | + top: 26rpx; | |
113 | + right: 0; | |
114 | + bottom: 0; | |
115 | +} | |
116 | + | |
117 | +.noMore { | |
118 | + padding: 20rpx; | |
119 | + color: #bbb; | |
120 | + text-align: center; | |
121 | + font-size: 26rpx; | |
122 | + /* background-color: #f4f4f4; */ | |
123 | +} | |
0 | 124 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/rookie/rookie.js
0 → 100644
1 | +var WxParse = require('../../../../utils/wxParse/wxParse.js'); | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + list: null, | |
12 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
13 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
14 | + pageNum: 1, // 当前页数 | |
15 | + }, | |
16 | + | |
17 | + /** | |
18 | + * 生命周期函数--监听页面加载 | |
19 | + */ | |
20 | + onLoad: function (options) { | |
21 | + self = this; | |
22 | + | |
23 | + // 判断会员是否授权登录, | |
24 | + // 没有登录则跳转到登录页, | |
25 | + // 已登录则设置已登录状态,请求加载数据 | |
26 | + // isLogin记录登录状态 | |
27 | + app.isLogin().then(function(data) { | |
28 | + // console.log('data', data); | |
29 | + // 1.登录成功 | |
30 | + self.setData({ | |
31 | + isLogin: true, | |
32 | + userInfo: data, | |
33 | + // currentQuery: { | |
34 | + // store_id: app.globalData.setting.stoid, | |
35 | + // user_id: app.globalData.user_id, | |
36 | + // }, | |
37 | + }); | |
38 | + // 2.请求数据 | |
39 | + self.get('/api/weshop/storeDistribut/get', { | |
40 | + store_id: app.globalData.setting.stoid, | |
41 | + }); | |
42 | + | |
43 | + }); | |
44 | + | |
45 | + }, | |
46 | + | |
47 | + /** | |
48 | + * 生命周期函数--监听页面初次渲染完成 | |
49 | + */ | |
50 | + onReady: function () { | |
51 | + | |
52 | + }, | |
53 | + | |
54 | + /** | |
55 | + * 生命周期函数--监听页面显示 | |
56 | + */ | |
57 | + onShow: function () { | |
58 | + if(app.globalData.userInfo instanceof Object) { | |
59 | + this.setData({ | |
60 | + userInfo: app.globalData.userInfo, | |
61 | + imghost: app.globalData.setting.imghost, | |
62 | + }); | |
63 | + // 检测从登录页返回后的登录状态 | |
64 | + if(this.data.isLogin) { | |
65 | + // 初次就授权登录 | |
66 | + return; | |
67 | + } else { | |
68 | + // 初次未授权登录,过后才授权 | |
69 | + this.setData({ | |
70 | + isLogin: true | |
71 | + }); | |
72 | + // 请求数据 | |
73 | + this.get('/api/weshop/storeDistribut/get', { | |
74 | + store_id: app.globalData.setting.stoid, | |
75 | + }); | |
76 | + | |
77 | + }; | |
78 | + }; | |
79 | + }, | |
80 | + | |
81 | + /** | |
82 | + * 生命周期函数--监听页面隐藏 | |
83 | + */ | |
84 | + onHide: function () { | |
85 | + | |
86 | + }, | |
87 | + | |
88 | + /** | |
89 | + * 生命周期函数--监听页面卸载 | |
90 | + */ | |
91 | + onUnload: function () { | |
92 | + | |
93 | + }, | |
94 | + | |
95 | + /** | |
96 | + * 页面相关事件处理函数--监听用户下拉动作 | |
97 | + */ | |
98 | + onPullDownRefresh: function () { | |
99 | + | |
100 | + }, | |
101 | + | |
102 | + /** | |
103 | + * 页面上拉触底事件的处理函数 | |
104 | + */ | |
105 | + onReachBottom: function () { | |
106 | + | |
107 | + }, | |
108 | + | |
109 | + /** | |
110 | + * 用户点击右上角分享 | |
111 | + */ | |
112 | + onShareAppMessage: function () { | |
113 | + | |
114 | + }, | |
115 | + | |
116 | + /** | |
117 | + * get请求数据 | |
118 | + */ | |
119 | + get(url, data) { | |
120 | + app.request.get(url + '/' + data.store_id, { | |
121 | + success: function(res) { | |
122 | + if(res.data.code == 0){ | |
123 | + console.log('success~~~~~~~~~~~',res); | |
124 | + self.setData({ | |
125 | + content: res.data.data.distriRule, | |
126 | + }); | |
127 | + /** | |
128 | + * WxParse.wxParse(bindName , type, data, target,imagePadding) | |
129 | + * 1.bindName绑定的数据名(必填) | |
130 | + * 2.type可以为html或者md(必填) | |
131 | + * 3.data为传入的具体数据(必填) | |
132 | + * 4.target为Page对象,一般为this(必填) | |
133 | + * 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选) | |
134 | + */ | |
135 | + WxParse.wxParse('content', 'html', self.data.content, self); | |
136 | + }else{ | |
137 | + wx.showToast({ | |
138 | + title: "网络繁忙,请重试", | |
139 | + icon: 'none', | |
140 | + duration: 2000 | |
141 | + }) | |
142 | + } | |
143 | + }, | |
144 | + fail: function() {}, | |
145 | + }); | |
146 | + }, | |
147 | + | |
148 | + /** | |
149 | + * 请求数据 | |
150 | + */ | |
151 | + // getData: function(isInit, url, data) { | |
152 | + // app.request.promiseGet(url, { | |
153 | + // data: data, | |
154 | + // isShowLoading: true, | |
155 | + // }) | |
156 | + // .then(function(res) { | |
157 | + // // console.log('1121', res.data.code); | |
158 | + // if(res.data.code == 0) { | |
159 | + | |
160 | + // self.setData({ | |
161 | + // isLoading: false | |
162 | + // }); | |
163 | + | |
164 | + // if(isInit) {// 第一次加载 | |
165 | + // self.setData({ | |
166 | + // list: res.data.data | |
167 | + // }); | |
168 | + // } else { | |
169 | + // self.setData({ | |
170 | + // 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
171 | + // }); | |
172 | + // }; | |
173 | + | |
174 | + // if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
175 | + // self.setData({ | |
176 | + // noMore: true | |
177 | + // }); | |
178 | + // }; | |
179 | + | |
180 | + // } else { | |
181 | + // self.setData({ | |
182 | + // 'list.pageData': [] | |
183 | + // }); | |
184 | + // }; | |
185 | + | |
186 | + // }) | |
187 | + // .catch(function(err) { | |
188 | + // console.log('出错拉!!!!',err); | |
189 | + // self.setData({ | |
190 | + // 'list.pageData': [] | |
191 | + // }); | |
192 | + // }); | |
193 | + // }, | |
194 | + | |
195 | + | |
196 | + /** | |
197 | + * 上拉加载 | |
198 | + */ | |
199 | + // scrollToLower(url, requestData) { | |
200 | + // // 数据总量 | |
201 | + // let total = this.data.list.total; | |
202 | + // // 单页最大数据量 | |
203 | + // let pageSize = this.data.list.pageSize; | |
204 | + // // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
205 | + // if((total != 0)&&(total <= pageSize)) { | |
206 | + // this.setData({ | |
207 | + // noMore: true | |
208 | + // }); | |
209 | + // }; | |
210 | + | |
211 | + // if(!this.data.isLoading && !this.data.noMore) { | |
212 | + // this.setData({ | |
213 | + // isLoading: true, | |
214 | + // pageNum: this.data.pageNum + 1 | |
215 | + // }); | |
216 | + // requestData.page = this.data.pageNum; | |
217 | + // this.getData(false, url, requestData); | |
218 | + // }; | |
219 | + // }, | |
220 | + | |
221 | +}) | |
0 | 222 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/rookie/rookie.json
0 → 100644
packageA/pages/distribution/rookie/rookie.wxml
0 → 100644
1 | +<view class="pd20"> | |
2 | + <!-- <image src="../../../images/cloud.jpg" mode="widthFix" style="width: 100%;"></image> --> | |
3 | + <view class="fs28 taj"> | |
4 | + <import src="../../../../utils/wxParse/wxParse.wxml"/> | |
5 | + <template is="wxParse" data="{{wxParseData:content.nodes}}"/> | |
6 | + </view> | |
7 | +</view> | ... | ... |
packageA/pages/distribution/rookie/rookie.wxss
0 → 100644
packageA/pages/distribution/shop/shop.js
0 → 100644
1 | +// packageA//pages/distribution/commision/commision.js | |
2 | +const app = getApp(); | |
3 | +let self = null; | |
4 | + | |
5 | +Page({ | |
6 | + | |
7 | + /** | |
8 | + * 页面的初始数据 | |
9 | + */ | |
10 | + data: { | |
11 | + isInputFocus: false,//记录搜索输入框是否聚焦 | |
12 | + inputVal: '',//记录搜索输入框的内容 | |
13 | + isSort: false,//控制排序开关状态,true开启排序 | |
14 | + isDescending: false, //isDescending降序,ascending升序 | |
15 | + imghost: '', | |
16 | + | |
17 | + tabArr: ['最新','销量','评论','价格'], | |
18 | + currentTabIndex: 0, | |
19 | + isShowRow: false,//控制视图切换状态 | |
20 | + isHiddenDropdown: true,//控制筛选下拉菜单显隐 | |
21 | + | |
22 | + list: null, | |
23 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
24 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
25 | + pageNum: 1, // 当前页数 | |
26 | + }, | |
27 | + | |
28 | + /** | |
29 | + * 生命周期函数--监听页面加载 | |
30 | + */ | |
31 | + onLoad: function (options) { | |
32 | + self = this;//保存全局指针 | |
33 | + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
34 | + self.setData({ | |
35 | + userInfo: data, | |
36 | + }); | |
37 | + }); | |
38 | + // 判断会员是否授权登录, | |
39 | + // 没有登录则跳转到登录页, | |
40 | + // 已登录则设置已登录状态,请求加载签到数据 | |
41 | + // isLogin记录登录状态 | |
42 | + // app.isLogin().then(function(data) { | |
43 | + // // 1.登录成功 | |
44 | + // self.setData({ | |
45 | + // isLogin: true, | |
46 | + // userInfo: data, | |
47 | + // currentQuery: { | |
48 | + // store_id: app.globalData.setting.stoid, | |
49 | + // user_id: app.globalData.user_id, | |
50 | + // }, | |
51 | + // }); | |
52 | + // // 2.请求全部商品数据 | |
53 | + // self.getData(true, '/api/weshop/users/distribut/pagemyshop', self.data.currentQuery); | |
54 | + // // 3.请求新品 | |
55 | + // app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | |
56 | + // data: self.data.currentQuery, | |
57 | + // }).then(function(res) { | |
58 | + // self.setData({ | |
59 | + // newList: res.data.data, | |
60 | + // }); | |
61 | + // }) | |
62 | + // }); | |
63 | + }, | |
64 | + | |
65 | + /** | |
66 | + * 生命周期函数--监听页面初次渲染完成 | |
67 | + */ | |
68 | + onReady: function () { | |
69 | + | |
70 | + }, | |
71 | + | |
72 | + /** | |
73 | + * 生命周期函数--监听页面显示 | |
74 | + */ | |
75 | + onShow: function () { | |
76 | + if(app.globalData.userInfo) { | |
77 | + if(!this.data.isLogin) { | |
78 | + this.setData({ | |
79 | + userInfo: app.globalData.userInfo, | |
80 | + imghost: app.globalData.setting.imghost, | |
81 | + currentQuery: { | |
82 | + store_id: app.globalData.setting.stoid, | |
83 | + user_id: app.globalData.user_id, | |
84 | + }, | |
85 | + isLogin: true, | |
86 | + }); | |
87 | + | |
88 | + // 请求数据 | |
89 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | |
90 | + // 新品 | |
91 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | |
92 | + data: self.data.currentQuery, | |
93 | + }).then(res => { | |
94 | + self.setData({ | |
95 | + newList: res.data.data, | |
96 | + }); | |
97 | + }); | |
98 | + // 广告banner | |
99 | + app.request.promiseGet("/api/weshop/ad/page", { | |
100 | + data: { | |
101 | + pid: 401, | |
102 | + enabled: 1, | |
103 | + store_id: app.globalData.setting.stoid, | |
104 | + } | |
105 | + }).then(res => { | |
106 | + if(res.data.code == 0 && res.data.data) { | |
107 | + let item = res.data.data.pageData[0]; | |
108 | + if(item && item.ad_code) { | |
109 | + self.setData({ | |
110 | + ad_img: item.ad_code, | |
111 | + }); | |
112 | + }; | |
113 | + }; | |
114 | + }); | |
115 | + | |
116 | + }; | |
117 | + }; | |
118 | + | |
119 | + }, | |
120 | + | |
121 | + /** | |
122 | + * 生命周期函数--监听页面隐藏 | |
123 | + */ | |
124 | + onHide: function () { | |
125 | + | |
126 | + }, | |
127 | + | |
128 | + /** | |
129 | + * 生命周期函数--监听页面卸载 | |
130 | + */ | |
131 | + onUnload: function () { | |
132 | + | |
133 | + }, | |
134 | + | |
135 | + /** | |
136 | + * 页面相关事件处理函数--监听用户下拉动作 | |
137 | + */ | |
138 | + onPullDownRefresh: function () { | |
139 | + | |
140 | + }, | |
141 | + | |
142 | + /** | |
143 | + * 页面上拉触底事件的处理函数 | |
144 | + */ | |
145 | + onReachBottom: function () { | |
146 | + this.scrollToLower('/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | |
147 | + }, | |
148 | + | |
149 | + /** | |
150 | + * 用户点击右上角分享 | |
151 | + */ | |
152 | + onShareAppMessage: function () { | |
153 | + | |
154 | + }, | |
155 | + | |
156 | + /** | |
157 | + * 点击下拉菜单 | |
158 | + */ | |
159 | + clickDropdown() { | |
160 | + this.setData({ | |
161 | + isHiddenDropdown: !this.data.isHiddenDropdown, | |
162 | + }); | |
163 | + }, | |
164 | + | |
165 | + /** | |
166 | + * 点击遮罩层 | |
167 | + */ | |
168 | + clickMask() { | |
169 | + this.setData({ | |
170 | + isHiddenDropdown: true, | |
171 | + }); | |
172 | + }, | |
173 | + | |
174 | + /** | |
175 | + * 选择下拉菜单项 | |
176 | + */ | |
177 | + selectDropdown(e) { | |
178 | + let currentIndex = e.target.dataset.index; | |
179 | + this.setData({ | |
180 | + isHiddenDropdown: true, | |
181 | + currentSelect: this.data.dropdownArr[currentIndex], | |
182 | + }); | |
183 | + }, | |
184 | + | |
185 | + /** | |
186 | + * 搜索输入框聚焦 | |
187 | + */ | |
188 | + inputFocus() { | |
189 | + this.setData({ | |
190 | + isInputFocus: true, | |
191 | + }); | |
192 | + }, | |
193 | + | |
194 | + | |
195 | + /** | |
196 | + * 搜索输入框失焦 | |
197 | + */ | |
198 | + inputBlur() { | |
199 | + this.setData({ | |
200 | + isInputFocus: false, | |
201 | + }); | |
202 | + }, | |
203 | + | |
204 | + /** | |
205 | + * 获取搜索输入框输入的内容 | |
206 | + */ | |
207 | + input(e) { | |
208 | + this.data.inputVal = e.detail.value; | |
209 | + }, | |
210 | + | |
211 | + /** | |
212 | + * 搜索输入框清空内容 | |
213 | + */ | |
214 | + inputClear() { | |
215 | + let inputVal = this.data.inputVal; | |
216 | + console.log('input', inputVal); | |
217 | + if(inputVal) { | |
218 | + this.setData({ | |
219 | + inputVal: '', | |
220 | + }); | |
221 | + }; | |
222 | + }, | |
223 | + | |
224 | + /** | |
225 | + * 搜索输入框聚焦 | |
226 | + */ | |
227 | + search() { | |
228 | + let data = this.data.currentQuery; | |
229 | + data.key = this.data.inputVal; | |
230 | + if(data.orderField) { | |
231 | + delete data.orderField; | |
232 | + }; | |
233 | + if(data.page) { | |
234 | + delete data.page; | |
235 | + }; | |
236 | + this.setData({ | |
237 | + currentTabIndex: 4, | |
238 | + isSort: false, | |
239 | + isDescending: false, | |
240 | + currentQuery: data, | |
241 | + pageNum: 1, | |
242 | + }); | |
243 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | |
244 | + }, | |
245 | + | |
246 | + /** | |
247 | + * 点击排序 | |
248 | + */ | |
249 | + clickSort(e) { | |
250 | + let data = this.data.currentQuery; | |
251 | + data.orderField = 'shop_price'; | |
252 | + if(data.page) { | |
253 | + delete data.page; | |
254 | + }; | |
255 | + if(!this.data.isSort) { | |
256 | + this.setData({ | |
257 | + isSort: true, | |
258 | + }); | |
259 | + data.orderType = 'asc'; | |
260 | + } else { | |
261 | + this.setData({ | |
262 | + isDescending: !this.data.isDescending, | |
263 | + }); | |
264 | + | |
265 | + if(this.data.isDescending) { | |
266 | + data.orderType = 'desc'; | |
267 | + } else { | |
268 | + data.orderType = 'asc'; | |
269 | + }; | |
270 | + | |
271 | + }; | |
272 | + console.log('当前参数:', data); | |
273 | + | |
274 | + this.setData({ | |
275 | + currentQuery: data, | |
276 | + noMore: false, | |
277 | + }); | |
278 | + | |
279 | + // 请求数据 | |
280 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | |
281 | + }, | |
282 | + | |
283 | + /** | |
284 | + * 点击视图切换按钮 | |
285 | + */ | |
286 | + change() { | |
287 | + this.setData({ | |
288 | + isShowRow: !this.data.isShowRow | |
289 | + }); | |
290 | + }, | |
291 | + | |
292 | + /** | |
293 | + * 点击Tab | |
294 | + */ | |
295 | + clickTab(e) { | |
296 | + let data = this.data.currentQuery; | |
297 | + let isSort = this.data.isSort; | |
298 | + let currentIndex = e.target.dataset.index; | |
299 | + if(currentIndex != 3) { | |
300 | + if(isSort) { | |
301 | + isSort = false; | |
302 | + }; | |
303 | + if(data.orderType) {// 清除orderType | |
304 | + delete data.orderType; | |
305 | + }; | |
306 | + }; | |
307 | + this.setData({ | |
308 | + list: null, | |
309 | + currentTabIndex: currentIndex, | |
310 | + isSort, | |
311 | + pageNum: 1, | |
312 | + noMore: false, | |
313 | + }); | |
314 | + if(data.page) {// 清除page | |
315 | + delete data.page; | |
316 | + }; | |
317 | + | |
318 | + | |
319 | + | |
320 | + if(currentIndex == 0) { | |
321 | + if(data.orderField) {// 清除orderField | |
322 | + delete data.orderField; | |
323 | + }; | |
324 | + }; | |
325 | + if(currentIndex == 1) { | |
326 | + data.orderField = 'sales_sum'; | |
327 | + }; | |
328 | + if(currentIndex == 2) { | |
329 | + data.orderField = 'comment_count'; | |
330 | + }; | |
331 | + | |
332 | + if(currentIndex == 3) { | |
333 | + // console.log('点击价格'); | |
334 | + return; | |
335 | + }; | |
336 | + | |
337 | + this.data.currentQuery = data; | |
338 | + this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | |
339 | + }, | |
340 | + | |
341 | + /** | |
342 | + * 点击筛选 | |
343 | + */ | |
344 | + clickFilter() { | |
345 | + this.setData({ | |
346 | + isHiddenDropdown: !this.data.isHiddenDropdown, | |
347 | + }); | |
348 | + }, | |
349 | + | |
350 | + /** | |
351 | + * 点击遮罩层,关闭筛选下拉菜单 | |
352 | + */ | |
353 | + clickMask() { | |
354 | + if(!this.data.isHiddenDropdown) { | |
355 | + this.setData({ | |
356 | + isHiddenDropdown: true, | |
357 | + }); | |
358 | + } | |
359 | + }, | |
360 | + | |
361 | + /** | |
362 | + * 请求数据 | |
363 | + */ | |
364 | + getData: function(isInit, url, data) { | |
365 | + | |
366 | + app.request.promiseGet(url, { | |
367 | + data: data, | |
368 | + isShowLoading: true, | |
369 | + }) | |
370 | + .then(function(res) { | |
371 | + // console.log('1121', res.data.code); | |
372 | + if(res.data.code == 0) { | |
373 | + | |
374 | + self.setData({ | |
375 | + isLoading: false | |
376 | + }); | |
377 | + | |
378 | + if(isInit) {// 第一次加载 | |
379 | + self.setData({ | |
380 | + list: res.data.data | |
381 | + }); | |
382 | + } else { | |
383 | + self.setData({ | |
384 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
385 | + }); | |
386 | + }; | |
387 | + | |
388 | + if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
389 | + self.setData({ | |
390 | + noMore: true | |
391 | + }); | |
392 | + }; | |
393 | + | |
394 | + } else { | |
395 | + self.setData({ | |
396 | + 'list.pageData': [] | |
397 | + }); | |
398 | + }; | |
399 | + | |
400 | + }) | |
401 | + .catch(function(err) { | |
402 | + console.log('出错拉!!!!',err); | |
403 | + self.setData({ | |
404 | + 'list.pageData': [] | |
405 | + }); | |
406 | + }); | |
407 | + }, | |
408 | + | |
409 | + | |
410 | + /** | |
411 | + * 上拉加载 | |
412 | + */ | |
413 | + scrollToLower(url, requestData) { | |
414 | + | |
415 | + // 数据总量 | |
416 | + let total = this.data.list.total; | |
417 | + // 单页最大数据量 | |
418 | + let pageSize = this.data.list.pageSize; | |
419 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
420 | + if((total != 0)&&(total <= pageSize)) { | |
421 | + this.setData({ | |
422 | + noMore: true | |
423 | + }); | |
424 | + }; | |
425 | + | |
426 | + if(!this.data.isLoading && !this.data.noMore) { | |
427 | + this.setData({ | |
428 | + isLoading: true, | |
429 | + pageNum: this.data.pageNum + 1 | |
430 | + }); | |
431 | + requestData.page = this.data.pageNum; | |
432 | + console.log('滚动data:', requestData); | |
433 | + this.getData(false, url, requestData); | |
434 | + }; | |
435 | + }, | |
436 | + | |
437 | + /** | |
438 | + * 点击跳转 | |
439 | + */ | |
440 | + goto(e) { | |
441 | + let url = ''; | |
442 | + if(e.target.dataset.url) { | |
443 | + url = e.target.dataset.url; | |
444 | + } else { | |
445 | + url = e.currentTarget.dataset.url; | |
446 | + } | |
447 | + console.log(url); | |
448 | + app.goto(url); | |
449 | + }, | |
450 | +}) | |
0 | 451 | \ No newline at end of file | ... | ... |
packageA/pages/distribution/shop/shop.json
0 → 100644
packageA/pages/distribution/shop/shop.wxml
0 → 100644
1 | +<wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | |
2 | +<view> | |
3 | + <view class="head pr"> | |
4 | + <view class="bdb"> | |
5 | + <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> --> | |
6 | + <view><image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner"/></view> | |
7 | + <view class="flex bg-white pdh20 jc_sb pr"> | |
8 | + <view class="avatar-container"> | |
9 | + <image class="avatar" src="{{userInfo.head_pic}}"/> | |
10 | + <view class="pdt20"><text class="nickname">{{userInfo.nickname}}</text></view> | |
11 | + </view> | |
12 | + <view class="flex t-c fs24 f1 jc_fe"> | |
13 | + <view class="pdv20 pdh40"> | |
14 | + <view class="fs30">{{filter.show_default(list.total)}}</view> | |
15 | + <view>全部商品</view> | |
16 | + </view> | |
17 | + <view class="pdv20 pdh40"> | |
18 | + <view class="fs30">{{filter.show_default(newList.total)}}</view> | |
19 | + <view>新品</view> | |
20 | + </view> | |
21 | + <view class="pdv20 pdh40" bindtap="goto" data-url="/pages/user/index/index"> | |
22 | + <view class="fs26"><text class="iconfont icon-ren1 bold"></text></view> | |
23 | + <view>会员中心</view> | |
24 | + </view> | |
25 | + </view> | |
26 | + </view> | |
27 | + </view> | |
28 | + | |
29 | + <!-- 搜索 --> | |
30 | + <view class="flex ai-center fs26 bg-white pd20"> | |
31 | + <view class="input-container f1"> | |
32 | + <input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" confirm-type="search" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" bindconfirm="search"/> | |
33 | + <text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text> | |
34 | + <!-- 搜索输入框聚焦时显示关闭按钮,否则隐藏关闭按钮 --> | |
35 | + </view> | |
36 | + <view class="pd20 c-red" bindtap="search">搜索</view> | |
37 | + </view> | |
38 | + | |
39 | + </view> | |
40 | + | |
41 | + <view class="flex t-c fs26 bg-white bdb sticky c-a" catchtap="clickTab"> | |
42 | + <block wx:for="{{tabArr}}"> | |
43 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}">{{item}}</view> | |
44 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort"> | |
45 | + {{item}} | |
46 | + <text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}"></text> | |
47 | + <text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" wx:else></text> | |
48 | + </view> | |
49 | + </block> | |
50 | + <view class="f1 pd20" catchtap="change"> | |
51 | + <text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text> | |
52 | + </view> | |
53 | + </view> | |
54 | + | |
55 | + | |
56 | + <view class="content"> | |
57 | + | |
58 | + <view class="fs26" wx:if="{{isShowRow}}"> | |
59 | + <view class="item bg-white flex ai-center pd20" wx:for="{{list.pageData}}"> | |
60 | + <view class="flex pdl10" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
61 | + <view class="img-container pdr20" data-txt="已售:{{item.sales_sum}}"><image class="img" src="{{imghost + item.original_img}}" lazy-load mode="aspectFit"/></view> | |
62 | + <view class="flex fdc jc_sb"> | |
63 | + <view class="ellipsis-2">{{item.goods_name}}</view> | |
64 | + <view> | |
65 | + <view> | |
66 | + <text class="money c-red fs32 pdr10">1.00</text> | |
67 | + <text class="money c-c7 line-del fs20">6.00</text> | |
68 | + </view> | |
69 | + <view class="github-badge"> | |
70 | + <text class="badge-subject money">0.90</text><view class="badge-value flex ai-center"><text class="iconfont icon-badge"></text>VIP超级会员</view> | |
71 | + </view> | |
72 | + <view class="fs24 c-a">分成金额:<text class="money c-red">1.00</text></view> | |
73 | + </view> | |
74 | + </view> | |
75 | + </view> | |
76 | + </view> | |
77 | + </view> | |
78 | + | |
79 | + | |
80 | + | |
81 | + <view class="fs26 flex pd20 wrap" wx:else> | |
82 | + <view class="item2 bg-white" wx:for="{{list.pageData}}" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | |
83 | + <view class="img-container" data-txt="已售:{{item.sales_sum}}"><image class="img2" src="{{imghost + item.original_img}}" mode="aspectFit" lazy-load/></view> | |
84 | + <view class="pd20 fs26"> | |
85 | + <view class="ellipsis-2">{{item.goods_name}}</view> | |
86 | + <view class="pdt20"> | |
87 | + <view class=""> | |
88 | + <view> | |
89 | + <text class="money c-red fs32 pdr10">1.00</text> | |
90 | + <text class="money c-c7 line-del fs20">6.00</text> | |
91 | + </view> | |
92 | + <view class="github-badge"> | |
93 | + <text class="badge-subject money">0.90</text><view class="badge-value flex ai-center"><text class="iconfont icon-badge"></text>VIP超级会员</view> | |
94 | + </view> | |
95 | + <view class="c-a fs24">分成金额:<text class="money c-red">1.00</text></view> | |
96 | + </view> | |
97 | + </view> | |
98 | + </view> | |
99 | + </view> | |
100 | + </view> | |
101 | + | |
102 | + | |
103 | + <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> | |
104 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | |
105 | + </view> | |
106 | + | |
107 | + | |
108 | + | |
109 | + | |
110 | + | |
111 | + <!-- <view class="bottomBar flex pd20 jc_sb fs26 ai-center"> | |
112 | + <view> | |
113 | + <label class="flex ai-center"> | |
114 | + <checkbox/>全选 | |
115 | + </label> | |
116 | + </view> | |
117 | + <view class="pd20 btn" wx:if="{{options.index == 0}}">一键上架</view> | |
118 | + <view class="pd20 btn" wx:else>一键下架</view> | |
119 | + </view> --> | |
120 | + | |
121 | + | |
122 | + | |
123 | +</view> | ... | ... |
packageA/pages/distribution/shop/shop.wxss
0 → 100644
1 | +page { | |
2 | + background-color: #f4f4f4; | |
3 | +} | |
4 | + | |
5 | +.avatar-container { | |
6 | + display: flex; | |
7 | + /* align-items: center; */ | |
8 | + position: absolute; | |
9 | + margin-top: -80rpx; | |
10 | + color: white; | |
11 | +} | |
12 | + | |
13 | +.avatar { | |
14 | + width: 160rpx; | |
15 | + height: 160rpx; | |
16 | + border-radius: 50%; | |
17 | + background-color: #eee; | |
18 | + margin-right: 10rpx; | |
19 | +} | |
20 | + | |
21 | +.nickname { | |
22 | + font-size: 28rpx; | |
23 | + padding-top: 30rpx; | |
24 | + background-color: rgba(0,0,0,.6); | |
25 | + padding: 4rpx 10rpx; | |
26 | + border-radius: 8rpx 8rpx 8rpx 0; | |
27 | + overflow: hidden; | |
28 | + color: #f8f8f8; | |
29 | +} | |
30 | + | |
31 | +.banner { | |
32 | + display: block; | |
33 | + width: 100%; | |
34 | + background-color: white; | |
35 | +} | |
36 | + | |
37 | +.input-container { | |
38 | + position: relative; | |
39 | + background-color: #f0f0f0; | |
40 | + border-radius: 6rpx; | |
41 | +} | |
42 | +.input-container::before { | |
43 | + content: '\e618'; | |
44 | + font-family: iconfont; | |
45 | + position: absolute; | |
46 | + top: 50%; | |
47 | + left: 16rpx; | |
48 | + transform: translateY(-40%); | |
49 | + color: #aaa; | |
50 | +} | |
51 | +.input-container .icon-guanbi { | |
52 | + position: absolute; | |
53 | + top: 50%; | |
54 | + right: 16rpx; | |
55 | + transform: translateY(-40%); | |
56 | + font-size: 28rpx; | |
57 | + color: #aaa; | |
58 | + padding: 10rpx; | |
59 | + z-index: 2; | |
60 | +} | |
61 | +.input { | |
62 | + padding: 10rpx 50rpx; | |
63 | +} | |
64 | + | |
65 | +.time::before { | |
66 | + content: '\e64c'; | |
67 | + font-family: iconfont; | |
68 | + padding-right: 10rpx; | |
69 | + color: #FF6768; | |
70 | +} | |
71 | + | |
72 | +.icon-xia, | |
73 | +.icon-shang { | |
74 | + font-size: 16rpx; | |
75 | +} | |
76 | +.icon-sort2 { | |
77 | + font-size: 24rpx; | |
78 | +} | |
79 | + | |
80 | +/* .line { | |
81 | + position: relative; | |
82 | +} | |
83 | +.line::after { | |
84 | + content: ''; | |
85 | + position: absolute; | |
86 | + right: 0; | |
87 | + background-color: #f4f4f4; | |
88 | + width: 2rpx; | |
89 | + height: 30rpx; | |
90 | + top: 50%; | |
91 | + transform: translateY(-50%); | |
92 | +} */ | |
93 | + | |
94 | +/* .item { | |
95 | + border-radius: 12rpx; | |
96 | + background-color: white; | |
97 | +} */ | |
98 | + | |
99 | +/* .item ~ .item { | |
100 | + margin-top: 20rpx; | |
101 | +} */ | |
102 | + | |
103 | +.money { | |
104 | + /* word-break: break-all; | |
105 | + word-wrap: break-word; */ | |
106 | +} | |
107 | + | |
108 | +.money::before { | |
109 | + content: '¥'; | |
110 | + font-size: 22rpx; | |
111 | +} | |
112 | + | |
113 | +.md { | |
114 | + position: relative; | |
115 | +} | |
116 | +.md::before, | |
117 | +.md::after { | |
118 | + content: ''; | |
119 | + position: absolute; | |
120 | + top: 50%; | |
121 | + transform: translateY(-50%); | |
122 | + width: 2rpx; | |
123 | + height: 40%; | |
124 | + background-color: #f4f4f4; | |
125 | +} | |
126 | +.md::before { | |
127 | + left: 0; | |
128 | +} | |
129 | +.md::after { | |
130 | + right: 0; | |
131 | +} | |
132 | + | |
133 | +.noMore { | |
134 | + padding: 20rpx; | |
135 | + color: #bbb; | |
136 | + text-align: center; | |
137 | + font-size: 26rpx; | |
138 | + background-color: transparent !important; | |
139 | +} | |
140 | + | |
141 | +.sticky { | |
142 | + position: sticky; | |
143 | + top: 0; | |
144 | + z-index: 1; | |
145 | +} | |
146 | + | |
147 | +.dropdown { | |
148 | + border-top: 2rpx solid #f8f8f8; | |
149 | + position: absolute; | |
150 | + width: 100%; | |
151 | + top: 54rpx; | |
152 | + left: 0; | |
153 | + background-color: white; | |
154 | + z-index: 1; | |
155 | +} | |
156 | + | |
157 | + | |
158 | +.active { | |
159 | + color: #FF6768; | |
160 | + font-weight: bold; | |
161 | + position: relative; | |
162 | +} | |
163 | + | |
164 | +.active::after { | |
165 | + content: ''; | |
166 | + width: 30%; | |
167 | + height: 2rpx; | |
168 | + background-color: #FF6768; | |
169 | + position: absolute; | |
170 | + left: 0; | |
171 | + right: 0; | |
172 | + bottom: 0; | |
173 | + margin: 0 auto; | |
174 | +} | |
175 | + | |
176 | + | |
177 | +.mask { | |
178 | + position: fixed; | |
179 | + width: 100%; | |
180 | + height: 100%; | |
181 | + background-color: rgba(0,0,0,.5); | |
182 | +} | |
183 | + | |
184 | +.hover { | |
185 | + background-color: #eee; | |
186 | +} | |
187 | + | |
188 | +.t-icon-sort-up { | |
189 | + width: 12px; | |
190 | + height: 12px; | |
191 | + position: relative; | |
192 | + top: 2rpx; | |
193 | + right: 0; | |
194 | + background-repeat: no-repeat; | |
195 | + box-sizing: border-box; | |
196 | +} | |
197 | + | |
198 | +.t-icon-sort-up.reverse { | |
199 | + transform: rotateZ(-180deg); | |
200 | +} | |
201 | + | |
202 | + | |
203 | +.img-container { | |
204 | + position: relative; | |
205 | +} | |
206 | +.img-container::after { | |
207 | + content: attr(data-txt); | |
208 | + position: absolute; | |
209 | + left: 0; | |
210 | + bottom: 0; | |
211 | + background-color: rgba(0,0,0,.4); | |
212 | + color: white; | |
213 | + font-size: 20rpx; | |
214 | + padding: 4rpx; | |
215 | + border-radius: 6rpx 6rpx 6rpx 0; | |
216 | +} | |
217 | + | |
218 | +.img { | |
219 | + display: block; | |
220 | + width: 240rpx; | |
221 | + height: 240rpx; | |
222 | + background-color: #eee; | |
223 | +} | |
224 | + | |
225 | +.img2 { | |
226 | + display: block; | |
227 | + width: 100%; | |
228 | + height: 340rpx; | |
229 | + /* height: auto; */ | |
230 | + /* width: 200rpx; | |
231 | + height: 200rpx; */ | |
232 | + background-color: white; | |
233 | +} | |
234 | + | |
235 | + | |
236 | +/*checkbox 整体大小 */ | |
237 | +checkbox { | |
238 | + /* width: 240rpx; | |
239 | + height: 90rpx; */ | |
240 | +} | |
241 | +/*checkbox 选项框大小 */ | |
242 | +checkbox .wx-checkbox-input { | |
243 | + width: 34rpx; | |
244 | + height: 34rpx; | |
245 | + border-radius: 50%; | |
246 | + | |
247 | +} | |
248 | +/*checkbox选中后样式 */ | |
249 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked { | |
250 | + background-color: #FF6768; | |
251 | + border-color: #FF6768; | |
252 | + /* color: white; */ | |
253 | +} | |
254 | +/*checkbox选中后图标样式 */ | |
255 | +checkbox .wx-checkbox-input.wx-checkbox-input-checked::before { | |
256 | + width: 34rpx; | |
257 | + height: 34rpx; | |
258 | + line-height: 34rpx; | |
259 | + text-align: center; | |
260 | + font-size: 24rpx; | |
261 | + color: #fff; | |
262 | + background: transparent; | |
263 | + transform: translate(-50%, -50%) scale(1); | |
264 | + -webkit-transform: translate(-50%, -50%) scale(1); | |
265 | +} | |
266 | + | |
267 | +.bottomBar { | |
268 | + box-sizing: border-box; | |
269 | + position: fixed; | |
270 | + bottom: 0; | |
271 | + width: 100%; | |
272 | + background-color: white; | |
273 | + border-radius: 20rpx 20rpx 0 0; | |
274 | +} | |
275 | + | |
276 | +.btn { | |
277 | + color: white; | |
278 | + background-color: #FF6768; | |
279 | + border-radius: 6rpx; | |
280 | +} | |
281 | + | |
282 | +/* .item { | |
283 | + border-radius: 10rpx; | |
284 | +} */ | |
285 | + | |
286 | +.item2 { | |
287 | + width: calc((100% - 20rpx)/2); | |
288 | + box-sizing: border-box; | |
289 | + border-radius: 12rpx; | |
290 | + overflow: hidden; | |
291 | + margin-bottom: 20rpx; | |
292 | +} | |
293 | + | |
294 | +.item2:nth-child(even) { | |
295 | + margin-left: 20rpx; | |
296 | +} | |
297 | + | |
298 | +/* .content { | |
299 | + padding-bottom: 110rpx; | |
300 | +} */ | |
301 | + | |
302 | +.dropdown { | |
303 | + position: absolute; | |
304 | + left: 0; | |
305 | + top: 114rpx; | |
306 | + width: 100%; | |
307 | + background-color: white; | |
308 | + box-sizing: border-box; | |
309 | +} | |
310 | + | |
311 | +.label { | |
312 | + display: inline-block; | |
313 | + padding: 5rpx 20rpx; | |
314 | + color: #aaa; | |
315 | + border: 2rpx solid #eee; | |
316 | + background-color: #f0f0f0; | |
317 | + border-radius: 6rpx; | |
318 | + box-sizing: border-box; | |
319 | + text-align: center; | |
320 | +} | |
321 | + | |
322 | + | |
323 | +.mask { | |
324 | + display: none; | |
325 | + position: fixed; | |
326 | + left: 0; | |
327 | + right: 0; | |
328 | + top: 0; | |
329 | + bottom: 0; | |
330 | + background-color: rgba(0,0,0,.5); | |
331 | + z-index: -1; | |
332 | +} | |
333 | + | |
334 | +.bsbb { | |
335 | + box-sizing: border-box; | |
336 | +} | |
337 | + | |
338 | +.l-red { | |
339 | + background-image: linear-gradient(-225deg, #FF6060, #FF6768); | |
340 | +} | |
341 | + | |
342 | +.bgf0 { | |
343 | + background-color: #f0f0f0; | |
344 | +} | |
345 | + | |
346 | +.filter::after { | |
347 | + content: '\e68a'; | |
348 | + font-family: iconfont; | |
349 | +} | |
350 | + | |
351 | +.dropdown.show ~ .mask { | |
352 | + display: block; | |
353 | +} | |
354 | + | |
355 | +.icon-badge { | |
356 | + font-size: 19rpx; | |
357 | + padding-right: 4rpx; | |
358 | +} | |
359 | + | |
360 | + | |
361 | + | |
362 | + | |
363 | + | |
364 | + | |
365 | + | |
366 | +.github-badge { | |
367 | + display: inline-block; | |
368 | + border-radius: 4px; | |
369 | + text-shadow: none; | |
370 | + font-size: 12px; | |
371 | + color: #fff; | |
372 | + line-height: 24rpx; | |
373 | + background-color: #ABBAC3; | |
374 | + margin-bottom: 5px; | |
375 | + font-size: 20rpx; | |
376 | +} | |
377 | +.github-badge .badge-subject { | |
378 | + display: inline-block; | |
379 | + background-color: #FFA500; | |
380 | + padding: 0 4px 0 6px; | |
381 | + border-top-left-radius: 4px; | |
382 | + border-bottom-left-radius: 4px; | |
383 | +} | |
384 | +.github-badge .badge-value { | |
385 | + display: inline-block; | |
386 | + padding: 0 6px 0 4px; | |
387 | + border-top-right-radius: 4px; | |
388 | + border-bottom-right-radius: 4px; | |
389 | + font-size: 20rpx; | |
390 | + background-color: #4D4D4D !important; | |
391 | +} | |
392 | + | |
393 | + | |
394 | + | |
395 | + | |
396 | + | |
397 | + | |
398 | + | |
399 | + | ... | ... |