更新聊天次数购买弹窗

修复bug
This commit is contained in:
2025-10-14 11:00:49 +08:00
parent b4b1d347fc
commit 0088515f2a
21 changed files with 2473 additions and 2115 deletions
@@ -238,7 +238,6 @@ export class ChatController {
return false;
}
} catch (error) {
ErrorHandler.Instance.handleApiError(
error,
"ChatController.sendMessage",
@@ -16,12 +16,16 @@ export class ChargePopPanel extends li_BaseView {
Utils.parseNode(this.node, this._nodeTab);
GButton.BandClick(this._nodeTab.chargeBtn, this.gotoCharge, this);
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
GButton.BandClick(this._nodeTab.closeBtn, this.Close, this);
}
gotoCharge() {
NavigationManager.Instance.openPopupPanel("PurchasePanel");
this.close();
this.Close();
}
Close() {
NavigationManager.Instance.closePopupPanel(this.node);
}
}
@@ -22,7 +22,6 @@ import { ChatContentsLayout } from "../components/ChatContentsLayout";
import { ImagePopup } from "../components/ImagePopup";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { PriceType, VideoEmotion, purchase } from "../../../schema/schema";
import { PayToTalkSubpanel } from "./PayToTalkSubpanel";
import { DataId, DataManager } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { SceneBgVideoLayer } from "../../../Sub/UI/SceneBgVideoLayer";
@@ -39,9 +38,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
manager: DialogManager = null;
private chatController: ChatController = null;
@property(PayToTalkSubpanel)
payToTalkPanel: PayToTalkSubpanel = null;
@property(EditBox)
editBox: EditBox = null;
@@ -105,7 +101,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.register();
//this.refresh();
this.payToTalkPanel.node.active = false;
// 检查 SceneBgVideoLayer 是否可用
if (!this.videoLayer) {
@@ -470,7 +465,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
onChatLimitReached(): void {
this.payToTalkPanel.show(this.categoryId, this.id);
NavigationManager.Instance.openPopupPanel("PayToTalkPanel", {
categoryId: this.categoryId,
girlId: this.id,
});
TipsPanel.show(LanguageUtils.getText("chat_error_code_1001"));
}
/**
@@ -17,41 +17,33 @@ import { ConfigId, ConfigManager } from "../../manager/ConfigManager";
import { PurchaseConfig } from "../../config/PurchaseConfig";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import li_BaseView from "../../../Main/Common/li_BaseView";
import { TipsPanel } from "./TipsPanel";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@ccclass("PayToTalkSubpanel")
export class PayToTalkSubpanel extends Component {
@property(Label)
timeLabel: Label = null;
@property(Label)
timeBtnLabel: Label = null;
@property(Label)
vipLabel: Label = null;
@property(Label)
vipBtnLabel: Label = null;
@ccclass("PayToTalkPanel")
export class PayToTalkPanel extends li_BaseView {
base: UIOpacity;
categoryId: number;
girlId: number;
protected onLoad(): void {
categoryId: string;
girlId: number;
openUIDataCT(data) {
this.categoryId = data.categoryId;
this.girlId = data.girlId;
}
onLoadCT(): void {
this.base = this.getComponent(UIOpacity);
this.show();
}
show(categoryId: string, girlId: number) {
show() {
if (!this.base) this.base = this.getComponent(UIOpacity);
this.node.active = true;
this.base.opacity = 0;
this.categoryId = Number(categoryId);
this.girlId = girlId;
const cfg = ConfigManager.I.getDataById<PurchaseConfig>(ConfigId.Purchase);
const count = cfg.getCountById(cfg.getChatIds()[0]);
this.timeBtnLabel.string =
count + LanguageUtils.getText("chatpanel.buy10times");
tween(this.base).to(0.3, { opacity: 255 }).start();
}
@@ -63,7 +55,7 @@ export class PayToTalkSubpanel extends Component {
{ opacity: 0 },
{
onComplete: () => {
this.base.node.active = false;
NavigationManager.Instance.closePopupPanel(this.node);
},
}
)
@@ -86,9 +78,13 @@ export class PayToTalkSubpanel extends Component {
onClick_BuyVip() {
//购买VIP
logger.log("购买vip");
const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
const memberId = shopData.get7DayMemberId();
this.reqBuyGood(memberId, this.girlId);
// const shopData = DataManager.I.getDataById<ShopData>(DataId.Shop);
// const memberId = shopData.get7DayMemberId();
// this.reqBuyGood(memberId, this.girlId);
NavigationManager.Instance.openPopupPanel("PurchasePanel");
}
onClickClose() {
this.hide();
}
// 使用余额购买商品
@@ -105,7 +101,7 @@ export class PayToTalkSubpanel extends Component {
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setChatRemainCount(
this.categoryId.toString(),
this.categoryId,
girlId,
resData.chatRemainCount
);
@@ -113,7 +109,14 @@ export class PayToTalkSubpanel extends Component {
walletData.balance = Number(resData.balance);
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
TipsPanel.show(LanguageUtils.getText("payment.succeed"));
this.hide();
} else {
if (res && res.code) {
const key = "error_code_" + res.code;
TipsPanel.show(LanguageUtils.getText(key));
}
}
}
}
@@ -107,7 +107,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
}
Close() {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
async buyAsset() {
// 购买id为girlId的女生
@@ -145,7 +145,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
} else {
NavigationManager.Instance.openPopupPanel("ChargePopPanel");
}
this.close();
this.Close();
}
// 刷新余额
private refreshCoinNum() {
@@ -129,7 +129,7 @@ export class PurchasePanel extends li_BaseView {
GButton.BandClick(
this._nodeTab.ReturnBtn,
() => {
NavigationManager.Instance.closeSubPanel(this);
NavigationManager.Instance.closePopupPanel(this.node);
},
this
);
@@ -14,6 +14,7 @@ import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { PersonalPanel } from "./PersonalPanel";
import { PaymentMethod } from "db://assets/Scripts/chat18x/payment/types";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@@ -260,7 +261,7 @@ export class Web3PopPanel extends li_BaseView {
onClickClose() {
this.stopCountdown();
this.payPanel.web3PopPanel = null;
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
private formatCountdownTime(seconds: number): string {