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 { 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; } }