diff --git a/src/pages/UserCenter/components/UserInfo/index.vue b/src/pages/UserCenter/components/UserInfo/index.vue index d4c10f7..60fa99f 100644 --- a/src/pages/UserCenter/components/UserInfo/index.vue +++ b/src/pages/UserCenter/components/UserInfo/index.vue @@ -48,7 +48,7 @@ :disabled="isCheckingWithdrawal" @click="handleWithdrawClick" > - 点击提现 + {{ hasPendingWithdrawal ? '审核中' : '点击提现' }} @@ -115,6 +115,7 @@ const inviteStats = ref({ }) const isUserLoading = ref(true) const isCheckingWithdrawal = ref(false) +const hasPendingWithdrawal = ref(false) async function init() { // 1. 用户信息 & 设备列表 isUserLoading.value = true @@ -136,6 +137,8 @@ async function init() { request.get('/api/v1/public/user/invite/stats').then((res: any) => { inviteStats.value = res }) + + checkPendingWithdrawal() } onMounted(() => { @@ -168,23 +171,37 @@ const referralText = computed(() => { }) async function handleWithdrawClick() { + if (hasPendingWithdrawal.value) { + toast.info('已有提现申请审核中,请勿重复提交') + return + } if (isCheckingWithdrawal.value) return + const canWithdraw = await checkPendingWithdrawal(true) + if (canWithdraw) { + walletDialogRef.value?.show() + } +} + +async function checkPendingWithdrawal(showErrorToast = false) { try { isCheckingWithdrawal.value = true const res: any = await request.get('/api/v1/public/user/withdrawal_log', { page: 1, size: 20, }) - const hasPendingWithdrawal = (res?.list || []).some((item: any) => item.status === 0) - if (hasPendingWithdrawal) { + hasPendingWithdrawal.value = (res?.list || []).some((item: any) => item.status === 0) + if (hasPendingWithdrawal.value) { toast.info('已有提现申请审核中,请勿重复提交') - return + return false } - walletDialogRef.value?.show() + return true } catch (error) { console.error('Check withdrawal logs error:', error) - toast.error('提现记录检查失败,请稍后重试') + if (showErrorToast) { + toast.error('提现记录检查失败,请稍后重试') + } + return false } finally { isCheckingWithdrawal.value = false }