实现Salon工作台注册审核闭环

This commit is contained in:
2026-09-07 12:09:42 +08:00
parent 28c2c2603e
commit b4af2d6ab1
30 changed files with 584 additions and 22 deletions
@@ -108,7 +108,7 @@ const visibleModules = computed(() => {
{
key: 'products',
title: '作品管理',
description: '维护作品、标签、可预约美甲师和优惠券。',
description: '维护作品、标签、可预约员工和优惠券。',
path: '/admin/products',
icon: ShopOutlined,
permissionCode: 'product:view',
@@ -134,8 +134,8 @@ const visibleModules = computed(() => {
},
{
key: 'artists',
title: '美甲师',
description: '查看状态、技能与作品挂载关系。',
title: '员工',
description: '查看员工状态、技能与排班关系。',
path: '/admin/nail-artists',
icon: TeamOutlined,
permissionCode: 'nail_artist:view',
@@ -548,7 +548,7 @@ const getUserTypeText = (type: number) => {
const map: Record<number, string> = {
0: '用户',
2: '店长',
3: '美甲师',
3: '店员',
4: '管理员'
}
return map[type] || '未知'
@@ -565,12 +565,12 @@ const filteredUserList = computed(() => {
return userList.value.filter(user => user.type !== 0 && !sameId(user.id, currentUserId))
}
// 店长只能看到美甲师(除了自己)
// 店长只能看到店员(除了自己)
if (currentLoginUser.value.type === 2) {
return userList.value.filter(user => user.type === 3 && !sameId(user.id, currentUserId))
}
// 其他用户类型(如美甲师)不能管理权限
// 其他用户类型(如店员)不能管理权限
return []
})
@@ -0,0 +1,57 @@
<template>
<div class="registration-page">
<a-page-header title="工作台注册审核" sub-title="审核店长注册申请" />
<a-card :bordered="false">
<a-table :columns="columns" :data-source="applications" :loading="loading" row-key="id">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'roleType'">{{ record.roleType === 'MANAGER' ? '店长' : '店员' }}</template>
<template v-else-if="column.key === 'status'">{{ statusLabel(record.status) }}</template>
<template v-else-if="column.key === 'action'">
<a-space v-if="record.status === 'PENDING_ADMIN'">
<a-button type="link" size="small" @click="approve(record.id)">通过</a-button>
<a-button type="link" danger size="small" @click="reject(record.id)">驳回</a-button>
</a-space>
</template>
</template>
</a-table>
</a-card>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
import { adminWorkbenchRegistrationApi, type WorkbenchRegistrationApplication } from '@/api/admin'
const loading = ref(false)
const applications = ref<WorkbenchRegistrationApplication[]>([])
const columns = [
{ title: '申请编号', dataIndex: 'applicationNo', key: 'applicationNo' },
{ title: '身份', key: 'roleType' },
{ title: '店铺', dataIndex: 'shopName', key: 'shopName' },
{ title: '地址', dataIndex: 'shopAddress', key: 'shopAddress' },
{ title: '状态', key: 'status' },
{ title: '操作', key: 'action', width: 150 }
]
const statusLabel = (status: string) => ({ PENDING_ADMIN: '待管理员审核', PENDING_MANAGER: '待店长审核', APPROVED: '已通过', REJECTED: '已驳回' }[status] || status)
const load = async () => {
loading.value = true
try { applications.value = await adminWorkbenchRegistrationApi.list() } catch (error) { message.error(error instanceof Error ? error.message : '获取注册申请失败') } finally { loading.value = false }
}
const approve = async (id: string | number) => {
await adminWorkbenchRegistrationApi.approve(id)
message.success('申请已通过')
await load()
}
const reject = (id: string | number) => {
const reason = window.prompt('请输入驳回原因') || ''
if (!reason.trim()) return
adminWorkbenchRegistrationApi.reject(id, reason).then(async () => { message.success('申请已驳回'); await load() }).catch(error => message.error(error instanceof Error ? error.message : '驳回失败'))
}
onMounted(load)
</script>
@@ -18,7 +18,7 @@ export const getAdminRoleLabel = (type?: number) => {
case 2:
return '店长'
case 3:
return '美甲师'
return '店员'
default:
return '后台账号'
}