xiaoe_mp_npm 1.0.19-test01 → 1.0.20-test01
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/GoodsItem/index.js +1057 -1008
- package/miniprogram_dist/GoodsItem/index.json +6 -6
- package/miniprogram_dist/GoodsItem/index.scss +558 -548
- package/miniprogram_dist/GoodsItem/index.wxml +208 -201
- package/miniprogram_dist/GoodsItem/index.wxs +18 -18
- package/miniprogram_dist/GoodsItem/index.wxss +64 -41
- package/miniprogram_dist/LiveGoodsList/Header/index.js +54 -54
- package/miniprogram_dist/LiveGoodsList/Header/index.json +6 -6
- package/miniprogram_dist/LiveGoodsList/Header/index.less +45 -45
- package/miniprogram_dist/LiveGoodsList/Header/index.scss +105 -105
- package/miniprogram_dist/LiveGoodsList/Header/index.wxml +32 -32
- package/miniprogram_dist/LiveGoodsList/README.md +9 -9
- package/miniprogram_dist/LiveGoodsList/index.js +889 -875
- package/miniprogram_dist/LiveGoodsList/index.json +8 -8
- package/miniprogram_dist/LiveGoodsList/index.less +53 -53
- package/miniprogram_dist/LiveGoodsList/index.scss +92 -92
- package/miniprogram_dist/LiveGoodsList/index.wxml +103 -101
- package/package.json +1 -1
- package/src/GoodsItem/index.js +1057 -1008
- package/src/GoodsItem/index.json +6 -6
- package/src/GoodsItem/index.scss +558 -548
- package/src/GoodsItem/index.wxml +208 -201
- package/src/GoodsItem/index.wxs +18 -18
- package/src/GoodsItem/index.wxss +1 -2026
- package/src/LiveGoodsList/Header/index.js +54 -54
- package/src/LiveGoodsList/Header/index.json +6 -6
- package/src/LiveGoodsList/Header/index.less +45 -45
- package/src/LiveGoodsList/Header/index.scss +105 -105
- package/src/LiveGoodsList/Header/index.wxml +32 -32
- package/src/LiveGoodsList/README.md +9 -9
- package/src/LiveGoodsList/index.js +889 -875
- package/src/LiveGoodsList/index.json +8 -8
- package/src/LiveGoodsList/index.less +53 -53
- package/src/LiveGoodsList/index.scss +92 -92
- package/src/LiveGoodsList/index.wxml +103 -101
- package/src/LiveGoodsList/index.wxss +218 -218
|
@@ -1,1008 +1,1057 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Descripttion:
|
|
3
|
-
* @version:
|
|
4
|
-
* @Author: conlinchen
|
|
5
|
-
* @Date: 2021-10-28 18:17:48
|
|
6
|
-
* @LastEditors: conlinchen
|
|
7
|
-
* @LastEditTime: 2021-11-18 19:49:11
|
|
8
|
-
*/
|
|
9
|
-
import { debounce, rpxToVmin } from "../common/utils/index"
|
|
10
|
-
import {
|
|
11
|
-
getUserPermission,
|
|
12
|
-
getUserPermissionNew,
|
|
13
|
-
snapCheck,
|
|
14
|
-
snapCheckNew,
|
|
15
|
-
showGoods,
|
|
16
|
-
requestChangeShow,
|
|
17
|
-
setGoodsSellOut,
|
|
18
|
-
getGoodValue
|
|
19
|
-
} from "../common/api/liveGoodsList"
|
|
20
|
-
import {
|
|
21
|
-
ASSOCIATION,
|
|
22
|
-
PUNCH_CARD
|
|
23
|
-
} from "../common/utils/constants.js";
|
|
24
|
-
|
|
25
|
-
const { utils, sensorLog } = require("live-mp-tools");
|
|
26
|
-
|
|
27
|
-
const computedBehavior = require('miniprogram-computed').behavior
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
type:
|
|
149
|
-
value:
|
|
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
|
-
},
|
|
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
|
-
if (
|
|
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
|
-
return
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
return data.
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
-
this.showToast(
|
|
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
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
},
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
},
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
})
|
|
746
|
-
}
|
|
747
|
-
},
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
let
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
},
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
const {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
if (
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1
|
+
/*
|
|
2
|
+
* @Descripttion:
|
|
3
|
+
* @version:
|
|
4
|
+
* @Author: conlinchen
|
|
5
|
+
* @Date: 2021-10-28 18:17:48
|
|
6
|
+
* @LastEditors: conlinchen
|
|
7
|
+
* @LastEditTime: 2021-11-18 19:49:11
|
|
8
|
+
*/
|
|
9
|
+
import { debounce, rpxToVmin } from "../common/utils/index"
|
|
10
|
+
import {
|
|
11
|
+
getUserPermission,
|
|
12
|
+
getUserPermissionNew,
|
|
13
|
+
snapCheck,
|
|
14
|
+
snapCheckNew,
|
|
15
|
+
showGoods,
|
|
16
|
+
requestChangeShow,
|
|
17
|
+
setGoodsSellOut,
|
|
18
|
+
getGoodValue
|
|
19
|
+
} from "../common/api/liveGoodsList"
|
|
20
|
+
import {
|
|
21
|
+
ASSOCIATION,
|
|
22
|
+
PUNCH_CARD
|
|
23
|
+
} from "../common/utils/constants.js";
|
|
24
|
+
|
|
25
|
+
const { utils, sensorLog } = require("live-mp-tools");
|
|
26
|
+
|
|
27
|
+
const computedBehavior = require('miniprogram-computed').behavior
|
|
28
|
+
|
|
29
|
+
const formatNum = (num) => {
|
|
30
|
+
if (!num || isNaN(num)) return num
|
|
31
|
+
|
|
32
|
+
num = Number(num)
|
|
33
|
+
const isDecimals = (num) => {
|
|
34
|
+
num = num.toString()
|
|
35
|
+
if(num.split('.')[1] != '00'){
|
|
36
|
+
return true
|
|
37
|
+
}else{
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (Math.abs(num) >= 100000000) {
|
|
43
|
+
num = num / 100000000
|
|
44
|
+
return isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '亿' : num + '亿'
|
|
45
|
+
} else if (Math.abs(num) >= 10000) {
|
|
46
|
+
num = num / 10000
|
|
47
|
+
return isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '万' : num + '万'
|
|
48
|
+
} else {
|
|
49
|
+
return num
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Component({
|
|
54
|
+
behaviors: [computedBehavior],
|
|
55
|
+
options: {
|
|
56
|
+
addGlobalClass: true,
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* 组件的属性列表
|
|
60
|
+
*/
|
|
61
|
+
properties: {
|
|
62
|
+
goodsInfo: {
|
|
63
|
+
type: Object,
|
|
64
|
+
value: {},
|
|
65
|
+
observer(newVal) {
|
|
66
|
+
// 商品没有的话,不处理
|
|
67
|
+
if (!newVal.id) return
|
|
68
|
+
//超级会员全免权益
|
|
69
|
+
let svipAllFree = newVal.resource_rights_type === 1
|
|
70
|
+
let currentActive = ''
|
|
71
|
+
if (svipAllFree) {
|
|
72
|
+
currentActive = '超级会员'
|
|
73
|
+
} else {
|
|
74
|
+
currentActive = newVal.currentActive
|
|
75
|
+
}
|
|
76
|
+
//IOS小程序端 ios小程序商品列表 直播、线下课、班课、实物商品可买,其他知识商品不可买,需不显示价格 点击去抢购后按现网逻辑跳转至小程序的商品详情
|
|
77
|
+
let info = wx.getSystemInfoSync()
|
|
78
|
+
let IOSMiniProgramCanBuy = [4, 29, 35, 21, 69].indexOf(newVal.resource_type) > -1 //true-能买 false-不能买
|
|
79
|
+
let isIOS = info.platform === 'ios'
|
|
80
|
+
console.log("platform", info.platform, isIOS)
|
|
81
|
+
const pages = getCurrentPages();
|
|
82
|
+
const currentPage = pages[pages.length - 1];
|
|
83
|
+
const url = `/${currentPage.route}`;
|
|
84
|
+
//预热开始时间
|
|
85
|
+
let startTime = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
86
|
+
let time = startTime.getTime() - newVal.sec_kill_preheat_time * 1000
|
|
87
|
+
let preHeatTime = new Date(time) || new Date()
|
|
88
|
+
|
|
89
|
+
let hasPreheat = newVal.sec_kill_is_preheat === 1
|
|
90
|
+
|
|
91
|
+
let startTime2 = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
92
|
+
let nowTime = new Date().getTime()
|
|
93
|
+
let preheating = hasPreheat && nowTime > preHeatTime.getTime() && startTime2.getTime() > nowTime
|
|
94
|
+
let isSeckill = currentActive === '秒杀'
|
|
95
|
+
let checked = newVal.is_display_package === 1
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
this.setData({
|
|
99
|
+
goodsItem: newVal,
|
|
100
|
+
currentActive,
|
|
101
|
+
IOSMiniProgramCanBuy,
|
|
102
|
+
isIOS,
|
|
103
|
+
page_path: url,
|
|
104
|
+
preHeatTime,
|
|
105
|
+
preheating,
|
|
106
|
+
isSeckill,
|
|
107
|
+
checked
|
|
108
|
+
}, () => {
|
|
109
|
+
const isSoldOut = +newVal.is_sell_out === 1;
|
|
110
|
+
const isRealOver = newVal.stock === 0 ||
|
|
111
|
+
(newVal.is_activity &&
|
|
112
|
+
(newVal.activity_type === 8 || newVal.activity_type === 3) &&
|
|
113
|
+
newVal.activity_stock - newVal.activity_order_num === 0);
|
|
114
|
+
const isOver = isSoldOut || isRealOver;
|
|
115
|
+
|
|
116
|
+
this.setData({
|
|
117
|
+
isOver,
|
|
118
|
+
isSoldOut,
|
|
119
|
+
isRealOver,
|
|
120
|
+
})
|
|
121
|
+
this.countTime()
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
sending: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
value: false
|
|
128
|
+
},
|
|
129
|
+
explainingGoods: {
|
|
130
|
+
type: Object,
|
|
131
|
+
value: {}
|
|
132
|
+
},
|
|
133
|
+
isInElive: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
value: false
|
|
136
|
+
},
|
|
137
|
+
aliveInfo: {
|
|
138
|
+
type: Object,
|
|
139
|
+
value: {},
|
|
140
|
+
},
|
|
141
|
+
// 是否去客服内支付
|
|
142
|
+
allContactPay: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
value: false
|
|
145
|
+
},
|
|
146
|
+
//店铺设置是否展示券后价
|
|
147
|
+
coupon_switch: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
value: false
|
|
150
|
+
},
|
|
151
|
+
envName: {
|
|
152
|
+
type: String,
|
|
153
|
+
value: ""
|
|
154
|
+
},
|
|
155
|
+
sensorReportParams: {
|
|
156
|
+
type: Object,
|
|
157
|
+
value: {}
|
|
158
|
+
},
|
|
159
|
+
current_role: {
|
|
160
|
+
type: String,
|
|
161
|
+
value: 'student'
|
|
162
|
+
},
|
|
163
|
+
isFullScreen: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
value: false
|
|
166
|
+
},
|
|
167
|
+
style: {
|
|
168
|
+
type: String,
|
|
169
|
+
value: ''
|
|
170
|
+
},
|
|
171
|
+
index: {
|
|
172
|
+
type: Number,
|
|
173
|
+
value: -1
|
|
174
|
+
},
|
|
175
|
+
// 是否是新带货接口灰度
|
|
176
|
+
isGrayMarketing: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
value: false
|
|
179
|
+
},
|
|
180
|
+
isManage: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
value: false
|
|
183
|
+
},
|
|
184
|
+
visibleSwitchStatusBtn: {
|
|
185
|
+
type: Boolean,
|
|
186
|
+
value: false
|
|
187
|
+
},
|
|
188
|
+
sendingGoodId: {
|
|
189
|
+
type: String,
|
|
190
|
+
value: '',
|
|
191
|
+
},
|
|
192
|
+
// 是否展示库存
|
|
193
|
+
stockSwitch: {
|
|
194
|
+
type: Number,
|
|
195
|
+
value: 0
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
lifetimes: {
|
|
200
|
+
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
201
|
+
attached: function () {
|
|
202
|
+
|
|
203
|
+
},
|
|
204
|
+
moved: function () { },
|
|
205
|
+
detached: function () { },
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* 组件的初始数据
|
|
210
|
+
*/
|
|
211
|
+
data: {
|
|
212
|
+
time: '',
|
|
213
|
+
goodsItem: {},
|
|
214
|
+
currentActive: '',
|
|
215
|
+
IOSMiniProgramCanBuy: false,
|
|
216
|
+
isIOS: false,
|
|
217
|
+
page_path: '',
|
|
218
|
+
preHeatTime: '',
|
|
219
|
+
isSeckill: false,
|
|
220
|
+
checked: false,
|
|
221
|
+
switchLoading: false,
|
|
222
|
+
imageRadius: rpxToVmin(16),
|
|
223
|
+
isOver: false, //是否已抢光
|
|
224
|
+
isSoldOut: false, //商品是否设置已售罄
|
|
225
|
+
isRealOver: false, //商品是否为非手动售罄下的,真实抢光
|
|
226
|
+
changeStateLoading: false, // 修改状态 loading(如售罄状态、显示状态)
|
|
227
|
+
skillNowTime: 0 // 秒杀活动对比的当前时间
|
|
228
|
+
},
|
|
229
|
+
computed: {
|
|
230
|
+
// 是否显示库存
|
|
231
|
+
showStock(data) {
|
|
232
|
+
const { current_role, goodsInfo, stockSwitch, skillNowTime } = data
|
|
233
|
+
// 只涉及实物商品,线下课,班课,有价优惠券,课时包,服务类商品
|
|
234
|
+
if (![21, 29, 35, 41, 42, 68].includes(goodsInfo.resource_type)) return false
|
|
235
|
+
// 讲师必定展示
|
|
236
|
+
if (current_role === 'teacher') return true
|
|
237
|
+
// 学员的话,参与营销活动有活动库存,并且开始了,就不展示了
|
|
238
|
+
const activityTime = new Date(goodsInfo.start_at?.replace(/-/g, "/")).getTime() || 0
|
|
239
|
+
const nowTime = skillNowTime || new Date().getTime()
|
|
240
|
+
if (+goodsInfo.is_activity === 1 && (nowTime > activityTime) && goodsInfo.activity_stock) return false
|
|
241
|
+
// 学员其余情况下,根据b端显示库存开关
|
|
242
|
+
return stockSwitch === 1
|
|
243
|
+
},
|
|
244
|
+
goodsStock(data) {
|
|
245
|
+
const { current_role, goodsInfo, skillNowTime } = data
|
|
246
|
+
// 讲师显示原库存
|
|
247
|
+
if (current_role === 'teacher') return formatNum(goodsInfo.stock)
|
|
248
|
+
// 售罄了
|
|
249
|
+
if (+goodsInfo.is_sell_out === 1) return 0
|
|
250
|
+
// 原库存为0
|
|
251
|
+
if (+goodsInfo.stock === 0) return 0
|
|
252
|
+
// 如果参与了营销活动开始后且有活动呢库存, 展示活动库存
|
|
253
|
+
const activityTime = new Date(goodsInfo.start_at?.replace(/-/g, "/")).getTime() || 0
|
|
254
|
+
const nowTime = skillNowTime || new Date().getTime()
|
|
255
|
+
if (+goodsInfo.is_activity === 1 && (nowTime > activityTime)) {
|
|
256
|
+
return goodsInfo.activity_stock ? formatNum(goodsInfo.activity_stock - goodsInfo.activity_order_num) : formatNum(goodsInfo.stock)
|
|
257
|
+
}
|
|
258
|
+
return formatNum(goodsInfo.stock)
|
|
259
|
+
},
|
|
260
|
+
showPreferentialPrice(properties) {
|
|
261
|
+
// 券后价小于展示价格的时候展示券后价; coupon_switch B端店铺设置 是否展示券后价,err_code === 0 是正常,非0表示券后价相关接口报错了,去抢购按钮展示为查看详情
|
|
262
|
+
//超级会员全免权益
|
|
263
|
+
let svipAllFree = properties.goodsInfo.resource_rights_type === 1
|
|
264
|
+
//免费的情况下不展示券后价
|
|
265
|
+
let isFree = svipAllFree || properties.goodsInfo.priceShow === 0
|
|
266
|
+
let showPreferentialPrice = properties.coupon_switch && properties.goodsInfo.preferential_price < properties.goodsInfo.priceShow && !properties.goodsInfo.err_code && !isFree
|
|
267
|
+
return showPreferentialPrice
|
|
268
|
+
},
|
|
269
|
+
params_url(data) {
|
|
270
|
+
if (!Object.keys(data.goodsItem).length) {
|
|
271
|
+
return ''
|
|
272
|
+
} else {
|
|
273
|
+
// 后端规则拼接参数规则:$ => ?、@ => &
|
|
274
|
+
// 商品带货链接需拼接多一个aliveId
|
|
275
|
+
const aliveId = data.aliveInfo.alive_id
|
|
276
|
+
const url = data.goodsItem.target_url.replaceAll('&', "@")
|
|
277
|
+
const link = url.replaceAll('?', "$")
|
|
278
|
+
// 判断后端返回链接是否已拼接(如:?type= )参数,兼容 aliveId 拼接符
|
|
279
|
+
const symbol = url.indexOf('?') !== -1 ? '@' : '$'
|
|
280
|
+
return `${data.page_path}?type=1&link=${link}${symbol}aliveId=${aliveId}&title=${data.goodsItem.title}`
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
isStudent(properties) {
|
|
284
|
+
return properties.current_role === 'student'
|
|
285
|
+
},
|
|
286
|
+
//超过99999不够位置展示划线价,只能不要孩子了
|
|
287
|
+
showPriceLine(data) {
|
|
288
|
+
return data.goodsItem.priceLine > 0 && (data.goodsItem.priceShow < 100000 || !data.showPreferentialPrice)
|
|
289
|
+
},
|
|
290
|
+
showPrice(data) {
|
|
291
|
+
return data.isIOS && data.IOSMiniProgramCanBuy && data.goodsItem.priceShow !== 0 || !data.isIOS && data.goodsItem.priceShow !== 0
|
|
292
|
+
},
|
|
293
|
+
// 是否为安卓设备
|
|
294
|
+
isAndroid() {
|
|
295
|
+
let info = wx.getSystemInfoSync()
|
|
296
|
+
return info.platform === 'android'
|
|
297
|
+
},
|
|
298
|
+
//讲解中的商品
|
|
299
|
+
isShowExamplaining(properties) {
|
|
300
|
+
return properties.explainingGoods && properties.explainingGoods.resource_id === properties.goodsItem.resource_id;
|
|
301
|
+
},
|
|
302
|
+
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示,受B端店铺设置(hide_sub_count):隐藏商品销量控制 0-显示 1-隐藏
|
|
303
|
+
hasSaleNum(data) {
|
|
304
|
+
return !data.goodsItem.hide_sub_count && data.goodsItem.order_num > 0
|
|
305
|
+
},
|
|
306
|
+
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示
|
|
307
|
+
saleNum(data) {
|
|
308
|
+
//实物商品
|
|
309
|
+
if (data.goodsItem.resource_type === 21 || data.goodsItem.resource_type === 41 || data.goodsItem.resource_type === 68) {
|
|
310
|
+
return ' 已售 ' + (data.goodsItem.order_num || 0)
|
|
311
|
+
} else if (data.goodsItem.resource_type === 6 || data.goodsItem.resource_type === 8 || data.goodsItem.resource_type === 5) {
|
|
312
|
+
return ' 订阅 ' + (data.goodsItem.order_num || 0)
|
|
313
|
+
} else {
|
|
314
|
+
return ''
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
// 点击去查看
|
|
318
|
+
isNeedToContact(data) {
|
|
319
|
+
return Boolean(data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy))
|
|
320
|
+
},
|
|
321
|
+
btnTxt(data) {
|
|
322
|
+
// 以下各种情况,按去查看 -> 已抢光 -> 查看详情 -> 免费领取 -> 券后 -> 去抢购 优先级展示
|
|
323
|
+
// 超级会员全免权益
|
|
324
|
+
let svipAllFree = data.goodsItem.resource_rights_type === 1
|
|
325
|
+
if (data.isSoldOut && !data.isStudent) {
|
|
326
|
+
return "已售罄"
|
|
327
|
+
} else if (data.isOver) {
|
|
328
|
+
// 库存为0,已售罄
|
|
329
|
+
return "已抢光"
|
|
330
|
+
} else if (data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy)) {
|
|
331
|
+
// IOS小程序中不能买的展示去查看,跳转到小程序客服
|
|
332
|
+
return "去查看"
|
|
333
|
+
} else if (data.goodsItem.err_code) {
|
|
334
|
+
// 券后价接口报错,领取不了优惠券的情况
|
|
335
|
+
return "查看详情"
|
|
336
|
+
} else if (svipAllFree || data.goodsItem.priceShow === 0) {
|
|
337
|
+
// 超级会员全免或者0元商品
|
|
338
|
+
return "免费领取"
|
|
339
|
+
} else if (data.showPreferentialPrice) {
|
|
340
|
+
// 展示券后价
|
|
341
|
+
return "购买"
|
|
342
|
+
} else {
|
|
343
|
+
return "购买"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
//当前适用的活动或者超级会员,活动价低就是活动,会员价低就是超级会员,超级会员全免,肯定最低,适用超级会员
|
|
347
|
+
// "限时折扣",
|
|
348
|
+
// "好友助力",
|
|
349
|
+
// "裂变海报",
|
|
350
|
+
// "拼团",
|
|
351
|
+
// "涨粉神器",
|
|
352
|
+
// "秒杀",
|
|
353
|
+
// "超级会员",
|
|
354
|
+
//是否开启了预热 1-开启 0-未开启
|
|
355
|
+
hasPreheat(data) {
|
|
356
|
+
return data.goodsItem.sec_kill_is_preheat === 1
|
|
357
|
+
},
|
|
358
|
+
//秒杀开始时间
|
|
359
|
+
startTime(data) {
|
|
360
|
+
return data.goodsItem.start_at && new Date(data.goodsItem.start_at.replace(/-/g, "/")) || new Date()
|
|
361
|
+
},
|
|
362
|
+
//超级会员
|
|
363
|
+
isSupperVip(data) {
|
|
364
|
+
return data.currentActive === '超级会员'
|
|
365
|
+
},
|
|
366
|
+
//秒杀活动需要预约
|
|
367
|
+
isAppointment(data) {
|
|
368
|
+
data.goodsItem.appointment = 1 //mock
|
|
369
|
+
return data.goodsItem.appointment === 1
|
|
370
|
+
},
|
|
371
|
+
secText(data) {
|
|
372
|
+
if (data.isSeckill && data.preheating) {
|
|
373
|
+
return `秒杀活动将在 ${data.time} 后开始`
|
|
374
|
+
} else {
|
|
375
|
+
return ''
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
filterSrc(data) {
|
|
379
|
+
return utils.replaceCDN(data.goodsItem.img_url, '?imageMogr2/thumbnail/400x400>/ignore-error/1')
|
|
380
|
+
},
|
|
381
|
+
// 是否展示已抢完
|
|
382
|
+
// 学员端:已设置售罄、或者已抢完
|
|
383
|
+
// 讲师端:已抢完,且未设置已售罄
|
|
384
|
+
isSellOut({ isStudent, isOver, isRealOver }) {
|
|
385
|
+
return isStudent ? isOver : isRealOver;
|
|
386
|
+
},
|
|
387
|
+
// 已售百分比
|
|
388
|
+
percentage(data) {
|
|
389
|
+
if (data.isSellOut) return 100
|
|
390
|
+
// 无库存 拼团、限时抢购
|
|
391
|
+
if (!data.goodsItem.activity_stock) return 28
|
|
392
|
+
let num = 0
|
|
393
|
+
num = (data.goodsItem.activity_order_num / data.goodsItem.activity_stock) * 100
|
|
394
|
+
// 有库存时,最低占40%
|
|
395
|
+
return num <= 40 ? 40 : num
|
|
396
|
+
},
|
|
397
|
+
// 商品剩余数量
|
|
398
|
+
residueQuantity(data) {
|
|
399
|
+
// "已抢光"
|
|
400
|
+
if (data.isSellOut) return '已抢光'
|
|
401
|
+
|
|
402
|
+
// 没有库存 - 已开抢
|
|
403
|
+
if (!data.goodsItem.activity_stock) return '已开抢'
|
|
404
|
+
|
|
405
|
+
return `仅剩${formatNum(data.goodsItem.activity_stock - data.goodsItem.activity_order_num)}件`
|
|
406
|
+
},
|
|
407
|
+
// 配送方式(-1:全部 1:快递配送 2:自提)
|
|
408
|
+
distributionWay(data) {
|
|
409
|
+
let text = ''
|
|
410
|
+
switch (data.goodsItem.distribution_pattern) {
|
|
411
|
+
case -1:
|
|
412
|
+
text = '自提·快递'
|
|
413
|
+
break
|
|
414
|
+
case 1:
|
|
415
|
+
text = '快递'
|
|
416
|
+
break
|
|
417
|
+
case 2:
|
|
418
|
+
text = '自提'
|
|
419
|
+
break
|
|
420
|
+
default:
|
|
421
|
+
text = ''
|
|
422
|
+
break
|
|
423
|
+
}
|
|
424
|
+
return text
|
|
425
|
+
},
|
|
426
|
+
distributionPattern(data) {
|
|
427
|
+
return [-1,1,2].indexOf(data.goodsItem.distribution_pattern) !== -1
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
/**
|
|
431
|
+
* 组件的方法列表
|
|
432
|
+
*/
|
|
433
|
+
methods: {
|
|
434
|
+
async checkSellOut() {
|
|
435
|
+
// 非真实抢光,需要拿最新状态判断下
|
|
436
|
+
if (this.data.isRealOver) return;
|
|
437
|
+
|
|
438
|
+
if (this.data.isNeedToContact) {
|
|
439
|
+
const goodsStatusRes = await this.getGoodsStatus()
|
|
440
|
+
|
|
441
|
+
if (!goodsStatusRes) return
|
|
442
|
+
|
|
443
|
+
// 更新售罄状态
|
|
444
|
+
const is_sell_out = +goodsStatusRes.is_sell_out
|
|
445
|
+
this.triggerEvent('changeGoodsState', {
|
|
446
|
+
index: this.properties.index,
|
|
447
|
+
type: 'is_sell_out',
|
|
448
|
+
state: is_sell_out,
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
if (is_sell_out) {
|
|
452
|
+
return wx.showToast({
|
|
453
|
+
title: '很遗憾, 手慢抢光了',
|
|
454
|
+
icon: 'none',
|
|
455
|
+
duration: 3000,
|
|
456
|
+
})
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
this.toDetails()
|
|
460
|
+
} else {
|
|
461
|
+
this.snapUpCheck()
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
snapUpCheck: debounce(async function () {
|
|
465
|
+
!this.data.isOver && this.showToast('努力加载中')
|
|
466
|
+
|
|
467
|
+
const goodsStatusRes = await this.getGoodsStatus()
|
|
468
|
+
|
|
469
|
+
if (!goodsStatusRes) return
|
|
470
|
+
|
|
471
|
+
// 更新售罄状态
|
|
472
|
+
const is_sell_out = +goodsStatusRes.is_sell_out
|
|
473
|
+
this.triggerEvent('changeGoodsState', {
|
|
474
|
+
index: this.properties.index,
|
|
475
|
+
type: 'is_sell_out',
|
|
476
|
+
state: is_sell_out,
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
if (is_sell_out) {
|
|
480
|
+
return wx.showToast({
|
|
481
|
+
title: '很遗憾, 手慢抢光了',
|
|
482
|
+
icon: 'none',
|
|
483
|
+
duration: 3000,
|
|
484
|
+
})
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
this.triggerEvent('sendNewMsg')
|
|
488
|
+
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
489
|
+
sensorLog.sensors.track('click_butt', {
|
|
490
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
491
|
+
page_name: '直播间页面',
|
|
492
|
+
l_program: '鹅直播',
|
|
493
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
494
|
+
page_button: "列表去抢购",
|
|
495
|
+
client: "小程序",
|
|
496
|
+
goods_id: goodsInfo.id,
|
|
497
|
+
app_id: aliveInfo.app_id,
|
|
498
|
+
c_user_id: aliveInfo.user_id,
|
|
499
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
500
|
+
current_role: sensorReportParams.current_role,
|
|
501
|
+
resource_id: aliveInfo.alive_id,
|
|
502
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
503
|
+
type: sensorReportParams.type,
|
|
504
|
+
cmm1: sensorReportParams.alive_type,
|
|
505
|
+
cmm2: sensorReportParams.version_type,
|
|
506
|
+
comm2: sensorReportParams.pay_type,
|
|
507
|
+
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
508
|
+
})
|
|
509
|
+
// 线下课29课时包42/拼团 --判断权益
|
|
510
|
+
if ([29, 42].indexOf(this.data.goodsItem.resource_type) > -1 || this.data.goodsItem.activity_type === 6) {
|
|
511
|
+
this.judgePermission()
|
|
512
|
+
return
|
|
513
|
+
}
|
|
514
|
+
let params = {
|
|
515
|
+
id: this.data.goodsItem.id,
|
|
516
|
+
resource_id: this.data.goodsItem.resource_id,
|
|
517
|
+
resource_type: this.data.goodsItem.resource_type,
|
|
518
|
+
price: this.data.goodsItem.price,
|
|
519
|
+
app_id: this.data.aliveInfo.app_id,
|
|
520
|
+
user_id: this.data.aliveInfo.user_id,
|
|
521
|
+
coupon_id: this.data.goodsItem.coupon_id,
|
|
522
|
+
alive_id: this.data.aliveInfo.alive_id
|
|
523
|
+
}
|
|
524
|
+
const url = this.properties.isGrayMarketing ? snapCheckNew : snapCheck
|
|
525
|
+
url(params).then(res => {
|
|
526
|
+
this.hideToast()
|
|
527
|
+
let { code, data } = res.data
|
|
528
|
+
if (code === 0) {
|
|
529
|
+
if (data.err_msg) {
|
|
530
|
+
this.showToast(data.err_msg)
|
|
531
|
+
}
|
|
532
|
+
if (data.is_sec_kill_toast) {
|
|
533
|
+
this.showToast("秒杀活动开始,您未预约,需以原价购买!")
|
|
534
|
+
}
|
|
535
|
+
if (data.is_goods_detail === 1) {
|
|
536
|
+
this.judgePermission(data.is_has_permission)
|
|
537
|
+
} else if (data.is_more_sku === 1) {
|
|
538
|
+
this.showSku()
|
|
539
|
+
} else {
|
|
540
|
+
this.showConfirmOrder(data.sku)
|
|
541
|
+
}
|
|
542
|
+
} else {
|
|
543
|
+
this.showToast("网络繁忙,请稍后再试")
|
|
544
|
+
}
|
|
545
|
+
})
|
|
546
|
+
}, 1000, true),
|
|
547
|
+
getGoodsStatus() {
|
|
548
|
+
if (this.data.isRealOver) {
|
|
549
|
+
wx.showToast({
|
|
550
|
+
title: '很遗憾, 手慢抢光了',
|
|
551
|
+
icon: 'none',
|
|
552
|
+
duration: 3000,
|
|
553
|
+
})
|
|
554
|
+
|
|
555
|
+
return Promise.resolve(null)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
const { id, spu_id, resource_id } = this.data.goodsItem
|
|
559
|
+
const { user_id, app_id, alive_id } = this.properties.aliveInfo
|
|
560
|
+
|
|
561
|
+
return getGoodValue({
|
|
562
|
+
spu_id: spu_id || id,
|
|
563
|
+
user_id,
|
|
564
|
+
app_id,
|
|
565
|
+
alive_id,
|
|
566
|
+
resource_id: id || resource_id,
|
|
567
|
+
}, true)
|
|
568
|
+
.then((res) => {
|
|
569
|
+
res = res.data || {}
|
|
570
|
+
|
|
571
|
+
if (res.code === 0 && res.data) {
|
|
572
|
+
return res.data
|
|
573
|
+
} else {
|
|
574
|
+
this.showToast(res?.msg || res?.data?.msg || '获取商品状态失败')
|
|
575
|
+
return null
|
|
576
|
+
}
|
|
577
|
+
})
|
|
578
|
+
.catch(() => {
|
|
579
|
+
this.showToast('获取商品状态失败')
|
|
580
|
+
return null
|
|
581
|
+
})
|
|
582
|
+
},
|
|
583
|
+
cardToDetails() {
|
|
584
|
+
if (!this.data.isStudent) { return }
|
|
585
|
+
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
586
|
+
sensorLog.sensors.track('click_butt', {
|
|
587
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
588
|
+
page_name: '直播间页面',
|
|
589
|
+
l_program: '鹅直播',
|
|
590
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
591
|
+
page_button: "列表空白热区",
|
|
592
|
+
client: "小程序",
|
|
593
|
+
goods_id: goodsInfo.id,
|
|
594
|
+
product_name: goodsInfo.title,
|
|
595
|
+
app_id: aliveInfo.app_id,
|
|
596
|
+
c_user_id: aliveInfo.user_id,
|
|
597
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
598
|
+
current_role: sensorReportParams.current_role,
|
|
599
|
+
resource_id: aliveInfo.alive_id,
|
|
600
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
601
|
+
type: sensorReportParams.type,
|
|
602
|
+
cmm1: sensorReportParams.alive_type,
|
|
603
|
+
cmm2: sensorReportParams.version_type,
|
|
604
|
+
comm2: sensorReportParams.pay_type,
|
|
605
|
+
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
606
|
+
})
|
|
607
|
+
this.judgePermission()
|
|
608
|
+
},
|
|
609
|
+
// 点击空白热区进来判断权益,或者接口返回有权益的时候进来判断跳转路径
|
|
610
|
+
judgePermission: debounce(async function (permission) {
|
|
611
|
+
const goodsStatusRes = await this.getGoodsStatus()
|
|
612
|
+
|
|
613
|
+
if (!goodsStatusRes) return
|
|
614
|
+
|
|
615
|
+
// 更新售罄状态
|
|
616
|
+
const is_sell_out = +goodsStatusRes.is_sell_out
|
|
617
|
+
this.triggerEvent('changeGoodsState', {
|
|
618
|
+
index: this.properties.index,
|
|
619
|
+
type: 'is_sell_out',
|
|
620
|
+
state: is_sell_out,
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
if (is_sell_out) {
|
|
624
|
+
return wx.showToast({
|
|
625
|
+
title: '很遗憾, 手慢抢光了',
|
|
626
|
+
icon: 'none',
|
|
627
|
+
duration: 3000,
|
|
628
|
+
})
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// 实物21 有价优惠券41 超级会员23 可多次购买,没有权益说法,直接拉起客服;直播商品有没有权益都是去详情页。
|
|
632
|
+
if ([41, 21, 23, 4].indexOf(Number(this.data.goodsItem.resource_type)) > -1) {
|
|
633
|
+
this.toDetails()
|
|
634
|
+
return
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (permission !== 0 && permission !== 1) {
|
|
638
|
+
permission = await this.getUserPermission()
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// 有权益的情况下
|
|
642
|
+
if (permission) {
|
|
643
|
+
// 电子书20/班课35 鹅学习不支持,无权益的情况下,内嵌h5, 有权益TOAST提示
|
|
644
|
+
if ([20, 35].indexOf(this.data.goodsItem.resource_type) > -1) {
|
|
645
|
+
this.showToast('您已拥有该课程,小程序内暂不支持学习此课程')
|
|
646
|
+
} else {
|
|
647
|
+
// 弹出提示去小程序学习 有三种可能 -圈子小程序 -小鹅通小程序 -打卡小程序
|
|
648
|
+
this.showdialog(this.data.goodsItem)
|
|
649
|
+
}
|
|
650
|
+
} else {
|
|
651
|
+
// 没有权益的情况下 直播商品去直播详情页,其他拉起客服
|
|
652
|
+
this.toDetails()
|
|
653
|
+
}
|
|
654
|
+
}, 1000, true),
|
|
655
|
+
getUserPermission() {
|
|
656
|
+
return new Promise((resolve, reject) => {
|
|
657
|
+
let params = {
|
|
658
|
+
id: this.data.goodsItem.id,
|
|
659
|
+
app_id: this.data.aliveInfo.app_id,
|
|
660
|
+
user_id: this.data.aliveInfo.user_id,
|
|
661
|
+
}
|
|
662
|
+
const url = this.properties.isGrayMarketing ? getUserPermissionNew : getUserPermission
|
|
663
|
+
url(params).then((res) => {
|
|
664
|
+
let { code, data } = res.data
|
|
665
|
+
if (code === 0) {
|
|
666
|
+
resolve(!!data.auth_state)
|
|
667
|
+
}
|
|
668
|
+
})
|
|
669
|
+
})
|
|
670
|
+
},
|
|
671
|
+
async showConfirmOrder(sku) {
|
|
672
|
+
//带货列表返回的 resource_id就是业务侧的spu_id
|
|
673
|
+
// 返回的id,就是业务侧的resource_id
|
|
674
|
+
const params = {
|
|
675
|
+
id: this.data.goodsItem.resource_id,
|
|
676
|
+
spu_id: this.data.goodsItem.resource_id,
|
|
677
|
+
resource_type: this.data.goodsItem.resource_type,
|
|
678
|
+
resource_id: this.data.goodsItem.id,
|
|
679
|
+
spu_type: this.data.goodsItem.spu_type,
|
|
680
|
+
sku,
|
|
681
|
+
count: 1,
|
|
682
|
+
isAlive: 1,
|
|
683
|
+
aliveId: this.data.aliveInfo.alive_id,
|
|
684
|
+
isCollectCoupons: this.data.showPreferentialPrice
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
this.triggerEvent("showConfirmOrder", params)
|
|
688
|
+
},
|
|
689
|
+
showSku() {
|
|
690
|
+
let params = {
|
|
691
|
+
spuId: this.data.goodsItem.resource_id,
|
|
692
|
+
isCollectCoupons: this.data.showPreferentialPrice
|
|
693
|
+
}
|
|
694
|
+
this.triggerEvent("showSku", params)
|
|
695
|
+
},
|
|
696
|
+
showdialog() {
|
|
697
|
+
this.triggerEvent('showDialog', this.data.goodsItem)
|
|
698
|
+
},
|
|
699
|
+
sendNewMsg() {
|
|
700
|
+
this.triggerEvent('sendNewMsg')
|
|
701
|
+
},
|
|
702
|
+
showToast(title = '') {
|
|
703
|
+
wx.showToast({
|
|
704
|
+
title,
|
|
705
|
+
icon: "none",
|
|
706
|
+
duration: 1000
|
|
707
|
+
})
|
|
708
|
+
},
|
|
709
|
+
hideToast() {
|
|
710
|
+
wx.hideToast()
|
|
711
|
+
},
|
|
712
|
+
countTime() {
|
|
713
|
+
if (!this.data.isSeckill || !this.data.preheating) { //不是秒杀活动 或者不在预热中不倒计时
|
|
714
|
+
return
|
|
715
|
+
}
|
|
716
|
+
//获取当前时间
|
|
717
|
+
let date = new Date();
|
|
718
|
+
let now = date.getTime();
|
|
719
|
+
//截止时间
|
|
720
|
+
let deadline = new Date(this.data.startTime);
|
|
721
|
+
let end = deadline.getTime();
|
|
722
|
+
//剩余时间
|
|
723
|
+
let time = end - now;
|
|
724
|
+
this.setData({ skillNowTime: now })
|
|
725
|
+
//定义变量 d,h,m,s保存倒计时的时间
|
|
726
|
+
let d = 0, h = 0, m = 0, s = 0;
|
|
727
|
+
if (time >= 0) {
|
|
728
|
+
d = Math.floor(time / 1000 / 60 / 60 / 24);
|
|
729
|
+
h = Math.floor(time / 1000 / 60 / 60 % 24);
|
|
730
|
+
m = Math.floor(time / 1000 / 60 % 60);
|
|
731
|
+
s = Math.floor(time / 1000 % 60);
|
|
732
|
+
h = d > 0 ? h + 24 * d : h
|
|
733
|
+
h = h < 10 ? '0' + h : h
|
|
734
|
+
m = m < 10 ? '0' + m : m
|
|
735
|
+
s = s < 10 ? '0' + s : s
|
|
736
|
+
this.setData({
|
|
737
|
+
time: h + ":" + m + ":" + s
|
|
738
|
+
})
|
|
739
|
+
}
|
|
740
|
+
//递归每秒调用countTime方法,显示动态时间效果
|
|
741
|
+
let that = this
|
|
742
|
+
if (!(d === 0 && h === 0 && m === 0 && s === 0)) { //秒杀活动还未到时间
|
|
743
|
+
setTimeout(() => that.countTime(), 1000)
|
|
744
|
+
} else {
|
|
745
|
+
this.setData({ skillNowTime: 0 })
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
handleContact(e) {
|
|
749
|
+
console.log("点击了去查看")
|
|
750
|
+
},
|
|
751
|
+
formatUrl(goodsInfo) {
|
|
752
|
+
var url = ''
|
|
753
|
+
var jumpUrl = ''
|
|
754
|
+
if (typeof goodsInfo == 'object' && Object.keys(goodsInfo).length > 0) {
|
|
755
|
+
url = goodsInfo.target_url
|
|
756
|
+
jumpUrl = goodsInfo.target_url
|
|
757
|
+
} else {
|
|
758
|
+
url = this.data.goodsItem.target_url
|
|
759
|
+
jumpUrl = this.data.goodsItem.target_url //跳转链接
|
|
760
|
+
}
|
|
761
|
+
//跳转链接 带上参数
|
|
762
|
+
let queryIndex = url.indexOf("?"); //查询索引位置
|
|
763
|
+
if (queryIndex === -1) {
|
|
764
|
+
jumpUrl += "?"; //问号不存在,则拼接问号
|
|
765
|
+
} else {
|
|
766
|
+
url.length - 1 !== queryIndex ? (jumpUrl += "&") : ""; //问号是否不在末尾位置? 进行&拼接 :不处理
|
|
767
|
+
}
|
|
768
|
+
jumpUrl = `${jumpUrl}live_room=1&success=1&aliveId=${this.data.aliveInfo.alive_id}`;
|
|
769
|
+
if (![0, 2, 3].includes(this.data.aliveInfo.alive_state)) {
|
|
770
|
+
jumpUrl += `&is_living=1&unique_type=elive`;
|
|
771
|
+
}
|
|
772
|
+
return encodeURIComponent(jumpUrl)
|
|
773
|
+
},
|
|
774
|
+
toDetails() {
|
|
775
|
+
// 直播商品-去详情页,其他商品-拉起客服
|
|
776
|
+
let { title, img_url, target_url } = this.data.goodsItem
|
|
777
|
+
let params = encodeURIComponent(`img_url=${img_url}&title=${title}¶ms_url=${this.data.params_url}`)
|
|
778
|
+
console.log("urlurlurl", `/page/customerService/customerService?params=${params}`)
|
|
779
|
+
if (this.data.goodsItem.resource_type === 4) {
|
|
780
|
+
wx && wx.redirectTo({
|
|
781
|
+
url: `/pages/webView/webView?appId=${this.properties.aliveInfo.app_id}&aliveId=${this.data.goodsItem.id}&refreshAliveId=${this.properties.aliveInfo.alive_id}`,
|
|
782
|
+
})
|
|
783
|
+
|
|
784
|
+
} else {
|
|
785
|
+
// PC 复制链接
|
|
786
|
+
const { isPC, isDevtools } = getApp().globalData.system
|
|
787
|
+
if (isPC || isDevtools) {
|
|
788
|
+
this.copyLink(target_url)
|
|
789
|
+
return
|
|
790
|
+
}
|
|
791
|
+
// 暂时屏蔽内嵌H5详情页,拉起客服
|
|
792
|
+
wx && wx.navigateTo({
|
|
793
|
+
url: '/page/customerService/customerService' + `?params=${params}`
|
|
794
|
+
})
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
//judgePermission里面 showDialog 外部弹窗调用
|
|
798
|
+
toMiniProgram(goodsInfo) {
|
|
799
|
+
let { aliveInfo, sensorReportParams } = this.properties
|
|
800
|
+
sensorLog.sensors.track('click_butt', {
|
|
801
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
802
|
+
page_name: '直播间页面',
|
|
803
|
+
l_program: '鹅直播',
|
|
804
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
805
|
+
page_button: "前往",
|
|
806
|
+
app_id: aliveInfo.app_id,
|
|
807
|
+
c_user_id: aliveInfo.user_id,
|
|
808
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
809
|
+
current_role: sensorReportParams.current_role,
|
|
810
|
+
resource_id: aliveInfo.alive_id,
|
|
811
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
812
|
+
type: sensorReportParams.type,
|
|
813
|
+
cmm1: sensorReportParams.alive_type,
|
|
814
|
+
cmm2: sensorReportParams.version_type,
|
|
815
|
+
comm2: sensorReportParams.pay_type
|
|
816
|
+
})
|
|
817
|
+
let spu_type = goodsInfo.spu_type
|
|
818
|
+
switch (spu_type) {
|
|
819
|
+
case ASSOCIATION:
|
|
820
|
+
this.toAssociation(goodsInfo);
|
|
821
|
+
break;
|
|
822
|
+
case PUNCH_CARD:
|
|
823
|
+
this.toPunchCard(goodsInfo);
|
|
824
|
+
break;
|
|
825
|
+
default:
|
|
826
|
+
this.toXiaoeLearn(goodsInfo);
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
toXiaoeLearn(goodsInfo) {
|
|
831
|
+
let { aliveInfo } = this.properties
|
|
832
|
+
let h5_url = this.formatUrl(goodsInfo)
|
|
833
|
+
var path
|
|
834
|
+
// 音频 视频
|
|
835
|
+
if (goodsInfo.resource_type === 2 || goodsInfo.resource_type === 3) {
|
|
836
|
+
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&resource_id=${goodsInfo.id}&unique_type=elive`
|
|
837
|
+
} else {
|
|
838
|
+
// 其他
|
|
839
|
+
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&h5_url=${h5_url}`
|
|
840
|
+
}
|
|
841
|
+
let params = {
|
|
842
|
+
appId: "wxa3589f1193170aa3",
|
|
843
|
+
path,
|
|
844
|
+
}
|
|
845
|
+
if (this.properties.envName == 'inside' || this.properties.envName == 'test') { //开发环境 测试环境 加上这个参数可以跳转去鹅学习体验版
|
|
846
|
+
params.appId = 'wx9eb4d7b3f2a3e003'
|
|
847
|
+
params.envVersion = 'trial'
|
|
848
|
+
}
|
|
849
|
+
wx.navigateToMiniProgram(params)
|
|
850
|
+
},
|
|
851
|
+
toPunchCard(goodsInfo) {
|
|
852
|
+
let { aliveInfo } = this.properties
|
|
853
|
+
let path = `/pages-participate-progress/pages/participate/participate?app_id=${aliveInfo.app_id}&&activity_id=${goodsInfo.resource_id}`
|
|
854
|
+
let params = {
|
|
855
|
+
appId: "wx839728854b1e23ad", //现网
|
|
856
|
+
path,
|
|
857
|
+
}
|
|
858
|
+
if (this.properties.envName == 'inside') { //开发环境
|
|
859
|
+
params.appId = 'wx802f346b1c7dcdd9'
|
|
860
|
+
} else if (this.properties.envName == 'test') { // 测试环境
|
|
861
|
+
params.appId = 'wx778bc88236be97d9'
|
|
862
|
+
}
|
|
863
|
+
wx.navigateToMiniProgram(params)
|
|
864
|
+
},
|
|
865
|
+
toAssociation(goodsInfo) {
|
|
866
|
+
let { aliveInfo } = this.properties
|
|
867
|
+
let path = `/pages-community/pages/home/index?appId=${aliveInfo.app_id}&&communityId=${goodsInfo.resource_id}`
|
|
868
|
+
let params = {
|
|
869
|
+
appId: "wxd0ad7e76d51ae4cc",
|
|
870
|
+
path,
|
|
871
|
+
}
|
|
872
|
+
if (this.properties.envName == 'inside') {
|
|
873
|
+
params.appId = 'wx52419e90dc6dd535' //开发环境
|
|
874
|
+
} else if (this.properties.envName == 'test') { //测试环境
|
|
875
|
+
params.appId = 'wxb245d452213c48c9' //测试环境
|
|
876
|
+
}
|
|
877
|
+
wx.navigateToMiniProgram(params)
|
|
878
|
+
},
|
|
879
|
+
// 商品设置售罄/取消售罄
|
|
880
|
+
async changeSoldOut() {
|
|
881
|
+
if (this.data.changeStateLoading) return this.showToast('状态更改中,请稍后');
|
|
882
|
+
|
|
883
|
+
const confirmPromise = () => new Promise(resolve => {
|
|
884
|
+
wx.showModal({
|
|
885
|
+
title: '确认售罄?',
|
|
886
|
+
content: '标记售罄后不影响实际库存,仅在用户端展示商品已抢光,无法购买',
|
|
887
|
+
confirmText: '确认',
|
|
888
|
+
cancelText: '取消',
|
|
889
|
+
confirmColor: '#1472FF',
|
|
890
|
+
success: (res) => {
|
|
891
|
+
if (res.confirm) {
|
|
892
|
+
return resolve(true);
|
|
893
|
+
} else if (res.cancel) {
|
|
894
|
+
return resolve(false);
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
fail: () => resolve(false),
|
|
898
|
+
});
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
const isConfirmOperation = this.data.isSoldOut || await confirmPromise();
|
|
902
|
+
|
|
903
|
+
if (!isConfirmOperation) return;
|
|
904
|
+
|
|
905
|
+
const { alive_id, app_id, user_id } = this.properties.aliveInfo;
|
|
906
|
+
const {
|
|
907
|
+
goodsItem,
|
|
908
|
+
isSoldOut,
|
|
909
|
+
} = this.data;
|
|
910
|
+
const params = {
|
|
911
|
+
alive_id,
|
|
912
|
+
app_id,
|
|
913
|
+
resource_id: goodsItem.id,
|
|
914
|
+
is_sell_out: isSoldOut ? 0 : 1, // 该商品是否售罄 1-已售罄 0-未售罄
|
|
915
|
+
user_id,
|
|
916
|
+
token: wx.getStorageSync('login_data').token,
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
this.setData({
|
|
920
|
+
changeStateLoading: true,
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
const res = await setGoodsSellOut(params, false).catch(error => ({ data: { code: -1, msg: error?.message || error || '操作失败' } }));
|
|
924
|
+
|
|
925
|
+
this.setData({
|
|
926
|
+
changeStateLoading: false,
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
const { data: { code, msg } } = res;
|
|
930
|
+
|
|
931
|
+
if (code !== 0) {
|
|
932
|
+
return this.showToast(msg);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// 更新售罄状态
|
|
936
|
+
this.triggerEvent('changeGoodsState', {
|
|
937
|
+
index: this.properties.index,
|
|
938
|
+
type: 'is_sell_out',
|
|
939
|
+
state: params.is_sell_out,
|
|
940
|
+
});
|
|
941
|
+
this.showToast('操作成功');
|
|
942
|
+
},
|
|
943
|
+
// 商品设置显示/隐藏
|
|
944
|
+
async changeVisible() {
|
|
945
|
+
if (this.data.changeStateLoading) return this.showToast('状态更改中,请稍后');
|
|
946
|
+
|
|
947
|
+
// 确认隐藏商品弹窗
|
|
948
|
+
const confirmPromise = () => new Promise(resolve => {
|
|
949
|
+
wx.showModal({
|
|
950
|
+
title: '确认隐藏吗',
|
|
951
|
+
content: '用户端商品列表不展示已隐藏商品,讲师仍可通过讲解发送商品',
|
|
952
|
+
confirmText: '确认',
|
|
953
|
+
cancelText: '取消',
|
|
954
|
+
confirmColor: '#1472FF',
|
|
955
|
+
success: (res) => {
|
|
956
|
+
if (res.confirm) {
|
|
957
|
+
return resolve(true);
|
|
958
|
+
} else if (res.cancel) {
|
|
959
|
+
return resolve(false);
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
fail: () => resolve(false),
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
// 已隐藏的商品可以直接调用接口显示,已显示的需要弹窗提示
|
|
967
|
+
const isConfirmOperation = !this.data.goodsItem.is_display_package || await confirmPromise();
|
|
968
|
+
|
|
969
|
+
if (!isConfirmOperation) return;
|
|
970
|
+
|
|
971
|
+
// 确认隐藏/显示,格式化参数、调用接口处理
|
|
972
|
+
const { alive_id, app_id } = this.properties.aliveInfo;
|
|
973
|
+
const { id, true_type, is_display_package } = this.data.goodsItem;
|
|
974
|
+
const params = {
|
|
975
|
+
alive_id,
|
|
976
|
+
app_id,
|
|
977
|
+
resource_ids: [{ id, type: true_type }],
|
|
978
|
+
is_display_package: +is_display_package ? 0 : 1,
|
|
979
|
+
token: wx.getStorageSync('login_data').token,
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
this.setData({
|
|
983
|
+
changeStateLoading: true,
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
const res = await requestChangeShow(params, false).catch(error => ({ data: { code: -1, msg: error?.message || error || '操作失败' } }));
|
|
987
|
+
|
|
988
|
+
this.setData({
|
|
989
|
+
changeStateLoading: false,
|
|
990
|
+
});
|
|
991
|
+
|
|
992
|
+
const { data: { code, msg } } = res;
|
|
993
|
+
|
|
994
|
+
if (code !== 0) {
|
|
995
|
+
return this.showToast(msg);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// 更新商品显示、隐藏状态
|
|
999
|
+
this.triggerEvent('changeGoodsState', {
|
|
1000
|
+
index: this.properties.index,
|
|
1001
|
+
type: 'is_display_package',
|
|
1002
|
+
state: params.is_display_package,
|
|
1003
|
+
});
|
|
1004
|
+
this.showToast('操作成功');
|
|
1005
|
+
},
|
|
1006
|
+
sendGoodsCard(e) {
|
|
1007
|
+
let dataset = e.currentTarget.dataset;
|
|
1008
|
+
// 触发父组件的send
|
|
1009
|
+
this.triggerEvent('sendGoodsCard', {
|
|
1010
|
+
datas: dataset
|
|
1011
|
+
});
|
|
1012
|
+
},
|
|
1013
|
+
changeShowType() {
|
|
1014
|
+
if (this.data.goodsItem.teacher_auth != 2) {
|
|
1015
|
+
this.showToast('暂无权限')
|
|
1016
|
+
return
|
|
1017
|
+
}
|
|
1018
|
+
this.setData({
|
|
1019
|
+
switchLoading: true
|
|
1020
|
+
})
|
|
1021
|
+
let params = {
|
|
1022
|
+
alive_id: this.properties.aliveInfo.alive_id,
|
|
1023
|
+
app_id: this.properties.aliveInfo.app_id,
|
|
1024
|
+
resource_id: this.data.goodsItem.id,
|
|
1025
|
+
is_display_package: this.data.checked ? 0 : 1
|
|
1026
|
+
};
|
|
1027
|
+
showGoods(params).then((res) => {
|
|
1028
|
+
let { code } = res.data
|
|
1029
|
+
if (code === 0) {
|
|
1030
|
+
this.setData({
|
|
1031
|
+
switchLoading: false,
|
|
1032
|
+
checked: !this.data.checked
|
|
1033
|
+
})
|
|
1034
|
+
this.showToast('操作成功')
|
|
1035
|
+
} else {
|
|
1036
|
+
this.setData({
|
|
1037
|
+
switchLoading: false
|
|
1038
|
+
})
|
|
1039
|
+
}
|
|
1040
|
+
})
|
|
1041
|
+
},
|
|
1042
|
+
stopEvent() {
|
|
1043
|
+
return
|
|
1044
|
+
},
|
|
1045
|
+
copyLink(link) {
|
|
1046
|
+
wx.setClipboardData({
|
|
1047
|
+
data: link,
|
|
1048
|
+
success() {
|
|
1049
|
+
wx.showToast({
|
|
1050
|
+
title: '商品链接已复制,请用浏览器打开',
|
|
1051
|
+
icon: 'none',
|
|
1052
|
+
})
|
|
1053
|
+
},
|
|
1054
|
+
})
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
})
|