| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { _decorator, Component, Node, Prefab, instantiate, RichText } from 'cc';
- import { Http } from '../../core/net/Http';
- import { ResourcesUtils } from '../../core/resourceManager/ResourcesUtils';
- import { WindowManager } from '../../core/ui/window/WindowManager';
- import { ConfigData } from '../../Data/ConfigData';
- import { g } from '../../Data/g';
- import { WithdrawIteml } from '../../Item/WithdrawIteml';
- const { ccclass, property } = _decorator;
- @ccclass('WithdrawalList')
- export class WithdrawalList extends Component {
- @property({ tooltip: "item父级节点", type: Node })
- public itemBox: Node;
- @property({ tooltip: "item预制体路径" })
- public itemPrefab = "";
- @property({ tooltip: "提现总金额", type: Node })
- public totalMoney: Node;
- @property({ type: Http, tooltip: "Http服务" })
- http: Http;
- start() {
- }
- private async onOpenHandler() {
- if (g.gameData.hasNewwithdrawalLog) {
- g.gameData.hasNewwithdrawalLog = false;
- let result = await this.http.send("/api/fission/GetContributionLogs");
- if (!result.code) {
- g.gameData.withdrawalLogs = result.data.logs;
- } else {
- WindowManager.showTips(g.CodeMsg[result.code]);
- }
- }
- this.addItems(g.gameData.withdrawalLogs);
- }
- /**
- * TODO 缺少数据
- * @param data 体现记录array
- */
- public async addItems(data: any[]) {
- let num = 0;
- for (let i = 0; i < data.length; i++) {
- let prefabData = await ResourcesUtils.load<Prefab>(this.itemPrefab, null, this.node);
- var itemNode = instantiate(prefabData);
- itemNode.parent = this.itemBox;
- itemNode.getComponent(WithdrawIteml).setData(data[i]);
- num += Math.abs(data[i].value);
- }
- this.totalMoney.getComponent(RichText).string = "<color=#000000>累计提现:</color><color=#ff7f00>" + (num / ConfigData.configMap.get("systemConfig").moneyRate) + "元</color>";//TODO 获取提现金额
- }
- }
|