[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
+17 -2
View File
@@ -29,7 +29,17 @@ const queryContactByName = (param) => getAction('/company/payContactsManagement/
// 通过id获取支出合同信息 // 通过id获取支出合同信息
const getExpenditureContractById = (param) => getAction('/contract/paySpendingContract/queryById', param) const getExpenditureContractById = (param) => getAction('/contract/paySpendingContract/queryById', param)
// 添加来款阶段 // 添加来款阶段
const addPaymentPhase = (param) => postAction('/paymentRecord/payPaymentRecord/addPhase', param) const addPaymentPhase = (param) => postAction('/paymentRecord/payPaymentRecord/addAmountReceived', param)
// 编辑来款阶段
const editAmountPhase = (param) => postAction('/paymentRecord/payPaymentRecord/editAmountReceived', param)
// 来款列表
const amountReceivedList = (param) => postAction(`/paymentRecord/payPaymentRecord/amountReceivedList?id=${param}`)
// 开票列表
const payBillList = (param) => postAction(`/paymentRecord/payPaymentRecord/payBillList?id=${param}`)
// 新增开票阶段
const addPayBill = (projectId, projectType, param) => postAction(`/paymentRecord/payPaymentRecord/addPayBill?projectIds=${projectId}&projectTypes=${projectType}`, param)
// 编辑开票阶段
const editPayBill = (param) => postAction('/paymentRecord/payPaymentRecord/editPayBill', param)
export { export {
getWorkingGroupById, getWorkingGroupById,
@@ -46,5 +56,10 @@ export {
queryUserByDepartId, queryUserByDepartId,
queryContactByName, queryContactByName,
getExpenditureContractById, getExpenditureContractById,
addPaymentPhase addPaymentPhase,
editAmountPhase,
amountReceivedList,
payBillList,
addPayBill,
editPayBill
} }
+7 -4
View File
@@ -82,17 +82,17 @@ export default {
}, },
validatorRules: { validatorRules: {
phaseName: { phaseName: {
rules: [{ required: true, message: '请输入名称'}], rules: [{ required: true, message: '请输入名称' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
accountsReceivableAmount: { accountsReceivableAmount: {
rules: [{ required: true, message: '请输入金额'}], rules: [{ required: true, message: '请输入金额' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
paidAmount: { paidAmount: {
rules: [{ required: false, message: '请输入金额'}], rules: [{ required: false, message: '请输入金额' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, }
}, },
index: 1, index: 1,
installmentList: [], installmentList: [],
@@ -132,7 +132,10 @@ export default {
this.installmentList.push(this.defaultFormData) this.installmentList.push(this.defaultFormData)
}, },
deleteInstallmentItem(index) { deleteInstallmentItem(index) {
let valArr = Object.values(this.form.getFieldValue(['installmentList']))[0]
this.installmentList.splice(index, 1) this.installmentList.splice(index, 1)
valArr.splice(index, 1)
this.form.setFieldsValue({ installmentList: valArr })
}, },
handleSave() { handleSave() {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
+3 -2
View File
@@ -71,10 +71,11 @@ export function number(s) {
} }
/** /**
* 金额格式,小数点后两位 * 金额格式,小数点后两位,整数部分十位
* /^[1-9](\d{1,10})?(\.\d{1,2})$|^0\.([1-9](\d{0,1})|\d[1-9])$|^[1-9]\d{1,10}$|^0$/ ---- 最初的正则,能输入十一位整数
* @param s * @param s
* @returns {boolean} * @returns {boolean}
*/ */
export function money(s) { export function money(s) {
return /^[1-9](\d{1,10})?(\.\d{1,2})$|^0\.([1-9](\d{0,1})|\d[1-9])$|^[1-9]\d{0,10}$|^0$/.test(s) return /^[1-9](\d{1,10})?(\.\d{1,2})$|^0\.([1-9](\d{0,1})|\d[1-9])$|^[1-9]\d{1,9}$|^0$/.test(s)
} }
@@ -87,7 +87,7 @@
<span slot="action" class="action-span-cell" slot-scope="text, record"> <span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="incomePayment(record.id)">来款</a> <a @click="incomePayment(record.id)">来款</a>
<a @click="invoicing(record.id)">开票</a> <a @click="invoicing(record)">开票</a>
</span> </span>
</a-table> </a-table>
</div> </div>
@@ -95,7 +95,13 @@
<!-- 来款阶段--> <!-- 来款阶段-->
<arrive-stage-module ref="arriveStage" @ok="modalFormOk" :project-id="selectProjectId"></arrive-stage-module> <arrive-stage-module ref="arriveStage" @ok="modalFormOk" :project-id="selectProjectId"></arrive-stage-module>
<!-- 开票阶段--> <!-- 开票阶段-->
<invoicing-stage-module ref="invoicingStage" @ok="modalFormOk"></invoicing-stage-module> <invoicing-stage-module
ref="invoicingStage"
@ok="modalFormOk"
:project-id="selectProjectId"
:project-type="selectProjectType"
:project-name="selectProjectName"
:charge-company-name="selectProjectChargeCompanyName"></invoicing-stage-module>
<project-detail-modal ref="projectDetail"></project-detail-modal> <project-detail-modal ref="projectDetail"></project-detail-modal>
</div> </div>
</template> </template>
@@ -113,7 +119,15 @@ import ProjectDetailModal from '../../../components/ProjectDetailModal'
export default { export default {
name: 'ArriveAndInvoivingList', name: 'ArriveAndInvoivingList',
components: { PageHeaderTitle, JYearDate, StatusSlot, ArriveStageModule, InvoicingStageModule, SelectPrincipal, ProjectDetailModal }, components: {
PageHeaderTitle,
JYearDate,
StatusSlot,
ArriveStageModule,
InvoicingStageModule,
SelectPrincipal,
ProjectDetailModal
},
mixins: [JeroListMixin], mixins: [JeroListMixin],
data() { data() {
return { return {
@@ -213,7 +227,10 @@ export default {
list: '/paymentRecord/payPaymentRecord/mainList', list: '/paymentRecord/payPaymentRecord/mainList',
exportXlsUrl: '' exportXlsUrl: ''
}, },
selectProjectId: null selectProjectId: null, // 选中项目id
selectProjectType: null, // 选中项目类型
selectProjectName: null, // 选中项目名称
selectProjectChargeCompanyName: null // 选中项目来款企业
} }
}, },
methods: { methods: {
@@ -229,8 +246,12 @@ export default {
* 开票 * 开票
* @param id * @param id
*/ */
invoicing(id) { invoicing(record) {
console.log(id) console.log(record)
this.selectProjectId = record.id
this.selectProjectType = record.projectType
this.selectProjectName = record.chargeProject
this.selectProjectChargeCompanyName = record.chargeCompanyTemporaryName
this.$refs.invoicingStage.open() this.$refs.invoicingStage.open()
} }
} }
@@ -41,7 +41,7 @@
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { money } from '../../../../utils/validate' import { money } from '../../../../utils/validate'
import JDate from '../../../../components/tools/JDate' import JDate from '../../../../components/tools/JDate'
import { addPaymentPhase } from '../../../../api/incomePaymentsApi' import { addPaymentPhase, editAmountPhase } from '../../../../api/incomePaymentsApi'
export default { export default {
name: 'ArriveModule', name: 'ArriveModule',
@@ -87,6 +87,7 @@ export default {
this.edit({}) this.edit({})
}, },
edit(record) { edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
@@ -99,7 +100,13 @@ export default {
values.projectId = this.projectId values.projectId = this.projectId
const formData = Object.assign(this.model, values) const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData) console.log('表单提交数据', formData)
addPaymentPhase(formData).then(res => { let okHttpMethod
if (this.model.id) {
okHttpMethod = editAmountPhase
} else {
okHttpMethod = addPaymentPhase
}
okHttpMethod(formData).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
this.$emit('ok') this.$emit('ok')
@@ -7,9 +7,8 @@
switchFullscreen switchFullscreen
@ok="handleAdd" @ok="handleAdd"
@cancel="handleCancel" @cancel="handleCancel"
okText="添加阶段" okText="添加阶段">
cancelText="关闭"> <a-spin :spinning="confirmLoading" v-if="stageList.length > 0">
<a-spin :spinning="confirmLoading">
<div v-for="(item, index) in stageList" :key="index" class="stage-box"> <div v-for="(item, index) in stageList" :key="index" class="stage-box">
<div class="title"> <div class="title">
<div class="title-text">第{{ item.chinaNumIndex }}阶段</div> <div class="title-text">第{{ item.chinaNumIndex }}阶段</div>
@@ -32,23 +31,39 @@
<a-row> <a-row>
<a-col> <a-col>
<div class="stage"> <div class="stage">
<div class="stage-title stage-remark-title">备注:</div> <div class="stage-title">备注:</div>
<div class="stage-content">{{ item.remark }}</div> <div class="stage-content">{{ item.remark }}</div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</a-spin> </a-spin>
<arrive-module ref="arriveModal" v-bind="$attrs" @ok="loadData"></arrive-module>
<a-empty v-else></a-empty>
<template slot="footer">
<a-button type="primary" @click="handleAdd">添加阶段</a-button>
</template>
<arrive-module ref="arriveModal" :project-id="projectId" @ok="addArriveOk"></arrive-module>
</j-modal> </j-modal>
</template> </template>
<script> <script>
import ArriveModule from './ArriveModule' import ArriveModule from './ArriveModule'
import { amountReceivedList } from '../../../../api/incomePaymentsApi'
export default { export default {
name: 'ArriveStageModule', name: 'ArriveStageModule',
components: { ArriveModule }, components: { ArriveModule },
props: {
// 项目id
projectId: {
type: String,
required: false,
default: null
}
},
data() { data() {
return { return {
title: '来款阶段', title: '来款阶段',
@@ -57,46 +72,45 @@ export default {
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
// 阶段列表,用于循环展示阶段信息 // 阶段列表,用于循环展示阶段信息
stageList: [ stageList: []
{
amountReceived: 1000,
paymentDate: '2020-09-09',
remark: '这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!'
}, {
amountReceived: 2000,
paymentDate: '2020-09-08',
remark: '这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!'
}
]
} }
}, },
created() {
this.loadData()
},
methods: { methods: {
handleAdd() { handleAdd() {
this.$refs.arriveModal.title='添加阶段' this.$refs.arriveModal.title = '添加阶段'
this.$refs.arriveModal.add() this.$refs.arriveModal.add()
}, },
handleEdit(record) { handleEdit(record) {
this.$refs.arriveModal.title='编辑阶段' this.$refs.arriveModal.title = '编辑阶段'
this.$refs.arriveModal.edit(record) this.$refs.arriveModal.edit(record)
}, },
handleCancel() { handleCancel() {
this.close() this.close()
}, },
open() { open() {
this.loadData()
this.visible = true this.visible = true
}, },
close() { close() {
this.visible = false this.visible = false
}, },
loadData() { loadData() {
// 匹配每一项的汉字序号 this.confirmLoading = true
this.stageList.forEach((item, index) => { amountReceivedList(this.projectId).then(res => {
item.chinaNumIndex = this.convertToChinaNum(index + 1) this.stageList = res.result
// 匹配每一项的汉字序号
if (this.stageList.length > 0) {
this.stageList.forEach((item, index) => {
item.chinaNumIndex = this.convertToChinaNum(index + 1)
})
}
}).finally(() => {
this.confirmLoading = false
}) })
}, },
addArriveOk() {
this.loadData()
},
//将数字(整数)转为汉字 //将数字(整数)转为汉字
convertToChinaNum(num) { convertToChinaNum(num) {
let arr1 = new Array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九') let arr1 = new Array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九')
@@ -172,7 +186,6 @@ export default {
padding-bottom: 10px; padding-bottom: 10px;
&-title { &-title {
width: 20%;
flex-shrink: 0; flex-shrink: 0;
text-align: right; text-align: right;
font-size: 14px; font-size: 14px;
@@ -180,10 +193,6 @@ export default {
color: #4D4D4D; color: #4D4D4D;
} }
&-remark-title {
width: 10%;
}
&-content { &-content {
padding-right: 20px; padding-right: 20px;
word-break: break-all; word-break: break-all;
@@ -13,27 +13,27 @@
<a-form :form="form"> <a-form :form="form">
<a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入开票金额" <a-input placeholder="请输入开票金额"
v-decorator="['invoicingAmount',validatorRules.invoicingAmount]" v-decorator="['invoiceAmount',validatorRules.invoiceAmount]"
:maxLength='50' :maxLength='50'
@change="e => e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()"></a-input> @change="e => e.target.value = (e.target.value.replace(/[^0-9.]/g, '')).trim()"></a-input>
</a-form-item> </a-form-item>
<a-form-item label="开票号" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入开票号" <a-input placeholder="请输入开票号"
v-decorator="['invoicingNum',validatorRules.invoicingNum]" v-decorator="['billNo',validatorRules.billNo]"
:maxLength='50' :maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input> @change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item> </a-form-item>
<a-form-item label="开票日期" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开票日期" <j-date placeholder="请选择开票日期"
style="width: 100%;" style="width: 100%;"
v-decorator="['invoicingDate',validatorRules.invoicingDate]" v-decorator="['billDate',validatorRules.billDate]"
:trigger-change="true" :trigger-change="true"
date-format="YYYY-MM-DD"/> date-format="YYYY-MM-DD"/>
</a-form-item> </a-form-item>
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea <a-textarea
placeholder="请输入备注" placeholder="请输入备注"
v-decorator="['remarks']" v-decorator="['remark']"
:auto-size="{ minRows: 3, maxRows: 6 }" :auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200' :maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/> @change="e => {e.target.value = (e.target.value + '').trim()}"/>
@@ -47,10 +47,37 @@
import JDate from '../../../../components/tools/JDate' import JDate from '../../../../components/tools/JDate'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { money } from '../../../../utils/validate' import { money } from '../../../../utils/validate'
import { addPayBill, addPaymentPhase, editAmountPhase, editPayBill } from '../../../../api/incomePaymentsApi'
export default { export default {
name: 'InvoicingModule', name: 'InvoicingModule',
components: { JDate }, 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() { data() {
return { return {
title: '来款信息', title: '来款信息',
@@ -68,15 +95,15 @@ export default {
sm: { span: 18 } sm: { span: 18 }
}, },
validatorRules: { validatorRules: {
invoicingAmount: { invoiceAmount: {
rules: [{ required: true, validator: this.checkMoney }], rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
invoicingNum: { billNo: {
rules: [{ required: true, message: '请输入开票号' }], rules: [{ required: true, message: '请输入开票号' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
invoicingDate: { billDate: {
rules: [{ required: true, message: '请选择开票日期' }], rules: [{ required: true, message: '请选择开票日期' }],
validateTrigger: 'change' validateTrigger: 'change'
} }
@@ -88,14 +115,38 @@ export default {
this.edit({}) this.edit({})
}, },
edit(record) { edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'invoicingAmount', 'invoicingNum', 'invoicingDate', 'remarks')) this.form.setFieldsValue(pick(this.model, 'invoiceAmount', 'billNo', 'billDate', 'remark'))
}) })
}, },
handleOk() { 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() { handleCancel() {
this.close() this.close()
@@ -7,7 +7,6 @@
switchFullscreen switchFullscreen
@ok="handleAdd" @ok="handleAdd"
@cancel="handleCancel" @cancel="handleCancel"
okText="添加阶段"
cancelText="关闭"> cancelText="关闭">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<div v-for="(item, index) in stageList" :key="index" class="stage-box"> <div v-for="(item, index) in stageList" :key="index" class="stage-box">
@@ -16,45 +15,71 @@
<img src="../../../../assets/imgs/icon/icon_edit.png" @click="handleEdit(item)"> <img src="../../../../assets/imgs/icon/icon_edit.png" @click="handleEdit(item)">
</div> </div>
<a-row> <a-row>
<a-col :span="8"> <a-col :span="6">
<div class="stage">
<div class="stage-title">项目名称:</div>
<div class="stage-content">{{ item.projectName }}</div>
</div>
</a-col>
<a-col :span="6">
<div class="stage"> <div class="stage">
<div class="stage-title">开票金额:</div> <div class="stage-title">开票金额:</div>
<div class="stage-content stage-content-money">{{ item.invoicingAmount }}</div> <div class="stage-content stage-content-money">{{ item.invoiceAmount }}</div>
</div> </div>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="6">
<div class="stage"> <div class="stage">
<div class="stage-title">开票号:</div> <div class="stage-title">开票号:</div>
<div class="stage-content">{{ item.invoicingNum }}</div> <div class="stage-content">{{ item.billNo }}</div>
</div> </div>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="6">
<div class="stage"> <div class="stage">
<div class="stage-title">开票日期:</div> <div class="stage-title">开票日期:</div>
<div class="stage-content">{{ item.invoicingDate }}</div> <div class="stage-content">{{ item.billDate }}</div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col> <a-col>
<div class="stage"> <div class="stage">
<div class="stage-title stage-remark-title">备注:</div> <div class="stage-title">备注:</div>
<div class="stage-content">{{ item.remarks }}</div> <div class="stage-content">{{ item.remark }}</div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
</a-spin> </a-spin>
<invoicing-module ref="invoicingModal"></invoicing-module>
<!-- <a-empty v-else></a-empty>-->
<template slot="footer">
<a-button type="primary" @click="handleAdd">添加阶段</a-button>
</template>
<invoicing-module
ref="invoicingModal"
:project-id="projectId"
v-bind="$attrs"
@ok="loadData"></invoicing-module>
</j-modal> </j-modal>
</template> </template>
<script> <script>
import InvoicingModule from './InvoicingModule' import InvoicingModule from './InvoicingModule'
import { payBillList } from '../../../../api/incomePaymentsApi'
export default { export default {
name: 'InvoicingStageModule', name: 'InvoicingStageModule',
components: { InvoicingModule }, components: { InvoicingModule },
props: {
// 项目id
projectId: {
type: String,
required: false,
default: null
}
},
data() { data() {
return { return {
title: '开票阶段', title: '开票阶段',
@@ -63,24 +88,9 @@ export default {
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
// 阶段列表,用于循环展示阶段信息 // 阶段列表,用于循环展示阶段信息
stageList: [ stageList: []
{
invoicingAmount: 1000,
invoicingNum: '1234465',
invoicingDate: '2020-09-09',
remarks: '这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!'
}, {
invoicingAmount: 2000,
invoicingNum: '1234465',
invoicingDate: '2020-09-08',
remarks: '这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!这是备注!'
}
]
} }
}, },
created() {
this.loadData()
},
methods: { methods: {
handleAdd() { handleAdd() {
this.$refs.invoicingModal.title = '添加阶段' this.$refs.invoicingModal.title = '添加阶段'
@@ -94,15 +104,23 @@ export default {
this.close() this.close()
}, },
open() { open() {
this.loadData()
this.visible = true this.visible = true
}, },
close() { close() {
this.visible = false this.visible = false
}, },
loadData() { loadData() {
// 匹配每一项的汉字序号 this.confirmLoading = true
this.stageList.forEach((item, index) => { payBillList(this.projectId).then(res => {
item.chinaNumIndex = this.convertToChinaNum(index + 1) this.stageList = res.result
// 匹配每一项的汉字序号
this.stageList.forEach((item, index) => {
item.chinaNumIndex = this.convertToChinaNum(index + 1)
})
}).finally(() => {
this.$forceUpdate()
this.confirmLoading = false
}) })
}, },
//将数字(整数)转为汉字 //将数字(整数)转为汉字
@@ -180,7 +198,6 @@ export default {
padding-bottom: 10px; padding-bottom: 10px;
&-title { &-title {
width: 30%;
flex-shrink: 0; flex-shrink: 0;
text-align: right; text-align: right;
font-size: 14px; font-size: 14px;
@@ -188,10 +205,6 @@ export default {
color: #4D4D4D; color: #4D4D4D;
} }
&-remark-title {
width: 10%;
}
&-content { &-content {
padding-right: 20px; padding-right: 20px;
word-break: break-all; word-break: break-all;