equityList.vue
32.1 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
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
<!-- 权益订单列表 -->
<template>
<div class="before-sale">
<div class="flex m-b-10">
<!-- <el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit(1)">新增权益</el-button> -->
<GLButton :size="size" fn="新增权益" icon="el-icon-plus" type="primary" @click="handleEdit(1)">新增权益</GLButton>
<!-- <div class="table-top-tips"><span class="el-icon-warning"></span>请注意:订单列表还有{{countNoData}}单未上传客户凭证等资料,若发生事故无法获得补偿,请尽快在列表操作-上传资料中完善。</div> -->
</div>
<div class="container">
<div class="find_wrap">
<GLCombiForm ref="showSearch" :formObj="searchForm" :searchSelectObj="searchSelectObj" @handleOk="handleSearch" @handleRest="handleReset" :formData="searchFormData"></GLCombiForm>
</div>
<!-- 表格区域 开始 -->
<div class="table_wrapper">
<el-button plain :size="size" style="float:right;margin-bottom:10px;" @click="handleExport">导出</el-button>
<GLTable ref="equityRef" :pageSizes="sizeList" :paginationattrs="paginationattrs" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="table-btns" slot-scope="scope">
<!-- <GLButton v-if="[2, 4, 5].includes(scope.scope.orderStatus)" fn="查看" type="text" @click="handleEdit(5, scope.scope)">查看</GLButton>
<el-button v-if="[2].includes(scope.scope.orderStatus)" type="text" @click="handlePdf(scope.scope)">打印</el-button>
<GLButton v-if="[0].includes(scope.scope.orderStatus)" fn="编辑" type="text" @click="handleEdit(2, scope.scope)">编辑</GLButton>
<GLButton v-if="[2].includes(scope.scope.orderStatus)" fn="修改" type="text" @click="handleEdit(3, scope.scope)">修改</GLButton>
<el-button v-if="[2].includes(scope.scope.orderStatus)" type="text" @click="handleBack(scope.scope)">退单</el-button>
<GLButton v-if="[3, 4, 5].includes(scope.scope.orderStatus)" fn="重新提单" type="text" @click="handleEdit(4, scope.scope)">重新提单</GLButton> -->
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
<!-- 表格区域 end -->
</div>
<pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog>
<!-- <glsx-dialog title="上传资料" :isVisible.sync="isFileVisible" width="547px" :noCancel="noCancel" btnOkLabel="关闭" @confirmDialog="handleUploadFileClose" @closeDialog="handleUploadFileClose">
<div style="height: 284px; overflow-y: scroll">
<glsx-combi-form labelWidth="300px" :isBlock="isBlock" ref="uploadFormRef" formRef="uploadChildRef" :formRules="uploadRule" :formObj.sync="uploadForm" :formData="uploadFormData"></glsx-combi-form>
</div>
</glsx-dialog> -->
<el-dialog :visible.sync="isTipVisible" width="400px" class="tips-dialog" top="30%" title="提示">
<div class="f-size">
<i v-show="editNotify.code == '0'" class="el-icon-success"></i>
<i v-show="editNotify.code != '0'" class="el-icon-error"></i>
<span>{{ editNotify.code == '0' ? '操作成功' : editNotify.message }}</span>
</div>
</el-dialog>
<el-dialog :visible.sync="isSecondVisible" width="400px" class="tips-dialog" top="30%" :title="secondObj.title">
<div class="f-size">
<i class="el-icon-warning"></i>
<span>{{ secondObj.txt }}</span>
</div>
<span slot="footer" class="dialog-footer">
<el-button :size="size" @click="handleSecondCancel">取 消</el-button>
<el-button :size="size" type="primary" @click="handleSecondConfirm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import glsxDialog from '@/components/glsx-dialog'
import pdfDialog from './pdfDialog'
import utils from '../../util/util'
export default {
name: 'equityList',
data() {
return {
// :page-size="100"
paginationattrs: {
'page-size': 5
},
buttonList: [
{
type: 'GLButton',
name: row => {
return '查看'
},
condition: row => {
return [2, 4, 5].includes(row.scope.orderStatus)
},
attrs: {
type: 'text',
fn: '查看'
},
listeners: {
click: row => this.handleEdit(5, row.scope)
}
},
{
type: 'el-button',
name: row => {
return '打印'
},
condition: row => {
return [2].includes(row.scope.orderStatus)
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.handlePdf(row.scope)
}
},
{
type: 'GLButton',
name: row => {
return '编辑'
},
condition: row => {
return [0].includes(row.scope.orderStatus)
},
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.handleEdit(2, row.scope)
}
},
{
type: 'GLButton',
name: row => {
return '修改'
},
condition: row => {
return [2].includes(row.scope.orderStatus)
},
attrs: {
type: 'text',
fn: '修改'
},
listeners: {
click: row => this.handleEdit(3, row.scope)
}
},
{
type: 'el-button',
name: row => {
return '退单'
},
condition: row => {
return [2].includes(row.scope.orderStatus)
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.handleBack(row.scope)
}
},
{
type: 'GLButton',
name: row => {
return '重新提单'
},
condition: row => {
return [3, 4, 5].includes(row.scope.orderStatus)
},
attrs: {
type: 'text',
fn: '重新提单'
},
listeners: {
click: row => this.handleEdit(4, row.scope)
}
}
],
size: 'small',
noCancel: true,
isBlock: true,
isTipVisible: false,
isFirst: true,
showClose: false,
editNotify: {},
isSecondVisible: false,
secondObj: {
title: '',
txt: ''
},
userInfo: {},
countNoData: '',
levelToShow: {
1: 'merchantId',
2: 'dqtId',
3: 'pqId',
4: 'mdId'
},
searchForm: {
queryText: '',
orderStatus: '',
packageCode: '',
merchantId: '',
dqtId: '',
pqId: '',
mdId: '',
auditStatus: '',
dataPerfection: '',
successDate: [],
effectiveDate: []
},
tableSearchForm: {},
// 合同打印
isPdfVisible: false,
pdfUrl: '',
// 上传资料
isFileVisible: false,
packageList: [],
uploadRule: {},
uploadForm: {},
uploadFormData: [],
// 搜索
searchSelectObj: {
nameOrNoOrVin: {
attr: 'customerName',
value: ''
}
},
searchFormData: [
{
type: 'selectInput',
selectName: 'nameOrNoOrVin',
isClear: true,
inputWidth: '325px',
selectWidth: '110px',
selectOption: [
{
label: '车主姓名',
name: 'customerName'
},
{
label: '合同号',
name: 'contractNo'
},
{
label: '车架号',
name: 'vin'
}
],
handleSelectChange: value => {
this.searchSelectObj.nameOrNoOrVin.value = ''
}
},
{
label: '服务状态',
name: 'orderStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'orderStatusList'
},
{
label: '产品名称',
name: 'packageCode',
type: 'select',
optionList: [],
optionId: 'packageCode',
optionLabel: 'packageName',
optionsName: 'goodsStatusList'
},
{
label: '提单成功时间',
name: 'successDate',
type: 'datePicker',
labelWidth: 95,
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '生效时间',
name: 'effectiveDate',
type: 'datePicker',
isClear: true
}
],
searchFormData2: [
{
label: '提单成功时间',
name: 'successDate',
type: 'datePicker',
labelWidth: 95,
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
},
{
label: '生效时间',
name: 'effectiveDate',
type: 'datePicker',
isClear: true
}
],
// 表格
getListApi: this.$apis.beforeSale.getListApi,
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '车主姓名',
prop: 'customerName',
line: 1,
width: '200px',
formatter: cellValue => {
return cellValue.customerName || '-'
}
},
{
label: '合同号',
prop: 'contractNo',
width: '250px',
formatter: cellValue => {
return [2, 4, 5].includes(cellValue.orderStatus) ? cellValue.contractNo || '-' : '-'
}
},
{
label: '提单成功时间',
width: '200px',
prop: 'successDate',
formatter: cellValue => {
return cellValue.successDate ? dayjs(cellValue.successDate).format('YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
label: '购车日期',
prop: 'billingDate',
width: '200px',
formatter: cellValue => {
return cellValue.billingDate ? dayjs(cellValue.billingDate).format('YYYY-MM-DD') : '-'
}
},
{
label: '店面名称',
line: 1,
prop: 'merchantName',
width: '200px',
formatter: cellValue => {
return cellValue.merchantName || '-'
}
},
{
label: '车品牌',
line: 1,
prop: 'vehicleBrandName',
width: '160px',
formatter: cellValue => {
return cellValue.vehicleBrandName || '-'
}
},
{
label: '车系',
line: 1,
width: '160px',
prop: 'vehicleSeriesName',
formatter: cellValue => {
return cellValue.vehicleSeriesName || '-'
}
},
{
label: '无忧卡卡号',
prop: 'cardSeqNo',
width: '200px',
formatter: cellValue => {
return cellValue.cardSeqNo || '-'
}
},
{
label: '车架号',
prop: 'vin',
width: '200px',
formatter: cellValue => {
return cellValue.vin || '-'
}
},
{
label: '电话',
prop: 'customerPhone',
width: '160px',
formatter: cellValue => {
return cellValue.customerPhone || '-'
}
},
{
label: '产品名称',
prop: 'packageName',
width: '200px',
formatter: cellValue => {
return cellValue.packageName || '-'
}
},
{
label: '无忧保障服务费/元',
prop: 'actualSalesPrice',
width: '200px',
align: 'right',
formatter: cellValue => {
return cellValue.actualSalesPrice ? (cellValue.actualSalesPrice / 100).toFixed(2) : '-'
}
},
// {
// label: '实际销售价',
// prop: 'actualSalesPrice',
// width: '160px',
// line: 1,
// formatter: cellValue => {
// return cellValue.actualSalesPrice ? (cellValue.actualSalesPrice / 100).toFixed(2) : '-'
// }
// },
{
label: '服务期限',
width: '200px',
prop: 'servicePeriod',
formatter: cellValue => {
return cellValue.servicePeriod ? `${cellValue.servicePeriod}年` : '-'
}
},
{
label: '生效时间',
prop: 'effectiveDate',
width: '200px',
formatter: cellValue => {
return cellValue.effectiveDate ? dayjs(cellValue.effectiveDate).format('YYYY-MM-DD') : '-'
}
},
{
label: '服务状态',
prop: 'orderStatus',
width: '100px',
formatter: cellValue => {
return this.baseData.orderStatusList.map(item => item.confId).includes(cellValue.orderStatus) ? this.baseData.orderStatusList.find(item => item.confId == cellValue.orderStatus).confName : '-'
}
},
// {
// label: '审核状态',
// prop: 'auditStatus',
// width: '100px',
// line: 1,
// formatter: cellValue => {
// var auditStatusTxt = '-'
// if ([2, 4, 5].includes(cellValue.orderStatus)) {
// auditStatusTxt = this.baseData.auditStatusList.map(item => item.confId).includes(cellValue.auditStatus) ? this.baseData.auditStatusList.find(item => item.confId == cellValue.auditStatus).confName : '-'
// }
// return auditStatusTxt
// }
// },
// {
// label: '审核人',
// prop: 'auditBy',
// width: '140px',
// line: 1,
// formatter: cellValue => {
// return cellValue.auditBy || '-'
// }
// },
// {
// label: '门店编码',
// prop: 'sap',
// line: 1,
// formatter: cellValue => {
// return cellValue.sap || '-'
// }
// },
// {
// label: '实际销售人员',
// prop: 'actualSalesPerson',
// width: '160',
// line: 1,
// formatter: cellValue => {
// return cellValue.actualSalesPerson || '-'
// }
// },
{
label: '省代',
prop: 'provinceMerchantName',
width: '200px',
formatter: cellValue => {
return cellValue.provinceMerchantName || '-'
}
},
{
label: '市代',
width: '200px',
prop: 'cityMerchantName',
formatter: cellValue => {
return cellValue.cityMerchantName || '-'
}
},
{
label: '操作人',
line: 1,
prop: 'updatedBy',
width: '140px',
formatter: cellValue => {
return cellValue.updatedBy || '-'
}
},
{
label: '操作',
prop: '',
width: '200px',
fixed: 'right',
addHtml: 'table-btns'
}
]
},
sizeList: [5, 10, 20, 30, 40],
pageConf: { pageSize: 'pageCount', pageNum: 'pageSize', totalCount: 'total' },
// 公共数据
baseData: {
goodsStatusList: [],
merchantList: [],
dqList: [],
pqList: [],
mdList: [],
orderStatusList: [
{
confId: 0,
confName: '待提单'
},
{
confId: 2,
confName: '提单成功'
},
{
confId: 3,
confName: '提单失败'
},
{
confId: 4,
confName: '已退单'
},
{
confId: 5,
confName: '已过期'
}
],
dataPerfectionList: [
{
confId: 1,
confName: '已完成'
},
{
confId: 0,
confName: '未完成'
}
],
auditStatusList: [
{
confId: 0,
confName: '待审核'
},
{
confId: 1,
confName: '已审核'
}
]
}
}
},
components: {
// glsxDialog,
pdfDialog
},
mounted() {
this.editNotify = this.$route.params
// if (this.isFirst && this.editNotify.hasOwnProperty('code')) {
// this.isFirst = false
// this.isTipVisible = true
// clearTimeout(this.timer)
// this.timer = setTimeout(
// () => {
// this.isTipVisible = false
// },
// this.editNotify.code == '0' ? 1500 : 3000
// )
// }
this.$refs.equityRef.page.pageSize = 5
this.$apis.beforeSale.getProListApi({}).then(res => {
this.baseData.goodsStatusList = res
this.getOptionsList('searchFormData')
})
this.getCountNoData()
this.$apis.beforeSale.getUserInfoApi({}).then(res => {
this.userInfo = res
// if (res.merchantAccountLevel != 4) {
// var idx = this.searchFormData.findIndex(item => item.name == this.levelToShow[this.userInfo.admin ? res.merchantAccountLevel : res.merchantAccountLevel + 1])
// this.searchFormData[idx].isHide = false
// this.getMerchantList('', '', this.searchFormData[idx].name, this.searchFormData[idx].optionsName)
// }
})
},
methods: {
getCountNoData() {
this.$apis.beforeSale.getCountNoDataApi({}).then(res => {
this.countNoData = res
})
},
getMerchantList(merchantId, accountLevel, attrName, listName) {
var params = {
merchantId: merchantId,
accountLevel: accountLevel
}
this.$apis.beforeSale.getMerchantApi(params).then(res => {
this.baseData[listName] = res
this.getOptionsList('searchFormData', false, attrName)
})
},
getSelectInputParams() {
const list = Object.keys(this.searchSelectObj)
var params = {}
list.forEach(i => {
const item = this.searchSelectObj[i]
item.value && (params[item.attr] = item.value)
})
return params
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
const tempParams = this.getSelectInputParams()
params = {
...params,
...tempParams
}
// 商户-merchantId
for (var i = 1; i <= 4; i++) {
if (this.searchForm[this.levelToShow[i]]) {
params.merchantId = this.searchForm[this.levelToShow[i]]
params.accountLevel = i
}
}
if (this.searchForm.successDate.length) {
params.successStartDates = new Date(this.searchForm.successDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.successEndDates = new Date(this.searchForm.successDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (this.searchForm.effectiveDate.length) {
params.effectiveStartDates = new Date(this.searchForm.effectiveDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.effectiveEndDates = new Date(this.searchForm.effectiveDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.successDate
delete params.effectiveDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
secondConfirm(title, txt, apiModule, apiName, apiParams) {
this.secondObj = {
title: title,
txt: txt,
apiModule: apiModule,
apiName: apiName,
apiParams: apiParams
}
if (title == '退单') {
this.$confirm('是否确认退单?', '退单', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
customClass: 'customConfirm'
}).then(() => {
this.handleSecondConfirm()
})
return
}
this.handleSecondCancel()
},
handleSecondConfirm() {
this.$apis[this.secondObj.apiModule][this.secondObj.apiName](this.secondObj.apiParams).then(res => {
// this.handleSecondCancel()
// this.isTipVisible = true
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
this.editNotify = res
// clearTimeout(this.timer)
// this.timer = setTimeout(
// () => {
// this.isTipVisible = false
// },
// this.editNotify.code == '0' ? 1500 : 3000
// )
if (res.code == '0') {
this.handleSearch()
}
})
},
handleSecondCancel() {
this.isSecondVisible = !this.isSecondVisible
},
// 1-新增;2-编辑;3-修改;4-重新提单;5-查看
handleEdit(addOrEdit, row) {
if (addOrEdit == 3 && !this.userInfo.admin && new Date(new Date().setDate(new Date().getDate() - 7)) > new Date(row.successDate)) {
const h = this.$createElement
const tip = addOrEdit == 3 ? '修改申请' : '退单申请'
this.$message({
message: h('p', null, [h('p', { style: 'text-align: center; line-height: 20px; color: #F56C6C;' }, '为保障客户权益,请邮件主送:service@didihu.com.cn,提交修改申请 ,邮件标题:门店名称+合同号+修改内容,并备注门店接待姓名+电话')]),
type: 'error',
customClass: 'customMessage'
})
return true
}
let paraFormat = {
addOrEdit,
contractNo: addOrEdit == 1 ? -1 : row.contractNo,
isSuper: this.userInfo.admin
}
const title = this.jumpTitle(addOrEdit)
const urlpara = encodeURIComponent(JSON.stringify(paraFormat))
this.$router.push({ path: '/beforeSale/editEquity/' + urlpara, query: { $title: title } })
// addOrEdit == 1 ? this.$router.push('/beforeSale/editEquity/' + urlpara) : this.$router.push('/beforeSale/editEquity/' + urlpara)
},
handlePdfClose() {
this.isPdfVisible = !this.isPdfVisible
},
// 打印
handlePdf(row) {
// if (!row.auditStatus) {
// const h = this.$createElement
// this.isTipVisible = true
// this.editNotify = {
// code: '-1',
// message: '财务未审核,合同无法打印'
// }
// clearTimeout(this.timer)
// this.timer = setTimeout(
// () => {
// this.isTipVisible = false
// },
// this.editNotify.code == '0' ? 1500 : 3000
// )
// return true
// }
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.beforeSale.getPriteApi({ contractNo: row.contractNo }).then(res => {
this.pdfUrl = res
this.handlePdfClose()
loading.close()
})
},
uploadFile(imgUrl, targetItem) {
var params = {
contractNo: this.uploadForm.contractNo,
attachmentCode: targetItem.name,
attachmentFile: imgUrl,
attachmentType: 'IMG'
}
this.$apis.beforeSale.updateOrderApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.$set(this.uploadForm, targetItem.name, imgUrl)
}
})
},
// 上传资料
autoGenerate() {
var tempList = []
this.uploadFormData = []
this.packageList.forEach(item => {
this.$set(this.uploadForm, item.attachmentCode, '')
this.uploadFormData.push({
label: item.attachmentName,
name: item.attachmentCode,
type: 'uploadBtn',
limitSize: 20,
maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const targetNameList = file.name.split('.')
const base64 = targetNameList[targetNameList.length - 1] + '@' + imgFile.split(',')[1]
var imgUrl = ''
this.$apis.beforeSale.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
this.uploadFile(res, targetItem)
})
}
})
if (item.required == 1) {
this.uploadRule[item.attachmentCode] = [
{
required: true,
message: '请选择' + item.attachmentName,
trigger: 'change'
}
]
}
})
this.handleUploadFileClose()
},
handleUploadFileClose() {
this.isFileVisible = !this.isFileVisible
},
handleUpload(row) {
this.$apis.beforeSale.getOrderAttrApi({ packageCode: row.packageCode }).then(res => {
this.packageList = res
this.uploadForm.contractNo = row.contractNo
this.$apis.beforeSale.getAllOrderValueApi({ contractNo: row.contractNo }).then(subRes => {
var idx = ''
this.packageList.forEach(item => {
idx = subRes.findIndex(i => i.attachmentCode == item.attachmentCode)
this.uploadForm[item.attachmentCode] = idx != -1 ? subRes[idx].attachmentFile : ''
})
})
this.autoGenerate()
})
},
// 退单
handleBack(row) {
if (!this.userInfo.admin && new Date(new Date().setDate(new Date().getDate() - 7)) > new Date(row.successDate)) {
const h = this.$createElement
this.$message({
message: h('p', null, [h('p', { style: 'text-align: center; line-height: 20px; color: #F56C6C;' }, '为保障客户权益,请邮件主送:service@didihu.com.cn,提交退单申请 ,邮件标题:门店名称+合同号+退单原因,并备注门店接待姓名+电话')]),
type: 'error',
customClass: 'customMessage'
})
return true
}
this.secondConfirm('退单', '是否确认退单?', 'beforeSale', 'backOrderApi', { contractNo: row.contractNo, merchantId: row.merchantId })
},
// 导出
handleExport() {
var params = this.getParams()
this.$apis.beforeSale.getExportApi(params).then(res => {
// window.open(res)
let tempaa = utils.getExplorer()
if (tempaa == 'QQ') {
window.open(res)
} else {
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = res
document.body.appendChild(iframe)
}
})
},
handleSearch() {
this.$refs.equityRef.refreshTable()
},
handleReset() {
this.searchForm = {
queryText: '',
orderStatus: '',
merchantId: '',
dqtId: '',
pqId: '',
mdId: '',
auditStatus: '',
dataPerfection: '',
successDate: [],
effectiveDate: []
}
this.searchSelectObj = {
nameOrNoOrVin: {
attr: 'customerName',
value: ''
}
}
var tempIdx = ''
// var addNum = this.userInfo.admin ? 1 : 2
// if (this.userInfo.merchantAccountLevel != 4) {
// for (var i = this.userInfo.merchantAccountLevel + addNum; i <= 4; i++) {
// tempIdx = this.searchFormData.findIndex(item => item.name == this.levelToShow[i + ''])
// this.searchFormData[tempIdx].isHide = true
// this.searchForm[this.levelToShow[i + '']] = ''
// }
// }
this.handleSearch()
},
// 页面跳转标题判断
jumpTitle(addOrEdit) {
let title = '新增权益'
switch (addOrEdit) {
case 1:
title = '新增权益'
break
case 2:
title = '编辑'
break
case 3:
title = '修改'
break
case 4:
title = '重新提单'
break
case 5:
title = '查看'
break
default:
title = '新增权益'
break
}
return title
}
}
}
</script>
<style lang="scss" scoped>
// .before-sale {
// margin-top: 17px;
// }
.before-sale .flex {
display: flex;
}
.find_wrap {
background: #ffffff;
// box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px 20px 2px 20px;
.resetBtn {
background: #ffffff;
color: #5850ff;
border: 1px solid #5850ff;
}
.m-r-l-20 {
margin: 0 20px;
}
}
.table_wrapper {
// margin-top: 10px;
background: #ffffff;
// box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 0 20px 20px;
}
.before-sale .m-b-10 {
margin-bottom: 10px;
}
.before-sale .table-top-tips {
box-sizing: border-box;
margin-left: 10px;
width: 100%;
height: 32px;
line-height: 30px;
font-size: 12px;
background-color: #fff0bb;
border: 1px solid #ffca78;
padding: 0 10px;
border-radius: 2px;
}
.before-sale .table-top-tips .el-icon-warning {
font-size: 12px;
color: #f77315;
margin-right: 8px;
}
.before-sale .circule-tips {
position: absolute;
top: 0;
right: -6px;
display: inline-block;
height: 6px;
width: 6px;
border-radius: 100%;
background-color: red;
}
.before-sale .footer-btns {
float: right;
/* display: block;
text-align: right; */
/* margin-bottom: 18px; */
}
.before-sale .el-table .cell {
line-height: 16px;
}
// .before-sale .table-btns {
// display: grid;
// grid-template-columns: repeat(auto-fill, 33.33%);
// grid-row-gap: 10px;
// }
.before-sale .table-btns .el-button {
// padding: 0 0 0 5px;
border-radius: 0;
border: 0;
padding: 0;
margin: 0;
}
// .before-sale .table-btns .el-button:first-child {
// padding: 0;
// border: 0;
// }
.tips-dialog .el-icon-success {
margin-right: 10px;
font-size: 22px;
color: #228b22;
}
.tips-dialog .el-icon-warning {
margin-right: 10px;
font-size: 22px;
color: #f77315;
}
.tips-dialog .el-icon-error {
margin-right: 10px;
font-size: 22px;
color: #f56c6c;
}
.f-size {
font-size: 14px;
display: flex;
/* text-align: center; */
}
.tips-dialog .el-dialog__body {
padding: 10px 15px 20px !important;
}
</style>