| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { AppKernel } from '@scripts/app/AppKernel';
- import { UIViewID } from '@scripts/define/UIDefine';
- import { UIPopup } from '@scripts/framework/ui/UIPopup';
- import { formatCurrency, formatGoodsNum } from '@scripts/utils/Helper';
- import { addBtnClick } from '@scripts/utils/UIHelper';
- import { _decorator, Component, Label, Node } from 'cc';
- const { ccclass, property } = _decorator;
- export interface UIPayoutResultData {
- success?: boolean;
- amount?: string;
- msg?: string;
- }
- @ccclass('UIPayoutResult')
- export class UIPayoutResult extends UIPopup<UIPayoutResultData> {
- readonly viewId: UIViewID = UIViewID.UIPayoutResult;
- @property(Node)
- btnClose: Node;
- @property(Node)
- btnConfirm: Node;
- @property(Node)
- iconSuccess: Node;
- @property(Node)
- iconFail: Node;
- @property(Label)
- lblMsg: Label;
- protected onCreate() {
- addBtnClick(this.btnClose, this.closeSelf, this);
- addBtnClick(this.btnConfirm, this.closeSelf, this);
- }
- protected onOpen(data: UIPayoutResultData) {
- this.updateView(data.success, data.amount, data.msg);
- const success = data.success;
- const amount = data.amount;
- const msg = data.msg;
- let key = msg;
- if (!msg) key = success ? "payout.result_success" : "payout.result_fail";
- this.lblMsg.string = AppKernel.i18n.t(key, amount);
- this.iconSuccess.active = success;
- this.iconFail.active = !success;
- }
- private updateView(success: boolean, amount: string, msg: string) {
- const key = success ? "payout.result_success" : "payout.result_fail";
- this.lblMsg.string = AppKernel.i18n.t(key, amount);
- this.iconSuccess.active = success;
- this.iconFail.active = !success;
- }
- }
|