1
|
-// page/subPackage/pages/zeroSell/detail.js
|
|
|
2
|
-
|
|
|
3
|
import ZeroSellService from './service/zero-sell'
|
1
|
import ZeroSellService from './service/zero-sell'
|
4
|
import CommonService from './service/common'
|
2
|
import CommonService from './service/common'
|
5
|
import {
|
3
|
import {
|
|
@@ -31,18 +29,10 @@ const ACTIVITY = { |
|
@@ -31,18 +29,10 @@ const ACTIVITY = { |
31
|
READY: 1, // 活动未开始
|
29
|
READY: 1, // 活动未开始
|
32
|
START: 2, // 活动开始
|
30
|
START: 2, // 活动开始
|
33
|
END: 3, // 活动结束
|
31
|
END: 3, // 活动结束
|
34
|
- LUCK: 4, // 抽奖结束
|
32
|
+ LUCK: 4, // 活动已开奖、抽奖结束
|
35
|
END_LESS_PEOPLE: 5 // 人数不足
|
33
|
END_LESS_PEOPLE: 5 // 人数不足
|
36
|
}
|
34
|
}
|
37
|
|
35
|
|
38
|
-const STEP = {
|
|
|
39
|
- ZERO: 0,
|
|
|
40
|
- FIRST: 1,
|
|
|
41
|
- SECOND: 2,
|
|
|
42
|
- THIRD: 3,
|
|
|
43
|
- FOURTH: 4,
|
|
|
44
|
-}
|
|
|
45
|
-
|
|
|
46
|
const ACTION_BAR_STATUS = {
|
36
|
const ACTION_BAR_STATUS = {
|
47
|
UNKNOWN: 0,
|
37
|
UNKNOWN: 0,
|
48
|
READY: 1, // 未开始
|
38
|
READY: 1, // 未开始
|
|
@@ -51,6 +41,7 @@ const ACTION_BAR_STATUS = { |
|
@@ -51,6 +41,7 @@ const ACTION_BAR_STATUS = { |
51
|
WAIT: 4, // 等待抽奖中
|
41
|
WAIT: 4, // 等待抽奖中
|
52
|
LUCK: 5, // 抽奖结束
|
42
|
LUCK: 5, // 抽奖结束
|
53
|
END: 6, // 活动结束
|
43
|
END: 6, // 活动结束
|
|
|
44
|
+ PEOPLE_LIMIT_WAIT: 7 // 人数达到活动限制、已满员、人数不足统一为待开奖状态
|
54
|
}
|
45
|
}
|
55
|
|
46
|
|
56
|
let app = getApp();
|
47
|
let app = getApp();
|
|
@@ -66,12 +57,10 @@ Page(Object.assign({ |
|
@@ -66,12 +57,10 @@ Page(Object.assign({ |
66
|
actPrizeId: '',
|
57
|
actPrizeId: '',
|
67
|
shareUid: 0,
|
58
|
shareUid: 0,
|
68
|
scene: '',
|
59
|
scene: '',
|
69
|
- participantCount: 0,
|
|
|
70
|
myPrizeCount: 0,
|
60
|
myPrizeCount: 0,
|
71
|
product: {},
|
61
|
product: {},
|
72
|
avatars: [],
|
62
|
avatars: [],
|
73
|
recommends: [],
|
63
|
recommends: [],
|
74
|
- step: STEP.ZERO,
|
|
|
75
|
actionStatus: ACTION_BAR_STATUS.UNKNOWN,
|
64
|
actionStatus: ACTION_BAR_STATUS.UNKNOWN,
|
76
|
snapData: {},
|
65
|
snapData: {},
|
77
|
hasUnionID: false,
|
66
|
hasUnionID: false,
|
|
@@ -346,8 +335,6 @@ Page(Object.assign({ |
|
@@ -346,8 +335,6 @@ Page(Object.assign({ |
346
|
product_qrCode: qrcode
|
335
|
product_qrCode: qrcode
|
347
|
};
|
336
|
};
|
348
|
|
337
|
|
349
|
- let participantCount = r1.code === 200 ? r1.data.joinNum : 0;
|
|
|
350
|
-
|
|
|
351
|
this.setData({
|
338
|
this.setData({
|
352
|
product: product,
|
339
|
product: product,
|
353
|
recommends: r2.code === 200 ? r2.data : [],
|
340
|
recommends: r2.code === 200 ? r2.data : [],
|
|
@@ -358,14 +345,12 @@ Page(Object.assign({ |
|
@@ -358,14 +345,12 @@ Page(Object.assign({ |
358
|
}),
|
345
|
}),
|
359
|
|
346
|
|
360
|
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
|
347
|
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
|
361
|
- participantCount,
|
|
|
362
|
snapData,
|
348
|
snapData,
|
363
|
notice: JSON.parse(product.notice || '{}'),
|
349
|
notice: JSON.parse(product.notice || '{}'),
|
364
|
lottery: JSON.parse(product.lottery_info || '{}')
|
350
|
lottery: JSON.parse(product.lottery_info || '{}')
|
365
|
});
|
351
|
});
|
366
|
|
352
|
|
367
|
this._setActionStatus();
|
353
|
this._setActionStatus();
|
368
|
- this._setStep();
|
|
|
369
|
} else {
|
354
|
} else {
|
370
|
return Promise.reject();
|
355
|
return Promise.reject();
|
371
|
}
|
356
|
}
|
|
@@ -383,58 +368,37 @@ Page(Object.assign({ |
|
@@ -383,58 +368,37 @@ Page(Object.assign({ |
383
|
})
|
368
|
})
|
384
|
})
|
369
|
})
|
385
|
},
|
370
|
},
|
386
|
-
|
|
|
387
|
- _setStep() {
|
|
|
388
|
- let step = STEP.ZERO;
|
|
|
389
|
- let activityStatus = this.data.product.status;
|
|
|
390
|
- let myPrizeCount = this.data.myPrizeCount;
|
|
|
391
|
-
|
|
|
392
|
- if (myPrizeCount === 0) {
|
|
|
393
|
- step = STEP.ZERO
|
|
|
394
|
- } else {
|
|
|
395
|
- if (activityStatus === ACTIVITY.START) {
|
|
|
396
|
- let myPrizeCount = this.data.myPrizeCount;
|
|
|
397
|
-
|
|
|
398
|
- if (myPrizeCount === 0) {
|
|
|
399
|
- step = STEP.ZERO;
|
|
|
400
|
- } else if (myPrizeCount === 1) {
|
|
|
401
|
- step = STEP.FIRST;
|
|
|
402
|
- } else if (myPrizeCount >= 2) {
|
|
|
403
|
- step = STEP.SECOND;
|
|
|
404
|
- } else {
|
|
|
405
|
- step = STEP.ZERO;
|
|
|
406
|
- }
|
|
|
407
|
- } else if (activityStatus === ACTIVITY.END || activityStatus === ACTIVITY.LUCK) {
|
|
|
408
|
- step = STEP.THIRD;
|
|
|
409
|
- } else if (activityStatus === ACTIVITY.END_LESS_PEOPLE) {
|
|
|
410
|
- step = STEP.FOURTH;
|
|
|
411
|
- } else {
|
|
|
412
|
- step = STEP.ZERO;
|
|
|
413
|
- }
|
|
|
414
|
- }
|
|
|
415
|
-
|
|
|
416
|
- this.setData({
|
|
|
417
|
- step: step
|
|
|
418
|
- });
|
|
|
419
|
- },
|
|
|
420
|
_setActionStatus() {
|
371
|
_setActionStatus() {
|
421
|
let status = ACTION_BAR_STATUS.START;
|
372
|
let status = ACTION_BAR_STATUS.START;
|
422
|
let activityStatus = this.data.product.status;
|
373
|
let activityStatus = this.data.product.status;
|
423
|
|
374
|
|
|
|
375
|
+ console.log('hahahaha')
|
|
|
376
|
+ console.log(activityStatus);
|
|
|
377
|
+
|
424
|
if (activityStatus === ACTIVITY.UNKNOWN) {
|
378
|
if (activityStatus === ACTIVITY.UNKNOWN) {
|
425
|
status = ACTION_BAR_STATUS.END;
|
379
|
status = ACTION_BAR_STATUS.END;
|
426
|
} else if (activityStatus === ACTIVITY.READY) {
|
380
|
} else if (activityStatus === ACTIVITY.READY) {
|
427
|
status = ACTION_BAR_STATUS.READY;
|
381
|
status = ACTION_BAR_STATUS.READY;
|
428
|
- } else if (activityStatus >= ACTIVITY.END) {
|
382
|
+ }
|
|
|
383
|
+
|
|
|
384
|
+ else if (activityStatus >= ACTIVITY.END) {
|
429
|
if (this._isInActivity()) {
|
385
|
if (this._isInActivity()) {
|
430
|
if (activityStatus === ACTIVITY.LUCK) {
|
386
|
if (activityStatus === ACTIVITY.LUCK) {
|
431
|
status = ACTION_BAR_STATUS.LUCK;
|
387
|
status = ACTION_BAR_STATUS.LUCK;
|
432
|
- } else {
|
388
|
+ }
|
|
|
389
|
+ else if (activityStatus === ACTIVITY.END_LESS_PEOPLE || activityStatus === ACTIVITY.END) {
|
|
|
390
|
+ status = ACTION_BAR_STATUS.WAIT;
|
|
|
391
|
+ }
|
|
|
392
|
+ else {
|
433
|
status = ACTION_BAR_STATUS.WAIT;
|
393
|
status = ACTION_BAR_STATUS.WAIT;
|
434
|
}
|
394
|
}
|
435
|
} else {
|
395
|
} else {
|
|
|
396
|
+ if (activityStatus === ACTIVITY.END_LESS_PEOPLE || activityStatus === ACTIVITY.END) {
|
|
|
397
|
+ status = ACTION_BAR_STATUS.PEOPLE_LIMIT_WAIT;
|
|
|
398
|
+ } else {
|
436
|
status = ACTION_BAR_STATUS.END;
|
399
|
status = ACTION_BAR_STATUS.END;
|
437
|
}
|
400
|
}
|
|
|
401
|
+ }
|
438
|
} else {
|
402
|
} else {
|
439
|
if (this._isInActivity()) {
|
403
|
if (this._isInActivity()) {
|
440
|
status = ACTION_BAR_STATUS.ALEADY;
|
404
|
status = ACTION_BAR_STATUS.ALEADY;
|
|
@@ -586,7 +550,6 @@ Page(Object.assign({ |
|
@@ -586,7 +550,6 @@ Page(Object.assign({ |
586
|
var that = this;
|
550
|
var that = this;
|
587
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
551
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
588
|
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) {
|
552
|
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) {
|
589
|
- // console.log('!!!!result',result)
|
|
|
590
|
if (result.code != 200) {
|
553
|
if (result.code != 200) {
|
591
|
that.wetoast.toast({
|
554
|
that.wetoast.toast({
|
592
|
title: result.message,
|
555
|
title: result.message,
|