|
|
@@ -0,0 +1,248 @@
|
|
|
+<template>
|
|
|
+ <div class="matchmaker-audit-container">
|
|
|
+ <h2 class="page-title">红娘审核</h2>
|
|
|
+
|
|
|
+ <el-card shadow="never" class="toolbar-card">
|
|
|
+ <el-space wrap>
|
|
|
+ <el-input
|
|
|
+ v-model="filters.name"
|
|
|
+ placeholder="按姓名模糊搜索"
|
|
|
+ clearable
|
|
|
+ style="width: 200px"
|
|
|
+ @keyup.enter="loadList"
|
|
|
+ >
|
|
|
+ <template #append>
|
|
|
+ <el-button icon="Search" @click="loadList" />
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="filters.phone"
|
|
|
+ placeholder="按手机号模糊搜索"
|
|
|
+ clearable
|
|
|
+ style="width: 200px"
|
|
|
+ @keyup.enter="loadList"
|
|
|
+ >
|
|
|
+ <template #append>
|
|
|
+ <el-button icon="Search" @click="loadList" />
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ <el-button icon="Refresh" @click="resetFilters">重置</el-button>
|
|
|
+ </el-space>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <el-card shadow="never" class="table-card">
|
|
|
+ <el-table v-loading="loading" :data="list" stripe>
|
|
|
+ <template #empty>
|
|
|
+ <div class="custom-empty-state">
|
|
|
+ <el-icon class="empty-icon"><User /></el-icon>
|
|
|
+ <div class="empty-text">暂无红娘申请</div>
|
|
|
+ <div class="empty-hint">等待用户提交申请后在此审核</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-table-column type="index" label="序号" width="60" />
|
|
|
+ <el-table-column prop="name" label="姓名" min-width="100">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span class="data-highlight">{{ row.name || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="phone" label="手机号" min-width="140" />
|
|
|
+ <el-table-column prop="age" label="年龄" width="80" align="center" />
|
|
|
+ <el-table-column prop="gender" label="性别" width="90" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-tag size="small" effect="light">
|
|
|
+ {{ row.gender === 1 ? '男' : row.gender === 2 ? '女' : '未知' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="area" label="地区" min-width="140" />
|
|
|
+ <el-table-column prop="experience" label="经验" min-width="140" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="introduction" label="简介" min-width="160" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="createTime" label="申请时间" width="180">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <span class="text-muted">{{ row.createTime || row.create_time || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="180" fixed="right">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleApprove(row)"
|
|
|
+ :loading="approvingId === row.applyId"
|
|
|
+ :disabled="isApproved(row)"
|
|
|
+ >
|
|
|
+ {{ isApproved(row) ? '审核成功' : '审核通过' }}
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="handleDelete(row)"
|
|
|
+ :loading="deletingId === row.applyId"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <div class="pagination-container">
|
|
|
+ <el-pagination
|
|
|
+ v-model:current-page="currentPage"
|
|
|
+ v-model:page-size="pageSize"
|
|
|
+ :total="total"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ @size-change="loadList"
|
|
|
+ @current-change="loadList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, reactive, onMounted } from 'vue'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { User } from '@element-plus/icons-vue'
|
|
|
+import request from '@/utils/request'
|
|
|
+import { API_ENDPOINTS } from '@/config/api'
|
|
|
+
|
|
|
+const loading = ref(false)
|
|
|
+const list = ref([])
|
|
|
+const total = ref(0)
|
|
|
+const currentPage = ref(1)
|
|
|
+const pageSize = ref(10)
|
|
|
+const approvingId = ref(null)
|
|
|
+const deletingId = ref(null)
|
|
|
+
|
|
|
+const filters = reactive({
|
|
|
+ name: '',
|
|
|
+ phone: ''
|
|
|
+})
|
|
|
+
|
|
|
+const loadList = async () => {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const params = {
|
|
|
+ page: currentPage.value,
|
|
|
+ pageSize: pageSize.value
|
|
|
+ }
|
|
|
+ if (filters.name && filters.name.trim()) {
|
|
|
+ params.name = filters.name.trim()
|
|
|
+ }
|
|
|
+ if (filters.phone && filters.phone.trim()) {
|
|
|
+ params.phone = filters.phone.trim()
|
|
|
+ }
|
|
|
+ const res = await request.get(API_ENDPOINTS.MATCHMAKER_AUDIT_LIST, { params })
|
|
|
+ if (res.code === 200) {
|
|
|
+ const data = res.data || {}
|
|
|
+ list.value = data.list || data.records || []
|
|
|
+ total.value = data.total || list.value.length
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('加载审核列表失败:', error)
|
|
|
+ ElMessage.error('加载审核列表失败')
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const resetFilters = () => {
|
|
|
+ filters.name = ''
|
|
|
+ filters.phone = ''
|
|
|
+ currentPage.value = 1
|
|
|
+ loadList()
|
|
|
+}
|
|
|
+
|
|
|
+// 判断是否已审核通过(根据updateMan字段判断)
|
|
|
+const isApproved = (row) => {
|
|
|
+ return !!(row.updateMan || row.update_man)
|
|
|
+}
|
|
|
+
|
|
|
+// 审核通过
|
|
|
+const handleApprove = async (row) => {
|
|
|
+ if (!row.userId) {
|
|
|
+ ElMessage.error('用户ID不存在,无法审核')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm(
|
|
|
+ `确定要通过 ${row.name || '该用户'} 的红娘申请吗?通过后该用户将成为红娘。`,
|
|
|
+ '确认审核',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ approvingId.value = row.applyId
|
|
|
+ const res = await request.post(
|
|
|
+ `${API_ENDPOINTS.MATCHMAKER_AUDIT_APPROVE}/${row.applyId}`,
|
|
|
+ null,
|
|
|
+ { params: { userId: row.userId } }
|
|
|
+ )
|
|
|
+
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success('审核通过成功')
|
|
|
+ loadList()
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg || '审核通过失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ console.error('审核通过失败:', error)
|
|
|
+ ElMessage.error(error.response?.data?.msg || error.message || '审核通过失败')
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ approvingId.value = null
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 删除申请
|
|
|
+const handleDelete = async (row) => {
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm(
|
|
|
+ `确定要删除 ${row.name || '该用户'} 的红娘申请吗?此操作不可恢复。`,
|
|
|
+ '确认删除',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ deletingId.value = row.applyId
|
|
|
+ const res = await request.delete(
|
|
|
+ `${API_ENDPOINTS.MATCHMAKER_AUDIT_DELETE}/${row.applyId}`
|
|
|
+ )
|
|
|
+
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ loadList()
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg || '删除失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ console.error('删除失败:', error)
|
|
|
+ ElMessage.error(error.response?.data?.msg || error.message || '删除失败')
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ deletingId.value = null
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(loadList)
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+@import '@/assets/list-common.css';
|
|
|
+
|
|
|
+.matchmaker-audit-container {
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|