修复仲裁退款并新增免押额度
This commit is contained in:
@@ -5,6 +5,7 @@ import { ref } from 'vue'
|
||||
import {
|
||||
fetchAdminUsers,
|
||||
freezeAdminUser,
|
||||
setAdminUserDepositFreeQuota,
|
||||
unfreezeAdminUser,
|
||||
type AdminUserItem,
|
||||
} from '@/features/admin/api/adminUsers'
|
||||
@@ -15,7 +16,9 @@ import AdminTablePagination from '../components/AdminTablePagination.vue'
|
||||
|
||||
const submitting = ref(false)
|
||||
const activeUser = ref<AdminUserItem | null>(null)
|
||||
const quotaUser = ref<AdminUserItem | null>(null)
|
||||
const freezeReason = ref('')
|
||||
const quotaAmount = ref(0)
|
||||
|
||||
const {
|
||||
loading,
|
||||
@@ -33,6 +36,26 @@ function openFreeze(row: AdminUserItem) {
|
||||
freezeReason.value = ''
|
||||
}
|
||||
|
||||
function openDepositQuota(row: AdminUserItem) {
|
||||
quotaUser.value = row
|
||||
quotaAmount.value = Number(row.deposit_free_quota || 0)
|
||||
}
|
||||
|
||||
async function handleSetDepositQuota() {
|
||||
if (!quotaUser.value) return
|
||||
submitting.value = true
|
||||
try {
|
||||
await setAdminUserDepositFreeQuota(quotaUser.value.id, quotaAmount.value)
|
||||
ElMessage.success('免押额度已更新')
|
||||
quotaUser.value = null
|
||||
await loadUsers()
|
||||
} catch (error) {
|
||||
ElMessage.error(readError(error, '设置免押额度失败'))
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFreeze() {
|
||||
if (!activeUser.value) return
|
||||
submitting.value = true
|
||||
@@ -68,6 +91,10 @@ function readError(error: unknown, fallback: string) {
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
function money(value: number | string | undefined) {
|
||||
return Number(value || 0).toFixed(2)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -88,11 +115,21 @@ function readError(error: unknown, fallback: string) {
|
||||
<el-table-column label="状态" width="110">
|
||||
<template #default="{ row }">{{ userStatusLabel(row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="免押额度" width="130">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_quota) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已占用" width="120">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_used) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="剩余免押" width="120">
|
||||
<template #default="{ row }">¥{{ money(row.deposit_free_remaining) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="注册时间" min-width="180">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column label="操作" width="220">
|
||||
<template #default="{ row }">
|
||||
<el-button size="small" @click="openDepositQuota(row)">免押</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'active'"
|
||||
size="small"
|
||||
@@ -145,5 +182,36 @@ function readError(error: unknown, fallback: string) {
|
||||
<el-button type="danger" :loading="submitting" @click="handleFreeze">确认冻结</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
:model-value="!!quotaUser"
|
||||
title="设置免押额度"
|
||||
width="520px"
|
||||
@update:model-value="quotaUser = null"
|
||||
>
|
||||
<div v-if="quotaUser" class="dialog-body">
|
||||
<p>
|
||||
<strong>{{ quotaUser.phone }}</strong> · {{ quotaUser.nickname }}
|
||||
</p>
|
||||
<p>
|
||||
已占用 ¥{{ money(quotaUser.deposit_free_used) }},剩余 ¥{{
|
||||
money(quotaUser.deposit_free_remaining)
|
||||
}}
|
||||
</p>
|
||||
<el-input-number
|
||||
v-model="quotaAmount"
|
||||
class="full-control"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="100"
|
||||
/>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button :disabled="submitting" @click="quotaUser = null">取消</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSetDepositQuota"
|
||||
>保存额度</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user