feat(admin-user): 增加超级管理员实名信息查询

This commit is contained in:
yml
2026-11-22 19:21:24 +08:00
parent 20be2273d5
commit 8c41c258fa
9 changed files with 304 additions and 16 deletions
@@ -47,6 +47,17 @@ export interface AdminWalletAdjustPayload {
reference_no?: string
}
export interface AdminRealnameIdentity {
realname_id: number
user_id: number
tenant_id: number
real_name: string
id_no: string
provider: string
status: string
verified_at?: string
}
export interface AdminGrowthPointsAdjustPayload {
target_points: number
reason: string
@@ -151,6 +162,13 @@ export async function manualAdminUserRealname(
return data.data
}
export async function fetchAdminUserRealname(id: number) {
const { data } = await apiClient.get<ApiResponse<AdminRealnameIdentity>>(
`/admin/users/${id}/realname`
)
return data.data
}
export async function adjustAdminUserWallet(id: number, payload: AdminWalletAdjustPayload) {
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(
`/admin/users/${id}/wallet/adjust`,
@@ -8,6 +8,7 @@ import {
adjustAdminUserGrowthLevel,
adjustAdminUserGrowthPoints,
adjustAdminUserWallet,
fetchAdminUserRealname,
fetchAdminUsers,
freezeAdminUser,
manualAdminUserRealname,
@@ -17,6 +18,7 @@ import {
unfreezeAdminUser,
type AdminUserItem,
type AdminUserQuery,
type AdminRealnameIdentity,
} from '@/features/admin/api/adminUsers'
import { defaultRenterGrowthConfig } from '@/features/admin/api/renterGrowth'
import { centToYuan, formatCent, yuanToCent } from '@/shared/utils/money'
@@ -34,6 +36,7 @@ const canAdjustWallet = computed(() => adminSession.hasPermission('user:wallet_a
const canAdjustGrowthPoints = computed(() => adminSession.hasPermission('user:growth_points'))
const canAdjustGrowthLevel = computed(() => adminSession.hasPermission('user:growth_level'))
const canSetQualityOwner = computed(() => adminSession.hasPermission('user:quality_owner'))
const canViewFullRealname = computed(() => adminSession.isSuperAdmin)
const canViewUserDetail = computed(
() =>
adminSession.hasPermission('wallet:view') ||
@@ -46,6 +49,9 @@ const activeUser = ref<AdminUserItem | null>(null)
const detailUser = ref<AdminUserItem | null>(null)
const quotaUser = ref<AdminUserItem | null>(null)
const realnameUser = ref<AdminUserItem | null>(null)
const realnameIdentityUser = ref<AdminUserItem | null>(null)
const realnameIdentity = ref<AdminRealnameIdentity | null>(null)
const realnameIdentityLoading = ref(false)
const manualRealnameUser = ref<AdminUserItem | null>(null)
const walletUser = ref<AdminUserItem | null>(null)
const growthUser = ref<AdminUserItem | null>(null)
@@ -303,6 +309,25 @@ function openRevokeRealname(row: AdminUserItem) {
revokeRealnameReason.value = ''
}
async function openRealnameIdentity(row: AdminUserItem) {
realnameIdentityUser.value = row
realnameIdentity.value = null
realnameIdentityLoading.value = true
try {
realnameIdentity.value = await fetchAdminUserRealname(row.id)
} catch (error) {
realnameIdentityUser.value = null
ElMessage.error(readError(error, '获取实名信息失败'))
} finally {
realnameIdentityLoading.value = false
}
}
function closeRealnameIdentity() {
realnameIdentityUser.value = null
realnameIdentity.value = null
}
function openManualRealname(row: AdminUserItem) {
manualRealnameUser.value = row
manualRealnameForm.name = ''
@@ -649,6 +674,16 @@ function moneyCent(value: number | string | undefined) {
>
明细
</el-button>
<el-button
v-if="canViewFullRealname && row.realname_status === 'verified'"
text
type="primary"
size="small"
:loading="realnameIdentityLoading && realnameIdentityUser?.id === row.id"
@click="openRealnameIdentity(row)"
>
查看实名
</el-button>
<el-button
v-if="canAdjustWallet"
text
@@ -844,6 +879,43 @@ function moneyCent(value: number | string | undefined) {
</template>
</el-dialog>
<el-dialog
:model-value="!!realnameIdentityUser"
title="实名信息"
width="500px"
destroy-on-close
@update:model-value="(visible: boolean) => !visible && closeRealnameIdentity()"
>
<div v-if="realnameIdentityUser" class="dialog-body">
<p>
<strong>{{ realnameIdentityUser.phone }}</strong> · {{ realnameIdentityUser.nickname }} ·
{{ userSiteLabel(realnameIdentityUser) }}
</p>
<el-descriptions v-loading="realnameIdentityLoading" :column="1" border>
<el-descriptions-item label="姓名">
{{ realnameIdentity?.real_name || '-' }}
</el-descriptions-item>
<el-descriptions-item label="身份证号">
<code>{{ realnameIdentity?.id_no || '-' }}</code>
</el-descriptions-item>
<el-descriptions-item label="实名状态">
{{
realnameIdentity?.status === 'verified' ? '已实名' : realnameIdentity?.status || '-'
}}
</el-descriptions-item>
<el-descriptions-item label="认证时间">
{{ formatDateTime(realnameIdentity?.verified_at, '未记录') }}
</el-descriptions-item>
<el-descriptions-item label="认证服务商">
{{ realnameIdentity?.provider || '-' }}
</el-descriptions-item>
</el-descriptions>
</div>
<template #footer>
<el-button @click="closeRealnameIdentity">关闭</el-button>
</template>
</el-dialog>
<el-dialog
:model-value="!!quotaUser"
title="设置人工免押额度"