addMemberPay.vue
11.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
<template>
<div class="box">
<el-form
ref="infoRef" size="small" label-width="100px" :model="form" :rules="rules"
style="width: 1000px;"
>
<el-form-item label="缴费名称:" prop="paymentName"><el-input v-model="form.paymentName" readonly style="width: 500px;" />
</el-form-item>
<el-form-item label="证件号码:" prop="idcCode">
<el-select v-model="form.idType" placeholder="请选择" style="width: 200px;">
<el-option v-for="item in cardType" :key="item.value" :hidden="item.value==2||item.value==3" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="form.idcCode" placeholder="请输入" style="width: 300px;" @change="IDchange" />
<el-button class="btn" icon="Plus" type="primary" @click="submitForm"> 添加</el-button>
<el-button type="primary" @click="onLineFN"> 在线选择</el-button>
<!-- <el-button type="primary" @click="dialogFold"> 批量导入</el-button>-->
<!-- <a class="btn a"> 下载模版</a>-->
</el-form-item>
<el-form-item label="缴费年限:" prop="payYear">
<el-select v-model="form.payYear" placeholder="请选择" style="width:500px;">
<el-option label="一年" value="1" />
<el-option label="两年" value="2" />
<el-option label="三年" value="3" />
<el-option label="四年" value="4" />
<el-option label="五年" value="5" />
</el-select>
</el-form-item>
</el-form>
<br>
<div class="vipData">
<div> 人数合计:<span>{{ formData.personCount? formData.personCount:0 }}</span>人 </div>
<div> 新会员合计:<span>{{ formData.newPersonCount? formData.newPersonCount:0 }}</span>人 </div>
<div> 续费会员合计:<span>{{ formData.oldPersonCount? formData.oldPersonCount:0 }}</span>人 </div>
<!-- <el-col :span="4">
<div class="nav-box"> 合计年限<span>{{ formData.oldPersonCount? formData.oldPersonCount:0 }}</span>人 </div>
</el-col> -->
</div>
<br>
<br>
<div>
<el-form ref="" :model="queryParams" size="small" :inline="true" label-width="auto">
<el-form-item label="姓名:" prop=""><el-input v-model="queryParams.personName" style="width: 200px;" />
</el-form-item>
<el-form-item label="证件号码:">
<el-select v-model="queryParams.personIdcType" placeholder="请选择" style="width: 200px;">
<el-option v-for="item in cardType" :key="item.value" :hidden="item.value==2||item.value==3" :label="item.label" :value="item.value" />
</el-select>
<el-input v-model="queryParams.personIdcCode" placeholder="请输入" style="width: 250px;" @change="IDchange" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="selectFN"> 查询</el-button>
<el-button type="" @click="reset"> 重置</el-button>
</el-form-item>
</el-form></div>
<div>
<el-table border :data="list" style="width: 100%" @sort-change="sortChange">
<el-table-column label="序号" type="index" width="55" />
<el-table-column
label="姓名"
align="center"
prop="personName"
min-width="80"
/>
<el-table-column
label="证件类型"
align="center"
prop="personIdcType"
min-width="80"
>
<template #default="props">
<!-- <div v-if="props.row.personIdcType == 1">护照</div>
<div v-else>身份证</div> -->
<div>{{ cardType[props.row.personIdcType]?.label }}</div>
</template>
</el-table-column>
<el-table-column
label="证件号"
align="center"
prop="personIdcCode"
min-width="170"
>
<template #default="props">
<div v-if="props.row.perType==1" />
</template>
</el-table-column>
<el-table-column
label="所属单位(团体会员)"
align="center"
prop="memberInfoName"
min-width="140"
:show-overflow-tooltip="true"
/>
<el-table-column
label="原有效期"
align="center"
prop="originValidityDate"
min-width="100"
:show-overflow-tooltip="true"
>
<template #default="scope">
<div>{{ scope.row?.personIdcType==3?"--": parseTime(scope.row.originValidityDate, '{y}-{m}-{d}') }}</div>
</template>
</el-table-column>
<el-table-column
label="续费年限"
min-width="200"
align="center"
>
<template #default="props">
<el-select v-model="props.row.payYear" placeholder="请选择" @change="getYear(props.row)">
<el-option label="一年" :value="1" />
<el-option label="两年" :value="2" />
<el-option label="三年" :value="3" />
<el-option label="四年" :value="4" />
<el-option label="五年" :value="5" />
</el-select>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
fixed="right"
class-name="small-padding"
width="200"
>
<template #default="scope">
<el-button type="primary" @click="handleInfo(scope.row)">查看</el-button>
<el-button type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</div>
<br>
<br>
<el-row justify="center">
<el-button type="primary" :disabled="list?.length<=0" @click="commitFN"> 保存并提交</el-button>
</el-row>
<onLine ref="onLineRef" @backFN="backFN" />
</div>
</template>
<script setup>
import { ref, toRefs, reactive, onMounted } from 'vue'
import { addPersonPayment, addSelectPageList, editYear, commit, selectPageList, delPayment } from '@/api/member/memberPay.js'
import { useRoute, useRouter } from 'vue-router'
import { getCurrentInstance } from '@vue/runtime-core'
import onLine from './components/onLine.vue'
const router = useRouter()
const route = useRoute()
const buttonLoading = ref(false)
const { proxy } = getCurrentInstance()
const dialogID = ref(false)
const cardType = ref([
{ label: '身份证', value: '0' },
{ label: '港澳台通行证 ', value: '1' },
{ label: '中国护照', value: '2' },
{ label: '外国护照', value: '3' },
{ label: '其它', value: '4' }
])
const data = reactive({
rules: {
payYear: { required: true, message: '请选择缴费年限', trigger: 'blur' },
idcCode: [
{ required: true, message: '请输入证件号', trigger: 'blur' },
{ validator: validateMin, trigger: 'blur' }
],
cityId: { required: true, message: '请选择地区', trigger: 'change' }
},
form: {
rangeId: -1
},
queryParams: {
pageNum: 1,
pageSize: 10,
rangeId: -1
},
formData: {}
})
const total = ref(0)
const list = ref([])
const { rules, form, queryParams, formData } = toRefs(data)
onMounted(() => {
if (route.query.rangId) {
form.value.rangeId = route.query.rangId
queryParams.value.rangeId = route.query.rangId
getList()
}
})
// 身份证校验
// 自定义表单验证
function validateMin(rule, value, callback) {
const i = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/
if (!form.value.idType) callback(new Error('请选择证件类型!'))
if (form.value.idType == 0) {
if (!i.test(form.value.idcCode)) {
callback(new Error('请输入正确的证件号!'))
} else {
callback()
}
} else {
callback()
}
}
function onLineFN() {
proxy.$refs['onLineRef'].open(route.query.rangId || queryParams.value.rangeId)
console.log(queryParams.value.rangeId)
}
// 身份证校验
function IDchange(e) {
dialogID.value = true
}
// 窗口关闭
function backFN(rangeId) {
form.value.rangeId = rangeId
queryParams.value.rangeId = rangeId
getList()
}
// 查看
function handleInfo(row) {
router.push({
path: '/member/list/memberDetails',
query: {
perId: row.perId
}
})
}
async function getYear(row) {
const res = await editYear(row.payId, row.payYear)
if (res.code === 200) {
proxy.$modal.msgSuccess('操作成功!')
} else {
proxy.$modal.msgSuccess('操作失败!')
}
getList()
}
async function getList() {
const res = await addSelectPageList(queryParams.value)
list.value = res.pageData.rows
total.value = res.pageData.total
formData.value = res
}
function selectFN() {
getList()
}
function reset() {
queryParams.value.personIdcCode = ''
queryParams.value.personIdcType = ''
queryParams.value.personName = ''
getList()
}
/** 添加 */
function submitForm() {
proxy.$refs['infoRef'].validate(async valid => {
if (valid) {
buttonLoading.value = true
let res = null
form.value.idcKey = form.value.idType + form.value.idcCode
res = await addPersonPayment(form.value)
if (res.code == 200) {
if (res.data?.range?.paymentName)form.value.paymentName = res.data.range.paymentName
if (res.data?.range?.rangId) {
queryParams.value.rangeId = res.data.range.rangId
form.value.rangeId = res.data.range.rangId
}
proxy.$modal.msgSuccess('新增成功')
} else {
proxy.$modal.msgError('新增失败')
}
buttonLoading.value = false
getList()
}
})
}
// 提交审核
async function commitFN() {
if (form.value.rangeId == -1) return
const res = await commit(route.query.rangId || form.value.rangeId)
if (res.code == 200) {
proxy.$modal.msgSuccess('提交成功!')
router.push('/member/memberPay')
} else {
proxy.$modal.msgError('提交失败!')
}
}
// 在线选着列表
getAddList()
async function getAddList(params) {
const res = await selectPageList()
console.log(res)
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除个人会员姓名为"' + row.personName + '"的数据项?').then(function() {
return delPayment([row.payId])
}).then(() => {
proxy.$modal.msgSuccess('删除成功')
if (list.value.length == 1 && queryParams.value.pageNum == 1) {
form.value.rangeId = -1
queryParams.value.rangeId = -1
form.value.paymentName = ''
} else if (list.value.length == 1 && queryParams.value.pageNum > 1) {
queryParams.value.pageNum--
}
getList()
}).catch(() => {
}).finally(() => {
})
}
</script>
<style scoped lang="scss">
.box{
padding: 50px;
}
.tdFlex {
display: flex;
}
.w50 {
width: 50%;
}
.ml20 {
margin-left: 20px;
}
:deep(.el-button--info){
background-color: #920f20;
border: 1px solid #920f20;
}
.idCode{
:deep(.el-upload--picture-card){
width: 380px;
height: 240px;
}
:deep(.fileItem ){
width: 380px;
height: 240px;
}
:deep(.el-upload__tip){
display: none;
}
:deep(.el-upload-list--picture-card){
// text-align: center;
display: flex;
justify-content: center;
}
}
.text-center{
display: flex;
margin-top: 30px;
margin-bottom: 40px;
}
.text-center>div{
margin-left: 20px;
}
.btn{
margin-left: 10px;
}
.a{
color:#0000ff;
border-bottom: 1px solid #0000ff;
}
.nav-box{
padding: 10px;
font-size: 16px;
background-color: #fff;
span{
font-weight: 600;
font-size: 18px;
margin: 0 10px;
}
}
</style>