|
|
|
@ -369,6 +369,8 @@ |
|
|
|
height="250" |
|
|
|
:data="detailList" |
|
|
|
border |
|
|
|
show-summary |
|
|
|
:summary-method="getDetailSummaries" |
|
|
|
v-loading="dataListLoading" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column |
|
|
|
@ -429,7 +431,7 @@ |
|
|
|
header-align="center" |
|
|
|
align="right" |
|
|
|
label="总价" |
|
|
|
min-width="60"> |
|
|
|
min-width="80"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span >{{scope.row.totalPrice.toFixed(2)}}</span> |
|
|
|
</template> |
|
|
|
@ -1439,6 +1441,35 @@ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
getDetailSummaries({ columns, data }) { |
|
|
|
const sums = [] |
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
sums[index] = '合计' |
|
|
|
return |
|
|
|
} |
|
|
|
if (column.property === 'qty' || column.property === 'netWeight') { |
|
|
|
const total = (data || []).reduce((sum, item) => { |
|
|
|
return sum + this.parseSummaryNumber(item[column.property]) |
|
|
|
}, 0) |
|
|
|
sums[index] = Number(total.toFixed(6)) |
|
|
|
return |
|
|
|
} |
|
|
|
if (column.property === 'totalPrice') { |
|
|
|
const totalInCents = (data || []).reduce((sum, item) => { |
|
|
|
return sum + Math.round(this.parseSummaryNumber(item.totalPrice) * 100) |
|
|
|
}, 0) |
|
|
|
sums[index] = (totalInCents / 100).toFixed(2) |
|
|
|
return |
|
|
|
} |
|
|
|
sums[index] = '' |
|
|
|
}) |
|
|
|
return sums |
|
|
|
}, |
|
|
|
parseSummaryNumber(value) { |
|
|
|
const numberValue = Number(value) |
|
|
|
return Number.isFinite(numberValue) ? numberValue : 0 |
|
|
|
}, |
|
|
|
changeToalPrice(row){ |
|
|
|
row.totalPrice=row.unitPrice*row.qty |
|
|
|
}, |
|
|
|
|