[update] 金额小数点;选择企业新增;批量打包开票金额限制
This commit is contained in:
@@ -70,6 +70,7 @@
|
||||
<script>
|
||||
import JDate from '../../../components/tools/JDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { addZero } from '../../../utils/util'
|
||||
|
||||
export default {
|
||||
name: 'BatchIncomePaymentModule',
|
||||
@@ -167,14 +168,27 @@ export default {
|
||||
],
|
||||
dataSource: [],
|
||||
inputIncomingAmount: null, // 输入的来款金额
|
||||
disableMixinCreated: true
|
||||
disableMixinCreated: true,
|
||||
sumAmountOwed: 0, // 总欠款金额
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
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()
|
||||
},
|
||||
@@ -190,6 +204,7 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
close() {
|
||||
this.clearThisTimeAmount()
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
/**
|
||||
@@ -197,8 +212,13 @@ export default {
|
||||
* @param e
|
||||
*/
|
||||
incomingAmountBlur(e) {
|
||||
this.addZero(e)
|
||||
e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()
|
||||
this.inputIncomingAmount = Number(e.target.value)
|
||||
if (this.inputIncomingAmount > this.sumAmountOwed) {
|
||||
this.$message.warn('来款金额大于总欠款金额,请修改')
|
||||
return
|
||||
}
|
||||
this.clearThisTimeAmount().then(() => {
|
||||
this.calculateThisTimeAmount()
|
||||
this.$forceUpdate()
|
||||
@@ -211,7 +231,7 @@ export default {
|
||||
clearThisTimeAmount() {
|
||||
return new Promise(resolve => {
|
||||
this.dataSource.forEach(item => {
|
||||
item.thisIncomingAmount = null
|
||||
item.thisIncomingAmount = 0.00
|
||||
})
|
||||
resolve()
|
||||
})
|
||||
@@ -229,19 +249,20 @@ export default {
|
||||
if (Number(item.amountOwed) > 0) {
|
||||
// 输入的来款金额是否 >= 当前项目欠款
|
||||
if (this.inputIncomingAmount >= Number(item.amountOwed)) {
|
||||
item.thisIncomingAmount = Number(item.amountOwed)
|
||||
item.thisIncomingAmount = this.getAddZero(Number(item.amountOwed))
|
||||
this.inputIncomingAmount -= Number(item.amountOwed)
|
||||
// item.amountOwed = 0
|
||||
} else {
|
||||
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款
|
||||
if (this.inputIncomingAmount > 0) {
|
||||
item.thisIncomingAmount = this.inputIncomingAmount
|
||||
item.thisIncomingAmount = this.getAddZero(this.inputIncomingAmount)
|
||||
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
|
||||
this.inputIncomingAmount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(this.dataSource)
|
||||
}
|
||||
,
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<a-input placeholder="请输入打包费用总计"
|
||||
v-decorator="['packChargeTotal',validatorRules.packChargeTotal]"
|
||||
:maxLength='50'
|
||||
@blur="addZero"
|
||||
@change="(e) => {e.target.value = (e.target.value.replace(/[^0-9.]/g,'')).trim()}"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -107,6 +108,7 @@ import CompanySelect from '../../../components/company/CompanySelect'
|
||||
import SelectContacts from '../../../components/company/SelectContacts'
|
||||
import JYearDate from '../../../components/jero/JYearDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { addZero } from '../../../utils/util'
|
||||
|
||||
export default {
|
||||
name: 'PackCompanyModule',
|
||||
@@ -167,6 +169,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addZero,
|
||||
add() {
|
||||
this.edit({})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user