实现Salon工作台注册审核闭环
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user