accountList.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
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
<!-- 虚拟账户成本 -->
<template>
<div>
<div class="d2-container-content" style="padding: 10px 20px;">
<div slot="header" class=" header">
<d2-search ref="showSearch"
:form-data="showFormData"
:search-form="searchForm">
<!-- :slot-scope="item" -->
<template slot="channelType">
<el-cascader v-model="merchantLevelVal"
style="width: 50%;"
clearable
filterable
:options="merchantLevelOptions[nameToOption[searchForm.channelType]]"
:props="{ checkStrictly: true, value: 'id', label: 'merchantName' }"
:show-all-levels="false" />
</template>
</d2-search>
<div class="up-btns">
<el-button size="small"
type="primary"
@click="searchList">
查询
</el-button>
<el-button size="small" @click="handleReset">
重置
</el-button>
</div>
</div>
</div>
<div class="d2-container-content">
<span slot="left">
<auth-button category="Button" :show-btn-ids="['9061003']" />
</span>
<!-- :get-list-api="getListApi" -->
<d2-table ref="merchantTable"
:array-span-method="arraySpanMethod"
:before-search-fn="beforeSearchFn"
:has-num="false"
:search-form="searchFormSearch"
:table-data="restructureList"
:table-params="tableParams"
:table-total="total"
@refreshTable="jumpPage">
<!-- <auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> -->
<div slot="auth-button"
slot-scope="scope"
class="btnClass">
<template v-if="scope.scope.accountStatus != 1">
<auth-button slot="auth-button"
:data="scope.scope"
:show-btn-ids="['9061007']" />
<auth-button v-if="!scope.scope.ineffectiveReceiptMode && scope.scope.payPlatform == 'ysepay'"
slot="auth-button"
:data="scope.scope"
:show-btn-ids="['9061008']" />
<!-- 未签约 -->
<auth-button v-if="scope.scope.withdrawSignStatus == 1 && scope.scope.payPlatform == 'allinpay'"
slot="auth-button"
:data="scope.scope"
:show-btn-ids="['9061009']" />
</template>
<template v-else>
<auth-button slot="auth-button"
:data="scope.scope"
:show-btn-ids="['9061001']" />
</template>
</div>
</d2-table>
</div>
<baseDialog class="dialog"
:config="dialogConfig.setting"
:dialog-config="dialogConfig.config"
:is-show.sync="accountDetailVisible"
@closeDialog="handleDetailClose">
<AccountDetail v-if="accountDetailVisible"
:account-detail-visible="accountDetailVisible"
:merchant-row="merchantRow" />
</baseDialog>
<baseDialog :dialog-config="modeDialogConfig.config"
:is-show.sync="receiptModeVisible"
@closeDialog="handleModeClose"
@handleClick="handleModeConfirm">
<EditAccountMode v-if="receiptModeVisible"
ref="editAccountModeForm"
:merchant-row="merchantRow"
@handleModeClose="handleModeClose" />
</baseDialog>
<!-- <settingDetail :show="settingDetailVisible"></settingDetail> -->
</div>
</template>
<script>
import { paymentChannelList } from "@api/index";
import { accountPage, getListApi, getMerchantLevelApi, getSignUrl, synchronizeBusinessInformation } from "@api/publicAccount";
import { mapActions } from "vuex";
import { BaseData, merchantStoreServiceList, receiptModeList, withdrawSignStatusList } from "@/common/constants.js";
import { deepClone, Util } from "@/common/util";
import accountDetail from "./accountDetail";
import editAccountMode from "./components/editAccountMode.vue";
// import baseDialog from '@/components/baseDialog/baseDialog'
// import settingDetail from './settingDetail.vue'
export default {
name: "AccountList",
components: {
AccountDetail: accountDetail,
EditAccountMode: editAccountMode,
// baseDialog,
// settingDetail
},
data() {
return {
// 账户详情
accountDetailVisible: false,
// 修改到账模式
receiptModeVisible: false,
// settingDetailVisible: false,
merchantRow: {},
nameToOption: {
1: "dj",
2: "gh",
8: "zy",
},
merchantLevelOptions: {
dj: [],
gh: [],
zy: [],
},
// 搜索
merchantLevelVal: [],
searchForm: {
merchantType: "",
channelType: "",
merchantName: "",
accountStatus: "",
merchantId: "",
yseUserCode: "",
yseRefFlag: "",
receiptMode: "",
paymentChannelId: "",
},
searchFormSearch: {},
page: {
pageSize: 10,
currentPage: 1,
},
total: 0,
showFormData: [{
label: "商户分类",
name: "merchantType",
type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "merchantStoreServiceList",
}, {
label: "渠道",
name: "channelType",
addHtml: "channelType",
type: "select",
width: "50%",
optionList: [],
optionId: "value",
optionLabel: "name",
optionsName: "channelTypeList",
changeAttr: (value, targetItem) => {
this.merchantLevelVal = [];
},
}, {
label: "商户名称",
name: "merchantName",
type: "input",
isClear: true,
placeholder: "请输入4S店/服务商/园区店名称",
keyFn: this.keyDowmGetList,
}, {
label: "账户状态",
name: "accountStatus",
type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "statusList",
}, {
label: "商户号",
name: "merchantId",
type: "input",
inputType: "number",
maxlength: "9",
isClear: true,
placeholder: "请输入4S店/服务商/园区店商户号",
keyFn: this.keyDowmGetList,
}, {
label: "虚账编码",
name: "yseUserCode",
type: "input",
maxlength: "20",
isClear: true,
placeholder: "请输入虚账编码",
keyFn: this.keyDowmGetList,
}, {
label: "关联状态",
name: "yseRefFlag",
type: "select",
// noDataText: "请先选择订单来源",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "yseRefFlagList",
}, {
label: "到账模式",
name: "receiptMode",
type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "receiptModeList",
}, {
label: "支付渠道",
name: "paymentChannelId",
type: "select",
optionList: [],
optionId: "paymentChannelId",
optionLabel: "paymentChannelName",
optionsName: "payChannelList",
}, {
label: "提现状态",
name: "withdrawSignStatus",
type: "select",
optionList: [],
optionId: "confId",
optionLabel: "confLabel",
optionsName: "withdrawSignStatusList",
}],
// 表格
getListApi,
restructureList: [],
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: "list",
tableOption: true,
tableColumns: [{
label: "序号",
prop: "num",
width: "50px",
}, {
label: "名称",
prop: "merchantName",
width: "200px",
}, {
label: "商户号",
prop: "merchantId",
}, {
label: "商户分类",
prop: "merchantType",
formatter: (cellValue) => {
let html = "";
if (cellValue.merchantType) {
if (cellValue.merchantType == "6" || cellValue.merchantType == "9") {
html = "园区店";
} else if (cellValue.merchantType == "7") {
html = "服务商";
} else {
html = "4S店";
}
}
return html;
},
}, {
label: "渠道",
prop: "",
formatter: (cellValue) => {
// return cellValue.channelType === 1 ? '嘀加' : '广汇'
return this.baseData.channelTypeShow[cellValue.channelType];
},
}, {
label: "支付渠道",
prop: "paymentChannelName",
width: "150px",
}, {
label: "账户状态",
prop: "accountStatus",
formatter: (cellValue) => {
return this.baseData.statusList.find(item => item.confId === cellValue.accountStatus).confLabel;
},
}, {
label: "关联状态",
prop: "yseRefFlag",
formatter: (cellValue) => {
return cellValue.yseRefFlag == "Y" ? "已关联" : "未关联";
},
}, {
label: "到账模式",
prop: "receiptMode",
formatter: (cellValue) => {
return cellValue.receiptMode == "1" ? "T+1" : cellValue.receiptMode == "2" ? "D+1" : "-";
},
}, {
label: "提现状态",
prop: "withdrawSignStatus",
formatter: (cellValue) => {
if (cellValue.payPlatform == "ysepay") {
return "-";
} else {
return cellValue.withdrawSignStatus == "1" ? "未签约" : cellValue.withdrawSignStatus == "2" ? "已签约" : "-";
}
// return cellValue.withdrawSignStatus == "1" ? "未签约" : cellValue.withdrawSignStatus == "2" ? "已签约" : "-";
},
}, {
label: "虚账编码",
prop: "yseUserCode",
width: "200px",
}, {
label: "最近更新时间",
prop: "updatedDate",
formatter: (cellValue) => {
return Util.dateFormate(cellValue.updatedDate, "YYYY-MM-DD HH:mm:ss");
},
}],
},
baseData: {
channelTypeList: [],
statusList: [{
confId: 1,
confLabel: "未申请",
}, {
confId: 2,
confLabel: "审核中",
}, {
confId: 3,
confLabel: "生效",
}, {
confId: 4,
confLabel: "失败",
}],
channelTypeShow: {
1: "嘀加",
2: "广汇",
8: "直营",
9: "冀联",
},
yseRefFlagList: [{
confLabel: "已关联",
confId: "Y",
}, {
confLabel: "未关联",
confId: "N",
}],
merchantStoreServiceList,
receiptModeList: JSON.parse(JSON.stringify(receiptModeList)),
payChannelList: [],
withdrawSignStatusList,
},
dialogConfig: {
setting: {
showClose: true,
appendToBody: false,
// width: '720px',
btnList: [
],
},
config: {
title: "查看详情",
width: "720px",
},
},
modeDialogConfig: {
config: {
title: "修改到账模式",
width: "600px",
},
},
/** 合并参数start */
spanArr1: [], // 合并序列
spanIndex1: 0, // 合并序列索引
spanArr2: [], // 合并名称
spanIndex2: 0, // 合并名称索引
spanArr3: [], // 合并商户号
spanIndex3: 0, // 合并商户号索引
spanArr4: [], // 合并商户分类
spanIndex4: 0, // 合并商户分类索引
spanArr5: [], // 合并渠道
spanIndex5: 0, // 合并渠道索引
/** 合并参数end */
};
},
mounted() {
this.paymentChannelList();
this.getBaseData();
// 1-嘀加;2-广汇; 8-直营
this.getMerchantLevel(1);
this.getMerchantLevel(2);
this.getMerchantLevel(8);
this.queryList();
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close",
}),
// associationSettings() {
// this.settingDetailVisible = true
// },
async handleCopyLink(item) {
// const ok = await this.copyText('测试')
// if (ok) {
// this.$message.success('复制成功')
// } else {
// this.$message.error('复制失败,请手动复制')
// }
const res = await getSignUrl({
// platformYseMerchantId: '4',
// paymentChannelId: '65339644694B4D56ADE2999692864E44'
// platformYseMerchantId: item.yseMerchantId,
paymentChannelId: item.paymentChannelId,
usercode: item.yseUserCode,
});
console.log(res);
if (res && res.signUrl) {
const ok = await this.copyText(res.signUrl);
if (ok) {
this.$message.success("复制成功");
} else {
this.$message.error("复制失败,请手动复制");
}
} else {
this.$message.error(res && res.msg ? res.msg : "获取签约链接失败");
}
},
async copyText(text) {
try {
if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
await navigator.clipboard.writeText(text);
return true;
}
} catch (e) { }
const input = document.createElement("textarea");
input.value = text || "";
input.setAttribute("readonly", "");
input.style.position = "fixed";
input.style.top = "-1000px";
input.style.opacity = "0";
document.body.appendChild(input);
input.focus();
input.select();
let ok = false;
try {
ok = document.execCommand("copy");
} catch (e) {
ok = false;
}
document.body.removeChild(input);
return ok;
},
async getBaseData() {
this.baseData.channelTypeList = await this.get(BaseData.channelType);
this.getOptionsList();
},
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]);
}
});
console.log(this.showFormData, "showFormData");
},
getMerchantLevel(channelType) {
// channelType:1-嘀加;2-广汇;8-直营
getMerchantLevelApi({ channelType }).then((res) => {
// this.merchantLevelOptions[this.nameToOption[channelType]] = JSON.parse(res)
this.merchantLevelOptions[this.nameToOption[channelType]] = res;
});
},
// 账户状态不同,会有不同的操作
// 1/4 - 待申请/失败(编辑);2 - 审核中(置灰); 3 - 生效中(详情)
handleApply(cellValue) {
// 查看详情
if (cellValue.accountStatus === 3 || cellValue.accountStatus === 5 || cellValue.yseRefFlag == "Y") {
this.merchantRow = cellValue;
this.merchantRow.fromPage = "accountList";
this.handleDetailClose();
return true;
}
if (cellValue.payPlatform == "ysepay") { // 银盛
// 编辑
this.close({ tagName: "/applyAccount_new" });
this.$router.push({
name: "applyAccount_new",
params: cellValue,
});
} else if (cellValue.payPlatform == "allinpay") { // 通联
// 编辑
this.close({ tagName: "/applyAccount_tonglian" });
this.$router.push({
name: "applyAccount_tonglian",
params: cellValue,
});
}
},
// 修改到账模式
handleEditAccountMode(row) {
this.merchantRow = row;
this.handleModeClose();
},
// 修改到账模式确认
handleModeConfirm() {
this.$refs.editAccountModeForm.submitForm();
},
// 修改到账模式 关闭弹窗
handleModeClose(isRefreshTable = false) {
this.receiptModeVisible = !this.receiptModeVisible;
if (isRefreshTable) {
this.$refs.merchantTable.refreshTable();
} // 只刷新页面 保留当前分页数据
},
handleReset() {
this.searchForm = {
merchantType: "",
channelType: "",
merchantName: "",
accountStatus: "",
merchantId: "",
yseUserCode: "",
yseRefFlag: "",
receiptMode: "",
paymentChannelId: "",
};
this.merchantLevelVal = [];
// this.$refs.merchantTable.resetRefreshTable()
this.getOptionsList();
// 重置分页
this.page.currentPage = 1;
this.queryList();
},
beforeSearchFn() {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.searchForm);
this.searchFormSearch.merchantTypeList = this.searchForm.merchantType ? [this.searchForm.merchantType] : [2, 7, -1];
this.searchFormSearch.merchantId = this.searchForm.merchantId ? this.searchForm.merchantId : this.merchantLevelVal[this.merchantLevelVal.length - 1];
delete this.searchFormSearch.merchantType;
resolve();
});
},
keyDowmGetList() {
this.$refs.merchantTable.refreshTable();
},
handleDetailClose() {
// console.log('visible')
this.accountDetailVisible = !this.accountDetailVisible;
},
// 同步
synchronization() {
synchronizeBusinessInformation({}).then((res) => {
this.notice.okTips("同步数据成功");
});
},
queryList() {
let params = this.searchForm;
params = {
...this.page,
...params,
};
// 去除为null的值
for (const key in params) {
if (params[key] === null || params[key] === "" || params[key].length == 0) {
delete params[key];
}
}
accountPage(params).then((res) => {
this.total = res.total;
this.restructureData(res);
});
},
searchList() {
this.page = {
pageSize: this.page.pageSize,
currentPage: 1,
};
this.$refs.merchantTable.page.currentPage = 1;
this.queryList();
},
jumpPage(page) {
this.page = page;
this.queryList();
},
restructureData(data) {
this.restructureList = [];
let dataList = data.list;
if (dataList && dataList.length > 0) {
dataList = dataList.map((item, index) => {
item.num = index + (data.pageNum - 1) * data.pageSize + 1;
return item;
});
this.restructureList = dataList.reduce((prev, cur, index, arr) => {
const paymentChannelAccounts = cur.paymentChannelAccounts;
delete cur.paymentChannelAccounts;
if (paymentChannelAccounts && paymentChannelAccounts.length > 0) {
paymentChannelAccounts.map((item) => {
prev.push({
...item,
...cur,
});
});
} else {
prev.push(cur);
}
return prev;
}, []);
console.log(this.restructureList);
this.merge(this.restructureList);
}
},
// 初始化合并行数组
mergeInit() {
this.spanArr1 = []; // 合并序列
this.spanIndex1 = 0; // 合并序列索引
this.spanArr2 = []; // 合并名称
this.spanIndex2 = 0; // 合并名称索引
this.spanArr3 = []; // 合并商户号
this.spanIndex3 = 0; // 合并商户号索引
this.spanArr4 = []; // 合并商户分类
this.spanIndex4 = 0; // 合并商户分类索引
this.spanArr5 = []; // 合并渠道
this.spanIndex5 = 0; // 合并渠道索引
},
// 合并表格
merge(data) {
this.mergeInit();
if (data.length > 0) {
for (let i = 0; i < data.length; i++) {
if (i === 0) {
// 第一行必须存在,以第一行为基准
this.spanArr1.push(1); // 合并序列
this.spanIndex1 = 0;
this.spanArr2.push(1); // 合并名称
this.spanIndex2 = 0;
this.spanArr3.push(1); // 合并商户号
this.spanIndex3 = 0;
this.spanArr4.push(1); // 合并商户分类
this.spanIndex4 = 0;
this.spanArr5.push(1); // 合并渠道
this.spanIndex5 = 0;
} else {
// 根据id判断固定合并前面4列
if (data[i].merchantId == data[i - 1].merchantId) {
this.spanArr1[this.spanIndex1] += 1;
this.spanArr1.push(0);
this.spanArr2[this.spanIndex2] += 1;
this.spanArr2.push(0);
this.spanArr3[this.spanIndex3] += 1;
this.spanArr3.push(0);
this.spanArr4[this.spanIndex4] += 1;
this.spanArr4.push(0);
this.spanArr5[this.spanIndex5] += 1;
this.spanArr5.push(0);
} else {
this.spanArr1.push(1);
this.spanIndex1 = i;
this.spanArr2.push(1);
this.spanIndex2 = i;
this.spanArr3.push(1);
this.spanIndex3 = i;
this.spanArr4.push(1);
this.spanIndex4 = i;
this.spanArr5.push(1);
this.spanIndex5 = i;
}
}
}
}
},
// 合并单元格
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
const len = this.restructureList.length;
// const t = this.columns.length
const t = 13;
if (columnIndex === 0) {
// 第一列 序号
const _row_1 = this.spanArr1[rowIndex];
const _col_1 = _row_1 > 0 ? 1 : 0;
return {
rowspan: _row_1,
colspan: _col_1,
};
} else if (columnIndex === 1) {
// 第二列 名称
const _row_2 = this.spanArr2[rowIndex];
const _col_2 = _row_2 > 0 ? 1 : 0;
return {
rowspan: _row_2,
colspan: _col_2,
};
// 第三列 商户号
} else if (columnIndex === 2) {
const _row_3 = this.spanArr3[rowIndex];
const _col_3 = _row_3 > 0 ? 1 : 0;
return {
rowspan: _row_3,
colspan: _col_3,
};
// 第四列 商户分类
} else if (columnIndex === 3) {
const _row_4 = this.spanArr4[rowIndex];
const _col_4 = _row_4 > 0 ? 1 : 0;
return {
rowspan: _row_4,
colspan: _col_4,
};
// 第五列 渠道
} else if (columnIndex === 4) {
const _row_5 = this.spanArr5[rowIndex];
const _col_5 = _row_5 > 0 ? 1 : 0;
return {
rowspan: _row_5,
colspan: _col_5,
};
} else if (columnIndex === t) {
const _row_6 = len;
const _col_6 = 1;
return {
rowspan: _row_6,
colspan: _col_6,
};
} else if (rowIndex === len) {
return {
rowspan: 1,
colspan: 1,
};
}
},
paymentChannelList() {
paymentChannelList({}).then((res) => {
this.baseData.payChannelList = res;
this.getOptionsList();
});
},
},
};
</script>
<style>
.header {
background-color: #fff;
}
.el-cascader-panel .el-cascader-menu {
width: 260px;
}
.btnClass span {
margin-right: 5px;
}
</style>