index.vue
21.4 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
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<template>
<div class="app-container">
<div class="from-Card">
<el-form ref="queryRef" size="small" :model="queryParams" :inline="true" label-position="top">
<el-row style="width: 100%;">
<el-col :span="4">
<el-form-item label="缴费名称" prop="finalDocName">
<el-input
v-model="queryParams.finalDocName" placeholder="缴费名称" clearable style="width: 100%"
@keyup.enter="searchFN"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="状态" prop="type">
<el-select v-model="queryParams.settle" style="width: 100%;" @change="searchFN">
<el-option label="全部" value="1" />
<el-option label="已结算" value="2" />
<el-option label="已上传凭证" value="3" />
<el-option label="未上传凭证" value="4" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="缴费编号" prop="">
<el-input
v-model="queryParams.sonWfCode" placeholder="" clearable style="width: 100%"
@keyup.enter="searchFN"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="结算编号" prop="">
<el-input
v-model="queryParams.wfCode" placeholder="" clearable style="width: 100%"
@keyup.enter="searchFN"
/>
</el-form-item>
</el-col>
<el-col :span="8" :hidden="showCollect">
<el-form-item label="缴费日期" prop="type">
<el-date-picker
v-model="payTimeRange" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss"
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%;"
@change="searchFN"
/>
</el-form-item>
</el-col>
<el-col :span="8" :hidden="showCollect">
<el-form-item label="结算日期" prop="name">
<el-date-picker
v-model="settleTimeRange" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss"
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%;"
@change="searchFN"
/>
</el-form-item>
</el-col>
<el-col :span="8" :hidden="showCollect">
<el-form-item label="审核日期" prop="name">
<el-date-picker
v-model="overDateRange" type="datetimerange" value-format="YYYY-MM-DD HH:mm:ss"
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%;"
@change="searchFN"
/>
</el-form-item>
</el-col>
<div class="po-r-btns">
<el-button type="primary" size="small" icon="Search" @click="searchFN">查询</el-button>
<el-button icon="Refresh" size="small" @click="resetQuery">重置</el-button>
<el-button
v-if="showCollect" size="small" type="primary" link icon="ArrowDown"
@click="showCollect = !showCollect"
>展开</el-button>
<el-button
v-else size="small" type="primary" link icon="ArrowUp"
@click="showCollect = !showCollect"
>收起</el-button>
</div>
</el-row>
</el-form>
<el-row justify="space-between">
<div>
<el-button
v-if="deptType == 1" :icon="Wallet" type="warning" :disabled="show"
@click="pSettlement"
>批量结算</el-button>
<el-button
v-if="deptType == 2 || deptType == 1 || deptType == 3" :icon="Download" type="primary"
:disabled="show" @click="batchDownload"
>批量下载缴费通知单</el-button>
<el-button v-if="deptType == 1 " :icon="Download" type="warning" @click="exportFN">导出</el-button>
</div>
</el-row>
</div>
<div class="table">
<el-table
v-loading="loading" :data="list" :row-class-name="tableRowClassName" border
style="width: 100%" @selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="45" align="center" />
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="结算编号" align="center" prop="docCode" min-width="120" :show-overflow-tooltip="true">
<template #default="scope">
<el-button
:disabled="(deptType == 2 || deptType == 3||deptType == 1) && (scope.row?.record?.auditStatus == 2 || scope.row?.record?.auditStatus == 3 || !scope.row?.record?.auditStatus)"
link type="primary" @click="billFN(scope.row)"
>{{ scope.row.wfCode }}</el-button>
</template>
</el-table-column>
<!-- <el-table-column
label="编号"
align="center"
prop="docCode"
min-width="120"
:show-overflow-tooltip="true"
>
<template #default="scope">
{{ scope.row.record.content.wfCode }}
</template>
</el-table-column> -->
<el-table-column label="缴费名称" align="center" prop="finalDocName" min-width="240" :show-overflow-tooltip="true" />
<el-table-column label="缴费单位" align="center" prop="payDeptName" min-width="120" :show-overflow-tooltip="true" />
<el-table-column label="缴费状态" align="center" prop="balance" min-width="100">
<template #default="props">
<div v-if="props.row.settleFlag == 0" class="text-success">已结算 </div>
<div v-if="props.row.settleFlag == 1 && props.row?.payFlag == 0" class="text-navy">已上传凭证</div>
<div v-if="props.row.settleFlag == 1 && props.row?.payFlag == 1" class="text-danger">未上传凭证</div>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="balance" min-width="100">
<template #default="scope">
<div v-if="scope.row?.record?.auditStatus == 0">审核中</div>
<div v-if="scope.row?.record?.auditStatus == 1" class="text-success">审核通过</div>
<div v-if="scope.row?.record?.auditStatus == 2" class="text-danger">审核拒绝</div>
<div v-if="scope.row?.record?.auditStatus == 3" class="text-warning">审核撤回</div>
</template>
</el-table-column>
<el-table-column label="费用合计" align="center" prop="allPrice" width="110" />
<el-table-column label="累计年限合计" align="center" prop="yearCount" width="110" />
<el-table-column v-if="deptType == 1" label="缴费单下发日期" align="center" prop="payNoticeSendTime" min-width="120">
<template #default="scope">
<span>{{ parseTime(scope.row.payNoticeSendTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="缴费日期" align="center" prop="payTime" min-width="100">
<template #default="scope">
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="结算日期" align="center" prop="settleTime" min-width="100">
<template #default="scope">
<span>{{ parseTime(scope.row.settleTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="审核日期" align="center" prop="settleTime" min-width="100">
<template #default="scope">
<span>{{ parseTime(scope.row.record.overDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="270">
<template #default="scope">
<el-button type="primary" @click="handleInfo(scope.row)">查看</el-button>
<el-button
v-if="deptType == 1" :disabled="!(scope.row?.payEvidence?.[0]?.url)" color="#13B5B1"
style="--el-color-black:#fff;" @click="downloadOrder(scope.row)"
>下载凭证</el-button>
<el-button
v-if="deptType == 1 && scope.row.settleFlag == 1"
:disabled="!(scope.row.settleFlag == 1 && scope.row.payFlag == 0) || scope.row?.record?.auditStatus == 3||scope.row?.record?.auditStatus == 2"
type="warning" @click="handleClose(scope.row)"
>结算</el-button>
<el-button
v-if="deptType == 1 && scope.row.settleFlag == 0" type="danger"
@click="handleCloseFn(scope.row)"
>取消结算</el-button>
<el-button
v-if="deptType == 2 || deptType == 3" style="width: 5.5em"
:disabled="(deptType == 2 || deptType == 3) && (scope.row?.record?.auditStatus == 2 || scope.row?.record?.auditStatus == 3 || !scope.row?.record?.auditStatus) || scope.row == 0"
type="warning" @click="downLoadFN(scope.row)"
> 下载通知单 </el-button>
<el-dropdown v-if="(deptType == 2 || deptType == 3)" class="poptdmore">
<el-button type="primary" plain>更多
<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>
<el-button
v-if="scope.row?.settleFlag == 1" color="#13B5B1" style="--el-color-black:#fff;"
:disabled="scope.row?.record?.auditStatus == 2 || scope.row?.record?.auditStatus == 3 || !scope.row?.record?.auditStatus"
@click="uploading(scope.row)"
>上传凭证</el-button>
<el-button
v-else :disabled="!(scope.row?.payEvidence?.[0]?.url)" color="#13B5B1"
style="--el-color-black:#fff;" @click="downloadOrder(scope.row)"
>下载凭证</el-button>
</el-dropdown-item>
<el-dropdown-item v-if="deptType == 2||deptType == 3">
<el-button
type="danger"
:disabled="!(scope.row?.record?.auditStatus == 2)"
@click="handleDelete(scope.row)"
>删除</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div v-show="total > 0" class="totalCost">
费用合计:<span>{{ totalCost.toFixed(2) }} 元</span>
年限合计:<span>{{ yearsTotal }} 年</span>
</div>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="initData"
/>
</div>
<!--文件上传-->
<el-dialog
v-if="showFileUpload" v-model="showFileUpload" draggable append-to-body title="上传缴费凭证"
width="600px"
>
<el-form ref="refForm" :model="form" :rules="rules">
<el-form-item label="缴费日期:" prop="payTime">
<el-date-picker
v-model="form.payTime" value-format="YYYY-MM-DD hh:mm:ss" type="datetime" placeholder="请选择缴费日期"
style="width: 100%;"
/>
</el-form-item>
<el-form-item label="缴费凭证:" prop="url">
<file-upload v-model="form.url" :file-type="arr" accept=".png,.jpg,.jpeg,.pdf,.zip" />
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input v-model="form.remark" :rows="4" type="textarea" />
</el-form-item>
</el-form>
<template #footer>
<el-row justify="center">
<el-button type="primary" @click="uploadSure">确 定</el-button>
<el-button @click="showFileUpload = false">取 消</el-button>
</el-row>
</template>
</el-dialog>
<!--账单结算-->
<el-dialog
v-if="showClose" v-model="showClose" style="padding: 20px ; border-radius: 20px;" draggable append-to-body
title="账单结算" width="600px"
>
<el-form ref="" :model="forms" :rules="rules">
<el-form-item label="操作" prop="flag">
<el-radio-group v-model="form.flag">
<el-radio label="1">已结算</el-radio>
<el-radio label="0">未结算</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-row justify="center">
<el-button type="primary" @click="payClose">确 定</el-button>
<el-button @click="showClose = false">取 消</el-button>
</el-row>
</template>
</el-dialog>
<!-- 缴费单编号 -->
<bill ref="billRef" />
<!-- 查看 -->
<viewInfo ref="viewRef" />
<!-- 下载缴费凭证 -->
<el-link
v-show="false" ref="linkRef" class="size" :href="fillImgUrl(url)" :underline="false"
target="_blank"
/>
</div>
</template>
<script setup>
import { getCurrentInstance, computed } from 'vue'
import { reactive } from '@vue/runtime-core'
import { ref, toRefs } from 'vue'
import useUserStore from '@/store/modules/user'
import bill from './bill.vue'
import viewInfo from './view.vue'
import { useRouter } from 'vue-router'
import { listInfo, settle, unSettle, commitPaymentVoucher, certifiedDocDelete } from '@/api/groupMember/settlement'
import { Download, Wallet } from '@element-plus/icons-vue'
const router = useRouter()
const arr = ['png', 'jpg', 'jpeg', 'pdf', 'zip']
// const baseUrl = import.meta.env.VITE_APP_BASE_API
// const download = ref(baseUrl + '/upload/getFile?fileUrl=') // 下载地址
const totalCost = ref(0)
const url = ref()
const showCollect = ref(true)
const deptType = computed(() => useUserStore().deptType)
const overDateRange = ref([])
const showFileUpload = ref(false)
const showClose = ref(false)
const { proxy } = getCurrentInstance()
const total = ref(0)
const list = ref([])
const payTimeRange = ref([])
const settleTimeRange = ref([])
const yearsTotal = ref(0)
const loading = ref(false)
const lists = ref([])
const show = ref(true)
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10
},
form: {},
rules: {
payTime: { required: true, message: '请选择缴费日期', trigger: 'blur' },
url: { required: true, message: '请上传缴费凭证', trigger: 'blur' }
// remark: { required: true, message: '备注不能为空', trigger: 'blur' }
}
})
const { queryParams, form, rules } = toRefs(data)
function searchFN() {
queryParams.value.pageNum = 1
initData()
}
initData()
// 获取赛会列表
async function initData() {
loading.value = true
queryParams.value.settleTimeRange = settleTimeRange.value?.toString()
queryParams.value.payTimeRange = payTimeRange.value?.toString()
queryParams.value.overDateRange = overDateRange.value?.toString()
if (queryParams.value.settle == 1) {
queryParams.value.settleFlag = undefined
queryParams.value.payFlag = undefined
}
if (queryParams.value.settle == 2) {
queryParams.value.settleFlag = 0
queryParams.value.payFlag = undefined
}
if (queryParams.value.settle == 3) {
queryParams.value.settleFlag = 1
queryParams.value.payFlag = 0
}
if (queryParams.value.settle == 4) {
queryParams.value.settleFlag = 1
queryParams.value.payFlag = 1
}
totalCost.value = 0
yearsTotal.value = 0
const res = await listInfo(queryParams.value)
list.value = res.rows
total.value = res.total
list.value.forEach(item => {
item.payEvidence = JSON.parse(item.payEvidence)
item.record.content = JSON.parse(item.record.content)
totalCost.value = totalCost.value + (item.allPrice * 1)
yearsTotal.value = yearsTotal.value + (item.yearCount * 1)
})
loading.value = false
console.log(list.value)
}
// // 背景色
const tableRowClassName = ({
row,
rowIndex
}) => {
if (row.settleFlag == 0) {
return 'success-row'
}
}
// 导出
function exportFN() {
proxy.download('/member/certifiedDoc/exportMemPayments', {
...queryParams.value
}, `团体会员缴费单${new Date().getTime()}.xlsx`)
}
// 多选
function handleSelectionChange(e) {
if (e.length > 0) {
show.value = false
lists.value = JSON.parse(JSON.stringify(e))
}
}
// 结算
function handleClose(row) {
proxy.$modal.confirm('是否确认结算缴费单号为 ' + row.wfCode + ' 的数据项?').then(function() {
loading.value = true
return settle(row.docId)
}).then(() => {
loading.value = true
initData()
proxy.$modal.msgSuccess('操作成功!')
}).catch(() => {
}).finally(() => {
loading.value = false
})
}
// 取消结算
function handleCloseFn(row) {
proxy.$modal.confirm('是否确认取消结算缴费单号为 ' + row.wfCode + ' 的数据项?').then(function() {
loading.value = true
return unSettle(row.docId)
}).then(() => {
loading.value = true
initData()
proxy.$modal.msgSuccess('操作成功!')
}).catch(() => {
}).finally(() => {
loading.value = false
})
}
// 批量结算
async function pSettlement() {
const arr = []
lists.value.forEach(item => {
arr.push(item.docId)
})
proxy.$modal.confirm('是否确认批量结算?').then(function() {
loading.value = true
return settle(arr)
}).then(() => {
loading.value = true
initData()
proxy.$modal.msgSuccess('操作成功!')
}).catch(() => {
}).finally(() => {
loading.value = false
})
}
// 缴费通知单
function downLoadFN(row) {
// proxy.download(
// `/member/certifiedDoc/downJiaoFei/${[row.docId]}`, {}
// )
const routerData = router.resolve({
path: '/download',
query: {
arr: [row.docId],
type: 'batchGroupMemberFeeBill'
}
})
window.open(routerData.href, '_blank')
}
// 批量下载
async function batchDownload() {
const arr = lists.value.map(item => item.docId)
const flag = lists.value.some(item => {
if (item.record.auditStatus == 2 || item.record.auditStatus == 3) {
return proxy.$message.warning(`缴费名称为${item.finalDocName}的数据项不符合下载!`)
}
})
if (flag) return
const routerData = router.resolve({
path: '/download',
query: {
arr: arr,
type: 'batchGroupMemberFeeBill'
}
})
window.open(routerData.href, '_blank')
// if (arr.length > 1) {
// proxy.download(
// `/member/certifiedDoc/downJiaoFei/${arr}`, {}, '缴费通知单.zip'
// )
// } else {
// proxy.download(
// `/member/certifiedDoc/downJiaoFei/${arr}`, {}, '缴费通知单.pdf'
// )
// }
}
// // 批量下载团体会员证书
// function batchMembershipCard() {
// const arr = lists.value.map(item => item.docId)
// const routerData = router.resolve({
// path: '/download',
// query: {
// arr: arr,
// type: 'batchGroupMember'
// }
// })
// window.open(routerData.href, '_blank')
// }
// 缴费单
async function billFN(row) {
console.log(row)
proxy.$refs['billRef'].open(row.docId)
}
// 查看
function handleInfo(row) {
console.log(row)
proxy.$refs['viewRef'].open(row.docId)
}
// 重置
function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10
}
settleTimeRange.value = []
payTimeRange.value = []
overDateRange.value = []
initData()
}
// 上传缴费凭证
function uploading(row) {
form.value = row
if (form.value.payEvidence) form.value.url = form.value.payEvidence
showFileUpload.value = true
}
// /** 删除按钮操作 */
// function payClose(row) {
// const _perIds = row.perId
// proxy.$modal.confirm('是否确认此操作?').then(function() {
// loading.value = true
// return delInfo(_perIds)
// }).then(() => {
// loading.value = true
// initData()
// proxy.$modal.msgSuccess('操作成功!')
// }).catch(() => {
// }).finally(() => {
// loading.value = false
// })
// }
// 下载缴费凭证
function downloadOrder(row) {
url.value = row.payEvidence?.[0]?.url
proxy.$refs['linkRef'].$el.click()
}
// 上传缴费凭证确定
async function uploadSure() {
proxy.$refs['refForm'].validate(async valid => {
if (valid) {
const res = await commitPaymentVoucher({
docId: form.value.docId,
payTime: form.value.payTime,
url: JSON.stringify(form.value.url),
remark: form.value.remark
})
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功')
showFileUpload.value = false
initData()
} else {
proxy.$modal.msgError('操作失败')
}
console.log(res)
} else {
proxy.$modal.msgError('请完善信息')
}
})
}
// 缴费单删除
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除缴费名称为"' + row.finalDocName + '"的数据项?').then(function() {
return certifiedDocDelete(row.docId)
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
if (list.value.length == 1 && queryParams.value.pageNum > 1) {
queryParams.value.pageNum--
}
initData()
}).catch(() => {
}).finally(() => {
})
}
</script>
<style lang="scss" scoped>
.router {
margin-right: 20px;
}
.size {
color: var(--el-button-text-color)
}
</style>