Blame view

绿纤uni-app/pages/reimbursement-audit-list/reimbursement-audit-list.vue 9.47 KB
6137a4e4   李宇   ```
1
2
  <template>
  	<view class="container">
6137a4e4   李宇   ```
3
4
5
6
7
8
9
10
11
12
13
  		<!-- 数据列表 -->
  		<view class="list-card">
  			<view class="list-header">
  				<text class="header-text">报销审核列表</text>
  				<text class="total-count">共 {{ totalCount }} 条</text>
  			</view>
  
  			<scroll-view scroll-y class="list-content" @scrolltolower="loadMore">
  				<view v-for="(item, index) in dataList" :key="index" class="list-item">
  					<view class="item-header">
  						<view class="applicant-name">{{ item.applicationUserName || '无' }}</view>
0f14a621   李宇   最新
14
  						<view class="application-time">{{ utils.formatTime(item.applicationTime) }}</view>
6137a4e4   李宇   ```
15
16
17
18
19
20
21
22
23
24
25
26
  					</view>
  					<view class="item-details">
  						<view class="detail-item">
  							<text class="detail-label">门店:</text>
  							<text class="detail-value">{{ getStoreName(item.applicationStoreId) || '无' }}</text>
  						</view>
  						<view class="detail-item">
  							<text class="detail-label">总金额:</text>
  							<text class="detail-value amount">¥{{ item.amount || 0 }}</text>
  						</view>
  					</view>
  					<view class="item-footer">
4e2687f7   李宇   最新
27
  						<view class="status-badge" :class="item.approveStatus=='待审批'?'pending':item.approveStatus=='审批中'?'pending':item.approveStatus=='已通过'?'approved':item.approveStatus=='未通过'?'rejected':item.approveStatus=='已退回'?'rejected':'unapproved'">
28dc12db   李宇   ```
28
  							{{ item.approveStatus || '待审批' }}
6137a4e4   李宇   ```
29
30
  						</view>
  						<view class="action-buttons">
28dc12db   李宇   ```
31
  							<view v-if="item.approveStatus === '待审批' || item.approveStatus === '审批中'" class="action-btn audit-btn" @click.stop="handleAudit(item)">
6137a4e4   李宇   ```
32
33
  								<text class="btn-text">审核</text>
  							</view>
28dc12db   李宇   ```
34
35
36
  							<view v-else class="action-btn view-btn" @click.stop="handleView(item)">
  								<text class="btn-text">查看</text>
  							</view>
6137a4e4   李宇   ```
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  						</view>
  					</view>
  				</view>
  
  				<!-- 空状态 -->
  				<view v-if="!loading && dataList.length === 0" class="empty-state">
  					<view class="empty-icon">📋</view>
  					<view>暂无报销申请记录</view>
  				</view>
  
  				<!-- 加载状态 -->
  				<view v-if="loading && dataList.length === 0" class="loading">正在加载数据...</view>
  
  				<!-- 加载更多 -->
  				<u-loadmore v-if="dataList.length > 0" :status="loadmoreStatus" :load-text="loadText"></u-loadmore>
  			</scroll-view>
  		</view>
  	</view>
  </template>
  
  <script>
  	import api from '@/apis/index.js'
6137a4e4   李宇   ```
59
60
  
  	export default {
6137a4e4   李宇   ```
61
  		data() {
6137a4e4   李宇   ```
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  			return {
  				loading: false,
  				dataList: [],
  				currentPage: 1,
  				pageSize: 10,
  				totalCount: 0,
  				hasMore: true,
  				loadmoreStatus: 'loadmore',
  				loadText: {
  					loadmore: '点击或上拉加载更多',
  					loading: '正在加载...',
  					nomore: '没有更多了'
  				},
  				userInfo: uni.getStorageSync('userInfo'),
  				newuserInfo: uni.getStorageSync('newuserInfo'),
2c7d6853   李宇   最新
77
  				storeOptions: []
6137a4e4   李宇   ```
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
  			}
  		},
  
  		onLoad() {
  			this.loadStoreOptions()
  			this.loadReimbursementList()
  		},
  
  		onShow() {
  			// 从详情页返回时刷新列表
  			this.refreshData()
  		},
  
  		methods: {
  			// 加载门店列表
  			async loadStoreOptions() {
  				try {
  					const res = await api.getStoreList({
  						currentPage: 1,
  						pageSize: 1000
  					})
  					if (res.code === 200 && res.data && res.data.list) {
  						this.storeOptions = res.data.list
  					} else {
  						this.storeOptions = []
  					}
  				} catch (error) {
  					console.error('加载门店列表失败:', error)
  					this.storeOptions = []
  				}
  			},
  
  			// 获取门店名称
  			getStoreName(storeId) {
  				if (!storeId) return '无'
  				const store = this.storeOptions.find(item => item.id === storeId)
  				return store ? store.dm : '无'
  			},
  
28dc12db   李宇   ```
117
  			// 加载报销申请列表(我的待办)
6137a4e4   李宇   ```
118
119
120
121
122
123
124
  			async loadReimbursementList() {
  				if (this.loading) return
  
  				try {
  					this.loading = true
  					this.loadmoreStatus = 'loading'
  
2c7d6853   李宇   最新
125
  					// 构建查询参数
6137a4e4   李宇   ```
126
127
  					const params = {
  						currentPage: this.currentPage,
28dc12db   李宇   ```
128
129
130
  						pageSize: this.pageSize,
  						sidx: 'applicationTime',
  						sort: 'desc'
6137a4e4   李宇   ```
131
132
  					}
  
28dc12db   李宇   ```
133
134
  					// 使用我的待办接口
  					const res = await api.getMyPendingList(params)
6137a4e4   李宇   ```
135
136
  
  					if (res.code === 200 && res.data) {
2c7d6853   李宇   最新
137
  						const list = res.data.list || []
6137a4e4   李宇   ```
138
139
  						const pagination = res.data.pagination || {}
  
6137a4e4   李宇   ```
140
141
142
  						if (this.currentPage === 1) {
  							this.dataList = list
  						} else {
28dc12db   李宇   ```
143
144
145
146
  							// 加载更多时,需要去重(避免重复数据)
  							const existingIds = new Set(this.dataList.map(item => item.id))
  							const newItems = list.filter(item => !existingIds.has(item.id))
  							this.dataList = [...this.dataList, ...newItems]
6137a4e4   李宇   ```
147
148
  						}
  
2c7d6853   李宇   最新
149
  						// 更新总数
28dc12db   李宇   ```
150
  						if (this.currentPage === 1) {
2c7d6853   李宇   最新
151
  							this.totalCount = pagination.total || list.length
28dc12db   李宇   ```
152
153
154
  						}
  						
  						// 判断是否还有更多数据
2c7d6853   李宇   最新
155
  						this.hasMore = this.dataList.length < (pagination.total || 0)
6137a4e4   李宇   ```
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
  
  						if (!this.hasMore) {
  							this.loadmoreStatus = 'nomore'
  						} else {
  							this.loadmoreStatus = 'loadmore'
  						}
  					} else {
  						uni.showToast({
  							title: res.message || '加载失败',
  							icon: 'none'
  						})
  					}
  				} catch (error) {
  					console.error('加载报销审核列表失败:', error)
  					uni.showToast({
  						title: '加载失败,请重试',
  						icon: 'none'
  					})
  				} finally {
  					this.loading = false
  				}
  			},
  
  			// 刷新数据
  			refreshData() {
  				this.currentPage = 1
  				this.hasMore = true
  				this.loadmoreStatus = 'loadmore'
  				this.dataList = []
  				this.loadReimbursementList()
  			},
  
  			// 加载更多
  			async loadMore() {
  				if (this.loading || !this.hasMore || this.loadmoreStatus === 'nomore') return
  
  				this.loadmoreStatus = 'loading'
  				this.currentPage++
  				await this.loadReimbursementList()
  			},
  
  			// 查看详情
  			handleView(item) {
  				uni.navigateTo({
9854a774   李宇   最新
200
  					url: `/pagesA/reimbursement-detail/reimbursement-detail?id=${item.id}`
6137a4e4   李宇   ```
201
202
203
204
205
206
  				})
  			},
  
  			// 审核(跳转到详情页进行审核)
  			handleAudit(item) {
  				uni.navigateTo({
9854a774   李宇   最新
207
  					url: `/pagesA/reimbursement-detail/reimbursement-detail?id=${item.id}`
6137a4e4   李宇   ```
208
209
  				})
  			},
28dc12db   李宇   ```
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
  			
  			// 获取状态样式类
  			getStatusClass(status) {
  				switch (status) {
  					case '待审批':
  						return 'pending'
  					case '审批中':
  						return 'pending'
  					case '已通过':
  						return 'approved'
  					case '未通过':
  						return 'rejected'
  					case '已退回':
  						return 'rejected'
  					default:
  						return 'unapproved'
  				}
6137a4e4   李宇   ```
227
228
229
230
231
232
233
234
235
236
237
238
239
  			}
  		}
  	}
  </script>
  
  <style lang="scss" scoped>
  	.container {
  		min-height: 100vh;
  		background: linear-gradient(135deg, #e8f5e9 0%, #b2dfdb 100%);
  		padding: 40rpx;
  		box-sizing: border-box;
  	}
  
6137a4e4   李宇   ```
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
  	.list-card {
  		background: #fff;
  		border-radius: 24rpx;
  		overflow: hidden;
  		box-shadow: 0 4rpx 16rpx rgba(76, 175, 80, 0.1);
  	}
  
  	.list-header {
  		display: flex;
  		justify-content: space-between;
  		align-items: center;
  		padding: 32rpx;
  		background: linear-gradient(120deg, #43e97b 0%, #38f9d7 100%);
  	}
  
  	.header-text {
  		font-size: 32rpx;
  		color: #fff;
  		font-weight: 600;
  		letter-spacing: 2rpx;
  	}
  
  	.total-count {
  		font-size: 24rpx;
  		color: #fff;
  		opacity: 0.9;
  	}
  
  	.list-content {
2c7d6853   李宇   最新
269
  		max-height: calc(100vh - 200rpx);
6137a4e4   李宇   ```
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
  	}
  
  	.list-item {
  		padding: 32rpx;
  		border-bottom: 2rpx solid #f0f0f0;
  		transition: all 0.2s ease;
  	}
  
  	.list-item:last-child {
  		border-bottom: none;
  	}
  
  	.list-item:active {
  		background: #f9fff9;
  	}
  
  	.item-header {
  		display: flex;
  		justify-content: space-between;
  		align-items: center;
  		margin-bottom: 16rpx;
  	}
  
  	.applicant-name {
  		font-size: 32rpx;
  		color: #2e7d32;
  		font-weight: 600;
  	}
  
  	.application-time {
  		font-size: 24rpx;
  		color: #6a9c6a;
  	}
  
  	.item-details {
  		display: flex;
  		flex-wrap: wrap;
  		gap: 24rpx;
  		margin-bottom: 16rpx;
  	}
  
  	.detail-item {
  		display: flex;
  		align-items: center;
  		gap: 8rpx;
  	}
  
  	.detail-label {
  		font-size: 24rpx;
  		color: #6a9c6a;
  	}
  
  	.detail-value {
  		font-size: 28rpx;
  		color: #2e7d32;
  		font-weight: 500;
  	}
  
  	.detail-value.amount {
  		color: #f57c00;
  		font-weight: 600;
  		font-size: 32rpx;
  	}
  
  	.item-footer {
  		display: flex;
  		justify-content: space-between;
  		align-items: center;
  		margin-top: 16rpx;
  	}
  
  	.status-badge {
  		display: inline-block;
  		padding: 8rpx 24rpx;
  		border-radius: 40rpx;
  		font-size: 24rpx;
  		font-weight: 500;
  		text-align: center;
  	}
  
  	.status-badge.unapproved {
  		background: #fff3e0;
  		color: #ef6c00;
  		border: 2rpx solid #ffe0b2;
  	}
  
  	.status-badge.pending {
  		background: #e3f2fd;
  		color: #1976d2;
  		border: 2rpx solid #bbdefb;
  	}
  
  	.status-badge.approved {
  		background: #e8f5e9;
  		color: #2e7d32;
  		border: 2rpx solid #c8e6c9;
  	}
  
  	.status-badge.rejected {
  		background: #ffebee;
  		color: #c62828;
  		border: 2rpx solid #ffcdd2;
  	}
  
  	.action-buttons {
  		display: flex;
  		align-items: center;
  		gap: 16rpx;
  	}
  
  	.action-btn {
  		display: flex;
  		align-items: center;
  		padding: 12rpx 24rpx;
  		border-radius: 24rpx;
  		font-size: 24rpx;
  		font-weight: 500;
  		transition: all 0.2s ease;
  		box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  	}
  
  	.action-btn:active {
  		transform: scale(0.95);
  		box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.15);
  	}
  
  	.view-btn {
  		background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
  		color: #fff;
  	}
  
  	.view-btn:active {
  		background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  	}
  
  	.audit-btn {
  		background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  		color: #fff;
  	}
  
  	.audit-btn:active {
  		background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
  	}
  
  	.btn-text {
  		letter-spacing: 1rpx;
  	}
  
  	.loading {
  		text-align: center;
  		padding: 80rpx 40rpx;
  		color: #6a9c6a;
  		font-size: 28rpx;
  	}
  
  	.empty-state {
  		text-align: center;
  		padding: 120rpx 40rpx;
  		color: #6a9c6a;
  	}
  
  	.empty-icon {
  		font-size: 120rpx;
  		margin-bottom: 32rpx;
  		opacity: 0.5;
  	}
  </style>