支付页面

qrcode生成,剪贴板sdk
This commit is contained in:
2025-09-18 23:33:06 +08:00
parent 85c8b51316
commit de0c97fc05
29 changed files with 3202 additions and 1852 deletions
@@ -53,8 +53,8 @@ export class PurchasePanel extends li_BaseView {
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
this.onVipExpireChange();
});
Utils.addInnerEL(InnerMsgCode.PayOrderCreateSucc, this, () => {
this.createOrRefreshWeb3PayPanel;
Utils.addInnerEL(InnerMsgCode.PayOrderCreateSucc, this, (data) => {
this.createOrRefreshWeb3PayPanel(data);
});
for (let index = 0; index < this.items.length; index++) {
@@ -75,6 +75,7 @@ export class PurchasePanel extends li_BaseView {
},
this
);
GButton.BandClick(
this._nodeTab.Buy30DayVipBtn,
() => {
@@ -85,6 +86,22 @@ export class PurchasePanel extends li_BaseView {
},
this
);
GButton.BandClick(
this._nodeTab.cashBtn,
() => {
// 购买7天会员
this.onClickCashBtn();
},
this
);
GButton.BandClick(
this._nodeTab.web3Btn,
() => {
// 购买7天会员
this.onClickWeb3Btn();
},
this
);
GButton.BandClick(
this._nodeTab.ReturnBtn,
() => {
@@ -145,6 +162,12 @@ export class PurchasePanel extends li_BaseView {
// 需要外部支付进行购买
this.startPayment(id, this.currentPayType, networkType);
}
//测试用
// Utils.sendInnerMsg(InnerMsgCode.PayOrderCreateSucc, {
// orderId: 123,
// payType: 1,
// goodId: 1001,
// });
}
createOrRefreshWeb3PayPanel(param: any) {
@@ -159,7 +182,7 @@ export class PurchasePanel extends li_BaseView {
if (
NavigationManager.Instance.getCurrentActivePanel() == PanelType.PERSONAL
)
if (this.web3PopPanel === null)
if (this.web3PopPanel == null)
NavigationManager.Instance.openSubPanel(
"Web3PopPanel",
this.node,
@@ -7,6 +7,9 @@ import { OrderData } from "../../data/OrderData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import ResManager from "../../../Main/Manager/ResManager";
import { PurchasePanel } from "./PurchasePanel";
import { QRCodeGenerator } from "db://assets/utils/qrcodeGenerator";
import { TipsPanel } from "./TipsPanel";
import { SDKManager } from "../../../Main/Channel/SDKManager";
const { ccclass, property } = _decorator;
@@ -21,6 +24,7 @@ export class Web3PopPanel extends li_BaseView {
private expireTimeText: Label;
private selection: Node;
private qrCode: Sprite;
private curType: proto.cs.EnmNetworkType;
private orderId;
@@ -43,6 +47,7 @@ export class Web3PopPanel extends li_BaseView {
this.coinText = this._nodeTab.SelectedCoinText.getComponent(Label);
this.address = this._nodeTab.addressText.getComponent(Label);
this.expireTimeText = this._nodeTab.expireTimeText.getComponent(Label);
this.qrCode = this._nodeTab.qrCode.getComponent(Sprite);
this.registerListener();
this.selection.setScale(new Vec3(1, 0, 1));
@@ -107,6 +112,7 @@ export class Web3PopPanel extends li_BaseView {
const expireTime = OrderData.getExpireById(this.orderId);
const retCode = OrderData.getRetCodeById(this.orderId);
this.expireTimeText.string = expireTime.toString();
this.amount.string = amount;
this.address.string = walletUrl;
switch (this.networkType) {
@@ -139,6 +145,21 @@ export class Web3PopPanel extends li_BaseView {
this.coinText.string = "ENT_BEP";
break;
}
//this.address.string = "asdasdasd";
//refreshQRcode
QRCodeGenerator.generateQRCodeSpriteFrame(
this.address.string,
320,
4,
(spriteframe) => {
if (spriteframe) {
this.qrCode.spriteFrame = spriteframe;
} else {
TipsPanel.show("qrcode generation fail, please copy url");
}
}
);
}
updateSelectNetwork() {}
@@ -166,7 +187,15 @@ export class Web3PopPanel extends li_BaseView {
}
onClickCopy() {
//todo:copy 功能
const stringToCopy = this.address.string;
SDKManager.copyToClipboard(stringToCopy, (success: boolean) => {
if (success) {
TipsPanel.show("地址已复制到剪贴板");
} else {
TipsPanel.show("复制失败,请手动复制地址");
}
});
}
onClickClose() {