活动:签到添加vip标识

This commit is contained in:
qiaoxin
2021-05-15 15:46:26 +08:00
parent 089617b6e9
commit 26de3569f8
2 changed files with 13 additions and 6 deletions

View File

@@ -16,7 +16,6 @@ export class SignInItem {
isReceive: boolean = false; //是否领取
constructor(data: any) {
console.log('dddddddddd', data)
this.dayIndex = data.dayIndex;
this.reward = data.reward;
}
@@ -52,6 +51,9 @@ export class SignInData extends ActivityBase {
list: Array<SignInItem> = [];
roundIndex: number = 0;//活动周期
todayIndex: number = 0;//本月第几天
price: number = 0;//vip价格普通签到为0
productID: string = '';//商品ID
isVip: boolean = false;//是否购买了当前的vip活动
//第几天的签到奖励
public findDayItem(dayIndex: number) {
@@ -67,15 +69,20 @@ export class SignInData extends ActivityBase {
obj.isReceive = data[index].isReceive;
}
}
let isBuy = data.findIndex(obj => { return obj.dayIndex == 0 });
this.isVip = (isBuy != -1)
}
public initData(data: string) {
let arr = JSON.parse(data);
this.roundIndex = moment(this.beginTime).diff(moment(), 'months');
let dataObj = JSON.parse(data);
this.price = dataObj.price;
this.productID = dataObj.productID;
this.roundIndex = moment().diff(moment(this.beginTime).startOf('months'), 'months') + 1;
console.log('dddddddddddd', this.roundIndex);
this.todayIndex = moment(Date.now()).date();
let arr = dataObj.data
for (let obj of arr) {
console.log('obj', obj)
this.list.push(new SignInItem(obj))