| | |
| | | <script setup> |
| | | import { computed, onMounted, reactive, ref } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { onMounted, reactive, ref } from 'vue' |
| | | import { useRouter } from 'vue-router' |
| | | import { Refresh, Search } from '@element-plus/icons-vue' |
| | | import { auditGuideApplication, getGuideApplicationDetail, getGuideApplications } from '@/api/guideAudits' |
| | | import { getGuideApplications } from '@/api/guideAudits' |
| | | |
| | | const router = useRouter() |
| | | const loading = ref(false) |
| | | const submitting = ref(false) |
| | | const records = ref([]) |
| | | const total = ref(0) |
| | | const dateRange = ref([]) |
| | | const auditVisible = ref(false) |
| | | const currentApplication = ref(null) |
| | | const query = reactive({ page: 1, size: 10, keyword: '', auditStatus: null }) |
| | | const auditForm = reactive({ auditStatus: 1, auditRemark: '' }) |
| | | const statusMeta = { |
| | | 0: { label: '待审核', type: 'warning' }, |
| | | 1: { label: '已通过', type: 'success' }, |
| | | 2: { label: '已驳回', type: 'danger' }, |
| | | } |
| | | |
| | | const currentStatus = computed(() => statusMeta[currentApplication.value?.auditStatus] || statusMeta[0]) |
| | | const canAudit = computed(() => currentApplication.value?.auditStatus === 0) |
| | | const formatDateTime = (value) => value ? value.replace('T', ' ').slice(0, 19) : '-' |
| | | const maskIdCard = (value) => value ? value.replace(/^(\w{6})\w+(\w{4})$/, '$1********$2') : '-' |
| | | const auditActionText = (status) => status === 0 ? '审核' : '查看' |
| | | const displayText = (value) => value || '-' |
| | | |
| | | const loadApplications = async () => { |
| | | loading.value = true |
| | |
| | | dateRange.value = [] |
| | | loadApplications() |
| | | } |
| | | const openAudit = async (row) => { |
| | | currentApplication.value = await getGuideApplicationDetail(row.id) |
| | | Object.assign(auditForm, { auditStatus: 1, auditRemark: '' }) |
| | | auditVisible.value = true |
| | | } |
| | | const submitAudit = async () => { |
| | | if (auditForm.auditStatus === 2 && !auditForm.auditRemark.trim()) { |
| | | ElMessage.warning('驳回时请填写审核备注') |
| | | return |
| | | } |
| | | submitting.value = true |
| | | try { |
| | | await auditGuideApplication(currentApplication.value.id, { |
| | | auditStatus: auditForm.auditStatus, |
| | | auditRemark: auditForm.auditRemark.trim() || undefined, |
| | | }) |
| | | ElMessage.success(auditForm.auditStatus === 1 ? '审核通过' : '申请已驳回') |
| | | auditVisible.value = false |
| | | loadApplications() |
| | | } finally { |
| | | submitting.value = false |
| | | } |
| | | } |
| | | const openAudit = (row) => router.push(`/guide-audits/${row.id}`) |
| | | const changePage = (page) => { query.page = page; loadApplications() } |
| | | const changePageSize = (size) => { query.page = 1; query.size = size; loadApplications() } |
| | | const closeAudit = () => { auditVisible.value = false } |
| | | |
| | | onMounted(loadApplications) |
| | | </script> |
| | |
| | | @current-change=changePage @size-change=changePageSize /> |
| | | </div> |
| | | </el-card> |
| | | <el-dialog v-model=auditVisible title=导游申请审核 width=680px> |
| | | <el-descriptions v-if=currentApplication :column=2 border> |
| | | <el-descriptions-item label=申请编号><span v-text=currentApplication.applicationNo /></el-descriptions-item> |
| | | <el-descriptions-item label=申请状态><el-tag :type=currentStatus.type v-text=currentStatus.label /></el-descriptions-item> |
| | | <el-descriptions-item label=导游姓名><span v-text=currentApplication.realName /></el-descriptions-item> |
| | | <el-descriptions-item label=手机号><span v-text=currentApplication.mobile /></el-descriptions-item> |
| | | <el-descriptions-item label=身份证号><span v-text=maskIdCard(currentApplication.idCardNo) /></el-descriptions-item> |
| | | <el-descriptions-item label=导游证号><span v-text=currentApplication.certificateNo /></el-descriptions-item> |
| | | <el-descriptions-item label=审核人><span v-text=displayText(currentApplication.auditor) /></el-descriptions-item> |
| | | <el-descriptions-item label=审核时间><span v-text=formatDateTime(currentApplication.auditedAt) /></el-descriptions-item> |
| | | <el-descriptions-item label=审核备注 :span=2><span v-text=displayText(currentApplication.auditRemark) /></el-descriptions-item> |
| | | </el-descriptions> |
| | | <el-form v-if=canAudit class=audit-form label-width=82px> |
| | | <el-form-item label=审核结果> |
| | | <el-radio-group v-model=auditForm.auditStatus> |
| | | <el-radio-button :value=1>通过</el-radio-button> |
| | | <el-radio-button :value=2>驳回</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label=审核备注> |
| | | <el-input v-model=auditForm.auditRemark type=textarea /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class=dialog-actions> |
| | | <el-button @click=closeAudit>关闭</el-button> |
| | | <el-button v-if=canAudit type=primary :loading=submitting @click=submitAudit>确认审核</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </section> |
| | | </template> |
| | | |
| | |
| | | .table-card :deep(.el-card__body) { padding-top: 26px; } |
| | | .pagination-row { display: flex; justify-content: space-between; align-items: center; padding-top: 20px; } |
| | | .pagination-row > span { color: #8a94a6; font-size: 13px; } |
| | | .audit-form { margin-top: 22px; padding-top: 20px; border-top: 1px solid #ebeef5; } |
| | | .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; } |
| | | @media (max-width: 1200px) { .query-form { grid-template-columns: repeat(2, minmax(260px, 1fr)); } } |
| | | </style> |