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