|
|
@@ -356,7 +356,7 @@ import { getQuery } from "@/hooks/detailQuery/index";
|
|
356
|
356
|
import store from "@/store";
|
|
357
|
357
|
import { useGetters } from "@/hooks/storeHooks";
|
|
358
|
358
|
const { access_token } = useGetters(["access_token"]);
|
|
359
|
|
-import { decimalMul, decimalDev } from "@/global/decimalCompute";
|
|
|
359
|
+import { decimalMul, decimalDev, decimalAdd } from "@/global/decimalCompute";
|
|
360
|
360
|
import type { TableColumnCtx } from "element-plus";
|
|
361
|
361
|
|
|
362
|
362
|
const { outdound_type, is_available, province_ch } = useDict("outdound_type", "is_available", "province_ch");
|
|
|
@@ -492,16 +492,16 @@ const getDeptName = (value: any, index: number) => {
|
|
492
|
492
|
|
|
493
|
493
|
|
|
494
|
494
|
interface Product {
|
|
495
|
|
- id: string
|
|
496
|
|
- quantity: string
|
|
497
|
|
- unitPrice: number
|
|
498
|
|
- totalPrice: number
|
|
|
495
|
+ id: string;
|
|
|
496
|
+ quantity: string;
|
|
|
497
|
+ unitPrice: number;
|
|
|
498
|
+ totalPrice: number;
|
|
499
|
499
|
}
|
|
500
|
500
|
interface SummaryMethodProps<T = Product> {
|
|
501
|
|
- columns: TableColumnCtx<T>[]
|
|
502
|
|
- data: T[]
|
|
|
501
|
+ columns: TableColumnCtx<T>[];
|
|
|
502
|
+ data: T[];
|
|
503
|
503
|
}
|
|
504
|
|
-const summaryJson = ["quantity","totalPrice"]
|
|
|
504
|
+const summaryJson = ["quantity", "totalPrice"];
|
|
505
|
505
|
const getSummaries = (param: SummaryMethodProps) => {
|
|
506
|
506
|
const { columns, data } = param;
|
|
507
|
507
|
const sums: (string | VNode)[] = [];
|
|
|
@@ -510,13 +510,14 @@ const getSummaries = (param: SummaryMethodProps) => {
|
|
510
|
510
|
sums[index] = h("div", ["合计"]);
|
|
511
|
511
|
return;
|
|
512
|
512
|
}
|
|
513
|
|
- if(summaryJson.indexOf(column.property)!=-1){
|
|
|
513
|
+ if (summaryJson.indexOf(column.property) != -1) {
|
|
514
|
514
|
const values = data.map((item) => Number(item[column.property]));
|
|
515
|
515
|
if (!values.every((value) => Number.isNaN(value))) {
|
|
516
|
516
|
sums[index] = `${values.reduce((prev, curr) => {
|
|
517
|
517
|
const value = Number(curr);
|
|
518
|
518
|
if (!Number.isNaN(value)) {
|
|
519
|
|
- return prev + curr;
|
|
|
519
|
+ return decimalAdd(prev, curr);
|
|
|
520
|
+ // return prev + curr;
|
|
520
|
521
|
} else {
|
|
521
|
522
|
return prev;
|
|
522
|
523
|
}
|