2
0

fix:充值界面提示错误修复

This commit is contained in:
zhongzm
2025-01-10 16:21:23 +08:00
parent 58723fd191
commit d8f28a5036

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted, inject } from 'vue';
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useBillingStore } from '@/store/modules/billing/billing';
import { useI18n } from 'vue-i18n';
import { submitOrder } from '@/service/api/auth';
@@ -10,8 +10,6 @@ defineOptions({
});
const { t } = useI18n();
// 注入更新仪表盘的方法
const updateDashboard = inject('updateDashboard') as () => Promise<void>;
interface RechargeOption {
amount: number;
@@ -83,7 +81,7 @@ onUnmounted(() => {
const balance = computed(() => billingStore.balance);
// 修改充值处理方法,移除邮箱验证
// 修改充值处理方法
const handleRecharge = async () => {
// 验证金额
if (!paymentAmount.value || paymentAmount.value <= 0) {
@@ -97,11 +95,8 @@ const handleRecharge = async () => {
orderAmount: paymentAmount.value
});
message.success('充值订单提交成功!');
// 更新余额,传入充值金额
await billingStore.updateBalance(paymentAmount.value);
// 更新仪表盘数据
await updateDashboard();
} catch (error) {
message.error('充值失败,请重试!');
console.error('Failed to submit recharge order:', error);