更新
This commit is contained in:
@@ -103,12 +103,12 @@
|
||||
{{ scope.row.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计" align="center" min-width="80" prop="合计">
|
||||
<el-table-column label="合计(元)" align="center" min-width="100" prop="合计">
|
||||
<template slot-scope="scope">
|
||||
{{ (parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0)).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" min-width="80" prop="单价">
|
||||
<el-table-column label="单价(元)" align="center" min-width="100" prop="单价">
|
||||
<template slot-scope="scope">
|
||||
{{ parseFloat(scope.row.单价||0).toFixed(2) }}
|
||||
</template>
|
||||
@@ -220,6 +220,29 @@ export default {
|
||||
} else {
|
||||
sums[index] = '0'
|
||||
}
|
||||
} else if (index === 5) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (!data[i].到货数量) {
|
||||
data[i].到货数量 = 0
|
||||
}
|
||||
if (!data[i].已到货数量) {
|
||||
data[i].已到货数量 = 0
|
||||
}
|
||||
}
|
||||
const values = data.map(item => Number(parseInt(item['数量'])) * Number(parseInt(item['单价'])))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
sums[index] = Number(sums[index]).toFixed(2) + ' 元'
|
||||
} else {
|
||||
sums[index] = '0.00'
|
||||
}
|
||||
}
|
||||
})
|
||||
return sums
|
||||
|
||||
Reference in New Issue
Block a user