68 lines
3.8 KiB
Vue
68 lines
3.8 KiB
Vue
<template>
|
|
<view class="page-shell applications-page">
|
|
<PageHeader title="入谱审核" action="审核说明" @action="showHelp" />
|
|
<view class="audit-tip"><text>{{ loadError || '通过前请核实申请人的亲属关系;审核结果会通过通知告知对方。' }}</text></view>
|
|
<view class="application-list">
|
|
<view v-for="item in applications" :key="item.id" class="application-card paper-card">
|
|
<view class="application-top"><view><text class="applicant-name">{{ item.name }}</text><text class="applicant-phone">{{ item.phone }}</text></view><text class="applicant-time">{{ item.appliedAt }}</text></view>
|
|
<text class="relation-copy">{{ item.relation }}</text>
|
|
<view v-if="item.status === 'PENDING'" class="audit-actions"><button class="reject-button" @click="audit(item, false)">拒绝</button><button class="approve-button" @click="audit(item, true)">通过</button></view>
|
|
<text v-else class="audit-status">{{ item.status === 'APPROVED' ? '已通过' : '已拒绝' }}</text>
|
|
</view>
|
|
<view v-if="!applications.length && !loadError" class="empty-copy">暂无待审核申请</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue'
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
import PageHeader from '@/components/PageHeader.vue'
|
|
import { appApi } from '@/utils/api.js'
|
|
import { genealogyContext } from '@/utils/genealogy-context.js'
|
|
|
|
const applications = ref([])
|
|
const genealogyId = ref('')
|
|
const loadError = ref('')
|
|
|
|
onLoad(async (query) => {
|
|
genealogyId.value = query.genealogyId || genealogyContext.getCurrentGenealogyId()
|
|
if (!genealogyId.value) { loadError.value = '未找到当前家谱,请从家谱总览进入。'; return }
|
|
genealogyContext.setCurrentGenealogyId(genealogyId.value)
|
|
try {
|
|
applications.value = await appApi.getPendingApplications(genealogyId.value)
|
|
} catch (error) {
|
|
loadError.value = error.message || '审核列表加载失败。'
|
|
}
|
|
})
|
|
|
|
const audit = async (item, approved) => {
|
|
try {
|
|
await appApi.auditApplication(genealogyId.value, item.id, approved)
|
|
item.status = approved ? 'APPROVED' : 'REJECTED'
|
|
uni.showToast({ title: approved ? '已通过申请' : '已拒绝申请', icon: 'none' })
|
|
} catch (error) {
|
|
uni.showToast({ title: error.message || '审核失败,请稍后重试', icon: 'none' })
|
|
}
|
|
}
|
|
const showHelp = () => uni.showModal({ title: '审核说明', content: '仅确认与本家谱存在真实亲属关系的申请,避免错误入谱。', showCancel: false })
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.applications-page { padding-bottom: 36rpx; }
|
|
.audit-tip { margin: 26rpx 28rpx 0; padding: 24rpx; border-left: 5rpx solid $brand-red; background: #efe3cd; color: $ink-muted; font-size: 24rpx; line-height: 1.6; }
|
|
.application-list { display: flex; flex-direction: column; gap: 20rpx; margin: 24rpx 28rpx; }
|
|
.application-card { padding: 28rpx; }
|
|
.application-top { display: flex; justify-content: space-between; }
|
|
.applicant-name { color: $ink; font-size: 32rpx; font-weight: 700; }
|
|
.applicant-phone { margin-left: 16rpx; color: $ink-muted; font-size: 22rpx; }
|
|
.applicant-time { color: #a39583; font-size: 21rpx; }
|
|
.relation-copy { display: block; margin-top: 16rpx; color: $ink-muted; font-size: 25rpx; }
|
|
.audit-actions { display: flex; justify-content: flex-end; gap: 16rpx; margin-top: 24rpx; }
|
|
.audit-actions button { min-width: 128rpx; min-height: 64rpx; margin: 0; border-radius: 8rpx; font-size: 24rpx; }
|
|
.reject-button { border: 1rpx solid $gold-soft; background: #fffaf0; color: $ink-muted; }
|
|
.approve-button { border: 1rpx solid $brand-red; background: $brand-red; color: #fff9ed; }
|
|
.audit-status { display: block; margin-top: 24rpx; color: $brand-red; font-size: 24rpx; text-align: right; }
|
|
.empty-copy { padding: 80rpx 0; color: $ink-muted; font-size: 26rpx; text-align: center; }
|
|
</style>
|