invoiceCodeList.vue
14.8 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
<!-- 门店产值 -->
<template>
<d2-container class="m-t-40">
<div class="header"
slot="header"
style="padding-bottom: 20px;">
<d2-search ref="showSearch"
class="show-search"
:search-form="searchForm"
:form-data="showFormData"
label-width="120px">
<div slot="invoiceAmountHtml">
<input-range start-placeholder="最小金额"
end-placeholder="最大金额"
:display-value="searchForm.invoiceAmount"></input-range>
</div>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId"
size="small"
type="primary">
查询
</el-button>
<el-button size="small"
@click="handleReset"> 重置 </el-button>
</div>
</div>
<!-- </div> -->
<div class="d2-container-content">
<d2-table-header>
<span>
<auth-button category="Button" /></span>
</d2-table-header>
<d2-table ref="recordTable"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn">
<div slot="auth-button"
slot-scope="scope">
<!-- 详情 -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope"
:show-btn-ids="['9170103']" />
</span>
<!-- 查看二维码 -->
<span style="margin-right: 10px"
v-if="scope.scope.invoiceQrCode">
<auth-button :data="scope.scope"
:show-btn-ids="['9170104']" />
</span>
</div>
</d2-table>
</div>
<!-- 详情 -->
<invoiceCodeDetailDialog :visible.sync="detailVisible"
v-if="detailVisible"
:params-obj="recordInfo"
@dialogClose="closeDetailDialog" />
<!-- 查看二维码 -->
<QRCodeDetailDialog :visible.sync="QRdetailVisible"
v-if="QRdetailVisible"
:params-obj="recordInfo"
@dialogClose="closeQRDetailDialog" />
</d2-container>
</template>
<script>
import { mapActions, mapState } from "vuex"
import { Util, deepClone } from "@/common/util"
import inputRange from './components/inputRange'
import invoiceCodeDetailDialog from "./components/invoiceCodeDetailDialog"
import QRCodeDetailDialog from "./components/QRCodeDetailDialog"
import {
invoicePage,
batchCancelInvoiceQrcode
} from "@api/invoiceManage"
import { useStatusOpt, expireStatusOpt, createdSourceOpt, cancelStatusOpt, invoiceTypeOpt } from "@/common/constants.js"
export default {
name: "InvoiceCodeList",
data() {
return {
searchForm: {
createTime: "",
useStatus: "",
expireStatus: "",
itemNames: "",
createdSource: "",
cancelStatus: "",
bizOrderCode: "",
bizTradeNo: "",
tradeNo: "",
invoiceType: "",
invoiceAmount: []
},
searchFormSearch: {},
showFormData: [
{
label: '生成日期',
name: 'createTime',
type: 'datePicker',
isClear: true,
pickerOptions: 'rangePickerOptions'
},
{
label: "使用状态",
name: "useStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "useStatusOpt"
},
{
label: "是否在有效期",
name: "expireStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "expireStatusOpt"
},
{
label: '主要开票项目',
name: 'itemNames',
type: 'input',
maxlength: '50',
isClear: true
},
{
label: "二维码来源",
name: "createdSource",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "createdSourceOpt"
},
{
label: "作废状态",
name: "cancelStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "cancelStatusOpt"
},
{
label: '主订单号',
name: 'bizOrderCode',
type: 'input',
maxlength: '50',
isClear: true
},
{
label: '交易参考号',
name: 'bizTradeNo',
type: 'input',
maxlength: '50',
isClear: true
},
{
label: '票通订单号',
name: 'tradeNo',
type: 'input',
maxlength: '50',
isClear: true
},
{
label: "发票种类",
name: "invoiceType",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "invoiceTypeOpt"
},
{
label: '开票金额',
name: 'invoiceAmount',
addHtml: "invoiceAmountHtml"
}
],
getListApi: invoicePage,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
mutiSelectUniqueKey: 'id',
mutiSelectName: 'invoiceCode',
listName: "list",
tableOption: { width: "150px" },
tableColumns: [
{
label: "发票种类",
prop: "invoiceType",
width: "300",
formatter: (cellValue) => {
let arr = cellValue.invoiceType.split(",")
arr = arr.map((o) => {
return this.baseData.invoiceTypeOpt.find(item => item.confId === o)?.confValue
})
return arr.join("/")
}
},
{
label: "开票金额",
prop: "invoiceAmount",
width: "150"
},
{
label: "主要开票项目",
prop: "itemNames",
width: "300"
},
{
label: '是否在有效期',
prop: 'expireStatus',
width: '120px',
formatter: (cellValue) => {
return this.baseData.expireStatusOpt.find(item => item.confId === cellValue.expireStatus)?.confValue
}
},
{
label: '使用状态',
prop: 'useStatus',
width: '120px',
formatter: (cellValue) => {
return this.baseData.useStatusOpt.find(item => item.confId === cellValue.useStatus)?.confValue
},
className: (cellValue) => {
return {
N: 'redSpot',
Y: 'greenSpot'
}[cellValue.useStatus]
}
},
{
label: '作废状态',
prop: 'cancelStatus',
width: '100px',
formatter: (cellValue) => {
return this.baseData.cancelStatusOpt.find(item => item.confId === cellValue.cancelStatus)?.confValue
}
},
{
label: '二维码来源',
prop: 'createdSource',
width: '100px',
formatter: (cellValue) => {
return this.baseData.createdSourceOpt.find(item => item.confId === cellValue.createdSource)?.confValue
}
},
{
label: "票通订单号",
prop: "tradeNo",
width: "200"
},
{
label: "主订单号",
prop: "bizOrderCode",
width: "200"
},
{
label: "交易参考号",
prop: "bizTradeNo",
width: "200"
},
{
label: "总开票份数",
prop: "allowInvoiceCount",
width: "100"
},
{
label: "已开票份数",
prop: "issuedInvoiceCount",
width: "100"
},
{
label: "生成时间",
prop: "createdDate",
width: "180"
},
{
label: "失效时间",
prop: "expireTime",
width: "180"
}
]
},
baseData: {
useStatusOpt: deepClone(useStatusOpt),
expireStatusOpt: deepClone(expireStatusOpt),
createdSourceOpt: deepClone(createdSourceOpt),
cancelStatusOpt: deepClone(cancelStatusOpt),
invoiceTypeOpt: deepClone(invoiceTypeOpt)
},
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
recordInfo: null,
detailVisible: false,
QRdetailVisible: false
}
},
components: {
inputRange,
invoiceCodeDetailDialog,
QRCodeDetailDialog
},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList,
updateList: (state) => state.d2admin.user.updateList
})
},
mounted() {
this.getBaseData()
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close"
}),
...mapActions("d2admin/user", ["actionSetDownloadList"]),
async getBaseData() {
this.getOptionsList()
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm)
if (this.searchFormSearch.createTime) {
this.searchFormSearch.createdStartDate = Util.dateFormate(this.searchFormSearch.createTime[0], 'YYYY-MM-DD HH:mm:ss')
this.searchFormSearch.createdEndDate = Util.dateFormate(this.searchFormSearch.createTime[1], 'YYYY-MM-DD') + ' 23:59:59'
} else {
delete this.searchFormSearch.createdStartDate
delete this.searchFormSearch.createdEndDate
}
if (this.searchFormSearch.invoiceAmount && this.searchFormSearch.invoiceAmount.length > 0) {
this.searchFormSearch.invoiceAmountMin = this.searchFormSearch.invoiceAmount[0]
this.searchFormSearch.invoiceAmountMax = this.searchFormSearch.invoiceAmount[1]
} else {
delete this.searchFormSearch.invoiceAmountMin
delete this.searchFormSearch.invoiceAmountMax
}
resolve()
})
},
handleReset() {
this.searchForm = {
createTime: "",
useStatus: "",
expireStatus: "",
itemNames: "",
createdSource: "",
cancelStatus: "",
bizOrderCode: "",
bizTradeNo: "",
tradeNo: "",
invoiceType: "",
invoiceAmount: []
}
this.$refs.recordTable.refreshTable()
},
getOptionsList() {
this.showFormData.forEach((item, index) => {
if (item.type === 'select') {
if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
const temp = {}
temp[this.showFormData[index].optionId] = ''
temp[this.showFormData[index].optionLabel] = '全部'
this.baseData[item.optionsName].unshift(temp)
}
this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
}
})
},
// 批量作废
handleCancel() {
var selectedData = []
if (this.$refs.recordTable.mutiSelectArr.invoiceCode) {
selectedData = this.$refs.recordTable.mutiSelectArr.invoiceCode
}
this.handleCancel_commit(selectedData)
},
handleCancel_commit(selectedData) {
if (!selectedData?.length) {
this.$message({
message: "请选择要作废的二维码",
type: "warning",
showClose: true
})
return false
}
let _flag = true
selectedData.forEach(item => {
if (item.cancelStatus == 'Y' || item.useStatus == 'Y') { // 包含已作废或已使用的二维码
_flag = false
}
})
if (!_flag) {
this.$message({
message: "包含已作废或已使用的二维码,请重新选择",
type: "warning",
showClose: true
})
return
}
const qrcodeNos = selectedData.map((item) => {
return item.qrcodeNo
})
this.$confirm('请确认是否要执行当前操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false
}).then(() => {
batchCancelInvoiceQrcode({ qrcodeNoList: qrcodeNos }).then(res => {
this.notice.okTips()
this.$refs.recordTable.refreshTable()
})
}).catch(err => {
console.log(err)
})
},
handleDetail(row) {
this.recordInfo = row
this.detailVisible = true
},
closeDetailDialog() {
this.detailVisible = !this.detailVisible
this.$refs.recordTable.refreshTable(false, true)
},
handleQRCode(row) {
this.recordInfo = row
this.QRdetailVisible = true
},
closeQRDetailDialog() {
this.QRdetailVisible = !this.QRdetailVisible
this.$refs.recordTable.refreshTable(false, true)
},
handleExport() {
var params = this.searchFormSearch
// 去除为null的值
for (const key in params) {
if (params[key] === null || params[key] === '' || params[key].length == 0) {
delete params[key]
}
}
params.method = 'dj.smartcarlife.api.vpt.invoiceIssueQrcode.export.async'
const list = [
...this.dowloadList,
{
name: '开票二维码',
exportParam: JSON.stringify(params),
status: 'waiting',
timeid: new Date().getTime()
}
]
this.actionSetDownloadList({ list, type: 'dowloadList' })
}
}
}
</script>
<style lang="scss" scoped>
.m-t-40 {
margin-top: 40px;
}
@mixin typeBase {
width: 52px;
border-radius: 239px;
opacity: 1;
font-size: 14px;
text-align: center;
line-height: 24px;
display: inline-block;
}
.type-yellow {
@include typeBase();
background: #ff8d1a1a;
color: #ff8d1a;
}
.type-blue {
@include typeBase();
background: #5850ff1a;
color: #5850ff;
}
.type-green {
@include typeBase();
background: #43cf7c1a;
color: #43cf7c;
}
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style>