This commit is contained in:
2025-09-19 00:50:31 +08:00
parent de0c97fc05
commit ad0e80ecda
3 changed files with 203 additions and 153 deletions
@@ -29,7 +29,8 @@ export class PurchasePanel extends li_BaseView {
private currentPayType: proto.cs.EnmPayType =
proto.cs.EnmPayType.EPT_Cash_INR;
private defaultNetworkType: proto.cs.EnmNetworkType.ENT_TRON;
private defaultNetworkType: proto.cs.EnmNetworkType =
proto.cs.EnmNetworkType.ENT_TRON;
public web3PopPanel: Web3PopPanel;
@property([PurchasePanelItem])
public items: PurchasePanelItem[] = [];
@@ -53,9 +54,11 @@ export class PurchasePanel extends li_BaseView {
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
this.onVipExpireChange();
});
Utils.addInnerEL(InnerMsgCode.PayOrderCreateSucc, this, (data) => {
this.createOrRefreshWeb3PayPanel(data);
});
Utils.addInnerEL(
InnerMsgCode.PayOrderCreateSucc,
this,
this.createOrRefreshWeb3PayPanel
);
for (let index = 0; index < this.items.length; index++) {
const element = this.items[index];
@@ -171,11 +174,11 @@ export class PurchasePanel extends li_BaseView {
}
createOrRefreshWeb3PayPanel(param: any) {
const data = {
let data = {
orderId: param.orderId,
payType: param.payType,
goodId: param.goodId,
networkType: this.defaultNetworkType,
networkType: this.getDefaultNetworkType(),
base: this,
};
@@ -189,6 +192,7 @@ export class PurchasePanel extends li_BaseView {
data
);
else {
data.networkType = undefined;
this.web3PopPanel.refreshData(data);
this.web3PopPanel.refreshView();
}
@@ -93,14 +93,12 @@ export class Web3PopPanel extends li_BaseView {
);
}
init() {
this.curType = 1;
}
refreshData(data: any): void {
this.orderId = data.orderId;
this.payType = data.payType;
this.goodId = data.goodId;
this.networkType = data.networkType;
this.curType =
data.networkType != undefined ? data.networkType : this.curType;
this.base = data.base;
}
refreshView() {
@@ -115,7 +113,7 @@ export class Web3PopPanel extends li_BaseView {
this.expireTimeText.string = expireTime.toString();
this.amount.string = amount;
this.address.string = walletUrl;
switch (this.networkType) {
switch (this.curType) {
case proto.cs.EnmNetworkType.ENT_TRON:
ResManager.I.changeResourceSpriteFrame(
this.coinIcon,
@@ -180,7 +178,6 @@ export class Web3PopPanel extends li_BaseView {
case proto.cs.EnmNetworkType.ENT_BEP:
break;
}
this.base.startPayment(this.goodId, proto.cs.EnmPayType.EPT_WEB3_USD, type);
this.selection.scale = new Vec3(1, 0, 1);
@@ -199,6 +196,7 @@ export class Web3PopPanel extends li_BaseView {
}
onClickClose() {
this.base.web3PopPanel = null;
this.close();
}
}