[update] 财务管理到账开票接口联调;金额正则修改;分期信息组件修改

This commit is contained in:
zhaoxiao
2021-09-10 16:05:02 +08:00
parent 5792523d10
commit b33562fb8c
8 changed files with 208 additions and 88 deletions
@@ -13,27 +13,27 @@
<a-form :form="form">
<a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入开票金额"
v-decorator="['invoicingAmount',validatorRules.invoicingAmount]"
v-decorator="['invoiceAmount',validatorRules.invoiceAmount]"
:maxLength='50'
@change="e => e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()"></a-input>
</a-form-item>
<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>
<a-form-item label="开票日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开票日期"
style="width: 100%;"
v-decorator="['invoicingDate',validatorRules.invoicingDate]"
v-decorator="['billDate',validatorRules.billDate]"
:trigger-change="true"
date-format="YYYY-MM-DD"/>
</a-form-item>
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea
placeholder="请输入备注"
v-decorator="['remarks']"
v-decorator="['remark']"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
@@ -47,10 +47,37 @@
import JDate from '../../../../components/tools/JDate'
import pick from 'lodash.pick'
import { money } from '../../../../utils/validate'
import { addPayBill, addPaymentPhase, editAmountPhase, editPayBill } from '../../../../api/incomePaymentsApi'
export default {
name: 'InvoicingModule',
components: { JDate },
props: {
// 项目id
projectId: {
type: String,
required: false,
default: null
},
// 项目类型
projectType: {
type: [Number, String],
required: false,
default: null
},
// 项目名称
projectName: {
type: String,
required: false,
default: null
},
// 企业名称
chargeCompanyName: {
type: String,
required: false,
default: null
}
},
data() {
return {
title: '来款信息',
@@ -68,15 +95,15 @@ export default {
sm: { span: 18 }
},
validatorRules: {
invoicingAmount: {
invoiceAmount: {
rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur'
},
invoicingNum: {
billNo: {
rules: [{ required: true, message: '请输入开票号' }],
validateTrigger: 'blur'
},
invoicingDate: {
billDate: {
rules: [{ required: true, message: '请选择开票日期' }],
validateTrigger: 'change'
}
@@ -88,14 +115,38 @@ export default {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'invoicingAmount', 'invoicingNum', 'invoicingDate', 'remarks'))
this.form.setFieldsValue(pick(this.model, 'invoiceAmount', 'billNo', 'billDate', 'remark'))
})
},
handleOk() {
console.log(this.projectType, this.chargeCompanyName)
this.form.validateFields((err, values) => {
if (!err) {
// values.chargeCompanyName = this.chargeCompanyName
values.projectName = this.projectName
const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData)
let okHttpMethod
if (this.model.id) {
okHttpMethod = editPayBill(formData)
} else {
okHttpMethod = addPayBill(this.projectId, this.projectType, formData)
}
okHttpMethod.then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warn(res.message)
}
})
}
})
},
handleCancel() {
this.close()