Authored by 李奇

人数导致的活动结束显示为待开奖

... ... @@ -40,6 +40,10 @@
<block wx:elif="{{status === 6}}">
<view class="action-item over">活动已结束</view>
</block>
<block wx:elif="{{status === 7}}">
<view class="action-item over">等待开奖中</view>
</block>
</view>
<new-lucky-alert wx:if="{{show}}" bindhiddenalert="hiddenAlert">
... ... @@ -54,16 +58,6 @@
</form>
<view class="share-desc">1个好友参加=1个抽奖码=中奖几率UP!</view>
</view>
<!-- <form bindsubmit='submitFormId' report-submit='true'>
<view class="foot">
<button class="foot-item info" plain="true" hover-class="none" form-type="submit" bindtap="goShare">去分享</button>
<button class="foot-item" plain="true" hover-class="none" form-type="submit" bindtap="cancelAlert">取消</button>
</view>
</form> -->
<!-- <view class="foot-item info" bindtap="goShare">去分享</view>
<view class="foot-item" bindtap="cancelAlert">取消</view> -->
</new-lucky-alert>
<zero-alert wx:if="{{error}}">
... ...
... ... @@ -17,7 +17,7 @@
</block>
<block wx:elif="{{item.status === 5}}">
<view class="btn">人数不足 活动结束</view>
<view class="btn">等待开奖中</view>
</block>
<block wx:else>
... ...
... ... @@ -11,12 +11,16 @@
<view class="btn ok" catchtap="onClick">参加抽奖</view>
</block>
<block wx:elif="{{product.status === 3 || product.status === 4}}">
<block wx:elif="{{product.status === 3}}">
<view class="btn cancel">等待开奖中</view>
</block>
<block wx:elif="{{product.status === 4}}">
<view class="btn cancel">活动结束</view>
</block>
<block wx:elif="{{product.status === 5}}">
<view class="btn cancel">人数不足 活动结束</view>
<view class="btn cancel">等待开奖中</view>
</block>
<block wx:else>
... ...
// page/subPackage/pages/zeroSell/detail.js
import ZeroSellService from './service/zero-sell'
import CommonService from './service/common'
import {
... ... @@ -31,18 +29,10 @@ const ACTIVITY = {
READY: 1, // 活动未开始
START: 2, // 活动开始
END: 3, // 活动结束
LUCK: 4, // 抽奖结束
LUCK: 4, // 活动已开奖、抽奖结束
END_LESS_PEOPLE: 5 // 人数不足
}
const STEP = {
ZERO: 0,
FIRST: 1,
SECOND: 2,
THIRD: 3,
FOURTH: 4,
}
const ACTION_BAR_STATUS = {
UNKNOWN: 0,
READY: 1, // 未开始
... ... @@ -51,6 +41,7 @@ const ACTION_BAR_STATUS = {
WAIT: 4, // 等待抽奖中
LUCK: 5, // 抽奖结束
END: 6, // 活动结束
PEOPLE_LIMIT_WAIT: 7 // 人数达到活动限制、已满员、人数不足统一为待开奖状态
}
let app = getApp();
... ... @@ -66,12 +57,10 @@ Page(Object.assign({
actPrizeId: '',
shareUid: 0,
scene: '',
participantCount: 0,
myPrizeCount: 0,
product: {},
avatars: [],
recommends: [],
step: STEP.ZERO,
actionStatus: ACTION_BAR_STATUS.UNKNOWN,
snapData: {},
hasUnionID: false,
... ... @@ -346,8 +335,6 @@ Page(Object.assign({
product_qrCode: qrcode
};
let participantCount = r1.code === 200 ? r1.data.joinNum : 0;
this.setData({
product: product,
recommends: r2.code === 200 ? r2.data : [],
... ... @@ -358,14 +345,12 @@ Page(Object.assign({
}),
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
participantCount,
snapData,
notice: JSON.parse(product.notice || '{}'),
lottery: JSON.parse(product.lottery_info || '{}')
});
this._setActionStatus();
this._setStep();
} else {
return Promise.reject();
}
... ... @@ -383,57 +368,36 @@ Page(Object.assign({
})
})
},
_setStep() {
let step = STEP.ZERO;
let activityStatus = this.data.product.status;
let myPrizeCount = this.data.myPrizeCount;
if (myPrizeCount === 0) {
step = STEP.ZERO
} else {
if (activityStatus === ACTIVITY.START) {
let myPrizeCount = this.data.myPrizeCount;
if (myPrizeCount === 0) {
step = STEP.ZERO;
} else if (myPrizeCount === 1) {
step = STEP.FIRST;
} else if (myPrizeCount >= 2) {
step = STEP.SECOND;
} else {
step = STEP.ZERO;
}
} else if (activityStatus === ACTIVITY.END || activityStatus === ACTIVITY.LUCK) {
step = STEP.THIRD;
} else if (activityStatus === ACTIVITY.END_LESS_PEOPLE) {
step = STEP.FOURTH;
} else {
step = STEP.ZERO;
}
}
this.setData({
step: step
});
},
_setActionStatus() {
let status = ACTION_BAR_STATUS.START;
let activityStatus = this.data.product.status;
console.log('hahahaha')
console.log(activityStatus);
if (activityStatus === ACTIVITY.UNKNOWN) {
status = ACTION_BAR_STATUS.END;
} else if (activityStatus === ACTIVITY.READY) {
status = ACTION_BAR_STATUS.READY;
} else if (activityStatus >= ACTIVITY.END) {
}
else if (activityStatus >= ACTIVITY.END) {
if (this._isInActivity()) {
if (activityStatus === ACTIVITY.LUCK) {
status = ACTION_BAR_STATUS.LUCK;
} else {
}
else if (activityStatus === ACTIVITY.END_LESS_PEOPLE || activityStatus === ACTIVITY.END) {
status = ACTION_BAR_STATUS.WAIT;
}
else {
status = ACTION_BAR_STATUS.WAIT;
}
} else {
status = ACTION_BAR_STATUS.END;
if (activityStatus === ACTIVITY.END_LESS_PEOPLE || activityStatus === ACTIVITY.END) {
status = ACTION_BAR_STATUS.PEOPLE_LIMIT_WAIT;
} else {
status = ACTION_BAR_STATUS.END;
}
}
} else {
if (this._isInActivity()) {
... ... @@ -586,7 +550,6 @@ Page(Object.assign({
var that = this;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
decodePhoneNumber(e.detail.iv, e.detail.encryptedData, '', function (result) {
// console.log('!!!!result',result)
if (result.code != 200) {
that.wetoast.toast({
title: result.message,
... ...
... ... @@ -2,10 +2,6 @@
<product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
<view class="open-shadow"></view>
<view class="code-list" animation="{{animation}}">
... ...