[update] -确认收入 的功能,增加分阶段;打包、到账开票功能增加未税金额、税额字段

This commit is contained in:
fengchenchen
2022-08-01 14:18:09 +08:00
parent 67c5434731
commit f483e9d450
6 changed files with 500 additions and 27 deletions
@@ -147,10 +147,7 @@
<a @click="invoicing(record)" :disabled="record.needInvoice === 0"
v-has="'incomePaymentAndInvoiving:invoicing'">开票</a>
<!-- 确认收入项目--- 普通项目工作组项目资料网员 项目 可以确认收入-->
<a
v-has="'incomePaymentAndInvoiving:confirmPayment'"
@click="preComeMoney(record)"
>确认收入</a>
<a v-has="'incomePaymentAndInvoiving:confirmPayment'" @click="confirmPayment(record)">确认收入</a>
</span>
</a-table>
</div>
@@ -191,7 +188,13 @@
<audit-modal ref="auditModal" :meeting-type="meetingType" :situation-id="situationId"
@ok="modalFormOk"></audit-modal>
<!-- 确认收入 弹窗-->
<pre-come-module ref="preComeModule" @ok="modalFormOk"></pre-come-module>
<confirm-stage-module
ref="confirmStageModule"
@ok="modalFormOk"
:project-id="selectProjectId"
:project-type="selectProjectType"
:visible.sync="confirmStageVisible"
></confirm-stage-module>
</div>
</template>
@@ -210,7 +213,7 @@ import {isAllEqual} from '../../../utils/util'
import AuditProofModule from './modules/AuditProofModule'
// import AuditProofModule from "@views/financialManagement/arriveAndInvoicing/modules/AuditProofModule";
import AuditModal from '@views/incomePayments/meetManage/modules/AuditModal'
import PreComeModule from './modules/PreComeModule'
import ConfirmStageModule from './modules/ConfirmStageModule'
// 项目类型 数据字典 的定义 和数据库的保持一致
const ProjectTypeEnums = {
@@ -236,7 +239,7 @@ export default {
BatchInvoicingModule,
AuditProofModule,
AuditModal,
PreComeModule
ConfirmStageModule
},
mixins: [JeroListMixin],
data() {
@@ -360,6 +363,7 @@ export default {
arriveVisible: false,
selectedProject: [],
batchInvoicingVisible: false,
confirmStageVisible: false, // 确认收入弹框是否隐藏
selectedCompany: {}, // 选中项目的企业信息
mailContactsId: null,// 项目邮寄联系人id
meetingType: undefined, // 会议项目的会议类型
@@ -498,11 +502,14 @@ export default {
* 确认收入 - 普通项目、工作组项目、资料网员 项目 可以确认收入(即记录跨年度提前来款)
* @param record
*/
preComeMoney(record) {
confirmPayment(record) {
// 判断是否是 普通项目、工作组项目、资料网员 项目 不是 直接返回
// let canOpe = record.projectType === ProjectTypeEnums.GENERAL_PRO.value || record.projectType === ProjectTypeEnums.GROUP_PRO.value || record.projectType === ProjectTypeEnums.MEMBER_PRO.value
// if(!canOpe) return
this.$refs.preComeModule.show(record)
this.selectProjectType = record.projectType
this.selectProjectId = record.id
this.confirmStageVisible = true
this.$refs.confirmStageModule.show(record)
},
/**
@@ -15,6 +15,20 @@
<a-input placeholder="请输入到账金额"
v-decorator="['amountReceived',validatorRules.amountReceived]"
:maxLength='50'
@blur="addZeroAmount"
@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="['tax',validatorRules.tax]"
:maxLength='50'
@blur="addZero"
@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="['noTaxAmount',validatorRules.noTaxAmount]"
:maxLength='50'
@blur="addZero"
@change="e => e.target.value = (e.target.value.replace(/[^0-9-.]/g, '')).trim()"></a-input>
</a-form-item>
@@ -83,6 +97,14 @@ export default {
rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur'
},
noTaxAmount: {
rules: [{required: true, validator: this.checkNoTaxMoney}],
validateTrigger: 'blur'
},
tax: {
rules: [{required: true, validator: this.checkTaxMoney}],
validateTrigger: 'blur'
},
paymentDate: {
rules: [{ required: true, message: '请选择来款日期' }],
validateTrigger: 'change'
@@ -100,7 +122,7 @@ export default {
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'amountReceived', 'paymentDate', 'remark'))
this.form.setFieldsValue(pick(this.model, 'amountReceived', 'tax', 'noTaxAmount', 'paymentDate', 'remark'))
})
},
handleOk() {
@@ -150,16 +172,44 @@ export default {
* @param rules
* @param value
* @param callback
* @param name --校验字段的名字
*
*/
checkMoney(rules, value, callback) {
checkMoneyTemplate(rules, value, callback, name) {
if (value) {
if (money(value)) {
callback()
}
callback('请输入合法的金额数字,最多2位小数,10位整数')
}
callback('请输入到账金额')
}
callback(`请输入${name}`)
},
// 校验金额格式
checkMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '到账金额')
},
checkNoTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '未税金额')
},
checkTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '税额')
},
// 总金额做相关的处理
addZeroAmount(event) {
this.addZero(event)
let finalValue = event.target.value
// 计算未税金额和税额的值
let obj = this.calcOtherNumber(finalValue)
// console.log(event.target.value )
this.$nextTick(() => {
this.form.setFieldsValue(obj)
})
},
calcOtherNumber(amount) {
let noTaxAmount = (amount / 1.06).toFixed(2) // 未税金额
let tax = (amount - noTaxAmount).toFixed(2) // 税额
return {noTaxAmount, tax}
},
}
}
</script>
@@ -16,6 +16,20 @@
<a-input placeholder="请输入确认金额"
v-decorator="['amountReceived',validatorRules.amountReceived]"
:maxLength='50'
@blur="addZeroAmount"
@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="['tax',validatorRules.tax]"
:maxLength='50'
@blur="addZero"
@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="['noTaxAmount',validatorRules.noTaxAmount]"
:maxLength='50'
@blur="addZero"
@change="e => e.target.value = (e.target.value.replace(/[^0-9-.]/g, '')).trim()"></a-input>
</a-form-item>
@@ -48,8 +62,22 @@ import {addZero} from '../../../../utils/util'
import { getPayConfirmList, addPayConfirm, editPayConfirm } from '../../../../api/incomePaymentsApi'
export default {
name: 'PreComeModule',
name: 'ConfirmModule',
components: {JDate},
props:{
// id
projectId: {
type: String,
required: false,
default: null
},
//
projectType: {
type: [Number, String],
required: false,
default: null
},
},
data() {
return {
title: '确认信息',
@@ -72,6 +100,14 @@ export default {
rules: [{required: true, validator: this.checkMoney}],
validateTrigger: 'blur'
},
noTaxAmount: {
rules: [{required: true, validator: this.checkNoTaxMoney}],
validateTrigger: 'blur'
},
tax: {
rules: [{required: true, validator: this.checkTaxMoney}],
validateTrigger: 'blur'
},
paymentDate: {
rules: [{required: true, message: '请选择确认日期'}],
validateTrigger: 'change'
@@ -81,6 +117,29 @@ export default {
},
methods: {
addZero,
add(projectInfo, isFirst) {
let currentDate = new Date()
let paymentDate = currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + currentDate.getDate()
let record = { paymentDate }
//
if(isFirst && projectInfo.invoiceAmount) {
//
record.amountReceived = projectInfo.invoiceAmount
let obj = this.calcOtherNumber(record.amountReceived)
record = {...record, ...obj}
}
this.edit(record, projectInfo)
},
// edit(record) {
// this.form.resetFields()
// this.model = Object.assign({}, record)
// this.getMailContactPostalCode()
// this.visible = true
// this.$nextTick(() => {
// this.form.setFieldsValue(pick(this.model, 'invoiceAmount', 'billNo', 'billDate', 'remark'))
// })
// },
show(record) {
this.form.resetFields()
this.projectInfo = Object.assign({}, record)
@@ -88,10 +147,13 @@ export default {
this.getInfoById(record.id)
this.visible = true
},
edit(record) {
edit(record, projectInfo) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.projectInfo = Object.assign({}, projectInfo)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'amountReceived', 'paymentDate', 'remark'))
this.form.setFieldsValue(pick(this.model, 'amountReceived', 'tax', 'noTaxAmount','paymentDate', 'remark'))
})
},
getInfoById(id) {
@@ -123,7 +185,7 @@ export default {
values.projectType = this.projectInfo.projectType
const obj = Object.assign(this.model, values)
let okHttpMethod
if (this.isEdit) {
if (this.model.id) {
okHttpMethod = editPayConfirm(obj)
} else {
okHttpMethod = addPayConfirm(obj)
@@ -157,16 +219,46 @@ export default {
* @param rules
* @param value
* @param callback
* @param name --校验字段的名字
*
*/
checkMoney(rules, value, callback) {
checkMoneyTemplate(rules, value, callback, name) {
if (value) {
if (money(value)) {
callback()
}
callback('请输入合法的金额数字,最多2位小数,10位整数')
}
callback('请输入确认金额')
}
callback(`请输入${name}`)
},
/**
* 校验金额格式
*/
checkMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '确认金额')
},
checkNoTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '未税金额')
},
checkTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '税额')
},
//
addZeroAmount(event) {
this.addZero(event)
let finalValue = event.target.value
//
let obj = this.calcOtherNumber(finalValue)
// console.log(event.target.value )
this.$nextTick(() => {
this.form.setFieldsValue(obj)
})
},
calcOtherNumber(amount) {
let noTaxAmount = (amount / 1.06).toFixed(2) //
let tax = (amount - noTaxAmount).toFixed(2) //
return {noTaxAmount, tax}
},
}
}
</script>
@@ -0,0 +1,250 @@
<!--确认来款的阶段 模态框-->
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleAdd"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<template v-if="stageList.length > 0">
<div v-for="(item, index) in stageList" :key="index" class="stage-box">
<div class="title">
<div class="title-text">{{ item.chinaNumIndex }}阶段</div>
<img src="../../../../assets/imgs/icon/icon_edit.png" @click="handleEdit(item)">
</div>
<a-row>
<a-col :span="6">
<div class="stage">
<div class="stage-title">确认金额</div>
<div class="stage-content">{{ item.amountReceived }}</div>
</div>
</a-col>
<a-col :span="6">
<div class="stage">
<div class="stage-title">税额</div>
<div class="stage-content stage-content-money">{{ item.tax }}</div>
</div>
</a-col>
<a-col :span="6">
<div class="stage">
<div class="stage-title">未税金额</div>
<div class="stage-content">{{ item.noTaxAmount }}</div>
</div>
</a-col>
<a-col :span="6">
<div class="stage">
<div class="stage-title">确认日期</div>
<div class="stage-content">{{ item.paymentDate }}</div>
</div>
</a-col>
</a-row>
<a-row>
<a-col>
<div class="stage">
<div class="stage-title">备注</div>
<div class="stage-content">{{ item.remark }}</div>
</div>
</a-col>
</a-row>
</div>
</template>
<a-empty v-else></a-empty>
</a-spin>
<template slot="footer">
<a-button type="primary" @click="handleAdd" v-preventclick>添加阶段</a-button>
</template>
<confirm-module
ref="confirmModal"
:project-id="projectId"
v-bind="$attrs"
@ok="loadData"></confirm-module>
</j-modal>
</template>
<script>
import ConfirmModule from './ConfirmModule'
import {getPayConfirmList, payBillList} from '../../../../api/incomePaymentsApi'
export default {
name: 'InvoicingStageModule',
components: { ConfirmModule },
provide: {},
props: {
// 项目id
projectId: {
type: String,
required: false,
default: null
},
// 弹窗显隐
visible: {
type: Boolean,
required: false,
default: false
}
},
data() {
return {
title: '确认收入阶段',
width: 900,
// visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
// 阶段列表,用于循环展示阶段信息
stageList: []
}
},
watch: {
// 弹窗显示时获取数据
visible: {
handler(value) {
if (value) {
this.open()
}
}
}
},
methods: {
// 显示数据的相关方法
show(record) {
console.log(record)
// 存储项目的信息
this.projectInfo = record
},
handleAdd() {
this.$refs.confirmModal.title = '添加阶段'
this.$refs.confirmModal.add(this.projectInfo, this.stageList.length === 0)
},
handleEdit(record) {
this.$refs.confirmModal.title = '编辑阶段'
this.$refs.confirmModal.edit(record, this.projectInfo)
},
handleCancel() {
this.close()
},
open() {
// this.visible = true
console.log(this.projectId, "________projectId________")
this.loadData()
},
close() {
// this.visible = false
this.$emit('update:visible', false)
this.$emit('ok')
},
loadData() {
this.confirmLoading = true
getPayConfirmList({projectId: this.projectId}).then(res => {
this.stageList = res.result || []
// 匹配每一项的汉字序号
this.stageList.forEach((item, index) => {
item.chinaNumIndex = this.convertToChinaNum(index + 1)
})
}).finally(() => {
this.$forceUpdate()
this.confirmLoading = false
})
},
//将数字(整数)转为汉字
convertToChinaNum(num) {
let arr1 = new Array('零', '一', '二', '三', '四', '五', '六', '七', '八', '九')
let arr2 = new Array('', '十', '百', '千', '万', '十', '百', '千', '亿', '十', '百', '千', '万', '十', '百', '千', '亿')//可继续追加更高位转换值
if (!num || isNaN(num)) {
return '零'
}
let english = num.toString().split('')
let result = ''
for (let i = 0; i < english.length; i++) {
let des_i = english.length - 1 - i//倒序排列设值
result = arr2[i] + result
let arr1_index = english[des_i]
result = arr1[arr1_index] + result
}
//将【零千、零百】换成【零】 【十零】换成【十】
result = result.replace(/零(千|百|十)/g, '零').replace(/十零/g, '十')
//合并中间多个零为一个零
result = result.replace(/零+/g, '零')
//将【零亿】换成【亿】【零万】换成【万】
result = result.replace(/零亿/g, '亿').replace(/零万/g, '万')
//将【亿万】换成【亿】
result = result.replace(/亿万/g, '亿')
//移除末尾的零
result = result.replace(/零+$/, '')
//将【零一十】换成【零十】
//result = result.replace(/零一十/g, '零十');//貌似正规读法是零一十
//将【一十】换成【十】
result = result.replace(/^一十/g, '十')
return result
}
}
}
</script>
<style scoped lang="less">
.stage-box {
padding-bottom: 10px;
}
.title {
display: flex;
align-items: center;
padding-bottom: 10px;
&-text {
position: relative;
font-size: 16px;
font-family: NotoSansHans, NotoSansHans-DemiLight;
font-weight: 700;
color: #333333;
margin-right: 10px;
}
&-text::before {
position: absolute;
top: 4px;
left: -10px;
content: "";
height: 20px;
width: 2px;
background: #069f99;
}
img {
height: 13px;
cursor: pointer;
}
}
.stage {
display: flex;
padding-bottom: 10px;
&-title {
flex-shrink: 0;
text-align: right;
font-size: 14px;
font-family: NotoSansHans, NotoSansHans-Light;
color: #4D4D4D;
}
&-content {
padding-right: 20px;
word-break: break-all;
white-space: pre-wrap;
font-size: 14px;
font-family: NotoSansHans, NotoSansHans-Light;
color: #4D4D4D;
&-money {
color: #D40505;
white-space: pre-wrap;
}
}
}
</style>
@@ -15,6 +15,20 @@
<a-input placeholder="请输入开票金额"
v-decorator="['invoiceAmount',validatorRules.invoiceAmount]"
:maxLength='50'
@blur="addZeroAmount"
@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="['tax',validatorRules.tax]"
:maxLength='50'
@blur="addZero"
@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="['noTaxAmount',validatorRules.noTaxAmount]"
:maxLength='50'
@blur="addZero"
@change="e => e.target.value = (e.target.value.replace(/[^0-9.-]/g, '')).trim()"></a-input>
</a-form-item>
@@ -108,6 +122,14 @@ export default {
rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur'
},
noTaxAmount: {
rules: [{required: true, validator: this.checkNoTaxMoney}],
validateTrigger: 'blur'
},
tax: {
rules: [{required: true, validator: this.checkTaxMoney}],
validateTrigger: 'blur'
},
billNo: {
rules: [{ required: true, message: '请输入开票号' }],
validateTrigger: 'blur'
@@ -132,7 +154,7 @@ export default {
this.getMailContactPostalCode()
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'invoiceAmount', 'billNo', 'billDate', 'remark'))
this.form.setFieldsValue(pick(this.model, 'invoiceAmount', 'tax', 'noTaxAmount', 'billNo', 'billDate', 'remark'))
})
},
getMailContactPostalCode() {
@@ -203,16 +225,45 @@ export default {
* @param rules
* @param value
* @param callback
* @param name --校验字段的名字
*
*/
checkMoney(rules, value, callback) {
checkMoneyTemplate(rules, value, callback, name) {
if (value) {
if (money(value)) {
callback()
}
callback('请输入合法的金额数字,最多2位小数,10位整数')
}
callback('请输入到账金额')
}
callback(`请输入${name}`)
},
// 校验金额格式
checkMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '开票金额')
},
checkNoTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '未税金额')
},
checkTaxMoney(rules, value, callback) {
this.checkMoneyTemplate(rules, value, callback, '税额')
},
// 总金额做相关的处理
addZeroAmount(event) {
this.addZero(event)
let finalValue = event.target.value
// 计算未税金额和税额的值
let obj = this.calcOtherNumber(finalValue)
// console.log(event.target.value )
this.$nextTick(() => {
this.form.setFieldsValue(obj)
})
},
calcOtherNumber(amount) {
let noTaxAmount = (amount / 1.06).toFixed(2) // 未税金额
let tax = (amount - noTaxAmount).toFixed(2) // 税额
return {noTaxAmount, tax}
},
}
}
</script>
@@ -132,6 +132,7 @@
<a @click="cancelPack(record.id)" v-has="'packProject:cancelPack'">取消打包</a>
<a @click="invoicing(record)" :disabled="record.needInvoice === 0 || Number(record.receivableAmount) === 0"
v-has="'packProject:invoicing'">开票</a>
<a v-has="'packProject:confirmPayment'" @click="confirmPayment(record)">确认收入</a>
</span>
</a-table>
</div>
@@ -176,6 +177,14 @@
:project-type="selectProjectType"
:project-name="selectProjectName"
@ok="modalFormOk"></invoicing-stage-module>
<!-- 确认收入阶段 -->
<confirm-stage-module
ref="confirmStageModule"
:visible.sync="confirmStageVisible"
:project-id="selectProjectId"
:project-type="selectProjectType"
:project-name="selectProjectName"
@ok="modalFormOk"></confirm-stage-module>
<!-- 项目详情-->
<project-detail-modal ref="projectDetail"></project-detail-modal>
@@ -195,6 +204,7 @@ import ArriveStageModule from '../financialManagement/arriveAndInvoicing/modules
import InvoicingStageModule from '../financialManagement/arriveAndInvoicing/modules/InvoicingStageModule'
import { getPackCompanyById, batchRemovePackProject, removePackProject } from '../../api/incomePaymentsApi'
import ProjectDetailModal from '../../components/ProjectDetailModal'
import ConfirmStageModule from '../financialManagement/arriveAndInvoicing/modules/ConfirmStageModule'
export default {
name: 'PackProjectMaintenance',
@@ -207,7 +217,8 @@ export default {
BatchInvoicingModule,
ArriveStageModule,
InvoicingStageModule,
ProjectDetailModal
ProjectDetailModal,
ConfirmStageModule
},
mixins: [JeroListMixin],
data() {
@@ -339,7 +350,7 @@ export default {
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 180,
width: 280,
scopedSlots: { customRender: 'action' }
}
],
@@ -350,6 +361,7 @@ export default {
incomeVisible: false, // 批量来款对话框开启状态
arriveStageVisible: false, // 来款阶段对话框开启状态
invoicingStageVisible: false, // 开票阶段对话框开启状态
confirmStageVisible: false, // 确认收入阶段对话框开启状态
selectProjectId: null, // 选中项目id
selectProjectType: null, // 选中项目类型
selectProjectName: null, // 选中项目名称
@@ -559,7 +571,18 @@ export default {
}
resolve(arr)
})
}
},
/**
* 确认收入 -(记录跨年度提前来款)
* @param record
*/
confirmPayment(record) {
this.selectProjectType = record.projectType
this.selectProjectId = record.id
this.confirmStageVisible = true
this.$refs.confirmStageModule.show(record)
},
}
}
</script>