monthSettlement.vue
17.6 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
<template>
<div class="app-container">
<div>
<!-- 搜索区域 -->
<div class="from-Card">
<el-form
ref="queryRef" size="small" :model="queryParams" :inline="true" label-width="auto"
label-position="top"
>
<el-row style="width: 100%;">
<el-col :span="4">
<el-form-item label="月结名称" prop="finalDocName">
<el-input
v-model.trim="queryParams.yjName" placeholder="" clearable style="width: 100%;"
@keyup.enter="serachFN"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="缴费单位" prop="payMemName">
<el-input
v-model.trim="queryParams.payMemName" placeholder="" clearable style="width: 100%;"
@keyup.enter="serachFN"
/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="缴费状态" prop="type">
<el-select v-model.trim="queryParams.settleFlag" style="width: 100%;" @change="serachFN">
<el-option label="全部" value="" />
<!-- <el-option label="已上传凭证" value="0" />-->
<!-- <el-option label="未上传凭证" value="1" />-->
<el-option label="已结算" value="0" />
<el-option label="未结算" value="1" />
<!-- <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.trim="queryParams.yjCode" placeholder="" clearable style="width: 100%"
@keyup.enter="serachFN"
/>
</el-form-item>
</el-col>
<!-- <el-col :span="4">-->
<!-- <el-form-item label="结算编号" prop="">-->
<!-- <el-select v-model.trim="payFlag" style="width: 100%;" @change="serachFN">-->
<!-- <el-option label="全部" value="" />-->
<!-- <el-option label="已上传凭证" value="0" />-->
<!-- <el-option label="未上传凭证" value="1" />-->
<!-- <el-option label="已结算" value="3" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="4">-->
<!-- <el-form-item label="缴费日期" prop="name">-->
<!-- <el-date-picker-->
<!-- v-model="jfTimeRange" value-format="YYYY-MM-DD" type="daterange"-->
<!-- range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%;"-->
<!-- @change="serachFN"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8" :hidden="showCollect">-->
<!-- <el-form-item label="结算日期" prop="name">-->
<!-- <el-date-picker-->
<!-- v-model="jsTimeRange" type="daterange" value-format="YYYY-MM-DD"-->
<!-- range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" style="width: 100%;"-->
<!-- @change="serachFN"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<div class="po-r-btns">
<el-button size="small" type="primary" icon="Search" @click="initData">查询</el-button>
<el-button size="small" icon="Refresh" @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
:icon="Download" :disabled="show" type="primary"
@click="batchDown"
>批量下载缴费通知单 </el-button>
<el-button
:icon="Wallet" :disabled="show" type="primary"
@click="pSettlement"
>批量结算 </el-button>
<el-button
:icon="Download" type="warning"
@click="exportList"
>导出 </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="40" align="center" />
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="缴费单位" align="center" prop="payMemName" min-width="120" :show-overflow-tooltip="true" />
<el-table-column
label="月结单号" align="center" min-width="120"
>
<template #default="scope">
<el-button :disabled="scope.row.sendFlag == 0" type="text" @click="monthCode(scope.row)">{{ scope.row.yjCode }}</el-button>
</template>
</el-table-column>
<el-table-column
label="月结名称" align="center" prop="yjName" min-width="260"
:show-overflow-tooltip="true"
/>
<el-table-column label="结算单日期范围" align="center" prop="timeRange" min-width="200" />
<el-table-column label="结算单数量" align="center" prop="recordCount" min-width="100" />
<el-table-column label="费用合计" align="center" prop="recordTotalFee" min-width="110" />
<el-table-column label="年限合计" align="center" prop="yearCounts" min-width="110" />
<el-table-column label="缴费单" align="center" min-width="120">
<template #default="scope">
<span>{{ scope.row.sendFlag==0?'未下发':'已下发' }}</span>
</template>
</el-table-column>
<el-table-column label="缴费凭证" align="center" prop="personCount" min-width="80">
<template #default="scope">
<!-- <div>{{ scope.row.payFlag }}</div>-->
<div v-if="scope.row.payFlag==0">已上传</div>
<el-link v-if="scope.row.payFlag==1" :disabled="scope.row.sendFlag==0" @click="handleUpdate(scope.row)" class="text-danger s">未上传</el-link>
<div v-if="scope.row.payFlag==2">未确认</div>
</template>
</el-table-column>
<el-table-column label="下发日期" align="center" min-width="120">
<template #default="scope">
<span>{{ parseTime(scope.row.yjTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="缴费日期" align="center" min-width="120">-->
<!-- <template #default="scope">-->
<!-- <span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="结算状态" align="center" prop="settleFlag" min-width="110">
<template #default="props">
<div v-if="props.row.settleFlag == 0" class="text-success s" @click="handleDownload(props.row)">已结算 </div>
<div v-if="props.row.settleFlag == 1" class="text-danger">未结算 </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>-->
<!-- <div v-if="props.row.settleFlag == 1 && props.row.payFlag == 2" class="text-danger">未确认 </div>-->
</template>
</el-table-column>
<!-- <el-table-column label="结算日期" align="center" prop="payTime" 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="payRemark" min-width="120" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding" width="270">
<template #default="scope">
<el-button type="primary" @click="handleInfo(scope.row)">查看</el-button>
<el-button :disabled="scope.row.payFlag!=0" type="primary" @click="handleDownload(scope.row)">下载凭证</el-button>
<el-button v-if="scope.row.settleFlag == 1" :disabled="scope.row.sendFlag==0" type="warning" @click="handleSettlement(scope.row)">结算</el-button>
<el-button v-else type="danger" @click="unHandleSettlement(scope.row)">取消结算</el-button>
</template>
</el-table-column>
</el-table>
<div v-show="total>0" class="totalCost">
总计:<span>{{ statistical.personCount }} 单</span>
共:<span>{{ statistical.totalCost?.toFixed(2) }} 元</span>
年限合计:<span>{{ statistical.totalYear }} 年</span>
</div>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total" @pagination="initData"
/>
</div>
</div>
<!--文件上传-->
<el-dialog
v-if="showFileUpload" v-model="showFileUpload" draggable title="上传缴费凭证" width="600px"
@close="close"
>
<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>
<feeBillView ref="feeBillViewRef" @approval="initData" />
<bill ref="billRef" />
<!-- 下载缴费凭证 -->
<el-link v-show="false" ref="linkRef" :href="fillImgUrl(url)" :underline="false" target="_blank" />
</div>
</template>
<script setup>
import { getCurrentInstance, nextTick, onMounted } from 'vue'
import { reactive } from '@vue/runtime-core'
import { ref, toRefs, computed } from 'vue'
import { Download, Wallet } from '@element-plus/icons-vue'
import { commitPaymentVoucher, paymentDoc } from '@/api/member/feeBill.js'
import feeBillView from './feeBillView.vue'
import bill from './bill'
import { useRouter } from 'vue-router'
import { mentDocList, settle, unSettle } from '@/api/member/monthlyFeeBill'
const router = useRouter()
const show = ref(true)
const { proxy } = getCurrentInstance()
const total = ref(0)
const showFileUpload = ref(false)
const list = ref([])
const lists = ref([])
const batchList = ref([])
const url = ref()
const statistical = ref({})
const arr = ['png', 'jpg', 'jpeg', 'pdf', 'zip']
const jsTimeRange = ref([])
const jfTimeRange = ref([])
const payFlag = ref()
const loading = ref(false)
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
settleFlag: '1'
},
form: {},
rules: {
payTime: { required: true, message: '请选择缴费日期', trigger: 'blur' },
url: { required: true, message: '请上传缴费凭证', trigger: 'blur' }
}
})
const { queryParams, form, rules } = toRefs(data)
onMounted(() => {
initData()
})
// // 背景色
const tableRowClassName = ({
row,
rowIndex
}) => {
if (row.settleFlag == 0) {
return 'success-row'
}
}
function serachFN() {
queryParams.value.pageNum = 1
initData()
}
// 获取赛会列表
async function initData() {
loading.value = true
queryParams.value.jfTimeRange = jfTimeRange.value?.toString()
queryParams.value.jsTimeRange = jsTimeRange.value?.toString()
const res = await mentDocList(queryParams.value)
statistical.value = {
totalCost: 0,
personCount: 0,
totalYear: 0
}
list.value = res.rows
total.value = res.total
list.value.forEach(item => {
item.payEvidence = JSON.parse(item.payEvidence)
statistical.value.totalCost += (item.recordTotalFee * 1)
statistical.value.personCount += (item.recordCount * 1)
statistical.value.totalYear += (item.yearCounts * 1)
})
loading.value = false
}
// 上传缴费凭证确定
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) {
showFileUpload.value = false
await initData()
proxy.$modal.msgSuccess('操作成功')
} else {
proxy.$modal.msgError('操作失败')
}
} else {
proxy.$modal.msgError('请完善信息')
}
})
}
// 上传缴费凭证
async function handleUpdate(row) {
form.value = row
if (form.value.payEvidence) form.value.url = form.value.payEvidence
showFileUpload.value = true
}
// 多选
function handleSelectionChange(e) {
lists.value = e.map(item => item.yjId)
batchList.value = e
show.value = !lists.value.length
}
// 查看
function handleInfo(row) {
proxy.$refs['feeBillViewRef'].open(row)
}
// 批量结算
async function pSettlement() {
const flag = batchList.value.some(item => {
// if (!(item.payFlag == 0 && item.settleFlag == 1)) {
// return proxy.$message.warning(`缴费名称为${item.finalDocName}的数据项不符合要求!`)
// }
if (item.settleFlag == 0 || item.sendFlag == 0) {
return proxy.$message.warning(`月结名称为${item.yjName}的数据项不符合要求!`)
}
})
if (flag) return
await settle(lists.value)
await proxy.$modal.msgSuccess('操作成功')
await initData()
}
// 缴费单
async function DownloadFN(row) {
// proxy.download(
// `/person/paymentDoc/downJiaoFei/${[row.docId]}`, {}, ``
// )
const routerData = router.resolve({
path: '/download',
query: {
arr: [row.docId],
type: 'batchMemberFeeBill'
}
})
window.open(routerData.href, '_blank')
}
// 批量下载缴费通知单
async function batchDown() {
// const flag = batchList.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: lists.value,
type: 'batchMemberYJFeeBill'
}
})
window.open(routerData.href, '_blank')
}
// 下载缴费凭证
function downloadOrder(row) {
url.value = row.payEvidence?.[0]?.url
proxy.$refs['linkRef'].$el.click()
}
// 订单编号
function monthCode(row) {
proxy.$refs['billRef'].open(row)
}
// 重置
function resetQuery() {
queryParams.value = {
pageNum: 1,
pageSize: 10,
settleFlag: '1'
}
payFlag.value = ''
jsTimeRange.value = []
jfTimeRange.value = []
initData()
}
function close() {
form.value = {}
}
function unHandleSettlement(row) {
proxy.$modal.confirm('是否确认取消月结缴费名称为 ' + row.yjName + ' 的数据项?').then(function() {
return unSettle(row.yjId)
}).then(() => {
}).finally(() => {
initData()
})
}
function handleSettlement(row) {
proxy.$modal.confirm('是否确认结算月结缴费名称为 ' + row.yjName + ' 的数据项?').then(function() {
return settle(row.yjId)
}).then(() => {
proxy.$modal.msgSuccess('操作成功!')
}).finally(() => {
initData()
})
}
function handleDownload(row) {
url.value = row.payEvidence?.[0]?.url
nextTick(() => {
proxy.$refs['linkRef'].$el.click()
})
}
function exportList() {
proxy.download(
`/person/paymentDocYj/export`, { ...queryParams.value }, `月结缴费记录.xlsx`
)
}
</script>
<style lang="scss" scoped>
.router {
margin-right: 20px;
}
.size {
color: var(--el-button-text-color)
}
</style>