普通项目;工作组变更--文件维护接口;批量开票
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入开票金额"
|
||||
v-decorator="['invoicingAmount',validatorRules.invoicingAmount]"
|
||||
v-decorator="['invoiceAmount',validatorRules.invoiceAmount]"
|
||||
:maxLength='50'
|
||||
@blur="invoicingAmountBlur"
|
||||
@change="(e) => {e.target.value = (e.target.value.replace(/[^0-9.]/g,'')).trim()}"></a-input>
|
||||
@@ -23,7 +23,7 @@
|
||||
<a-col :xl="12" :sm="24">
|
||||
<a-form-item label="开票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入开票号"
|
||||
v-decorator="['invoicingNum', validatorRules.invoicingNum]"
|
||||
v-decorator="['billNo', validatorRules.billNo]"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</a-form-item>
|
||||
@@ -34,7 +34,7 @@
|
||||
<a-form-item label="开票时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<j-date placeholder="请选择开票时间"
|
||||
style="width: 100%;"
|
||||
v-decorator="['invoicingTime', validatorRules.invoicingTime]"
|
||||
v-decorator="['billDate', validatorRules.billDate]"
|
||||
:trigger-change="true"
|
||||
v-bind="$attrs"
|
||||
date-format="YYYY-MM-DD"/>
|
||||
@@ -56,9 +56,9 @@
|
||||
</template>
|
||||
|
||||
<!-- 输入-->
|
||||
<template slot="input-text">
|
||||
<template slot="input-text" slot-scope="text, record">
|
||||
<a-input placeholder="请输入备注"
|
||||
v-decorator="['remark']"
|
||||
v-model="record.remark"
|
||||
:maxLength='50'
|
||||
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
|
||||
</template>
|
||||
@@ -77,6 +77,7 @@
|
||||
import JDate from '../../../components/tools/JDate'
|
||||
import { money } from '../../../utils/validate'
|
||||
import { addZero } from '../../../utils/util'
|
||||
import { addPayBill } from '../../../api/incomePaymentsApi'
|
||||
|
||||
export default {
|
||||
name: 'BatchInvoicingModule',
|
||||
@@ -148,7 +149,7 @@ export default {
|
||||
title: '已开票金额',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
dataIndex: 'paidAmount'
|
||||
dataIndex: 'invoiceAmount'
|
||||
}, {
|
||||
title: '本次开票金额',
|
||||
align: 'center',
|
||||
@@ -164,7 +165,7 @@ export default {
|
||||
],
|
||||
dataSource: [],
|
||||
validatorRules: {
|
||||
invoicingAmount: {
|
||||
invoiceAmount: {
|
||||
rules: [{ required: true, validator: this.checkMoney }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
@@ -172,7 +173,7 @@ export default {
|
||||
rules: [{ required: true, message: '请输入开票号' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
invoicingTime: {
|
||||
billDate: {
|
||||
rules: [{ required: true, message: '请选择开票时间' }],
|
||||
validateTrigger: 'blur'
|
||||
}
|
||||
@@ -198,10 +199,11 @@ export default {
|
||||
return e.target.value
|
||||
},
|
||||
loadData() {
|
||||
// 计算项目欠款信息
|
||||
// 计算项目未开票金额信息
|
||||
this.dataSource.forEach(item => {
|
||||
let amountOwed = Number(item.receivableAmount) - Number(item.paidAmount)
|
||||
let amountOwed = Number(item.receivableAmount) - Number(item.invoiceAmount)
|
||||
item.amountOwed = this.getAddZero(amountOwed)
|
||||
item.thisInvoicingAmount = 0
|
||||
this.sumAmountOwed += Number(item.amountOwed)
|
||||
})
|
||||
this.$forceUpdate()
|
||||
@@ -217,52 +219,72 @@ export default {
|
||||
this.$message.warn('开票金额大于总未开票金额,请修改')
|
||||
return
|
||||
}
|
||||
this.clearThisTimeAmount().then(() => {
|
||||
this.calculateThisTimeAmount()
|
||||
this.$forceUpdate()
|
||||
})
|
||||
this.clearThisTimeAmount()
|
||||
this.calculateThisTimeAmount()
|
||||
},
|
||||
/**
|
||||
* 清空本次来款金额
|
||||
* 清空本次开票金额
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
clearThisTimeAmount() {
|
||||
return new Promise(resolve => {
|
||||
this.dataSource.forEach(item => {
|
||||
item.thisInvoicingAmount = null
|
||||
})
|
||||
resolve()
|
||||
this.dataSource.forEach(item => {
|
||||
item.thisInvoicingAmount = 0
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 计算此次来款信息
|
||||
* 计算此次开票信息
|
||||
*/
|
||||
calculateThisTimeAmount() {
|
||||
if (this.inputInvoicingAmount <= 0) {
|
||||
this.$message.warn('请输入大于0的来款金额')
|
||||
this.$message.warn('请输入大于0的开票金额')
|
||||
return
|
||||
}
|
||||
this.dataSource.forEach(item => {
|
||||
this.dataSource.forEach((item, index) => {
|
||||
// 当前项目欠款是否 >0
|
||||
if (Number(item.amountOwed) > 0) {
|
||||
// 输入的来款金额是否 >= 当前项目欠款
|
||||
// 输入的开票金额是否 >= 当前项目欠款
|
||||
if (this.inputInvoicingAmount >= Number(item.amountOwed)) {
|
||||
item.thisInvoicingAmount = this.getAddZero(Number(item.amountOwed))
|
||||
this.inputInvoicingAmount -= Number(item.amountOwed)
|
||||
// item.amountOwed = 0
|
||||
} else {
|
||||
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款
|
||||
// 输入的开票金额小于当前项目欠款且剩余的输入开票金额大于0,则将剩余全部开票算入当前项目的此次开票
|
||||
if (this.inputInvoicingAmount > 0) {
|
||||
item.thisInvoicingAmount = this.getAddZero(this.inputInvoicingAmount)
|
||||
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
|
||||
this.inputInvoicingAmount = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$set(this.dataSource, index, item)
|
||||
})
|
||||
},
|
||||
handleOk() {
|
||||
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
let bmpList = []
|
||||
let data = this.dataSource.filter(tt => tt.thisInvoicingAmount !== 0 && tt.thisInvoicingAmount)
|
||||
data.forEach(item => {
|
||||
let obj = {
|
||||
invoiceAmount: item.thisInvoicingAmount,
|
||||
projectId: item.id,
|
||||
projectType: item.projectType,
|
||||
remark: item.remark
|
||||
}
|
||||
bmpList.push(obj)
|
||||
})
|
||||
let param = values
|
||||
param.bmpList = bmpList
|
||||
console.log(param)
|
||||
addPayBill(param).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.close()
|
||||
this.$emit('ok')
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel() {
|
||||
this.close()
|
||||
@@ -272,6 +294,8 @@ export default {
|
||||
this.loadData()
|
||||
},
|
||||
close() {
|
||||
this.form.resetFields()
|
||||
this.clearThisTimeAmount()
|
||||
this.$emit('update:visible', false)
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user