certDetail.vue
12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
<template>
<view class="cert-detail-page">
<!-- 考级基本信息 -->
<view class="section">
<view class="section-header">
<uni-icons type="paperclip" size="18" color="#AD181F"></uni-icons>
<text class="section-title">考级基本信息</text>
</view>
<view class="info-card">
<view class="info-row">
<text class="label">考级名称</text>
<text class="value">{{ form.name || '-' }}</text>
</view>
<view class="info-row">
<text class="label">申请日期</text>
<text class="value">{{ formatDate(form.applyTime) }}</text>
</view>
<view class="info-row">
<text class="label">申请单位</text>
<text class="value">{{ form.memberName || '-' }}</text>
</view>
<view class="info-row">
<text class="label">考官</text>
<text class="value">{{ form.examinerNames || '-' }}</text>
</view>
<view class="info-row">
<text class="label">考试时间</text>
<text class="value">{{ form.startTime ? formatDateTime(form.startTime) : '-' }}</text>
</view>
<view class="info-row">
<text class="label">考级地点</text>
<text class="value">{{ form.address || '-' }}</text>
</view>
<view class="info-row" v-if="form.totalAmount">
<text class="label">总金额</text>
<text class="value text-red">¥{{ (form.totalAmount * 1).toFixed(2) }}</text>
</view>
</view>
</view>
<!-- 收货地址 -->
<view class="section">
<view class="section-header">
<uni-icons type="location-filled" size="18" color="#AD181F"></uni-icons>
<text class="section-title">收货地址</text>
</view>
<view class="info-card">
<view class="info-row">
<text class="label">姓名</text>
<text class="value">{{ addressForm.name || '-' }}</text>
</view>
<view class="info-row">
<text class="label">联系方式</text>
<text class="value">{{ addressForm.phone || '-' }}</text>
</view>
<view class="info-row">
<text class="label">收件地址</text>
<text class="value">{{ addressForm.address || '-' }}</text>
</view>
</view>
</view>
<!-- 考生信息 -->
<view class="section">
<view class="section-header">
<uni-icons type="person" size="18" color="#AD181F"></uni-icons>
<text class="section-title">考生信息</text>
<view class="person-summary">
共 {{ personSummary.total }} 人
</view>
</view>
<view class="person-stats" v-if="personSummary.levelArr && personSummary.levelArr.length > 0">
<view class="stat-item" v-for="item in personSummary.levelArr" :key="item.level">
{{ levelToChinese(item.level) }}级:{{ item.num }}人
</view>
</view>
<view class="person-table">
<view class="table-header">
<view class="th th-name">姓名</view>
<!-- <view class="th th-idtype">证件类型</view> -->
<view class="th th-idcard">证件号码</view>
<view class="th th-level">级别</view>
</view>
<scroll-view scroll-y class="table-body-wrapper">
<view class="table-body">
<view class="table-row" v-for="(person, idx) in infoList" :key="idx">
<view class="td td-name">{{ person.realName }}</view>
<view class="td td-idtype">{{ person.idcTypeStr || '-' }}</view>
<view class="td td-idcard">{{ person.idcCode || '-' }}</view>
<view class="td td-level">
{{ levelToChinese(person.levelNew) }}级
<text class="level-old" v-if="person.levelOld">({{ levelToChinese(person.levelOld) }}级)</text>
</view>
</view>
</view>
</scroll-view>
<view class="no-data" v-if="infoList.length == 0">
<text>暂无考生信息</text>
</view>
</view>
<view class="pagination-wrap" v-if="total > pageSize">
<view class="page-btn" @click="prevPage" :class="{ disabled: pageNum <= 1 }">
<uni-icons type="left" size="14" color="#666"></uni-icons>
</view>
<view class="page-num">{{ pageNum }}/{{ totalPage }}</view>
<view class="page-btn" @click="nextPage" :class="{ disabled: pageNum >= totalPage }">
<uni-icons type="right" size="14" color="#666"></uni-icons>
</view>
</view>
</view>
<!-- 审核信息 -->
<view class="section" v-if="recordList.length > 0">
<view class="section-header">
<uni-icons type="checkmark-circle" size="18" color="#AD181F"></uni-icons>
<text class="section-title">审核信息</text>
</view>
<view class="audit-table">
<view class="table-header">
<view class="th th-dept">审核协会</view>
<view class="th th-time">审核时间</view>
<view class="th th-status">审核状态</view>
<view class="th th-remark">备注</view>
</view>
<view class="table-body">
<view class="table-row" v-for="(record, idx) in recordList" :key="idx">
<view class="td td-dept">{{ record.auditDeptName || '-' }}</view>
<view class="td td-time">{{ formatDateTime(record.auditTime) }}</view>
<view class="td td-status">
<text :class="record.auditResult == '1' ? 'text-success' : 'text-danger'">
{{ record.auditResult == '1' ? '通过' : '未通过' }}
</text>
</view>
<view class="td td-remark">{{ record.auditMsg || '-' }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js'
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
const loading = ref(false)
const examId = ref('')
const pageNum = ref(1)
const pageSize = ref(50)
const form = ref({})
const addressForm = ref({})
const infoList = ref([])
const personSummary = ref({ total: 0, levelArr: [] })
const total = ref(0)
const totalPage = computed(() => Math.ceil(total.value / pageSize.value))
const recordList = ref([])
onLoad((options) => {
if (options.examId) {
examId.value = options.examId
getExamInfo()
getStudentList()
getAuditRecords()
}
})
function getExamInfo() {
uni.showLoading({ title: '加载中' })
api.getExamInfo(examId.value).then(res => {
uni.hideLoading()
if (res.data) {
form.value = res.data
addressForm.value = res.data.postAddress || {}
}
}).catch(err => {
uni.hideLoading()
console.error('获取考试详情失败', err)
uni.showToast({ title: '获取详情失败', icon: 'none' })
})
}
function getStudentList() {
uni.showLoading({ title: '加载中' })
api.getStudentList({
examId: examId.value,
pageNum: pageNum.value,
pageSize: pageSize.value
}).then(res => {
uni.hideLoading()
if (res.rows) {
infoList.value = res.rows
total.value = res.total || 0
// 统计各级别人数
const levelMap = {}
res.rows.forEach(person => {
const level = person.levelNew
if (level) {
levelMap[level] = (levelMap[level] || 0) + 1
}
})
const levelArr = Object.keys(levelMap).map(key => ({
level: key,
num: levelMap[key]
})).sort((a, b) => b.level - a.level)
personSummary.value = {
total: total.value,
levelArr: levelArr
}
} else {
uni.hideLoading()
}
}).catch(err => {
uni.hideLoading()
console.error('获取考生列表失败', err)
})
}
function prevPage() {
if (pageNum.value > 1) {
pageNum.value--
getStudentList()
}
}
function nextPage() {
if (pageNum.value < totalPage.value) {
pageNum.value++
getStudentList()
}
}
function getAuditRecords() {
api.getLogs(examId.value, 1).then(res => {
recordList.value = res.data || []
}).catch(err => {
console.error('获取审核记录失败', err)
})
}
function formatDate(dateStr) {
if (!dateStr) return '-'
return dateStr.substring(0, 10)
}
function formatDateTime(dateStr) {
if (!dateStr) return '-'
return dateStr.replace('T', ' ').substring(0, 19)
}
function levelToChinese(level) {
if (!level) return '-'
const levelMap = {
'1': '一', '2': '二', '3': '三', '4': '四', '5': '五',
'6': '六', '7': '七', '8': '八', '9': '九', '10': '十'
}
return levelMap[String(level)] || level
}
</script>
<style lang="scss" scoped>
.cert-detail-page {
min-height: 100vh;
background-color: #f5f5f5;
padding: 20rpx;
padding-bottom: 40rpx;
}
.section {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx;
margin-bottom: 20rpx;
}
.section-header {
display: flex;
align-items: center;
margin-bottom: 24rpx;
.section-title {
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-left: 10rpx;
}
.person-summary {
margin-left: auto;
font-size: 26rpx;
color: #AD181F;
}
}
.info-card {
.info-row {
display: flex;
justify-content: space-between;
padding: 16rpx 0;
border-bottom: 1px solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.label {
font-size: 26rpx;
color: #999;
flex-shrink: 0;
}
.value {
font-size: 26rpx;
color: #333;
text-align: right;
margin-left: 20rpx;
&.text-red {
color: #AD181F;
font-weight: 600;
}
}
}
}
.person-stats {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
margin-bottom: 24rpx;
padding: 20rpx;
background-color: #fafafa;
border-radius: 12rpx;
.stat-item {
font-size: 24rpx;
color: #666;
padding: 8rpx 16rpx;
background-color: #fff;
border-radius: 20rpx;
}
}
.person-table {
border: 1px solid #eee;
border-radius: 12rpx;
overflow: hidden;
}
.table-header {
display: flex;
background-color: #f5f5f5;
.th {
padding: 20rpx 0;
text-align: center;
font-size: 24rpx;
color: #666;
font-weight: 500;
}
}
.table-body-wrapper {
max-height: 600rpx;
}
.table-body {
.table-row {
display: flex;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
.td {
padding: 20rpx 0;
text-align: center;
font-size: 24rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.th-name, .td-name { width: 20%; }
// .th-idtype, .td-idtype { width: 18%; }
.th-idcard, .td-idcard { width: 60%; }
.th-level, .td-level { width: 20%; }
.level-old {
color: #999;
font-size: 20rpx;
margin-left: 4rpx;
}
.no-data {
padding: 60rpx 0;
text-align: center;
color: #999;
font-size: 26rpx;
}
.pagination-wrap {
display: flex;
justify-content: center;
align-items: center;
gap: 30rpx;
margin-top: 30rpx;
padding-top: 30rpx;
border-top: 1px solid #f0f0f0;
.page-btn {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
background-color: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
&.disabled {
opacity: 0.4;
}
}
.page-num {
font-size: 28rpx;
color: #333;
min-width: 120rpx;
text-align: center;
}
}
/* 审核信息表格 */
.audit-table {
border: 1px solid #eee;
border-radius: 12rpx;
overflow: hidden;
.table-header {
display: flex;
background-color: #f5f5f5;
.th {
padding: 20rpx 0;
text-align: center;
font-size: 24rpx;
color: #666;
font-weight: 500;
}
}
.table-body {
.table-row {
display: flex;
border-bottom: 1px solid #eee;
&:last-child {
border-bottom: none;
}
.td {
padding: 16rpx 0;
text-align: center;
font-size: 22rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.th-dept, .td-dept { width: 25%; }
.th-time, .td-time { width: 25%; }
.th-status, .td-status { width: 15%; }
.th-remark, .td-remark { width: 35%; }
.text-success {
color: #4caf50;
}
.text-danger {
color: #f56c6c;
}
}
</style>