import { AppKernel } from '@scripts/app/AppKernel'; import { IPayoutGear, PayoutGears, PayoutType } from '@scripts/define/PayDefine'; import { UIViewID } from '@scripts/define/UIDefine'; import { UIPopup } from '@scripts/framework/ui/UIPopup'; import { addBtnClick } from '@scripts/utils/UIHelper'; import { _decorator, Component, EditBox, Label, Node } from 'cc'; const { ccclass, property } = _decorator; @ccclass('UIPayoutEditor') export class UIPayoutEditor extends UIPopup { readonly viewId: UIViewID = UIViewID.UIPayoutEditor; @property(Node) btnClose: Node; @property(Node) btnConfirm: Node; @property(Label) lblName: Label; @property(EditBox) inputAccount: EditBox; @property(EditBox) inputConfirm: EditBox; private m_gear: IPayoutGear; protected onCreate() { addBtnClick(this.btnClose, this.closeSelf, this); addBtnClick(this.btnConfirm, this.onBtnConfirmClick, this); } private async onBtnConfirmClick() { const account = this.inputAccount.string; const reAccount = this.inputConfirm.string; if (!account || account.length === 0) { AppKernel.ui.toast("payout.edit.account_empty", true); return; } if (reAccount !== account) { AppKernel.ui.toast("payout.edit.account_nosame", true); return; } let params: any = { pixType: 0 }; params.pixType = this.m_gear.pixType; switch (this.m_gear.type) { case PayoutType.CashApp: params.cashTag = account; break; case PayoutType.Paypal: params.paypal = account; break; } AppKernel.ui.loading(true); const withdraw = AppKernel.stores.withdrawStore; await withdraw.reqWithdrawSetInfo(params) AppKernel.ui.loading(false); } protected onOpen(type: PayoutType) { const gear = PayoutGears.find(gear => gear.type === type); if (!gear) return; this.m_gear = gear; this.lblName.string = gear.name; } }