| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { AppKernel } from '@scripts/app/AppKernel';
- import { CURRENCY_TYPE } from '@scripts/define/Define';
- import { PayoutType } from '@scripts/define/PayDefine';
- 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 UIPayoutData {
- amount: number;
- reallAmount?: number;
- feeAmount?: number;
- feePercent: number;
- method: string;
- account: string;
- payoutType?: PayoutType;
- }
- @ccclass('UIPayoutConfrim')
- export class UIPayoutConfrim extends UIPopup<UIPayoutData> {
- readonly viewId: UIViewID = UIViewID.UIPayoutConfrim;
- @property(Node)
- btnClose: Node;
- @property(Label)
- lblCount: Label;
- @property(Label)
- lblAmount: Label;
- @property(Label)
- lblFeePercent: Label;
- @property(Label)
- lblFee: Label;
- @property(Label)
- lblExchange: Label;
- @property(Label)
- lblMethod: Label;
- @property(Label)
- lblAccount: Label;
- @property(Node)
- btnConfirm: Node;
- private m_data: UIPayoutData;
- private m_payouting = false;
- protected onCreate() {
- addBtnClick(this.btnClose, this.closeSelf, this);
- addBtnClick(this.btnConfirm, this.onBtnConfirmClick, this);
- }
- private async onBtnConfirmClick() {
- if (this.m_payouting) return;
- this.m_payouting = true;
- AppKernel.ui.loading(true);
- const amount = this.m_data.amount;
- const withdraw = AppKernel.stores.withdrawStore;
- if (await withdraw.reqWithdrawPayout(amount)) {
- this.closeSelf();
- AppKernel.ui.open(UIViewID.UIPayoutResult, {
- success: true,
- msg: "payout.submitted"
- })
- }
- this.m_payouting = false;
- AppKernel.ui.loading(false);
- }
- protected onOpen(data: UIPayoutData) {
- this.m_data = data;
- this.lblCount.string = "$" + formatCurrency(data.reallAmount, 2);
- this.lblAmount.string = formatCurrency(data.amount, 2) + " " + CURRENCY_TYPE.SC;
- this.lblFeePercent.string = AppKernel.i18n.t("redeem.service_fee", data.feePercent);
- this.lblFee.string = formatCurrency(data.feeAmount, 2) + " " + CURRENCY_TYPE.SC;
- this.lblMethod.string = data.method;
- this.lblAccount.string = data.account;
- this.lblExchange.string = AppKernel.i18n.t("redeem.conversion");
- }
- }
|