xiaoe_mp_npm 0.5.42-test2 → 0.5.42-test21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.scss +45 -0
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.wxss +37 -1
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.scss +223 -0
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.wxss +522 -36
- package/miniprogram_dist/ConfirmOrder/components/IntegralSelect/index.scss +91 -0
- package/miniprogram_dist/ConfirmOrder/components/IntegralSelect/index.wxss +170 -14
- package/miniprogram_dist/ConfirmOrder/components/Invoice/index.scss +61 -0
- package/miniprogram_dist/ConfirmOrder/components/Invoice/index.wxss +68 -2
- package/miniprogram_dist/ConfirmOrder/components/LeaveWord/index.scss +40 -0
- package/miniprogram_dist/ConfirmOrder/components/LeaveWord/index.wxss +26 -2
- package/miniprogram_dist/ConfirmOrder/components/PayBar/index.scss +62 -0
- package/miniprogram_dist/ConfirmOrder/components/PayBar/index.wxss +81 -3
- package/miniprogram_dist/ConfirmOrder/components/PayDetail/index.scss +41 -0
- package/miniprogram_dist/ConfirmOrder/components/PayDetail/index.wxss +35 -3
- package/miniprogram_dist/CouponList/components/CouponItem/index.css +1715 -1715
- package/miniprogram_dist/CouponList/components/CouponItem/index.js +31 -22
- package/miniprogram_dist/CouponList/components/CouponItem/index.min.css +1 -1
- package/miniprogram_dist/CouponList/components/CouponItem/index.wxml +6 -2
- package/miniprogram_dist/CouponList/components/CouponItem/index.wxss +1037 -79
- package/miniprogram_dist/CouponList/couponColumn/index.js +5 -1
- package/miniprogram_dist/CouponList/couponColumn/index.scss +118 -0
- package/miniprogram_dist/CouponList/couponColumn/index.wxml +1 -0
- package/miniprogram_dist/CouponList/couponColumn/index.wxss +221 -32
- package/miniprogram_dist/CouponReceivePopup/index.js +75 -0
- package/miniprogram_dist/CouponReceivePopup/index.json +6 -0
- package/miniprogram_dist/CouponReceivePopup/index.scss +99 -0
- package/miniprogram_dist/CouponReceivePopup/index.wxml +85 -0
- package/miniprogram_dist/CouponReceivePopup/index.wxss +75 -0
- package/miniprogram_dist/GoodsItem/index.js +7 -5
- package/miniprogram_dist/GoodsItem/index.scss +45 -22
- package/miniprogram_dist/GoodsItem/index.wxml +11 -11
- package/miniprogram_dist/GoodsItem/index.wxs +18 -18
- package/miniprogram_dist/GoodsItem/index.wxss +1273 -116
- package/miniprogram_dist/GoodsRecommend/index.scss +162 -0
- package/miniprogram_dist/GoodsRecommend/index.wxss +418 -33
- package/miniprogram_dist/LiveGoodsList/Header/index.scss +79 -0
- package/miniprogram_dist/LiveGoodsList/Header/index.wxss +148 -10
- package/miniprogram_dist/LiveGoodsList/index.js +167 -25
- package/miniprogram_dist/LiveGoodsList/index.scss +93 -0
- package/miniprogram_dist/LiveGoodsList/index.wxml +41 -19
- package/miniprogram_dist/LiveGoodsList/index.wxss +187 -19
- package/miniprogram_dist/PayModule/button/index.scss +45 -0
- package/miniprogram_dist/PayModule/button/index.wxss +46 -4
- package/miniprogram_dist/TeacherGoodsList/index.js +778 -585
- package/miniprogram_dist/TeacherGoodsList/index.scss +5 -2
- package/miniprogram_dist/TeacherGoodsList/index.wxml +42 -24
- package/miniprogram_dist/TeacherGoodsList/index.wxss +132 -14
- package/miniprogram_dist/common/api/liveGoodsList.js +10 -2
- package/miniprogram_dist/common/utils/index.js +14 -0
- package/miniprogram_dist/coupon/components/CouponItem/index.less +1 -0
- package/miniprogram_dist/coupon/components/CouponItem/index.scss +247 -0
- package/miniprogram_dist/coupon/components/CouponItem/index.wxss +677 -86
- package/miniprogram_dist/coupon/components/CouponSelect/index.scss +331 -0
- package/miniprogram_dist/coupon/components/CouponSelect/index.wxss +861 -59
- package/miniprogram_dist/coupon/index.scss +83 -0
- package/miniprogram_dist/coupon/index.wxss +171 -15
- package/package.json +2 -2
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.scss +45 -0
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxss +42 -1
- package/src/ConfirmOrder/components/GoodsInfo/index.scss +223 -0
- package/src/ConfirmOrder/components/GoodsInfo/index.wxss +552 -39
- package/src/ConfirmOrder/components/IntegralSelect/index.scss +91 -0
- package/src/ConfirmOrder/components/IntegralSelect/index.wxss +182 -14
- package/src/ConfirmOrder/components/Invoice/index.scss +61 -0
- package/src/ConfirmOrder/components/Invoice/index.wxss +75 -2
- package/src/ConfirmOrder/components/LeaveWord/index.scss +40 -0
- package/src/ConfirmOrder/components/LeaveWord/index.wxss +30 -2
- package/src/ConfirmOrder/components/PayBar/index.scss +62 -0
- package/src/ConfirmOrder/components/PayBar/index.wxss +87 -3
- package/src/ConfirmOrder/components/PayDetail/index.scss +41 -0
- package/src/ConfirmOrder/components/PayDetail/index.wxss +39 -3
- package/src/CouponList/components/CouponItem/index.css +1715 -1715
- package/src/CouponList/components/CouponItem/index.js +31 -22
- package/src/CouponList/components/CouponItem/index.min.css +1 -1
- package/src/CouponList/components/CouponItem/index.wxml +6 -2
- package/src/CouponList/components/CouponItem/index.wxss +1039 -85
- package/src/CouponList/couponColumn/index.js +5 -1
- package/src/CouponList/couponColumn/index.scss +118 -0
- package/src/CouponList/couponColumn/index.wxml +1 -0
- package/src/CouponList/couponColumn/index.wxss +236 -32
- package/src/CouponReceivePopup/index.js +75 -0
- package/src/CouponReceivePopup/index.json +6 -0
- package/src/CouponReceivePopup/index.scss +99 -0
- package/src/CouponReceivePopup/index.wxml +85 -0
- package/src/CouponReceivePopup/index.wxss +1 -0
- package/src/GoodsItem/index.js +7 -5
- package/src/GoodsItem/index.scss +45 -22
- package/src/GoodsItem/index.wxml +11 -11
- package/src/GoodsItem/index.wxs +18 -18
- package/src/GoodsItem/index.wxss +1331 -116
- package/src/GoodsRecommend/index.scss +162 -0
- package/src/GoodsRecommend/index.wxss +441 -33
- package/src/LiveGoodsList/Header/index.scss +79 -0
- package/src/LiveGoodsList/Header/index.wxss +156 -10
- package/src/LiveGoodsList/index.js +167 -25
- package/src/LiveGoodsList/index.scss +93 -0
- package/src/LiveGoodsList/index.wxml +41 -19
- package/src/LiveGoodsList/index.wxss +230 -50
- package/src/PayModule/button/index.scss +45 -0
- package/src/PayModule/button/index.wxss +50 -4
- package/src/TeacherGoodsList/index.js +778 -585
- package/src/TeacherGoodsList/index.scss +5 -2
- package/src/TeacherGoodsList/index.wxml +42 -24
- package/src/TeacherGoodsList/index.wxss +151 -14
- package/src/common/api/liveGoodsList.js +10 -2
- package/src/common/utils/index.js +14 -0
- package/src/coupon/components/CouponItem/index.less +1 -0
- package/src/coupon/components/CouponItem/index.scss +247 -0
- package/src/coupon/components/CouponItem/index.wxss +712 -86
- package/src/coupon/components/CouponSelect/index.scss +331 -0
- package/src/coupon/components/CouponSelect/index.wxss +910 -59
- package/src/coupon/index.scss +83 -0
- package/src/coupon/index.wxss +181 -15
- package/miniprogram_dist/GoodsItem/index.css +0 -1364
- package/miniprogram_dist/GoodsItem/index.less +0 -299
- package/miniprogram_dist/GoodsItem/index.min.css +0 -1
- package/miniprogram_dist/TeacherGoodsList/index.css +0 -187
- package/miniprogram_dist/TeacherGoodsList/index.min.css +0 -1
- package/src/GoodsItem/index.css +0 -1364
- package/src/GoodsItem/index.less +0 -299
- package/src/GoodsItem/index.min.css +0 -1
- package/src/TeacherGoodsList/index.css +0 -187
- package/src/TeacherGoodsList/index.min.css +0 -1
|
@@ -1,585 +1,778 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Descripttion:
|
|
3
|
-
* @version:
|
|
4
|
-
* @Author: conlinchen
|
|
5
|
-
* @Date: 2021-10-28 15:32:24
|
|
6
|
-
* @LastEditors: conlinchen
|
|
7
|
-
* @LastEditTime: 2021-11-18 19:52:02
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { getGoodsList } from "../common/api/liveGoodsList"
|
|
11
|
-
const computedBehavior = require('miniprogram-computed').behavior
|
|
12
|
-
|
|
13
|
-
let activityCountdownTimer = null // 活动倒计时计时器
|
|
14
|
-
let hadActivity = false
|
|
15
|
-
let activityList = [] // 参与活动的商品
|
|
16
|
-
|
|
17
|
-
// 预热模块
|
|
18
|
-
let preheatTimer = null // 预热倒计时计时器
|
|
19
|
-
let hadPreheat = false
|
|
20
|
-
let preheatList = [] // 参与活动的商品
|
|
21
|
-
|
|
22
|
-
let hasActivity = false // 是否有参与活动的商品
|
|
23
|
-
let hasPreheat = false // 是否有参与预热的商品
|
|
24
|
-
|
|
25
|
-
const SPU_TYPE = {
|
|
26
|
-
1: "图文",
|
|
27
|
-
2: "音频",
|
|
28
|
-
3: "视频",
|
|
29
|
-
4: "直播",
|
|
30
|
-
35: "班课",
|
|
31
|
-
20: "电子书",
|
|
32
|
-
6: "专栏",
|
|
33
|
-
8: "大专栏",
|
|
34
|
-
5: "会员",
|
|
35
|
-
25: "训练营",
|
|
36
|
-
21: "实物商品",
|
|
37
|
-
29: "线下课", //体验课也是29
|
|
38
|
-
22: "分销商品",
|
|
39
|
-
12: "分销商品", //暂时不做
|
|
40
|
-
41: "有价优惠券",
|
|
41
|
-
45: "AI互动课",
|
|
42
|
-
23: "超级会员"
|
|
43
|
-
}
|
|
44
|
-
const MARKET_ACTIVITY_MAP = {
|
|
45
|
-
3: "限时折扣",
|
|
46
|
-
4: "好友助力",
|
|
47
|
-
5: "裂变海报",
|
|
48
|
-
6: "拼团",
|
|
49
|
-
7: "涨粉神器",
|
|
50
|
-
8: "秒杀",
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
Component({
|
|
54
|
-
behaviors: [computedBehavior],
|
|
55
|
-
properties: {
|
|
56
|
-
sensorReportParams: {
|
|
57
|
-
type: Object,
|
|
58
|
-
value: {}
|
|
59
|
-
},
|
|
60
|
-
aliveInfo: {
|
|
61
|
-
type: Object,
|
|
62
|
-
value: {
|
|
63
|
-
alive_id: 'l_61c2a4dae4b0ad9a9d6887dc',
|
|
64
|
-
alive_state: 2
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
ENV_NAME: {
|
|
68
|
-
type: String,
|
|
69
|
-
value: ""
|
|
70
|
-
},
|
|
71
|
-
showList: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
value: false,
|
|
74
|
-
observer(newVal) {
|
|
75
|
-
this.setData({
|
|
76
|
-
refreshing: newVal
|
|
77
|
-
})
|
|
78
|
-
console.log(newVal)
|
|
79
|
-
|
|
80
|
-
newVal && this.onLoad()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
break
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
this.
|
|
305
|
-
[
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (this.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
this.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
})
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
})
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Descripttion:
|
|
3
|
+
* @version:
|
|
4
|
+
* @Author: conlinchen
|
|
5
|
+
* @Date: 2021-10-28 15:32:24
|
|
6
|
+
* @LastEditors: conlinchen
|
|
7
|
+
* @LastEditTime: 2021-11-18 19:52:02
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { getGoodsList, requestChangeShow } from "../common/api/liveGoodsList"
|
|
11
|
+
const computedBehavior = require('miniprogram-computed').behavior
|
|
12
|
+
|
|
13
|
+
let activityCountdownTimer = null // 活动倒计时计时器
|
|
14
|
+
let hadActivity = false
|
|
15
|
+
let activityList = [] // 参与活动的商品
|
|
16
|
+
|
|
17
|
+
// 预热模块
|
|
18
|
+
let preheatTimer = null // 预热倒计时计时器
|
|
19
|
+
let hadPreheat = false
|
|
20
|
+
let preheatList = [] // 参与活动的商品
|
|
21
|
+
|
|
22
|
+
let hasActivity = false // 是否有参与活动的商品
|
|
23
|
+
let hasPreheat = false // 是否有参与预热的商品
|
|
24
|
+
|
|
25
|
+
const SPU_TYPE = {
|
|
26
|
+
1: "图文",
|
|
27
|
+
2: "音频",
|
|
28
|
+
3: "视频",
|
|
29
|
+
4: "直播",
|
|
30
|
+
35: "班课",
|
|
31
|
+
20: "电子书",
|
|
32
|
+
6: "专栏",
|
|
33
|
+
8: "大专栏",
|
|
34
|
+
5: "会员",
|
|
35
|
+
25: "训练营",
|
|
36
|
+
21: "实物商品",
|
|
37
|
+
29: "线下课", //体验课也是29
|
|
38
|
+
22: "分销商品",
|
|
39
|
+
12: "分销商品", //暂时不做
|
|
40
|
+
41: "有价优惠券",
|
|
41
|
+
45: "AI互动课",
|
|
42
|
+
23: "超级会员"
|
|
43
|
+
}
|
|
44
|
+
const MARKET_ACTIVITY_MAP = {
|
|
45
|
+
3: "限时折扣",
|
|
46
|
+
4: "好友助力",
|
|
47
|
+
5: "裂变海报",
|
|
48
|
+
6: "拼团",
|
|
49
|
+
7: "涨粉神器",
|
|
50
|
+
8: "秒杀",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Component({
|
|
54
|
+
behaviors: [computedBehavior],
|
|
55
|
+
properties: {
|
|
56
|
+
sensorReportParams: {
|
|
57
|
+
type: Object,
|
|
58
|
+
value: {}
|
|
59
|
+
},
|
|
60
|
+
aliveInfo: {
|
|
61
|
+
type: Object,
|
|
62
|
+
value: {
|
|
63
|
+
alive_id: 'l_61c2a4dae4b0ad9a9d6887dc',
|
|
64
|
+
alive_state: 2
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
ENV_NAME: {
|
|
68
|
+
type: String,
|
|
69
|
+
value: ""
|
|
70
|
+
},
|
|
71
|
+
showList: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
value: false,
|
|
74
|
+
observer(newVal) {
|
|
75
|
+
this.setData({
|
|
76
|
+
refreshing: newVal
|
|
77
|
+
})
|
|
78
|
+
console.log(newVal)
|
|
79
|
+
|
|
80
|
+
newVal && this.onLoad()
|
|
81
|
+
if(!newVal){
|
|
82
|
+
clearInterval(activityCountdownTimer)
|
|
83
|
+
activityCountdownTimer = null
|
|
84
|
+
clearInterval(preheatTimer)
|
|
85
|
+
preheatTimer = null
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
changState: {
|
|
90
|
+
type: Object,
|
|
91
|
+
value: {}
|
|
92
|
+
},
|
|
93
|
+
aliveConf: { //is_takegoods: 是否开启直播带货,0-关闭 1-开启
|
|
94
|
+
type: Object,
|
|
95
|
+
value: {}
|
|
96
|
+
},
|
|
97
|
+
isFullScreen: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
value: false,
|
|
100
|
+
},
|
|
101
|
+
// im实时同步的带货消息
|
|
102
|
+
msgGoodsData: {
|
|
103
|
+
type: Object,
|
|
104
|
+
value: {},
|
|
105
|
+
observer(newVal) {
|
|
106
|
+
this.handlerListInfo(newVal)
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
isManage: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
value: false,
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
data: {
|
|
115
|
+
goodsInfo: [],
|
|
116
|
+
page_size: 5,
|
|
117
|
+
page_index: 1,
|
|
118
|
+
total: 0,
|
|
119
|
+
refreshing: false,
|
|
120
|
+
finishedTxt: '加载中',
|
|
121
|
+
finished: false,
|
|
122
|
+
sendingIndex: -1,
|
|
123
|
+
sending: false,
|
|
124
|
+
selectGoods: [], // 多选列表
|
|
125
|
+
is_jurisdiction: false, // 操作权限
|
|
126
|
+
isSplitSelect: false, // 当前是否是单独勾选
|
|
127
|
+
selectGoodsIndexArr: [], // 当前已经选中的商品索引数组
|
|
128
|
+
is_show_now: 0, //当前已展示的数量
|
|
129
|
+
is_hide_now: 0, // 当前已隐藏的数量
|
|
130
|
+
isDisabled: false, // 复选框是否禁用
|
|
131
|
+
selectId: '', // 当前点击那一项的goodsId
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
lifetimes: {
|
|
135
|
+
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
136
|
+
attached: function () {
|
|
137
|
+
|
|
138
|
+
},
|
|
139
|
+
moved: function () { },
|
|
140
|
+
detached: function () { },
|
|
141
|
+
},
|
|
142
|
+
methods: {
|
|
143
|
+
// "sync_goods":{
|
|
144
|
+
// "switch":0,//开关:0关1开
|
|
145
|
+
// //带货配置列表-最多六条
|
|
146
|
+
// "conf_list":[],
|
|
147
|
+
// "update_list":[],
|
|
148
|
+
// //移除资源id
|
|
149
|
+
// "batch_del":["p_63845d8be4b07b05581ebf47"],
|
|
150
|
+
// //批量显示隐藏
|
|
151
|
+
// "batch_switch":[]
|
|
152
|
+
// }
|
|
153
|
+
/**
|
|
154
|
+
* 带货/优惠券实时同步
|
|
155
|
+
* @param {object} msgData im消息体
|
|
156
|
+
* @param {string} type 消息类型:带货goods、优惠券coupon
|
|
157
|
+
*/
|
|
158
|
+
handlerListInfo(msgData) {
|
|
159
|
+
let type = '',
|
|
160
|
+
marketInfo = []
|
|
161
|
+
// jer todo 还有im接受的相关逻辑需要补充
|
|
162
|
+
// 遍历获取操作类型
|
|
163
|
+
for (let key in msgData) {
|
|
164
|
+
switch (key) {
|
|
165
|
+
// 带货开关操作
|
|
166
|
+
case "switch":
|
|
167
|
+
type = "goodsSwitch";
|
|
168
|
+
marketInfo = Number(msgData[key]);
|
|
169
|
+
break;
|
|
170
|
+
// 新增操作
|
|
171
|
+
case 'conf_list':
|
|
172
|
+
type = 'goodsConfList'
|
|
173
|
+
marketInfo = msgData[key]
|
|
174
|
+
break
|
|
175
|
+
// 修改操作
|
|
176
|
+
case 'update_list':
|
|
177
|
+
type = 'goodsUpdateList'
|
|
178
|
+
marketInfo = msgData[key]
|
|
179
|
+
break
|
|
180
|
+
// 删除操作
|
|
181
|
+
case 'batch_del':
|
|
182
|
+
type = 'goodsDelList'
|
|
183
|
+
marketInfo = msgData[key]
|
|
184
|
+
break
|
|
185
|
+
// jer todo 可能字段需要更改
|
|
186
|
+
// 显隐操作
|
|
187
|
+
case 'batch_switch':
|
|
188
|
+
type = 'goodsBatchSwitchList'
|
|
189
|
+
marketInfo = msgData[key]
|
|
190
|
+
break
|
|
191
|
+
default:
|
|
192
|
+
break
|
|
193
|
+
}
|
|
194
|
+
console.log('jer=========', type, marketInfo)
|
|
195
|
+
if (marketInfo?.length > 0) {
|
|
196
|
+
this.changeGoodsList(type, marketInfo)
|
|
197
|
+
type = ''
|
|
198
|
+
marketInfo = []
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
// 处理实时同步的带货逻辑
|
|
203
|
+
changeGoodsList(type, marketInfo) {
|
|
204
|
+
let goodsInfo = this.data.goodsInfo,
|
|
205
|
+
delIndex = -1, // 删除数据的当前下标
|
|
206
|
+
selectGoods = this.data.selectGoods, // 批量隐藏数组id
|
|
207
|
+
selectGoodsIndexArr = this.data.selectGoodsIndexArr, // 批量隐藏数组索引
|
|
208
|
+
total = this.data.total, // 管理商品总数
|
|
209
|
+
isHasGoods = false // 是否已有这个商品
|
|
210
|
+
switch (type) {
|
|
211
|
+
// 带货和优惠券开关操作
|
|
212
|
+
case "goodsSwitch":
|
|
213
|
+
if (!marketInfo) {
|
|
214
|
+
this.triggerEvent("closePopup")
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case 'goodsConfList':
|
|
218
|
+
// 如果已经加载完了,可以拼接数据
|
|
219
|
+
// 由于看不出为何触发了两次,做id过滤
|
|
220
|
+
if (this.data.finished) {
|
|
221
|
+
marketInfo.map((item) => {
|
|
222
|
+
for (let index = 0; index < goodsInfo.length; index++) {
|
|
223
|
+
if (item.id === goodsInfo[index].id) {
|
|
224
|
+
isHasGoods = true;
|
|
225
|
+
break
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (!isHasGoods) {
|
|
229
|
+
// 管理商品需要增加
|
|
230
|
+
total += marketInfo.length
|
|
231
|
+
this.formatData([item]);
|
|
232
|
+
}
|
|
233
|
+
isHasGoods = false;
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
break
|
|
237
|
+
case 'goodsUpdateList':
|
|
238
|
+
case 'goodsBatchSwitchList':
|
|
239
|
+
marketInfo.map((item) => {
|
|
240
|
+
for (let index = 0; index < goodsInfo.length; index++) {
|
|
241
|
+
if (item.id === goodsInfo[index].id) {
|
|
242
|
+
// 遍历插入相应的修改值
|
|
243
|
+
for (let key in item) {
|
|
244
|
+
goodsInfo[index][key] = item[key]
|
|
245
|
+
}
|
|
246
|
+
break
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
this.formatData(goodsInfo, true);
|
|
251
|
+
break
|
|
252
|
+
case 'goodsDelList':
|
|
253
|
+
marketInfo.map((id) => {
|
|
254
|
+
for (let index = 0; index < goodsInfo.length; index++) {
|
|
255
|
+
if (id === goodsInfo[index].id) {
|
|
256
|
+
// 删除操作,获取下标
|
|
257
|
+
goodsInfo.splice(index, 1)
|
|
258
|
+
delIndex = index
|
|
259
|
+
index--
|
|
260
|
+
}
|
|
261
|
+
// 删除后,后面的数据都要权重+1显示
|
|
262
|
+
if (delIndex > -1 && index >= delIndex) {
|
|
263
|
+
goodsInfo[index].order_weight--
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// 重置删除下标
|
|
267
|
+
delIndex = -1
|
|
268
|
+
|
|
269
|
+
// 此处处理批量显隐的,删掉了,需要把选择的也删掉
|
|
270
|
+
if (selectGoodsIndexArr.length > 0) {
|
|
271
|
+
for (let index = 0; index < selectGoodsIndexArr.length; index++) {
|
|
272
|
+
if (id === selectGoodsIndexArr[index]) {
|
|
273
|
+
console.log("jer==========???删了几次?", id, selectGoodsIndexArr[index]);
|
|
274
|
+
// 删除操作,获取下标
|
|
275
|
+
selectGoodsIndexArr.splice(index, 1)
|
|
276
|
+
selectGoods.splice(index, 1)
|
|
277
|
+
index--
|
|
278
|
+
// 管理商品需要减少
|
|
279
|
+
total--
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
this.formatData(goodsInfo, true);
|
|
285
|
+
break
|
|
286
|
+
default:
|
|
287
|
+
break
|
|
288
|
+
}
|
|
289
|
+
this.setData({
|
|
290
|
+
total,
|
|
291
|
+
selectGoods,
|
|
292
|
+
selectGoodsIndexArr,
|
|
293
|
+
})
|
|
294
|
+
},
|
|
295
|
+
// 管理商品多选
|
|
296
|
+
onChange(e){
|
|
297
|
+
// this.setData({
|
|
298
|
+
// selectGoods:e.detail
|
|
299
|
+
// })
|
|
300
|
+
console.log("sage-------onchange",e.detail);
|
|
301
|
+
let tempGoodsArr = []
|
|
302
|
+
e.detail.forEach((item) => {
|
|
303
|
+
for (let index = 0; index < this.data.goodsInfo.length; index++) {
|
|
304
|
+
if (item === this.data.goodsInfo[index].id) {
|
|
305
|
+
tempGoodsArr.push(this.data.goodsInfo[index])
|
|
306
|
+
break
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
this.setData({
|
|
311
|
+
selectGoods: tempGoodsArr,
|
|
312
|
+
selectGoodsIndexArr: e.detail,
|
|
313
|
+
})
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
// 显示隐藏
|
|
317
|
+
// 商品显隐操作
|
|
318
|
+
changeShowType(e) {
|
|
319
|
+
let { type } = e.target.dataset
|
|
320
|
+
// 未选择商品
|
|
321
|
+
if (!this.data.selectGoods.length) {
|
|
322
|
+
this.showToast('请先选择商品')
|
|
323
|
+
return
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 商品是否已是对应的显隐状态
|
|
327
|
+
this.data.selectGoods.forEach((item) => {
|
|
328
|
+
if (item.is_display_package && type === 'show') {
|
|
329
|
+
this.setData({
|
|
330
|
+
is_show_now: this.data.is_show_now + 1,
|
|
331
|
+
})
|
|
332
|
+
} else if (!item.is_display_package && type === 'hide') {
|
|
333
|
+
this.setData({
|
|
334
|
+
is_hide_now: this.data.is_hide_now + 1,
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
if (type === 'show') {
|
|
339
|
+
if (this.data.is_show_now === this.data.selectGoods.length) {
|
|
340
|
+
this.showToast('当前选择的商品已显示')
|
|
341
|
+
this.setData({
|
|
342
|
+
is_show_now: 0,
|
|
343
|
+
})
|
|
344
|
+
return
|
|
345
|
+
} else {
|
|
346
|
+
this.requestChangeShow(1)
|
|
347
|
+
return
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// 隐藏商品确认弹窗
|
|
352
|
+
if (type === 'hide') {
|
|
353
|
+
console.log("sage----hide",this.data.is_hide_now,this.data.selectGoods);
|
|
354
|
+
if (this.data.is_hide_now === this.data.selectGoods.length) {
|
|
355
|
+
this.showToast('当前选择的商品已隐藏')
|
|
356
|
+
this.setData({
|
|
357
|
+
is_hide_now: 0,
|
|
358
|
+
})
|
|
359
|
+
return
|
|
360
|
+
} else {
|
|
361
|
+
wx.showModal({
|
|
362
|
+
title: `确认隐藏${
|
|
363
|
+
this.data.is_hide_now
|
|
364
|
+
? this.data.selectGoods.length - this.data.is_hide_now
|
|
365
|
+
: this.data.selectGoods.length
|
|
366
|
+
}个商品吗`,
|
|
367
|
+
content: '用户端商品列表不展示已隐藏商品,讲师仍可通过讲解发送商品',
|
|
368
|
+
confirmText: '确认',
|
|
369
|
+
cancelText: '取消',
|
|
370
|
+
confirmColor: '#1472FF',
|
|
371
|
+
success: (res) => {
|
|
372
|
+
if (res.confirm) {
|
|
373
|
+
this.requestChangeShow(0)
|
|
374
|
+
} else if (res.cancel) {
|
|
375
|
+
this.setData({
|
|
376
|
+
is_hide_now: 0,
|
|
377
|
+
})
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
})
|
|
381
|
+
return
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 显示
|
|
386
|
+
this.requestChangeShow(1)
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
// 商品显隐请求
|
|
390
|
+
requestChangeShow(state) {
|
|
391
|
+
const tempSelectGoodsArr = this.data.selectGoods.map((item) => ({
|
|
392
|
+
id: item.id,
|
|
393
|
+
type: item.resource_type,
|
|
394
|
+
}))
|
|
395
|
+
let params = {
|
|
396
|
+
alive_id: this.data.aliveInfo.alive_id,
|
|
397
|
+
app_id: this.data.aliveInfo.app_id,
|
|
398
|
+
resource_ids: tempSelectGoodsArr,
|
|
399
|
+
is_display_package: state,
|
|
400
|
+
}
|
|
401
|
+
console.log('sage----调用接口传参数', tempSelectGoodsArr, params)
|
|
402
|
+
|
|
403
|
+
requestChangeShow(params,false,{isNeedToken: true}).then((res) => {
|
|
404
|
+
let { code } = res.data
|
|
405
|
+
if (code === 0) {
|
|
406
|
+
// let temp = `marketResource.courseList[${this.data.selectIndex}].is_display_package`
|
|
407
|
+
// 操作成功之后,要把当前选中的商品改变状态
|
|
408
|
+
let temp = ''
|
|
409
|
+
this.data.selectGoodsIndexArr.forEach((item) => {
|
|
410
|
+
for (let index = 0; index < this.data.goodsInfo.length; index++) {
|
|
411
|
+
if (item === this.data.goodsInfo[index].id) {
|
|
412
|
+
temp = `goodsInfo[${index}].is_display_package`
|
|
413
|
+
break
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
this.setData({
|
|
417
|
+
[temp]: state,
|
|
418
|
+
})
|
|
419
|
+
})
|
|
420
|
+
this.setData({
|
|
421
|
+
selectGoodsIndexArr: [],
|
|
422
|
+
selectGoods: [],
|
|
423
|
+
is_hide_now: 0,
|
|
424
|
+
is_show_now: 0,
|
|
425
|
+
})
|
|
426
|
+
this.showToast('操作成功')
|
|
427
|
+
} else {
|
|
428
|
+
this.setData({
|
|
429
|
+
is_hide_now: 0,
|
|
430
|
+
is_show_now: 0,
|
|
431
|
+
})
|
|
432
|
+
this.showToast('操作失败')
|
|
433
|
+
}
|
|
434
|
+
})
|
|
435
|
+
},
|
|
436
|
+
|
|
437
|
+
// 商品总活动倒计时
|
|
438
|
+
startActivityCountdown(list) {
|
|
439
|
+
|
|
440
|
+
clearInterval(activityCountdownTimer)
|
|
441
|
+
activityCountdownTimer = setInterval(() => {
|
|
442
|
+
hadActivity = false
|
|
443
|
+
list.forEach((i) => {
|
|
444
|
+
let targetDate = new Date(i.time.replace(/-/g, '/')).getTime() - new Date().getTime()
|
|
445
|
+
if (targetDate <= 0) return
|
|
446
|
+
hadActivity = true
|
|
447
|
+
let temp = `goodsInfo[${i.index}].activityCountdown`
|
|
448
|
+
this.setData({
|
|
449
|
+
[temp]: targetDate,
|
|
450
|
+
})
|
|
451
|
+
})
|
|
452
|
+
if (!hadActivity) {
|
|
453
|
+
clearInterval(activityCountdownTimer)
|
|
454
|
+
activityCountdownTimer = null
|
|
455
|
+
}
|
|
456
|
+
}, 1000)
|
|
457
|
+
},
|
|
458
|
+
// 预热倒计时
|
|
459
|
+
startPreheatCountdown(list) {
|
|
460
|
+
clearInterval(preheatTimer)
|
|
461
|
+
preheatTimer = setInterval(() => {
|
|
462
|
+
hadPreheat = false
|
|
463
|
+
list.forEach((i) => {
|
|
464
|
+
let targetDate = new Date(i.time.replace(/-/g, '/')).getTime() - new Date().getTime()
|
|
465
|
+
if (targetDate <= 0) {
|
|
466
|
+
activityList.push({
|
|
467
|
+
time: this.data.goodsInfo[i.index].end_at,
|
|
468
|
+
index: i.index,
|
|
469
|
+
})
|
|
470
|
+
this.setData({
|
|
471
|
+
[`goodsInfo[${i.index}].preheatTime`]: 0,
|
|
472
|
+
})
|
|
473
|
+
return
|
|
474
|
+
}
|
|
475
|
+
hadPreheat = true
|
|
476
|
+
let temp = `goodsInfo[${i.index}].preheatTime`
|
|
477
|
+
this.setData({
|
|
478
|
+
[temp]: targetDate,
|
|
479
|
+
})
|
|
480
|
+
})
|
|
481
|
+
if (!hadPreheat) {
|
|
482
|
+
clearInterval(preheatTimer)
|
|
483
|
+
preheatTimer = null
|
|
484
|
+
}
|
|
485
|
+
}, 1000)
|
|
486
|
+
},
|
|
487
|
+
onLoad() {
|
|
488
|
+
if (!this.data.aliveConf.is_takegoods) {
|
|
489
|
+
this.setData({
|
|
490
|
+
refreshing: false
|
|
491
|
+
})
|
|
492
|
+
return
|
|
493
|
+
}
|
|
494
|
+
if (this._freshing) return
|
|
495
|
+
this._freshing = true
|
|
496
|
+
this.setData({
|
|
497
|
+
finished: false,
|
|
498
|
+
page_index: 1
|
|
499
|
+
})
|
|
500
|
+
this.getGoodsList()
|
|
501
|
+
},
|
|
502
|
+
onScrolltolower() {
|
|
503
|
+
if (this.scrolling || this.data.finishedTxt === 'no-data' || !this.data.aliveConf.is_takegoods) { return }
|
|
504
|
+
this.scrolling = true
|
|
505
|
+
this.setData({
|
|
506
|
+
finishedTxt: this.data.finished ? "没有更多了" : "加载中"
|
|
507
|
+
})
|
|
508
|
+
if (this.data.finished || this._freshing) {
|
|
509
|
+
return
|
|
510
|
+
}
|
|
511
|
+
this.getGoodsList()
|
|
512
|
+
},
|
|
513
|
+
getGoodsList() {
|
|
514
|
+
let params = {
|
|
515
|
+
alive_id: this.data.aliveInfo.alive_id,
|
|
516
|
+
type: 1,
|
|
517
|
+
page_size: this.data.page_size,
|
|
518
|
+
page: this.data.page_index,
|
|
519
|
+
port: 2
|
|
520
|
+
}
|
|
521
|
+
getGoodsList(params).then(res => {
|
|
522
|
+
let { data, code } = res.data
|
|
523
|
+
if (code === 0) {
|
|
524
|
+
var total = data[0] ? data[0].total : this.data.total
|
|
525
|
+
var finishedTxt = "加载中"
|
|
526
|
+
var finished = false
|
|
527
|
+
let is_jurisdiction = data[0] ? data[0].teacher_auth == 2 : false
|
|
528
|
+
|
|
529
|
+
if (this._freshing) {
|
|
530
|
+
//下拉加载直接赋值
|
|
531
|
+
this.formatData(data, true)
|
|
532
|
+
} else {
|
|
533
|
+
this.formatData(data)
|
|
534
|
+
}
|
|
535
|
+
// 下拉加载,且数据返回空
|
|
536
|
+
if (this._freshing && data.length === 0) {
|
|
537
|
+
finishedTxt = "no-data"
|
|
538
|
+
} else if (this.data.goodsInfo.length >= total || data.length === 0) {
|
|
539
|
+
// 获取到所有数据
|
|
540
|
+
finished = true// 没有更多了
|
|
541
|
+
finishedTxt = "没有更多了"
|
|
542
|
+
this.setData({ finishedTxt })
|
|
543
|
+
} else {
|
|
544
|
+
finishedTxt = "加载中"
|
|
545
|
+
}
|
|
546
|
+
this.setData({
|
|
547
|
+
refreshing: false,
|
|
548
|
+
page_index: this.data.page_index + 1,
|
|
549
|
+
finishedTxt,
|
|
550
|
+
finished,
|
|
551
|
+
total,
|
|
552
|
+
is_jurisdiction
|
|
553
|
+
})
|
|
554
|
+
this._freshing = false
|
|
555
|
+
this.scrolling = false
|
|
556
|
+
}
|
|
557
|
+
})
|
|
558
|
+
},
|
|
559
|
+
formatData(data, refreshing = false) {
|
|
560
|
+
let goodsInfo = this.data.goodsInfo
|
|
561
|
+
data.forEach((item, index) => {
|
|
562
|
+
this.formatItem(item)
|
|
563
|
+
if (!refreshing) {
|
|
564
|
+
goodsInfo.push(item)
|
|
565
|
+
}
|
|
566
|
+
})
|
|
567
|
+
if (refreshing) {
|
|
568
|
+
//下拉刷新的时候直接赋值
|
|
569
|
+
goodsInfo = JSON.parse(JSON.stringify(data))
|
|
570
|
+
}
|
|
571
|
+
this.setData({
|
|
572
|
+
goodsInfo
|
|
573
|
+
},()=>{
|
|
574
|
+
this.getActivityStatus(this.data.goodsInfo)
|
|
575
|
+
})
|
|
576
|
+
},
|
|
577
|
+
getActivityStatus(data){
|
|
578
|
+
activityList = []
|
|
579
|
+
preheatList = []
|
|
580
|
+
data.forEach((item, index) => {
|
|
581
|
+
if (item.is_activity && item.end_at) {
|
|
582
|
+
hasActivity = true
|
|
583
|
+
item.activityCountdown = 0
|
|
584
|
+
activityList.push({
|
|
585
|
+
time: item.end_at,
|
|
586
|
+
index,
|
|
587
|
+
})
|
|
588
|
+
}
|
|
589
|
+
// this.data.isSeckill && this.data.preheating
|
|
590
|
+
if (item.activity_type === 8 && item.sec_kill_is_preheat === 1) {
|
|
591
|
+
//预热开始时间
|
|
592
|
+
let startTime = (item.start_at && new Date(item.start_at.replace(/-/g, '/'))) || new Date()
|
|
593
|
+
let times = startTime.getTime() - item.sec_kill_preheat_time * 1000
|
|
594
|
+
let preHeatTime = new Date(times) || new Date()
|
|
595
|
+
|
|
596
|
+
let startTime2 = (item.start_at && new Date(item.start_at.replace(/-/g, '/'))) || new Date()
|
|
597
|
+
let nowTime = new Date().getTime()
|
|
598
|
+
let preheating = nowTime > preHeatTime.getTime() && startTime2.getTime() > nowTime
|
|
599
|
+
|
|
600
|
+
if (preheating) {
|
|
601
|
+
hasPreheat = true
|
|
602
|
+
item.preheatTime = 0
|
|
603
|
+
preheatList.push({
|
|
604
|
+
time: item.start_at,
|
|
605
|
+
index,
|
|
606
|
+
})
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
})
|
|
610
|
+
if (hasActivity) this.startActivityCountdown(activityList) //活动倒计时
|
|
611
|
+
if (hasPreheat) this.startPreheatCountdown(preheatList) // 预热倒计时
|
|
612
|
+
},
|
|
613
|
+
formatItem(e) {
|
|
614
|
+
e.resourceTypeName = e.resource_type_name // 商品类型
|
|
615
|
+
e.leftStock = e.is_activity && e.now_stock ? e.now_stock : e.stock // 商品库存,活动中且有活动库存就用活动库存
|
|
616
|
+
// 处理未到活动时间的限时折扣
|
|
617
|
+
if (e.activity_type === 3) {
|
|
618
|
+
let nowTime = new Date().getTime()
|
|
619
|
+
let startTime = new Date(e.start_at.replace(/-/g, "/")).getTime()
|
|
620
|
+
let isStart = !!(nowTime - startTime > 0)
|
|
621
|
+
if (!isStart) {
|
|
622
|
+
e.is_activity = 0 // 未到活动时间的限时折扣 不参与比价
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
// 预热前和活动结束后的秒杀不参与比价
|
|
626
|
+
if (e.activity_type === 8) {
|
|
627
|
+
let startTime = new Date(e.start_at.replace(/-/g, "/")).getTime()
|
|
628
|
+
let preHeatTime = startTime - e.sec_kill_preheat_time * 1000 // 预热开始时间
|
|
629
|
+
let nowTime = new Date().getTime()
|
|
630
|
+
let isStartPreHeat = !!(nowTime - preHeatTime > 0) // 预热时间到了
|
|
631
|
+
let endTime = new Date(e.end_at.replace(/-/g, "/")).getTime()
|
|
632
|
+
let isEndSecKill = !!(nowTime - endTime > 0) // 秒杀活动结束了
|
|
633
|
+
if (!isStartPreHeat || isEndSecKill) {
|
|
634
|
+
e.is_activity = 0 // 预热前和活动结束后的秒杀 不参与比价
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
//展示购买价处理;取原价、营销活动价、超级会员价到一个数组从小到大排序,最低为购买价。防止价格一样,所以加了权重比较
|
|
638
|
+
let arr = []
|
|
639
|
+
arr.push({
|
|
640
|
+
active: "",
|
|
641
|
+
price: e.price,
|
|
642
|
+
weight: e.price + 0.0003,
|
|
643
|
+
})
|
|
644
|
+
// 活动管理、实物商品、有价优惠券、线下课和课时包不能设置活动库存,其他可以设置活动库存得需要判断是否还剩余活动库存;拼团也不能设置活动库存。
|
|
645
|
+
let notExistNowStock = [9, 21, 41, 29, 42].indexOf(e.resource_type) > -1
|
|
646
|
+
e.is_activity &&
|
|
647
|
+
(notExistNowStock ||
|
|
648
|
+
typeof e.now_stock === "number" ||
|
|
649
|
+
e.activity_type === 6) &&
|
|
650
|
+
arr.push({
|
|
651
|
+
//参与营销活动且有活动库存的时候加入比较 now_stock -""空字符串的时候代表已经买完 -0代表不限量
|
|
652
|
+
active: MARKET_ACTIVITY_MAP[e.activity_type],
|
|
653
|
+
price: e.activity_price,
|
|
654
|
+
weight: e.activity_price + 0.0001,
|
|
655
|
+
})
|
|
656
|
+
e.svip_price &&
|
|
657
|
+
arr.push({
|
|
658
|
+
//判断超级会员价
|
|
659
|
+
active: "超级会员",
|
|
660
|
+
price: e.svip_price,
|
|
661
|
+
weight: e.svip_price + 0.0002,
|
|
662
|
+
})
|
|
663
|
+
arr.sort((a, b) => a.weight - b.weight)
|
|
664
|
+
let svipAllFree = e.resource_rights_type === 1
|
|
665
|
+
e.priceShow = arr[0].price //展示的购买价格
|
|
666
|
+
e.priceShowInt = svipAllFree ? this.priceInt(e.price) : this.priceInt(e.priceShow) // 展示价格的整数部分
|
|
667
|
+
e.priceShowFlow = svipAllFree ? this.priceFlow(e.price) : this.priceFlow(e.priceShow) // 展示是价格的小数部分
|
|
668
|
+
e.preferentialShowInt = this.priceInt(e.preferential_price) // 展示券后价的整数部分
|
|
669
|
+
e.preferentialShowFlow = this.priceFlow(e.preferential_price) // 展示券后价的小数部分
|
|
670
|
+
e.currentActive = arr[0].active //当前适用得营销模式;有可能是原价,超级会员,营销活动
|
|
671
|
+
//展示划线价处理;有营销活动、超级会员,划线价是原价;只有原价和原划线价,划线价是原划线价;
|
|
672
|
+
if (e.currentActive !== "") {
|
|
673
|
+
e.priceLine = e.price
|
|
674
|
+
} else {
|
|
675
|
+
e.priceLine = e.line_price || 0 //未设置原划线价的时候不展示划线价
|
|
676
|
+
}
|
|
677
|
+
e.priceLineShowInt = this.priceInt(e.priceLine) // 展示划线价的整数部分
|
|
678
|
+
e.priceLineShowFlow = this.priceFlow(e.priceLine) // 展示划线的小数部分
|
|
679
|
+
e.entityShowStock = (e.resource_type === 21 || e.resource_type === 41 || e.resource_type === 68) && e.show_stock // 实物商品库存依赖 B端店铺设置(show_stock):详情页展示不展示剩余件数
|
|
680
|
+
e.hasStock = [29, 35].indexOf(e.resource_type) > -1 || e.entityShowStock || e.now_stock // 班课、线下课、实物商品、体验课、有活动库存,满足其一即展示库存
|
|
681
|
+
},
|
|
682
|
+
priceInt(val) {
|
|
683
|
+
val = Number(val)
|
|
684
|
+
return ((val / 100).toFixed(2) + '').split('.')[0]
|
|
685
|
+
},
|
|
686
|
+
priceFlow(val) {
|
|
687
|
+
val = Number(val)
|
|
688
|
+
return ((val / 100).toFixed(2) + '').split('.')[1] || '00'
|
|
689
|
+
},
|
|
690
|
+
closePop() {
|
|
691
|
+
this.triggerEvent("closePop")
|
|
692
|
+
},
|
|
693
|
+
preventScroll() {
|
|
694
|
+
return
|
|
695
|
+
},
|
|
696
|
+
sendGoodsCard(e) {
|
|
697
|
+
console.log("npm", e)
|
|
698
|
+
let dataset = e.detail.datas;
|
|
699
|
+
this.setData({
|
|
700
|
+
sending: true,
|
|
701
|
+
sendingIndex: dataset['index']
|
|
702
|
+
})
|
|
703
|
+
// 触发父组件的send
|
|
704
|
+
this.triggerEvent('sendGoodsCard', {
|
|
705
|
+
datas: dataset
|
|
706
|
+
});
|
|
707
|
+
},
|
|
708
|
+
clear() {
|
|
709
|
+
this.setData({
|
|
710
|
+
goodsInfo: [],
|
|
711
|
+
finishedTxt: "no-data"
|
|
712
|
+
})
|
|
713
|
+
},
|
|
714
|
+
setIsTakeGoods(value) {
|
|
715
|
+
this.setData({
|
|
716
|
+
["aliveConf.is_takegoods"]: value
|
|
717
|
+
})
|
|
718
|
+
},
|
|
719
|
+
deleteGood(id) {
|
|
720
|
+
let deleteGoodIndex;
|
|
721
|
+
if(!this.data.goodsInfo) return;
|
|
722
|
+
this.data.goodsInfo.forEach((goods, index) => {
|
|
723
|
+
if(goods.id === id) {
|
|
724
|
+
deleteGoodIndex = index;
|
|
725
|
+
}
|
|
726
|
+
})
|
|
727
|
+
deleteGoodIndex !== undefined && this.data.goodsInfo.splice(deleteGoodIndex, 1)
|
|
728
|
+
this.setData({
|
|
729
|
+
goodsInfo: this.data.goodsInfo
|
|
730
|
+
})
|
|
731
|
+
},
|
|
732
|
+
selectToast(e) {
|
|
733
|
+
console.log("sage-----单选e",e);
|
|
734
|
+
let tempItemIndex = String(e.currentTarget.dataset.item)
|
|
735
|
+
this.setData({
|
|
736
|
+
selectId: this.data.goodsInfo[tempItemIndex].id
|
|
737
|
+
})
|
|
738
|
+
console.log("sage-----toast",this.data.selectId, this.data.selectGoodsIndexArr.length);
|
|
739
|
+
if (this.data.selectGoodsIndexArr.length >= 10 && this.data.selectGoodsIndexArr.indexOf(this.data.selectId) === -1) {
|
|
740
|
+
this.showToast('批量操作最多支持10条')
|
|
741
|
+
} else {
|
|
742
|
+
return
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
showToast(title = '') {
|
|
746
|
+
wx.showToast({
|
|
747
|
+
title,
|
|
748
|
+
icon: 'none',
|
|
749
|
+
duration: 1000,
|
|
750
|
+
})
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
observers: {
|
|
754
|
+
// 监听点击发送事件
|
|
755
|
+
"changState.time": function (newVal) {
|
|
756
|
+
// 处理成功回调,主要用于变更按钮发送状态
|
|
757
|
+
console.log('changState', newVal, this.properties.changState)
|
|
758
|
+
let state = this.properties.changState
|
|
759
|
+
if (state && state.index != -1) {
|
|
760
|
+
this.setData({
|
|
761
|
+
sending: false,
|
|
762
|
+
sendingIndex: state.index
|
|
763
|
+
})
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
"total": function(newVal){
|
|
767
|
+
this.triggerEvent("totalChange",newVal)
|
|
768
|
+
},
|
|
769
|
+
"isManage": function(newVal){
|
|
770
|
+
this.setData({
|
|
771
|
+
selectGoods: []
|
|
772
|
+
})
|
|
773
|
+
},
|
|
774
|
+
"is_jurisdiction": function(newVal){
|
|
775
|
+
this.triggerEvent("jurisdictionChange",newVal)
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
})
|