|
|
@ -118,7 +118,7 @@ |
|
|
|
<el-button type="primary" size="mini" icon="el-icon-plus" class="btntopblueline" @click="handleRebate()">明细计算</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-table :key="tableKey" :data="formobj.scmCollectionRebateVehs" :index="index" border style="width: 100%"> |
|
|
|
<el-table :key="tableKey" :data="formobj.scmCollectionRebateVehs" :index="index" border style="width: 100%" show-summary :summary-method="getSummaries"> |
|
|
|
<el-table-column fixed width="80" label="序号" type="index" :index="index + 1" align="center"/> |
|
|
|
<el-table-column prop="vinNo" label="车架号" align="center" /> |
|
|
|
<el-table-column prop="freight" label="运费" align="center" /> |
|
|
@ -302,6 +302,30 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 合计 |
|
|
|
getSummaries(param) { |
|
|
|
const {columns, data} = param |
|
|
|
const sums = [] |
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
sums[index] = '' |
|
|
|
return |
|
|
|
} |
|
|
|
const values = data.map(item => Number(item[column.property])) |
|
|
|
if (column.property !== 'vinNo') { |
|
|
|
sums[index] = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr) |
|
|
|
if (!isNaN(value)) { |
|
|
|
return Math.round((parseFloat(prev) + parseFloat(curr)) * 100) / 100 |
|
|
|
} else { |
|
|
|
return Math.round((parseFloat(prev)) * 100) / 100 |
|
|
|
} |
|
|
|
}, 0) |
|
|
|
sums[index] += '' |
|
|
|
} |
|
|
|
}) |
|
|
|
return sums |
|
|
|
}, |
|
|
|
// 返回(===既判断) |
|
|
|
handleReturn(isreload) { |
|
|
|
if (isreload === 'true') this.$emit('reloadlist') |
|
|
|