结算金额处略微调整

This commit is contained in:
BianLzhaoMin 2024-08-15 09:34:06 +08:00
parent 2ed34bec99
commit f3312f4970
1 changed files with 77 additions and 30 deletions

View File

@ -36,7 +36,6 @@
repairCost
}}报废费用¥{{ scrapCost }}丢失费用{{ loseCost }}
</div>
<div>
<el-table
:data="leaseList"
@ -420,14 +419,20 @@
:max="100000000"
@input="countNum(scope.row)"
></el-input-number> -->
<el-input-number
<!-- <el-input-number
controls-position="right"
style="width: 150px"
v-model="scope.row.addCost"
:min="0"
:max="99999999"
@change="onAddChange(scope.row)"
></el-input-number>
></el-input-number> -->
<el-input
v-model="scope.row.addCost"
clearable
@change="onAddChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
@ -445,14 +450,20 @@
:max="scope.row.cost"
@input="countNum(scope.row)"
></el-input-number> -->
<el-input-number
<!-- <el-input-number
controls-position="right"
style="width: 150px"
v-model="scope.row.subCost"
:min="0"
:max="subCostFlag"
@change="onSubChange(scope.row)"
></el-input-number>
></el-input-number> -->
<el-input
v-model="scope.row.subCost"
clearable
@change="onSubChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column
@ -732,46 +743,82 @@ export default {
/** 费用增项时触发的事件 */
onAddChange(row) {
if (row.addCost === undefined) {
this.$message.closeAll()
const isRegex = this.isNumRegex(row.addCost)
if (!isRegex && row.addCost != '') {
this.$message.error('请输入大于等于0或包含两位小数点的数字')
row.addCost = 0
}
if (row.addCost >= 100000000) {
if (row.addCost * 1 >= 100000000) {
this.$message.error('增项费用不能超过1亿')
row.addCost = 99999999
}
row.cost = (
// 0
if (
row.leaseCost +
row.repairCost +
row.scrapCost +
row.loseCost +
row.addCost -
row.subCost
).toFixed(2)
row.repairCost +
row.scrapCost +
row.loseCost +
row.addCost * 1 <
row.subCost * 1
) {
row.subCost = 0
}
row.addCost = row.addCost * 1
this.$nextTick(() => {
row.cost = (
row.leaseCost +
row.repairCost +
row.scrapCost +
row.loseCost +
row.addCost * 1 -
row.subCost * 1
).toFixed(2)
})
},
/** 费用减项时触发事件 */
onSubChange(row) {
if (row.subCost === undefined) {
this.$message.closeAll()
const isRegex = this.isNumRegex(row.subCost)
if (!isRegex && row.subCost != '') {
this.$message.error('请输入大于等于0或包含两位小数点的数字')
row.subCost = 0
}
if (row.subCost > this.costAll && this.costAll === row.cost) {
row.subCost = row.subCost * 1
if (row.subCost > row.cost && this.costAll <= row.cost) {
this.$message.error('减免费用不能超过小计费用')
this.subCostFlag = row.costAll
row.subCost = this.costAll
}
if (row.cost > this.costAll) {
this.$message.error('减免费用不能超过小计费用')
this.subCostFlag = row.cost
row.subCost = row.cost
}
row.cost = (
row.leaseCost +
row.repairCost +
row.scrapCost +
row.loseCost +
row.addCost -
row.subCost
).toFixed(2)
if (row.subCost > row.cost && this.costAll > row.cost) {
this.$message.error('减免费用不能超过小计费用')
row.subCost = this.costAll
}
if (row.cost == 0 && row.subCost != '') {
this.$message.error('小计费用已为0无法再减免')
row.subCost = 0
}
this.$nextTick(() => {
row.cost = (
row.leaseCost +
row.repairCost +
row.scrapCost +
row.loseCost +
row.addCost * 1 -
row.subCost * 1
).toFixed(2)
})
},
isNumRegex(val) {
const regex = /^(0|[1-9]\d*)(\.\d{2})?$/
const isNum = regex.test(val)
return isNum
},
//