SystemBillDialog.vue
49.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
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
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
<template>
<div>
<d2-dialog title="系统对账单" :is-visible="billVisible" class="privacyDailog" width="80%" @closeDialog="handleClose" @confirmDialog="handleConfirm">
<div class="flex">
<div>{{dateStr}}销售对账单</div>
<div>适用对象:{{billTmplInfo.billMerchantName}}</div>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%" ref="billMutiTable" show-summary :summary-method="getSummaries" :span-method="arraySpanMethod" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column v-for="(item, idx) in tableHeader" :key="idx" :label="item.moduleName">
<el-table-column v-for="(subItem, subIdx) in item.items" :key="subIdx" :prop="subItem.fieldCode" :label="subItem.fieldName" :width="subItem.width || '120px'">
<div class="tb-header-cell" slot="header" slot-scope="scope">
<span>{{subItem.fieldName}}</span>
<img v-if="judgeImgShow(scope)" src="@/assets/icon-edit.png" style="cursor: pointer;margin-left: 5px;width: 16px;height: 16px; vertical-align: middle;" @click="handleBatch(scope)" />
</div>
<div class="tb-cell" slot-scope="scope">
<!-- 输入框 -->
<template v-if="subItem.editType == 'input'">
<el-input :placeholder="item.placeholder || '请输入'" v-bind="subItem.attrs ? subItem.attrs : {}" v-on="subItem.listeners ? subItem.listeners : {}" :prefix-icon="subItem.prefixIcon" :disabled="judgeDisable(scope.$index, subItem.extInfo.source || 'ORDER', subItem)" v-model.trim="scope.row[subItem.extInfo.source || 'ORDER'][subItem.fieldCode]" :maxlength="subItem.maxlength" :type="subItem.inputType || 'text'" :style="{ width: defaultWidth }" @input="(e) => handleInputDown(e, scope.$index, subItem.extInfo.source || 'ORDER', subItem)" @blur="modifyAdd(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode) }">
<span v-if="subItem.editObj.prepend" slot="prepend">{{ subItem.editObj.prepend }}</span>
<span v-if="subItem.editObj.append" slot="suffix">{{ subItem.append }}</span>
</el-input>
<div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode)" class="el-form-item__error">
{{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode) }}
</div>
</template>
<!-- 选择框 -->
<div v-else-if="subItem.editType == 'select'">
<el-select style="width: 200px" v-model="scope.row[subItem.extInfo.source || 'ORDER'][subItem.fieldCode]" v-bind="item.attrs ? item.attrs : {}" v-on="item.listeners ? item.listeners : {}" clearable :placeholder="item.placeholder || '请选择'" :filterable="!item.noFilter" :disabled="judgeDisable(scope.$index, subItem.extInfo.source || 'ORDER', subItem)" no-data-text="无数据" :multiple="item.multiple || false" :collapse-tags="item.collapseTags || true" @change="selectAddAttr($event, scope.$index, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode) }">
<el-option v-for="k in baseData[subItem.editObj.optionsName]" :key="k[subItem.editObj.optionId]" :label="k[subItem.editObj.optionLabel]" :value="k[subItem.editObj.optionId]"></el-option>
</el-select>
<div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode)" class="el-form-item__error">
{{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode) }}
</div>
</div>
<!-- 选择输入组合框 -->
<div v-else-if="subItem.editType == 'selectInput'">
<div class="select-input-container">
<el-input placeholder="请输入" v-model.trim="scope.row[subItem.extInfo.source || 'ORDER'][subItem.editObj.inputField]" :type="subItem.editObj.inputType || 'text'" class="input-with-select" :disabled="judgeDisable(scope.$index, subItem.extInfo.source || 'ORDER', subItem)" @blur="modifyAdd(scope.$index, subItem.extInfo.source || 'ORDER', subItem.fieldCode, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.inputField) }">
<el-select v-model="scope.row[subItem.extInfo.source || 'ORDER'][subItem.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" :disabled="judgeDisable(scope.$index, subItem.extInfo.source || 'ORDER', subItem)" @change="handleSelectInputChange(scope.$index, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }">
<el-option v-for="(k, kIdx) in subItem.editObj.optionList" :key="kIdx" :label="k[subItem.editObj.optionLabel]" :value="k[subItem.editObj.optionId]" />
</el-select>
<span v-if="subItem.editObj.suffixFn" slot="suffix">
<span class="inputSuffix">{{ subItem.editObj.suffixFn(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField, subItem.editObj.inputField) }}</span>
</span>
</el-input>
<div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField)" class="el-form-item__error">
{{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }}
</div>
<div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.inputField)" class="el-form-item__error">
{{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.inputField) }}
</div>
</div>
</div>
<div v-else-if="subItem.txtType == 'selectInput'">
<!-- {{subItem.extInfo.source || 'ORDER'}}{{subItem.fieldCode}} -->
{{scope.row[subItem.extInfo.source || 'ORDER'][subItem.txtObj.selectField] ? (scope.row[subItem.extInfo.source || 'ORDER'][subItem.txtObj.selectField] + (scope.row[subItem.extInfo.source || 'ORDER'][subItem.txtObj.inputField] + '')) : '-'}}
</div>
<!-- 普通文本显示 -->
<div v-else>
<!-- {{subItem.extInfo.source || 'ORDER'}}{{subItem.fieldCode}} -->
<span v-if="scope.row[subItem.extInfo.source || 'ORDER'][subItem.fieldCode] === 0">0</span>
<span v-else>{{ scope.row[subItem.extInfo.source || 'ORDER'][subItem.fieldCode] || '-' }}</span>
</div>
</div>
</el-table-column>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.pageNum" :page-size="page.pageSize" :total="page.total" :page-sizes="[10, 20, 30, 40]" layout="sizes,total,->,prev,pager,next,jumper">
</el-pagination>
<DynamicAddTable ref="dynamicAdd" :adjustments="adjustments" @handleInputBlur="billCompute"></DynamicAddTable>
<div>总金额:{{totalAmount}}元</div>
</d2-dialog>
<!-- 批量輸入 -->
<d2-dialog :title="headObj.fieldCode == 'coverReceiverType' ? '备注' : ('批量设置' + headObj.fieldName)" :is-visible="batchVisible" class="privacyDailog" width="480px" @closeDialog="handleBatchClose" @confirmDialog="handleBatchConfirm">
<div class="batch-box">
<!-- 输入框 -->
<template v-if="headObj.editType == 'input'">
<el-input placeholder="请输入" :prefix-icon="headObj.prefixIcon" v-model.trim="batchForm[headObj.fieldCode]" :maxlength="headObj.maxlength" :type="headObj.inputType || 'text'" @blur="batchValidateForm" :style="{ width: headObj.width || defaultWidth }" @input="(e) => maxLengthInput(e)" :class="{ 'is-error': dialogErrors[headObj.fieldCode] }">
<span v-if="headObj.editObj.prepend" slot="prepend">{{ headObj.editObj.prepend }}</span>
<span v-if="headObj.editObj.append" slot="suffix">{{ headObj.append }}</span>
</el-input>
<div v-if="dialogErrors[headObj.fieldCode]" class="el-form-item__error">{{ dialogErrors[headObj.fieldCode] }}</div>
</template>
<!-- 选择框 -->
<div v-else-if="headObj.editType == 'select'">
<el-select style="width: 200px" v-model="batchForm[headObj.fieldCode]" placeholder="请选择" no-data-text="无数据" :class="{ 'is-error': dialogErrors[headObj.fieldCode] }" @change="batchValidateForm">
<el-option v-for="k in baseData[headObj.editObj.optionsName]" :key="k[headObj.editObj.optionId]" :label="k[headObj.editObj.optionLabel]" :value="k[headObj.editObj.optionId]"></el-option>
</el-select>
<div v-if="dialogErrors[headObj.fieldCode]" class="el-form-item__error">{{ dialogErrors[headObj.fieldCode] }}</div>
</div>
<!-- 选择输入组合框 -->
<div v-else-if="headObj.editType === 'selectInput'">
<div class="select-input-container">
<el-input placeholder="请输入" v-model.trim="batchForm[headObj.editObj.inputField]" class="input-with-select" :class="{ 'is-error': dialogErrors[headObj.editObj.inputField] }" @blur="batchValidateForm">
<el-select v-model="batchForm[headObj.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" :class="{ 'is-error': dialogErrors[headObj.editObj.selectField] }" @change="batchValidateForm">
<el-option v-for="(k, kIdx) in headObj.editObj.optionList" :key="kIdx" :label="k[headObj.editObj.optionLabel]" :value="k[headObj.editObj.optionId]" />
</el-select>
<span v-if="headObj.editObj.suffixFn" slot="suffix">
<span class="inputSuffix">{{ headObj.editObj.suffixFn('', headObj.extInfo.source || 'ORDER', headObj.editObj.selectField, headObj.editObj.inputField, true) }}</span>
</span>
</el-input>
<div v-if="dialogErrors[headObj.editObj.inputField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.inputField] }}</div>
<div v-if="dialogErrors[headObj.editObj.selectField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.selectField] }}</div>
</div>
</div>
<div v-if="headObj.fieldCode == 'coverReceiverType'" class="red-txt">
提示:若按支付方式拆分对账单,切换收款方式,系统自动将该订单切换至对应周期+收款方式的对账单中;若无对账单则在下次生成对应收款方式的对账单时自动加入;
</div>
</div>
</d2-dialog>
</div>
</template>
<script>
import { deepClone, Util } from '@/common/util'
import { getPlatformMerchantList } from '@api/index'
import DynamicAddTable from './DynamicAddTable'
import { billComputePage, editBillPage } from '@api/accountManage'
import { payTypeList } from "@/common/constants"
export default {
name: 'SystemBillDialog',
props: {
billVisible: {
type: Boolean,
default: false
},
billTmplInfo: {
type: Object,
default: () => ({})
}
},
components: {
DynamicAddTable
},
data() {
return {
loading: false,
billTypeStr: 'traffic',
dateStr: '',
tmplFieldsList: [],
tableHeader: [],
originalOrderList: [],
// 列表数据
tableList: [],
// 用户修改过的列表数据
tableModifyList: [],
// 用户删除的ordercodelist
tableDeleteList: [],
validationErrors: {},
adjustments: [],
multipleSelecList: [],
// 分页
page: {
pageNum: 1,
pageSize: 10,
total: 0,
},
headObj: {},
batchForm: {},
batchVisible: false,
dialogErrors: {},
trafficChangeTxtList: [{
name: '分账类型',
source: 'ORDER',
attr: 'divisionType',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'divisionTypeList',
}, {
name: '分账状态',
source: 'ORDER',
attr: 'divisionStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'divisionStatusList',
}, {
name: '对账状态',
source: 'ORDER',
attr: 'reconcileStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'reconcileStatusList',
}, {
name: '订单时间',
source: 'ORDER',
attr: 'orderTime',
type: 'time'
}, {
name: '支付时间',
source: 'ORDER',
attr: 'paymentTime',
type: 'time'
}, {
name: '支付方式',
source: 'ORDER',
attr: 'payType',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'payTypeList',
}, {
name: '流量方套餐比例',
source: 'PACKAGE',
attr: 'trafficFeeCalculateType,trafficFeeCalculateValue',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'trafficFeeCalculateTypeTxtList',
type: 'selectInput',
}, {
name: '流量方整单比例',
source: 'ORDER',
attr: 'trafficFeeCalculateType,trafficFeeCalculateValue',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'trafficFeeCalculateTypeTxtList',
type: 'selectInput',
}],
serviceChangeTxtList: [{
name: '分账类型',
source: 'ORDER',
attr: 'divisionType',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'divisionTypeList',
}, {
name: '分账状态',
source: 'ORDER',
attr: 'divisionStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'divisionStatusList',
}, {
name: '对账状态',
source: 'ORDER',
attr: 'reconcileStatus',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'reconcileStatusList',
}, {
name: '支付方式',
source: 'ORDER',
attr: 'payType',
type: 'select',
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'payTypeList',
}, {
name: '订单时间',
source: 'ORDER',
attr: 'orderTime',
type: 'time'
}, {
name: '支付时间',
source: 'ORDER',
attr: 'paymentTime',
type: 'time'
}],
// 用于标记表头字段是否可以编辑(唯一标识:source + FieldCode)
trafficSourceEditList: [
'ORDERplatformMerchantId',
'ORDERshopDivisionMoney',
'ORDERofflinePaidAmount',
'SUB_ORDERtrafficFeeCalculateType,trafficFeeCalculateValue',
"ORDERcoverReceiverType"
],
serviceSourceEditList: ["SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue", "SUB_ORDERpartnerFeeCalculateCoefficient", "ORDERcoverReceiverType"],
trafficEditList: [
'platformMerchantId',
'shopDivisionMoney',
'offlinePaidAmount',
'trafficFeeCalculateType,trafficFeeCalculateValue',
"coverReceiverType"
],
serviceEditList: ["partnerFeeCalculateType,partnerFeeCalculateValue", "partnerFeeCalculateCoefficient", "coverReceiverType"],
totalAmount: 0,
editObj: {
select: {
attrList: ['platformMerchantId', 'coverReceiverType'],
defaultConf: {
platformMerchantId: {
optionId: 'merchantId',
optionLabel: 'merchantName',
optionsName: 'PlatformMerchantList',
fn: (val, listIdx, obj) => {
const source = obj.extInfo.source || 'ORDER'
this.tableList[listIdx][source].platformMerchantName =
this.baseData[obj.editObj.optionsName]
.find(item => item[obj.editObj.optionId] == val)?.[obj.editObj.optionLabel]
}
},
coverReceiverType: {
optionId: 'confId',
optionLabel: 'confLabel',
optionsName: 'recvTypeList',
fn: (val, listIdx, obj) => {
}
},
}
},
input: {
attrList: ['shopDivisionMoney', 'offlinePaidAmount', 'partnerFeeCalculateCoefficient'],
defaultConf: {
// 流量方总金额
shopDivisionMoney: {
source: 'ORDER',
rule: (value) => {
var errorTxt = ''
const max = 999999
if (value > max) {
errorTxt = `请输入小于${max}的数字`
} else if (value !== null && value !== undefined && value !== '') {
const decimalPart = String(value).split('.')[1]
if (decimalPart && decimalPart.length > 2) {
errorTxt = '最多只能输入两位小数'
}
}
return errorTxt
}
},
// 线下已付金额
offlinePaidAmount: {
source: 'ORDER',
rule: (value) => {
var errorTxt = ''
const min = 0
const max = 999999
if (value < min || value > max) {
errorTxt = `请输入${min}-${max}的数字`
} else if (value !== null && value !== undefined && value !== '') {
const decimalPart = String(value).split('.')[1]
if (decimalPart && decimalPart.length > 2) {
errorTxt = '最多只能输入两位小数'
}
}
return errorTxt
}
},
//
// 按新政策标准
partnerFeeCalculateCoefficient: {
source: 'SUB_ORDER',
prepend: '分润系数*',
rule: (value) => {
var errorTxt = ''
const min = 0
const max = 1
if (value < min || value > max) {
errorTxt = `请输入${min}-${max}的数字`
} else if (value !== null && value !== undefined && value !== '') {
const decimalPart = String(value).split('.')[1]
if (decimalPart && decimalPart.length > 2) {
errorTxt = '最多只能输入两位小数'
}
}
return errorTxt
}
},
}
},
selectInput: {
attrList: ['SUB_ORDERtrafficFeeCalculateType,trafficFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue'],
defaultConf: {
'trafficFeeCalculateType,trafficFeeCalculateValue': {
optionId: 'confId',
optionLabel: 'confValue',
optionList: [
{ confId: 1, confValue: '按毛利' },
{ confId: 2, confValue: '按收入' },
{ confId: 3, confValue: '按固定金额' }
],
source: 'SUB_ORDER',
suffixFn: (rowIndex, source, selectField, inputField, isBatch = false) => {
const suffixObj = {
1: '%',
2: '%',
3: '元'
}
var suffix = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
suffix = suffixObj[obj[selectField]] || ''
return suffix
},
rule: (value, rowIndex, source, headObj, isBatch = false) => {
var errorTxt = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
const typeVal = obj[headObj.editObj.selectField] || ''
const inputVal = obj[headObj.editObj.inputField] || ''
switch (typeVal) {
case 1:
if (inputVal < 0 || inputVal > 100) {
errorTxt = '请输入0-100的数字'
}
break
case 2:
if (inputVal < 0 || inputVal > 100) {
errorTxt = '请输入0-100的数字'
}
break
case 3:
if (inputVal < 0 || inputVal > 999999) {
errorTxt = '请输入0-999999的数字'
}
break
}
if (inputVal !== null && inputVal !== undefined && inputVal !== '') {
const decimalPart = String(inputVal).split('.')[1]
if (decimalPart && decimalPart.length > 2) {
errorTxt = '最多只能输入两位小数'
}
}
return errorTxt
}
},
'partnerFeeCalculateType,partnerFeeCalculateValue': {
optionId: 'confId',
optionLabel: 'confValue',
optionList: [
{ confId: 1, confValue: '按毛利' },
{ confId: 2, confValue: '按收入' },
{ confId: 3, confValue: '按固定金额' }
],
source: 'SUB_ORDER',
suffixFn: (rowIndex, source, selectField, inputField, isBatch = false) => {
const suffixObj = {
1: '%',
2: '%',
3: '元'
}
var suffix = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
suffix = suffixObj[obj[selectField]] || ''
return suffix
},
rule: (value, rowIndex, source, headObj, isBatch = false) => {
var errorTxt = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
const typeVal = obj[headObj.editObj.selectField]
const inputVal = obj[headObj.editObj.inputField]
switch (typeVal) {
case 1:
if (inputVal < 0 || inputVal > 100) {
errorTxt = '请输入0-100的数字'
}
break
case 2:
if (inputVal < 0 || inputVal > 100) {
errorTxt = '请输入0-100的数字'
}
break
case 3:
if (inputVal < 0 || inputVal > 999999) {
errorTxt = '请输入0-999999的数字'
}
break
}
if (inputVal !== null && inputVal !== undefined && inputVal !== '') {
const decimalPart = String(inputVal).split('.')[1]
if (decimalPart && decimalPart.length > 2) {
errorTxt = '最多只能输入两位小数'
}
}
return errorTxt
}
}
}
}
},
changeFieldCodeList: [{
old: 'platformMerchantName',
new: 'platformMerchantId'
}],
baseData: {
PlatformMerchantList: [],
recvTypeList: [{
confId: 0,
confLabel: '嘀加收款'
}, {
confId: 1,
confLabel: '门店收款'
}],
divisionTypeList: [{
confId: 1,
confLabel: '线下对账'
}, {
confId: 2,
confLabel: '线上分账'
}],
divisionStatusList: [{
confId: 1,
confLabel: '待分账'
}, {
confId: 2,
confLabel: '分账中'
}, {
confId: 3,
confLabel: '分账成功'
}, {
confId: 4,
confLabel: '分账失败'
}],
reconcileStatusList: [{
confId: 1,
confLabel: '未对账'
}, {
confId: 2,
confLabel: '已对账'
}],
payTypeList: payTypeList,
trafficFeeCalculateTypeList: [{
confId: 1,
confValue: '按毛利'
},
{
confId: 2,
confValue: '按收入'
},
{
confId: 3,
confValue: '按固定金额'
}],
trafficFeeCalculateTypeTxtList: [{
confId: 1,
confLabel: '按毛利',
suffix: '%'
},
{
confId: 2,
confLabel: '按收入',
suffix: '%'
},
{
confId: 3,
confLabel: '按固定金额',
suffix: '元'
}, {
confId: 4,
confLabel: '按(产值-流量成本)比例',
suffix: '%'
},
{
confId: 5,
confLabel: '按(产值-流量成本-其他费用不包含成本)比例',
suffix: '%'
},
{
confId: 6,
confLabel: '按(产值-流量成本-其他费用包含成本)比例',
suffix: '%'
}, {
confId: 7,
confLabel: '可扩展兜底',
suffix: ''
},
{
confId: 8,
confLabel: '按(收入-自定义其他费用)比例',
suffix: '%'
},
{
confId: 9,
confLabel: '按(收入-其他费用)比例',
suffix: '%'
},
{
confId: 10,
confLabel: '按固定金额*购买数量',
suffix: '元'
}]
},
defaultWidth: '180px'
}
},
mounted() {
this.initComponent()
},
methods: {
initComponent() {
this.billTypeStr = this.billTmplInfo.billType == '1' ? 'traffic' : 'service'
console.log(this.billTmplInfo, 'this.billTmplInfo---')
this.dateStr = Util.dateFormate(this.billTmplInfo.startDate, 'YYYY年MM月DD日') + '~' + Util.dateFormate(this.billTmplInfo.endDate, 'YYYY年MM月DD日')
this.tmplFieldsList = JSON.parse(this.billTmplInfo.fieldsJson)
console.log(this.tmplFieldsList, 'this.tmplFieldsList---')
this.originalOrderList = this.billTmplInfo?.orderPage?.list || []
this.orderId = this.billTmplInfo.id
this.sceneType = this.billTmplInfo.sceneType
this.totalAmount = this.billTmplInfo.totalAmount
this.page.pageNum = this.billTmplInfo?.orderPage?.pageNum || 1
this.page.pageSize = this.billTmplInfo?.orderPage?.pageSize || 10
this.page.total = this.billTmplInfo?.orderPage?.total || 0
this.adjustments = this.billTmplInfo?.adjustments || []
this.orderTotalStat = this.billTmplInfo.orderTotalStat
this.getPlatformMerchantList()
this.dealTable()
},
hasError(rowIndex, source, field) {
if (['coverReceiverType'].includes(field)) {
return false
}
return this.validationErrors[`${rowIndex}_${source}_${field}`] !== undefined
},
getErrorMessage(rowIndex, source, field) {
if (['coverReceiverType'].includes(field)) {
return false
}
return this.validationErrors[`${rowIndex}_${source}_${field}`]
},
uniqueByProperty(arr, prop) {
return arr.filter((obj, index, self) =>
index === self.findIndex((o) => o[prop] === obj[prop])
)
},
// 用于处理修改过的主订单(标记修改过的主订单),并放入tableModifyList中,调测算/提交接口时,作为updatedOrders传给后端。
dealModify(rowIndex, source, field) {
const orderCode = this.tableList[rowIndex].ORDER.orderCode
const isExitIdx = this.tableModifyList.findIndex(item => item.orderCode == orderCode)
var orders = {}
if (isExitIdx != -1) {
this.tableModifyList.splice(isExitIdx, 1)
}
var addList = []
this.tableList.forEach(item => {
if (item.ORDER.orderCode == orderCode) {
addList.push(item)
}
})
var orders = deepClone(this.uniqueByProperty(addList.map(item => item.ORDER), 'orderCode'))
addList.forEach((item, idx) => {
let packages = {
...item.PACKAGE,
subOrders: []
}
if (item.subRowSpan) {
for (let i = 0; i < item.subRowSpan; i++) {
packages.subOrders.push(addList[idx + i].SUB_ORDER)
}
let orderIdx = orders.findIndex(k => k.orderCode == item.SUB_ORDER.orderCode)
if (!orders[orderIdx].hasOwnProperty('packages')) {
orders[orderIdx].packages = []
}
orders[orderIdx].packages.push(deepClone(packages))
}
})
this.tableModifyList.push(...orders)
},
// 用户修改-新增
modifyAdd(rowIndex, source, field, fieldConfig) {
this.dealModify(rowIndex, source, field)
this.billCompute(rowIndex, source, field, fieldConfig)
},
// 用户修改-删除(用于标记用户删除的主订单),并放入tableDeleteList中,调测算/提交接口时,作为excludeBillOrderCodes传给后端。
modifyDelete(orderCode) {
const isExitIdx = this.tableModifyList.findIndex(item => item.orderCode == orderCode)
if (isExitIdx != -1) {
this.tableModifyList.splice(isExitIdx, 1)
}
this.tableDeleteList.push(orderCode)
this.billCompute()
},
// 测算
billCompute(rowIndex, source, field, fieldConfig) {
if (field) {
this.validateField(rowIndex, source, field, fieldConfig)
}
this.billComputePage()
},
billComputePage() {
console.log(this.tableList, 'this.tableList---')
this.loading = true
console.log(this.tableModifyList, 'this.tableModifyList----')
const dynamicForm = {
id: this.orderId,
updatedOrders: deepClone(this.tableModifyList),
excludeBillOrderCodes: deepClone(this.tableDeleteList),
adjustments: this.$refs.dynamicAdd.dynamicForm.tableData,
orderCurrentPage: this.page.pageNum,
orderPageSize: this.page.pageSize
}
billComputePage({ json: JSON.stringify(dynamicForm) }).then(res => {
this.originalOrderList = res.orderPage?.list || []
this.totalAmount = res.totalAmount
this.orderTotalStat = res.orderTotalStat
this.page.pageNum = res.orderPage?.pageNum || 1
this.page.pageSize = res.orderPage?.pageSize || 10
this.page.total = res.orderPage?.total || 0
this.dealTableData()
}).finally(() => {
this.loading = false
})
},
validateField(rowIndex, source, field, fieldConfig) {
const value = this.tableList[rowIndex][source][field]
// const headObj = this.tmplFieldsList.find(i => i.fieldCode == field)
var key = `${rowIndex}_${source}_${field}`
// console.log(rowIndex, source, field, fieldConfig, '0000000')
if (this.judgeDisable(rowIndex, source, fieldConfig)) {
return true
}
if (fieldConfig?.editType === 'selectInput') {
const obj = this.tableList[rowIndex][source]
const selectVal = obj[fieldConfig.editObj.selectField]
const inputVal = obj[fieldConfig.editObj.inputField]
if (selectVal === undefined || selectVal === null || selectVal === '') {
this.$set(this.validationErrors, `${rowIndex}_${source}_${fieldConfig.editObj.selectField}`, '此项为必填项')
return false
}
if (inputVal === undefined || inputVal === null || inputVal === '') {
this.$set(this.validationErrors, `${rowIndex}_${source}_${fieldConfig.editObj.inputField}`, '此项为必填项')
return false
}
} else if (value === undefined || value === null || value === '') {
this.$set(this.validationErrors, key, '此项为必填项')
return false
}
if (fieldConfig?.editObj?.rule) {
let errorTxt = fieldConfig.editObj.rule(value, rowIndex, source, fieldConfig.editType == 'selectInput' ? fieldConfig : field)
if (errorTxt) {
if (fieldConfig.editType === 'selectInput') {
this.$set(this.validationErrors, `${rowIndex}_${source}_${fieldConfig.editObj.inputField}`, errorTxt)
} else {
this.$set(this.validationErrors, key, errorTxt)
}
return false
}
}
// 验证通过,清除错误
if (this.validationErrors[key]) {
this.$delete(this.validationErrors, key)
}
return true
},
validateForm() {
let isValid = true
this.validationErrors = {}
let noValidList = ['coverReceiverType']
this.tableList.forEach((row, rowIndex) => {
Object.keys(row).forEach(source => {
Object.keys(row[source]).forEach(field => {
const fieldConfig = this.getFieldConfig(field, source)
let headObj = this.tmplFieldsList.find(i => i.fieldCode == field)
if (!noValidList.includes(field) && fieldConfig && this.isEditableField(fieldConfig, field)) {
if (!this.validateField(rowIndex, source, field, fieldConfig)) {
isValid = false
}
}
})
})
})
return isValid
},
getFieldConfig(field, source) {
return this.tmplFieldsList.find(item =>
(item.fieldCode === field ||
(item.editType === 'selectInput' &&
(item.editObj.selectField === field || item.editObj.inputField === field))) &&
(item.extInfo?.source || 'ORDER') === source
)
},
isEditableField(fieldConfig, field) {
return this[this.billTypeStr + 'EditList'].some(editField =>
editField === field ||
(fieldConfig.editType === 'selectInput' &&
(editField.includes(fieldConfig.editObj.selectField) ||
editField.includes(fieldConfig.editObj.inputField))))
},
handleSelectChange(val, rowIndex, fieldConfig) {
if (fieldConfig.editObj.fn) {
fieldConfig.editObj.fn(val, rowIndex, fieldConfig)
}
this.validateField(rowIndex, fieldConfig.extInfo.source || 'ORDER', fieldConfig.fieldCode, fieldConfig)
},
handleSelectInputChange(rowIndex, fieldConfig) {
const source = fieldConfig.extInfo.source || 'ORDER'
this.validateField(rowIndex, source, fieldConfig.editObj.selectField, fieldConfig)
this.validateField(rowIndex, source, fieldConfig.editObj.inputField, fieldConfig)
this.modifyAdd(rowIndex, source, fieldConfig.fieldCode, fieldConfig)
},
handleConfirm() {
if (this.validateForm() && this.$refs.dynamicAdd.validateForm()) {
const dynamicForm = {
id: this.orderId,
updatedOrders: deepClone(this.tableModifyList),
excludeBillOrderCodes: deepClone(this.tableDeleteList),
adjustments: this.$refs.dynamicAdd.dynamicForm.tableData,
sceneType: this.sceneType
}
// console.log(dynamicForm, 'dynamicForm')
editBillPage({ json: JSON.stringify(dynamicForm) }).then(res => {
this.$message.success("操作成功")
this.$emit('handleConfirm')
})
} else {
this.$message.error('请检查表单中的报错项')
}
},
handleClose() {
this.$emit('handleClose')
},
getPlatformMerchantList() {
getPlatformMerchantList({}).then(res => {
res.unshift({
merchantId: -1,
merchantName: '嘀加智慧云'
})
this.baseData.PlatformMerchantList = res
})
},
// 处理动态表头信息,并将该列字段的特有属性写入,方便对表格里面的项做处理
dealTable() {
this.tableHeader = []
const moduleList = [...new Set(this.tmplFieldsList.map(item => item.moduleName))]
const changeCodeOldList = this.changeFieldCodeList.map(item => item.old)
const editList = this[this.billTypeStr + 'EditList']
const txtList = this[this.billTypeStr + 'ChangeTxtList']
moduleList.forEach(item => {
let list = this.tmplFieldsList.filter(k => k.moduleName == item)
list.forEach(k => {
k.extInfo = JSON.parse(k.extInfo)
let codeIdx = changeCodeOldList.findIndex(m => m == k.fieldCode)
if (codeIdx != -1 && editList.includes(this.changeFieldCodeList[codeIdx].new)) {
k.fieldCode = this.changeFieldCodeList[codeIdx].new
}
if (editList.includes(k.fieldCode)) {
if (this.editObj.select.attrList.includes(k.fieldCode)) {
k.editType = 'select'
k.width = '220px'
k.editObj = {
...this.editObj.select.defaultConf[k.fieldCode],
}
}
if (this.editObj.input.attrList.includes(k.fieldCode)) {
k.editType = 'input'
k.inputType = 'number'
k.width = '220px'
k.editObj = {
...this.editObj.input.defaultConf[k.fieldCode],
}
}
if (this.editObj.selectInput.attrList.includes(k.extInfo.source + k.fieldCode)) {
k.editType = 'selectInput'
k.editObj = {
selectField: k.fieldCode.split(',')[0],
inputField: k.fieldCode.split(',')[1],
inputType: 'number',
...this.editObj.selectInput.defaultConf[k.fieldCode]
}
k.width = '240px'
}
}
const txtObj = txtList.find(m => (m.source + m.attr) == (k.extInfo.source + k.fieldCode))
if (txtObj) {
if (txtObj.type == 'selectInput') {
k.txtType = 'selectInput'
k.txtObj = {
selectField: k.fieldCode.split(',')[0],
inputField: k.fieldCode.split(',')[1],
}
}
}
})
this.tableHeader.push({
moduleName: item,
items: list
})
})
this.dealTableData()
},
// 处理表格里面的数据,需结合表头这个字段的特有属性进行处理
dealTableData() {
this.tableList = []
let serialNo = 0
const txtList = this[this.billTypeStr + 'ChangeTxtList']
this.originalOrderList.forEach(item => {
let { packages, ...orderOtherObj } = item
serialNo = serialNo + 1
let subLen = 0
let subFirstIdx = 0
item.packages.forEach((k, kIdx) => {
let { subOrders, ...packagesOtherObj } = k
k.subOrders.forEach((m, mIdx) => {
this.tableList.push({
ORDER: deepClone({ ...orderOtherObj, serialNo: serialNo }),
PACKAGE: deepClone(packagesOtherObj),
SUB_ORDER: deepClone(m)
})
let targetIdx = this.tableList.length - 1
if (kIdx == 0 && mIdx == 0) {
subFirstIdx = targetIdx
}
if (mIdx == 0) {
// 行合并
this.tableList[targetIdx].subRowSpan = k.subOrders.length
subLen = subLen + k.subOrders.length
} else {
this.tableList[targetIdx].subRowSpan = 0
}
})
})
this.tableList[subFirstIdx].packRowSpan = subLen
})
this.tableList.forEach(item => {
txtList.forEach(m => {
if (m.type == 'select') {
item[m.source][m.attr] = this.baseData[m.optionsName].find(n => n[m.optionId] == item[m.source][m.attr])?.[m.optionLabel] || '-'
} else if (m.type == 'selectInput') {
const source = m.source
const selectField = m.attr.split(',')[0]
const inputField = m.attr.split(',')[1]
const selectObj = this.baseData[selectField + 'TxtList'].find(n => n[m.optionId] == item[m.source][selectField])
const selectTxt = selectObj?.[m.optionLabel]
item[m.source][selectField] = selectTxt || ''
item[m.source][inputField] = item[m.source][inputField] + selectObj?.suffix
} else if (m.type == 'time') {
item[m.source][m.attr] = item[m.source][m.attr] ? Util.dateFormate(item[m.source][m.attr], 'YYYY-MM-DD HH:mm:ss') : '-'
}
})
})
console.log(this.originalOrderList, 'this.originalOrderList----')
console.log(this.tableList, 'this.tableList---')
},
// 判断是否不可编辑
judgeDisable(rowIndex, source, fieldConfig) {
const value = this.tableList[rowIndex]
var isDisable = false
if (!fieldConfig) {
return isDisable
}
/**
* 流量方 - traffic;服务商 - service
* 对账单类型为服务商时,备注不能编辑
* */
if (this.billTypeStr == 'service') {
if (['ORDERcoverReceiverType'].includes(source + fieldConfig.fieldCode)) {
isDisable = true
}
}
/**
* sourceType:1-订单;2-退款
* 订单是退款单时,流量方总金额,服务商品类比例,按新政策标准的字段可以编辑
*/
if (value.ORDER.sourceType == 2) {
if (!['ORDERshopDivisionMoney', 'SUB_ORDERpartnerFeeCalculateType,partnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateType', 'SUB_ORDERpartnerFeeCalculateValue', 'SUB_ORDERpartnerFeeCalculateCoefficient'].includes(source + fieldConfig.fieldCode)) {
isDisable = true
}
}
/**editable为false,平台方和备注不能编辑
*/
if (value.ORDER.editable == false) {
if (['ORDERplatformMerchantId', 'ORDERcoverReceiverType'].includes(source + fieldConfig.fieldCode)) {
isDisable = true
}
}
return isDisable
},
// 判断表头字段是否可以批量编辑
judgeImgShow(obj) {
const editList = this[this.billTypeStr + 'SourceEditList']
const source = this.tmplFieldsList[obj.$index].extInfo.source
const fieldCode = this.tmplFieldsList[obj.$index].fieldCode
return editList.includes(source + fieldCode)
},
// 批量修改弹窗 - 验证表单
batchValidateForm() {
const value = this.batchForm[this.headObj.fieldCode]
this.dialogErrors = {};
let isValid = true;
// 必填校验
// if (this.headObj.required) {
if (this.headObj.editType === 'selectInput') {
const selectVal = this.batchForm[this.headObj.editObj.selectField]
const inputVal = this.batchForm[this.headObj.editObj.inputField]
if (selectVal === undefined || selectVal === null || selectVal === '') {
this.dialogErrors[this.headObj.editObj.selectField] = '请选择';
isValid = false;
}
if (inputVal === undefined || inputVal === null || inputVal === '') {
this.dialogErrors[this.headObj.editObj.inputField] = '请输入';
isValid = false;
}
} else if (value === undefined || value === null || value === '') {
this.dialogErrors[this.headObj.fieldCode] = this.headObj.editType === 'select' ? '请选择' : '请输入';
isValid = false;
}
// }
if (this.headObj?.editObj?.rule) {
let errorTxt = this.headObj.editObj.rule(value, '', '', this.headObj.editType == 'selectInput' ? this.headObj : this.headObj.fieldCode, true)
if (errorTxt) {
isValid = false;
if (this.headObj.editType === 'selectInput') {
this.dialogErrors[this.headObj.editObj.inputField] = errorTxt;
} else {
this.dialogErrors[this.headObj.fieldCode] = errorTxt;
}
return false
}
}
return isValid;
},
handelBatchVisible() {
this.batchVisible = !this.batchVisible
},
handleBatchClose() {
this.dialogErrors = {};
this.handelBatchVisible()
this.headObj = {}
},
handleBatchConfirm() {
// console.log(this.multipleSelecList)
let orderCodeList = this.multipleSelecList.map(item => item.ORDER.orderCode)
if (this.batchValidateForm()) {
this.tableList.forEach((item, idx) => {
if (orderCodeList.includes(item.ORDER.orderCode)) {
// let exitEditable = this.headObj.editObj?.hasOwnProperty('editableAttr') || false
let editable = !this.judgeDisable(idx, this.headObj.extInfo.source, this.headObj)
if (editable) {
if (this.headObj.editType == 'selectInput') {
this.tableList[idx][this.headObj.extInfo.source || 'ORDER'][this.headObj.editObj.selectField] = this.batchForm[this.headObj.editObj.selectField]
this.tableList[idx][this.headObj.extInfo.source || 'ORDER'][this.headObj.editObj.inputField] = this.batchForm[this.headObj.editObj.inputField]
} else {
this.tableList[idx][this.headObj.extInfo.source || 'ORDER'][this.headObj.fieldCode] = this.batchForm[this.headObj.fieldCode]
}
}
}
})
var orders = this.uniqueByProperty(this.multipleSelecList.map(item => item.ORDER), 'orderCode')
orders.forEach((item, idx) => {
const rowIdx = this.tableList.findIndex(k => k.ORDER.orderCode == item.orderCode)
this.dealModify(rowIdx, this.headObj.extInfo.source, this.headObj.fieldCode)
})
this.$nextTick(() => {
this.billCompute()
this.handleBatchClose()
})
}
},
handleBatch(obj) {
if (!this.multipleSelecList.length) {
this.$message.warning('请选择数据');
return true
}
this.headObj = this.tmplFieldsList[obj.$index]
if (this.headObj.editType == 'selectInput') {
this.$set(this.batchForm, this.headObj.editObj.selectField, '')
this.$set(this.batchForm, this.headObj.editObj.inputField, '')
} else {
this.$set(this.batchForm, this.headObj.fieldCode, '')
}
this.handelBatchVisible()
},
// 表格的合计字段,根据后端来的数据写入
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
return;
}
if (index === 1) {
sums[index] = '合计';
return;
}
const headObj = this.tmplFieldsList[index]
const source = headObj?.extInfo?.source || ''
switch (source) {
case 'ORDER':
sums[index + 1] = this.orderTotalStat[headObj.fieldCode] || '-'
break;
case 'PACKAGE':
sums[index + 1] = this.orderTotalStat.packages[0][headObj.fieldCode] || '-'
break;
case 'SUB_ORDER':
sums[index + 1] = this.orderTotalStat.packages[0].subOrders[0][headObj.fieldCode] || '-'
break
}
});
return sums;
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
/** 用于标识数据来源(ORDER、PACKAGE、SUB_ORDER)
* SUB_ORDER - 无需合并单元格;ORDER、PACKAGE - 需合并单元格
*/
const source = this.tmplFieldsList.find(item => item.fieldCode == column.property)?.extInfo?.source || 'ORDER'
if (['PACKAGE'].includes(source)) {
return {
rowspan: row.subRowSpan,
colspan: row.subRowSpan ? 1 : 0
}
}
if (['ORDER'].includes(source)) {
return {
rowspan: row.packRowSpan,
colspan: row.packRowSpan ? 1 : 0
}
}
},
handleDelete(rowIndex, row) {
if (this.tableList.length == 1) {
this.$message.error("至少选择一个")
return true
}
const orderCode = row.ORDER.orderCode
let list = []
this.tableList.forEach(item => {
if (item.ORDER.orderCode != orderCode) {
list.push(item)
}
})
this.tableList = deepClone(list)
this.modifyDelete(orderCode)
},
// 输入框
selectAddAttr(val, rowIndex, fieldConfig) {
this[fieldConfig.editObj.fn(val, rowIndex, fieldConfig)]
this.handleSelectChange(val, rowIndex, fieldConfig)
this.modifyAdd(rowIndex, fieldConfig.extInfo.source || 'ORDER', fieldConfig.fieldCode, fieldConfig)
},
handleSelectionChange(selection) {
// 处理选中行变化
this.multipleSelecList = selection
},
handleInputDown(e, rowIndex, source, fieldConfig) {
},
maxLengthInput(e, item) {
// 处理输入长度限制
},
handleSizeChange(value) {
this.page.pageSize = value
this.billCompute()
},
handleCurrentChange(value) {
this.page.pageNum = value
this.billCompute()
},
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
justify-content: space-between;
}
.el-form-item__error {
color: #f56c6c;
font-size: 12px;
line-height: 1;
padding-top: 4px;
position: relative;
top: 0;
left: 0;
}
.is-error {
.el-input__inner {
border-color: #f56c6c;
}
}
.select-input-container {
position: relative;
.el-form-item__error {
position: static;
margin-top: 2px;
}
.input-with-select {
.el-select {
&.is-error {
.el-input__inner {
border-color: #f56c6c;
}
}
}
&.is-error {
.el-input-group__prepend {
.el-input__inner {
border-right-color: #f56c6c;
}
}
.el-input__inner {
border-left-color: #dcdfe6;
}
}
}
}
::v-deep .el-input__suffix .inputSuffix {
position: absolute;
left: -14px;
top: 8px;
// transition: all 0.3s;
}
.tb-header-cell {
box-sizing: border-box;
text-align: center;
white-space: nowrap;
display: inline-block; /* 或者 inline */
}
.tb-cell {
padding: 14px;
text-align: center;
}
::v-deep .el-table .cell {
text-align: center;
}
::v-deep .el-table__footer-wrapper tbody td {
padding: 14px;
text-align: center;
}
.batch-box {
margin: 10px 36px;
}
.red-txt {
color: #eb4e4e;
font-size: 14px;
margin: 8px 0;
}
</style>