Compare commits
2 Commits
104e04a8cc
...
f02f3f5c04
| Author | SHA1 | Date | |
|---|---|---|---|
| f02f3f5c04 | |||
| adde209c57 |
@@ -42,8 +42,13 @@
|
||||
$ {{ (userInfo.commission / 100 || 0).toFixed(2) }}
|
||||
</div>
|
||||
</div>
|
||||
<Button variant="ghost" class="hover:bg-transparent" @click="walletDialogRef?.show()">
|
||||
点击提现
|
||||
<Button
|
||||
variant="ghost"
|
||||
class="hover:bg-transparent"
|
||||
:disabled="isCheckingWithdrawal"
|
||||
@click="handleWithdrawClick"
|
||||
>
|
||||
{{ hasPendingWithdrawal ? '审核中' : '点击提现' }}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -109,6 +114,8 @@ const inviteStats = ref({
|
||||
history_count: 0,
|
||||
})
|
||||
const isUserLoading = ref(true)
|
||||
const isCheckingWithdrawal = ref(false)
|
||||
const hasPendingWithdrawal = ref(false)
|
||||
async function init() {
|
||||
// 1. 用户信息 & 设备列表
|
||||
isUserLoading.value = true
|
||||
@@ -130,6 +137,8 @@ async function init() {
|
||||
request.get('/api/v1/public/user/invite/stats').then((res: any) => {
|
||||
inviteStats.value = res
|
||||
})
|
||||
|
||||
checkPendingWithdrawal()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
@@ -161,6 +170,43 @@ const referralText = computed(() => {
|
||||
return `超级合伙人 返佣比例${percentage}%`
|
||||
})
|
||||
|
||||
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,
|
||||
})
|
||||
hasPendingWithdrawal.value = (res?.list || []).some((item: any) => item.status === 0)
|
||||
if (hasPendingWithdrawal.value) {
|
||||
toast.info('已有提现申请审核中,请勿重复提交')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error('Check withdrawal logs error:', error)
|
||||
if (showErrorToast) {
|
||||
toast.error('提现记录检查失败,请稍后重试')
|
||||
}
|
||||
return false
|
||||
} finally {
|
||||
isCheckingWithdrawal.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function copy(text: string) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
toast.success('已复制到剪贴板')
|
||||
|
||||
Reference in New Issue
Block a user