活动:弹出商店结算奖励修改

This commit is contained in:
qiaoxin
2021-05-20 11:19:20 +08:00
parent ca19f04282
commit 3823174971
5 changed files with 91 additions and 26 deletions
@@ -7,6 +7,8 @@ import { ActivityBase } from './activityField';
// 商品数据
export class PopUpShopItem {
id: number; // 第几个,从1开始
consume: string; //消耗资源(这里优先rmb的price价格,其次资源消耗)
price: number; // 商品价格
productID: string; // 商品id支付时使用
reward: string; //任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
countMax: number = 0; //可购买的最大次数,0表示不限制
@@ -18,7 +20,9 @@ export class PopUpShopItem {
this.id = data.id;
this.reward = data.reward;
this.countMax = data.countMax;
this.productID = data.productID;
this.consume = data.consume ? data.consume : '';
this.price = data.price ? data.price : 0;
this.productID = data.productID ? data.productID : '';
this.name = data.name;
}
}
@@ -29,6 +33,10 @@ export class PopUpShopData {
taskId: number = 0;//id
list: Array<PopUpShopItem> = [];//每件商品信息
public findItemByProductID(productID: string) {
let index = this.list.findIndex(obj => { return obj && obj.productID === productID });
return (index != -1) ? this.list[index] : null
}
public findItem(id: number) {
let index = this.list.findIndex(obj => { return obj && obj.id === id });