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
<template>
<el-dialog visible width="1500px" :title="title" :before-close="close">
<el-card v-if="orderSummary">
<span slot="header" class="header-title">{{$t('订单收费汇总')}}</span>
<el-descriptions :column="4">
<el-descriptions-item :label="$t('应收运费')">
{{orderSummary.receivableFreightFee}}{{currencyMap[orderSummary.seaFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('应收清关费')">
{{orderSummary.receivableClearanceFee}}{{currencyMap[orderSummary.clearanceFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('应收额外费用')">
{{orderSummary.receivableOtherFee}}{{currencyMap[orderSummary.otherFeeCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('应收总金额')">
{{orderSummary.receivableTotalAmount}}{{currencyMap[orderSummary.writeOffCurrencyId]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('实收运费')">
{{orderSummary.netReceiptsFreightFee}}{{currencyMap[orderSummary.seaFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('实收清关费')">
{{orderSummary.netReceiptsClearanceFee}}{{currencyMap[orderSummary.clearanceFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('实收额外费用')">
{{orderSummary.netReceiptsOtherFee}}{{currencyMap[orderSummary.otherFeeCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('实收总额')">
{{orderSummary.netReceiptsTotalAmount}}{{currencyMap[orderSummary.writeOffCurrencyId]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('运费优惠金额')">
{{orderSummary.discountFreightTotalPrice}}{{currencyMap[orderSummary.seaFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('清关费优惠金额')">
{{orderSummary.discountClearanceFee}}{{currencyMap[orderSummary.clearanceFreightCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('额外费用优惠金额')">
{{orderSummary.discountOtherFee}}{{currencyMap[orderSummary.otherFeeCurrency]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('订单优惠金额')">
{{orderSummary.discountTotalAmount}}{{currencyMap[orderSummary.writeOffCurrencyId]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('已核销总金额')">
{{orderSummary.writeOffAmount}}{{currencyMap[orderSummary.writeOffCurrencyId]}}
</el-descriptions-item>
<el-descriptions-item :label="$t('已核销比例')">
{{orderSummary.writeOffRatio}}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="mt-10" v-if="orderSummary">
<span slot="header">{{$t('入仓信息')}}</span>
<!--仓库实测,是否重货,原重货标准,原收费数据
优惠重货标准,实际收费数据,货值-->
<el-descriptions :column="4">
<el-descriptions-item :label="$t('仓库实测')">
<span>{{orderSummary.sumNum}}{{$t('箱')}}</span>
<span class="ml-5">{{orderSummary.sumVolume}}m³</span>
<span class="ml-5">{{orderSummary.sumWeight}}kg</span>
<span class="ml-5" v-if="orderSummary.sumQuantity">{{orderSummary.sumQuantity}}{{$t('个')}}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('是否重货/泡货')">
<!--1 普货 2 重货 3 泡货-->
<dict-tag :type="DICT_TYPE.ORDER_TYPE" :value="orderSummary.orderType"></dict-tag>
</el-descriptions-item>
<el-descriptions-item :label="$t('原重货标准')" v-if="[1,2].indexOf(orderSummary.transportId) > -1">
{{orderSummary.orgWeightUnit}}KG/m³
</el-descriptions-item>
<el-descriptions-item :label="$t('原泡货标准')" v-else>
{{orderSummary.orgVolumeUnit}}kg/m³
</el-descriptions-item>
<el-descriptions-item :label="$t('原收费数据')">
<span>{{orderSummary.orgChargeNum}}{{$t('箱')}}</span>
<span class="ml-5">{{orderSummary.orgChargeVolume}}m³</span>
<span class="ml-5">{{orderSummary.orgChargeWeight}}kg</span>
<span class="ml-5" v-if="orderSummary.orgChargeQuantity">{{orderSummary.orgChargeQuantity}}{{$t('个')}}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('优惠重货标准')" v-if="[1,2].indexOf(orderSummary.transportId) > -1">
{{orderSummary.weightUnit}}KG/m³
</el-descriptions-item>
<el-descriptions-item :label="$t('优惠泡货标准')" v-else>
{{orderSummary.volumeUnit}}kg/m³
</el-descriptions-item>
<el-descriptions-item :label="$t('实际收费数据')">
<span>{{orderSummary.realityChargeNum}}{{$t('箱')}}</span>
<span class="ml-5">{{orderSummary.realityChargeVolume}}m³</span>
<span class="ml-5">{{orderSummary.realityChargeWeight}}kg</span>
<span class="ml-5" v-if="orderSummary.realityChargeQuantity">{{orderSummary.realityChargeQuantity}}{{$t('个')}}</span>
</el-descriptions-item>
<el-descriptions-item :label="$t('货值')">
{{orderSummary.totalWorth}}{{currencyMap[orderSummary.worthCurrency]}}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="mt-10" v-if="orderDetailSummary">
<span slot="header">{{$t('运费')}} & {{$t('清关费')}}</span>
<!--序号,中文品名,英文品名,品牌,入仓数据,是否重货,入仓数据,实收数据,应收单价,优惠单价金额,成交单价,应收运费&清关费,收款单优惠金额,总优惠金额,实收运费&清关费-->
<el-table :data="orderItemCostDtoList" show-summary :summary-method="getOrderItemSummary">
<el-table-column :label="$t('序号')" width="80">
<template slot-scope="scope">{{scope.$index+1}}</template>
</el-table-column>
<el-table-column :label="$t('中文品名')" prop="prodTitleZh"></el-table-column>
<el-table-column :label="$t('英文品名')" prop="prodTitleEn"></el-table-column>
<el-table-column :label="$t('品牌')" prop="brandName">
<template slot-scope="{row}">
<span v-if="row.brandName">{{row.brandName}}</span>
<dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('入仓实测')">
<template slot-scope="{row}">
<div>{{row.warehouseInNum}}{{$t('箱')}}</div>
<div>{{row.warehouseInVolume}}m³</div>
<div>{{row.warehouseInWeight}}kg</div>
<div v-if="row.warehouseInQuantity">{{row.warehouseInQuantity}}{{$t('个')}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('是否重货/泡货')">
<template slot-scope="{row}">
<!--1 普货 2 重货 3 泡货-->
<dict-tag :type="DICT_TYPE.ECW_YESNO" :value="row.itemType != 1 ? '1' : '0'"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('应收数据')">
<template slot-scope="{row}">
<div>{{row.orgChargeNum}}{{$t('箱')}}</div>
<div>{{row.orgChargeVolume}}m³</div>
<div>{{row.orgChargeWeight}}kg</div>
<div v-if="row.orgChargeQuantity">{{row.orgChargeQuantity}}{{$t('个')}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('实收数据')">
<template slot-scope="{row}">
<div>{{row.realityChargeNum}}{{$t('箱')}}</div>
<div>{{row.realityChargeVolume}}m³</div>
<div>{{row.realityChargeWeight}}kg</div>
<div v-if="row.realityChargeQuantity">{{row.realityChargeQuantity}}{{$t('个')}}</div>
</template>
</el-table-column>
<el-table-column :label="$t('应收单价')" width="180px">
<template slot-scope="{row}">
<!--全包价-->
<!--<template v-if="row.charging">
{{$t('全包价')}}:{{row.receivableOneSeaFreight}}{{currencyMap[row.seaFreightCurrency]}}
</template>
<template v-else>
<div>{{$t('运费')}}:{{row.receivableOneSeaFreight}}{{currencyMap[row.seaFreightCurrency]}}</div>
<div>{{$t('清关费')}}:{{row.receivableOneClearanceFreight}}{{currencyMap[row.clearanceFreightCurrency]}}</div>
</template>-->
<price
:charging="row.charging == 1"
:freight="row.receivableOneSeaFreight"
:freight-currency="row.seaFreightCurrency"
:clearance="row.receivableOneClearanceFreight"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('优惠单价金额')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.discountFreightPrice"
:freight-currency="row.seaFreightCurrency"
:clearance="row.discountClearanceFeePrice"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('成交单价')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.oneSeaFreight"
:freight-currency="row.seaFreightCurrency"
:clearance="row.oneClearanceFreight"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('应收运费') + '&' + $t('清关费')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.receivableSeaFreight"
:freight-currency="row.seaFreightCurrency"
:clearance="row.receivableClearanceFreight"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('优惠运费') + '&' + $t('清关费')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.totalDiscountFreightPrice"
:freight-currency="row.seaFreightCurrency"
:clearance="row.totalDiscountClearanceFeePrice"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('收款单优惠金额')" width="180px" prop="discountFee">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.receiptDiscountFreightPrice"
:freight-currency="row.seaFreightCurrency"
:clearance="row.receiptDiscountClearanceFeePrice"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('总优惠金额')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.totalDiscountFreightPrice"
:freight-currency="row.seaFreightCurrency"
:clearance="row.totalDiscountClearanceFeePrice"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
<el-table-column :label="$t('实收运费') + '&' + $t('清关费')" width="180px">
<template slot-scope="{row}">
<price
:charging="row.charging == 1"
:freight="row.realitySeaFreight"
:freight-currency="row.seaFreightCurrency"
:clearance="row.realityClearanceFreight"
:clearance-currency="row.clearanceFreightCurrency"
:currency-map="currencyMap"
></price>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="mt-10">
<span slot="header">{{$t('保费')}}</span>
<div v-if="insuranceFeeDto">
{{$t('订单总金额')}}:{{insuranceFeeDto.totalWorth}}{{currencyMap[insuranceFeeDto.worthCurrency]}},
{{$t('保费费率')}}:{{insuranceFeeDto.insuranceRatio}},
{{$t('应收保费')}}:{{insuranceFeeDto.receivableInsuranceFee}}{{currencyMap[insuranceFeeDto.insuranceCurrency]}},
{{$t('收款优惠金额')}}:{{insuranceFeeDto.discountInsuranceFee}}{{currencyMap[insuranceFeeDto.insuranceCurrency]}},
{{$t('实收保费')}}:{{insuranceFeeDto.realityInsuranceFee}}{{currencyMap[insuranceFeeDto.insuranceCurrency]}}
</div>
</el-card>
<el-card class="mt-10">
<span slot="header">{{$t('特需')}}</span>
<!--特需类型,金额,付款类型,备注,应收金额,收款优惠金额,实收美元金额,确认收款,申请人,申请时间-->
<el-table :data="specialNeedFeeList" show-summary :summary-method="getSpecialSummaries">
<el-table-column :label="$t('特需类型')">
<template slot-scope="{row}">
<!--<dict-tag :type="DICT_TYPE.ORDER_SPECIAL_NEEDS" :value="row."></dict-tag>-->
<dict-tag :type="DICT_TYPE.FEE_TYPE" :value="row.feeType"></dict-tag>
</template>
</el-table-column>
<!--<el-table-column :label="$t('金额')" prop="realityTotalAmount">
<template slot-scope="{row}">
TODO {{currencyMap[row.currencyId]}}
</template>
</el-table-column>-->
<el-table-column :label="$t('付款类型')">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.isPayAdvance"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('备注')" prop="remark"></el-table-column>
<el-table-column :label="$t('应收金额')">
<template slot-scope="{row}">
{{row.receivableTotalAmount}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('收款优惠金额')" width="120" prop="discountFee">
<template slot-scope="{row}">
{{row.discountTotal || 0}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('实收美元金额')" width="120" prop="realFee">
<template slot-scope="{row}">
{{row.realityTotalAmount}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('确认收款')">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_RECEIVABLE_STATE" :value="row.state"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('申请人')" prop="authorName"></el-table-column>
<el-table-column :label="$t('申请时间')" prop="applyTime">
<template slot-scope="{row}">{{row.createTime|parseTime}}</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="mt-10">
<span slot="header">{{$t('费用申请')}}</span>
<el-table :data="feeApplicationList" show-summary :summary-method="getFeeApplicationSummaries">
<el-table-column :label="$t('费用类型')" prop="feeType">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.FEE_TYPE" :value="row.feeType"></dict-tag>
</template>
</el-table-column>
<!--<el-table-column :label="$t('金额')" prop="fee">
<template slot-scope="{row}">
TODO {{currencyMap[row.currencyId]}}
</template>
</el-table-column>-->
<el-table-column :label="$t('付款类型')">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.isPayAdvance"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('备注')" prop="remark"></el-table-column>
<el-table-column :label="$t('应收金额')">
<template slot-scope="{row}">
{{row.receivableTotalAmount}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('收款优惠金额')">
<template slot-scope="{row}">
{{row.discountTotal || 0}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('实收金额')">
<template slot-scope="{row}">
{{row.realityTotalAmount}}{{currencyMap[row.currencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('确认收款')">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_RECEIVABLE_STATE" :value="row.state"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('申请人')" prop="author"></el-table-column>
<el-table-column :label="$t('申请时间')">
<template slot-scope="{row}">
{{row.createTime|parseTime}}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="mt-10">
<span slot="header">{{$t('优惠活动')}}</span>
<el-table :data="couponInfoVOList">
<el-table-column :label="$t('优惠ID')" width="100" prop="couponId"></el-table-column>
<el-table-column :label="$t('优惠名称')" width="120">
<template slot-scope="{row}">{{$l(row, 'title')}}</template>
</el-table-column>
<el-table-column :label="$t('类型')" prop="type">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_COUPON_TYPE" :value="row.type"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('运费优惠')" prop="fee">
<template slot-scope="{row}">
{{row.freightReduceAmount}}{{currencyMap[row.freightReduceCurrencyId]}}
</template>
</el-table-column>
<el-table-column :label="$t('清关费优惠')" prop="clearFee">
<template slot-scope="{row}">
{{row.clearanceReduceAmount}}{{currencyMap[row.clearanceReduceCurrencyId]}}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="mt-10">
<span slot="header">{{$t('特价折扣')}}</span>
<el-table :data="orderSpecialApplyVOList">
<el-table-column :label="$t('商品类型')" prop="prodType">
<template slot-scope="{row}">
{{showProductTypeName(row.prodType)}}
</template>
</el-table-column>
<el-table-column :label="$t('商品名称')" prop="prodTitleZh"></el-table-column>
<el-table-column :label="$t('英文名称')" prop="prodTitleEn"></el-table-column>
<!--<el-table-column :label="$t('线路')" width="120" prop="line">
</el-table-column>-->
<el-table-column :label="$t('是否预付')" width="120" prop="isPrepay">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_PAY_ADVANCE" :value="row.isPayAdvance"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('旧运费')">
<template slot-scope="{row}">
{{row.orgFreight}}{{currencyMap[row.freightCurrency]}}
</template>
</el-table-column>
<el-table-column :label="$t('新运费')">
<template slot-scope="{row}">
{{row.freight}}{{currencyMap[row.freightCurrency]}}
</template>
</el-table-column>
<el-table-column :label="$t('旧清关费')">
<template slot-scope="{row}">
{{row.orgClearanceFreight}}{{currencyMap[row.clearanceFreightCurrency]}}
</template>
</el-table-column>
<el-table-column :label="$t('新清关费')">
<template slot-scope="{row}">
{{row.clearanceFreight}}{{currencyMap[row.clearanceFreightCurrency]}}
</template>
</el-table-column>
<el-table-column :label="$t('申请人')" prop="creatorName"></el-table-column>
<el-table-column :label="$t('申请时间')">
<template slot-scope="{row}">
{{row.createTime|parseTime}}
</template>
</el-table-column>
</el-table>
</el-card>
</el-dialog>
</template>
<script>
import {orderDetailSummary, orderSummary} from "@/api/ecw/order";
import Price from "@/views/ecw/order/components/price.vue";
import {parseTime} from "@/utils/ruoyi";
import Decimal from "decimal.js";
import {createElementVNode} from "@vue/runtime-dom";
import {getProductTypeList} from "@/api/ecw/productType";
export default {
props:{
orderId: [Number, String],
currencyMap: {
type: Object,
default: () => {
return {}
}
},
},
filters: {parseTime},
components: {Price},
data(){
return {
// 订单费用汇总
orderSummary: null,
// 订单费用明细汇总
orderDetailSummary: null,
// 商品类型
productTypeList: []
}
},
computed:{
title(){
return this.orderSummary?.orderNo + this.$t('费用汇总')
},
// 保费
insuranceFeeDto(){
return this.orderDetailSummary?.insuranceFeeDto
},
// 特需
specialNeedFeeList(){
return this.orderDetailSummary?.specialNeedFeeList || []
},
// 费用申请
feeApplicationList(){
return this.orderDetailSummary?.feeApplicationList || []
},
// 运费清关费
orderItemCostDtoList(){
return this.orderDetailSummary?.orderItemCostDtoList || []
},
// 优惠活动
couponInfoVOList(){
return this.orderDetailSummary?.couponInfoVOList || []
},
// 特价折扣
orderSpecialApplyVOList(){
return this.orderDetailSummary?.orderSpecialApplyVOList || []
},
// 根据商品类型ID返回名称
showProductTypeName(){
return id => {
if(!this.productTypeList.length) return '-'
const item = this.productTypeList.find(item => item.id === id)
return this.$l(item, 'title')
}
}
},
watch:{
orderSpecialApplyVOList(list){
if(list.length && !this.productTypeList.length){
getProductTypeList().then(res => {
this.productTypeList = res.data
})
}
}
},
mounted() {
this.getOrderSummary()
this.getOrderDetailSummary()
},
methods:{
// 根据不同货币计算总额,返回currencyId: Decimal键值对
calcTotalByCurrency(arr, amountField, currencyField){
let total = {}
arr.forEach(item => {
const currency = item[currencyField]
if(!currency) return
if(!total[currency]){
total[currency] = new Decimal(0)
}
total[currency] = total[currency].plus(new Decimal(item[amountField] || 0))
})
console.log('currencyField', total)
return Object.keys(total).map(currencyId => {
return `${total[currencyId].toNumber()}${this.currencyMap[currencyId]}`
}).join(";")
},
// 特需汇总
getSpecialSummaries(){
let arr = []
arr[2] = this.$t('合计')
// 应收金额
arr[3] = this.calcTotalByCurrency(this.specialNeedFeeList, 'receivableTotalAmount', 'currencyId')
// 收款优惠金额
arr[4] = this.calcTotalByCurrency(this.specialNeedFeeList, 'discountTotal', 'currencyId')
// 实收金额
arr[5] = this.calcTotalByCurrency(this.specialNeedFeeList, 'realityTotalAmount', 'currencyId')
return arr
},
// 费用申请汇总
getFeeApplicationSummaries(){
if(!this.feeApplicationList) return []
let arr = []
arr[2] = this.$t('合计')
// 应收金额
arr[3] = this.calcTotalByCurrency(this.feeApplicationList, 'receivableTotalAmount', 'currencyId')
// 收款优惠金额
arr[4] = this.calcTotalByCurrency(this.feeApplicationList, 'discountTotal', 'currencyId')
// 实收金额
arr[5] = this.calcTotalByCurrency(this.feeApplicationList, 'realityTotalAmount', 'currencyId')
return arr
},
// 运费&清关费汇总
getOrderItemSummary(){
let arr = []
arr[10] = this.$t('合计')
// 运费和清关费要合计起来
let feeList = this.orderItemCostDtoList.map(item => {
return {
amount: item.receivableSeaFreight,
currency: item.seaFreightCurrency
}
})
feeList = feeList.concat(this.orderItemCostDtoList.map(item => {
return {
amount: item.receivableClearanceFreight,
currency: item.clearanceFreightCurrency
}
}))
// 应收金额
arr[11] = this.calcTotalByCurrency(feeList, 'amount', 'currency')
console.log('运费清关费汇总',feeList, arr)
return arr
},
close(){
this.$emit('close')
},
// 获得订单费用汇总
getOrderSummary(){
orderSummary(this.orderId).then(res => {
this.orderSummary = res.data
})
},
// 获得订单明细汇总
getOrderDetailSummary(){
orderDetailSummary(this.orderId).then(res => {
this.orderDetailSummary = res.data
})
}
}
}
</script>
<style scoped lang="scss">
</style>