[update] 金额小数点;选择企业新增;批量打包开票金额限制
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
<script>
|
||||
import JDate from '../../../components/tools/JDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { addZero } from '../../../utils/util'
|
||||
|
||||
export default {
|
||||
name: 'BatchInvoicingModule',
|
||||
@@ -177,13 +178,31 @@ export default {
|
||||
}
|
||||
},
|
||||
inputInvoicingAmount: null, // 输入的开票金额
|
||||
sumAmountOwed: 0 // 总未开票金额
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
/**
|
||||
* 获取补0的数据
|
||||
* @param value
|
||||
* @returns {*}
|
||||
*/
|
||||
getAddZero(value) {
|
||||
let e = {
|
||||
target: {
|
||||
value: value.toString()
|
||||
}
|
||||
}
|
||||
this.addZero(e)
|
||||
return e.target.value
|
||||
},
|
||||
loadData() {
|
||||
// 计算项目欠款信息
|
||||
this.dataSource.forEach(item => {
|
||||
item.amountOwed = Number(item.receivableAmount) - Number(item.paidAmount)
|
||||
let amountOwed = Number(item.receivableAmount) - Number(item.paidAmount)
|
||||
item.amountOwed = this.getAddZero(amountOwed)
|
||||
this.sumAmountOwed += Number(item.amountOwed)
|
||||
})
|
||||
this.$forceUpdate()
|
||||
},
|
||||
@@ -191,8 +210,13 @@ export default {
|
||||
* blur时分配金额
|
||||
*/
|
||||
invoicingAmountBlur(e) {
|
||||
this.addZero(e)
|
||||
e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()
|
||||
this.inputInvoicingAmount = Number(e.target.value)
|
||||
if (this.inputInvoicingAmount > this.sumAmountOwed) {
|
||||
this.$message.warn('开票金额大于总未开票金额,请修改')
|
||||
return
|
||||
}
|
||||
this.clearThisTimeAmount().then(() => {
|
||||
this.calculateThisTimeAmount()
|
||||
this.$forceUpdate()
|
||||
@@ -223,13 +247,13 @@ export default {
|
||||
if (Number(item.amountOwed) > 0) {
|
||||
// 输入的来款金额是否 >= 当前项目欠款
|
||||
if (this.inputInvoicingAmount >= Number(item.amountOwed)) {
|
||||
item.thisInvoicingAmount = Number(item.amountOwed)
|
||||
item.thisInvoicingAmount = this.getAddZero(Number(item.amountOwed))
|
||||
this.inputInvoicingAmount -= Number(item.amountOwed)
|
||||
// item.amountOwed = 0
|
||||
} else {
|
||||
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款
|
||||
if (this.inputInvoicingAmount > 0) {
|
||||
item.thisInvoicingAmount = this.inputInvoicingAmount
|
||||
item.thisInvoicingAmount = this.getAddZero(this.inputInvoicingAmount)
|
||||
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
|
||||
this.inputInvoicingAmount = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user