auditRecord2.vue
7.94 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
<template>
<view class="order-page">
<!-- 顶部Tab -->
<view class="tab-bar">
<view
v-for="(tab, index) in statusTabs"
:key="index"
class="tab-item"
:class="{ active: currentTab === index }"
@click="switchTab(index)"
>
{{ tab.name }}
</view>
</view>
<!-- 列表 -->
<scroll-view
scroll-y
class="order-list-scroll"
:show-scrollbar="false"
@scrolltolower="loadMore"
lower-threshold="200"
>
<view class="order-list">
<view v-if="list.length > 0">
<view
class="order-card"
v-for="(item, index) in list"
:key="index"
>
<!-- 卡片头部:日期 + 状态 -->
<view class="card-header">
<view class="date">
<image src="/static/calendar@2x.png" v-if="item.commitTime" mode="widthFix" style="width:30rpx;height:30rpx;"/>
<text class="date-text" v-if="item.commitTime">{{ item.commitTime }}</text>
</view>
<view class="status-tags">
<view class="status-tag" :class="getStatusClass(item.status)">
{{ item.statusStr || '待提交' }}
</view>
</view>
</view>
<!-- 基本信息 -->
<view class="info-row">
<text class="label">缴费编号:</text>
<text class="value">{{ item.examCode || '--' }}</text>
</view>
<view class="info-row">
<text class="label">缴费名称:</text>
<text class="value">{{ item.name || '--' }}</text>
</view>
<view class="info-row">
<text class="label">上报单位:</text>
<text class="value">{{ item.memberName || '--' }}</text>
</view>
<!-- 费用信息区 -->
<view class="info-section">
<view class="info-item">
<text class="item-label">考试人数</text>
<text class="item-value">{{ item.totalNum || 0 }}</text>
</view>
<view class="info-line"></view>
<view class="info-item">
<text class="item-label">总金额</text>
<text class="item-value">¥{{ (Number(item.price) || 0).toFixed(2) }}</text>
</view>
<view class="info-line"></view>
<view class="info-item">
<text class="item-label">支付方式</text>
<text class="item-value">民生付</text>
</view>
</view>
<!-- 审核信息 -->
<view class="price-section">
<view class="price-row">
<text class="price-label">提交日期</text>
<text class="price-value">{{ item.commitTime || '--' }}</text>
</view>
<view class="price-row">
<text class="price-label">审核日期</text>
<text class="price-value">{{ item.handleDate || '--' }}</text>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view v-else class="empty">
<text class="empty-text">暂无审核记录</text>
</view>
<!-- 加载/无更多提示 -->
<view class="loading-tip" v-if="loading">加载中...</view>
<view class="no-more" v-if="!loading && !hasMore && list.length > 0">没有更多了</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import * as api from '@/common/api.js';
// 状态Tab配置
const statusTabs = [
{ name: '全部', type: '' },
{ name: '审批中', type: '1' },
{ name: '审批通过', type: '2' },
{ name: '审批拒绝', type: '3' }
];
const currentTab = ref(0);
const list = ref([]);
const loading = ref(false);
const hasMore = ref(true);
const pageNum = ref(1);
const pageSize = ref(10);
onMounted(() => {
initData();
});
// 切换Tab
const switchTab = (index) => {
currentTab.value = index;
pageNum.value = 1;
list.value = [];
hasMore.value = true;
initData();
};
// 上拉加载更多
const loadMore = () => {
console.log("触发上拉加载");
if (loading.value || !hasMore.value) return;
pageNum.value++;
initData();
};
// 获取列表数据
const initData = async () => {
loading.value = true;
try {
const params = {
pageNum: pageNum.value,
pageSize: pageSize.value,
status: statusTabs[currentTab.value].type,
auditSelectType: '1'
};
const res = await api.getLevelList(params);
console.log("接口返回:", res);
if (!res || !res.rows || res.rows.length === 0) {
hasMore.value = false;
loading.value = false;
return;
}
// 第一页覆盖,后面页数追加
if (pageNum.value === 1) {
list.value = res.rows;
} else {
list.value.push(...res.rows);
}
// 关键修复:只要返回条数 < pageSize 就说明没有更多了
hasMore.value = res.rows.length === pageSize.value;
} catch (e) {
console.error('加载失败:', e);
uni.showToast({ title: '加载失败', icon: 'none' });
hasMore.value = false;
} finally {
loading.value = false;
}
};
// 状态样式
const getStatusClass = (status) => {
const map = { '1': 'pending', '2': 'success', '3': 'danger', '4': 'warning' };
return map[status] || '';
};
</script>
<style lang="scss" scoped>
.order-page {
height: 100vh;
background: #f5f7fa;
display: flex;
flex-direction: column;
}
// Tab栏
.tab-bar {
display: flex;
background: #fff;
border-bottom: 1rpx solid #eee;
flex-shrink: 0;
.tab-item {
flex: 1;
text-align: center;
padding: 24rpx 0;
font-size: 28rpx;
color: #666;
position: relative;
&.active {
color: #e4393c;
font-weight: 500;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 60rpx;
height: 4rpx;
background: linear-gradient(90deg, #FF755A, #F51722);
border-radius: 2rpx;
}
}
}
}
// 滚动列表容器 —— 这里是关键修复
.order-list-scroll {
flex: 1;
height: auto;
overflow: auto;
}
.order-list {
padding: 20rpx;
}
.order-card {
background: #fff;
margin-bottom: 20rpx;
padding: 24rpx;
border-radius: 12rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
border-top: 6rpx solid transparent;
background-clip: padding-box, border-box;
background-origin: padding-box, border-box;
background-image: linear-gradient(#fff, #fff), linear-gradient(90deg, #FF755A, #F51722);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
border-bottom: 1rpx dashed #eee;
.date {
display: flex;
align-items: center;
gap: 8rpx;
.date-text {
font-size: 26rpx;
color: #666;
}
}
.status-tags {
display: flex;
gap: 10rpx;
}
.status-tag {
font-size: 22rpx;
padding: 6rpx 16rpx;
border-radius: 20rpx;
&.success {
background: #e6f7ef;
color: #52c41a;
}
&.danger {
background: #fff1f0;
color: #ff4d4f;
}
&.pending {
background: #f5f5f5;
color: #999;
}
&.warning {
background: #fff7e6;
color: #faad14;
}
}
}
.info-row {
display: flex;
align-items: center;
margin-bottom: 16rpx;
font-size: 26rpx;
.label {
color: #999;
flex-shrink: 0;
min-width: 140rpx;
}
.value {
color: #333;
word-break: break-all;
}
}
.info-section {
display: flex;
align-items: center;
background: #f3f6fc;
padding: 16rpx 20rpx;
margin: 16rpx 0;
border-radius: 8rpx;
.info-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
.item-label {
font-size: 24rpx;
color: #999;
}
.item-value {
font-size: 28rpx;
color: #333;
font-weight: 500;
margin-top: 8rpx;
}
}
.info-line {
width: 1rpx;
height: 60rpx;
background: #ddd;
}
}
.price-section {
border-top: 1rpx dashed #eee;
padding-top: 16rpx;
margin-top: 8rpx;
.price-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8rpx 0;
.price-label {
font-size: 26rpx;
color: #333;
}
.price-value {
font-size: 26rpx;
color: #666;
}
}
}
.empty {
display: flex;
justify-content: center;
align-items: center;
padding: 120rpx 0;
.empty-text {
color: #999;
font-size: 28rpx;
}
}
.loading-tip,
.no-more {
text-align: center;
padding: 20rpx 0;
color: #999;
font-size: 26rpx;
}
</style>