Files
income_payments_client/src/views/financialManagement/arriveAndInvoicing/modules/AuditProofModule.vue
T
2021-12-23 10:53:22 +08:00

314 lines
9.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
okText="保存"
cancelText="关闭">
<div class="project-name">
<div>{{ model.chargeProject }}</div>
<div>{{ model.chargeCompanyTemporaryName }}</div>
</div>
<a-form :form="form">
<h3 class="title">凭证信息</h3>
<div>
<div class="info-item">
<label>缴费金额</label>
<div>{{ proofInfo.amountReceived }}</div>
</div>
<div class="info-item">
<label>缴费日期</label>
<div>{{ proofInfo.paymentDate }}</div>
</div>
<div class="info-item">
<label>申请人</label>
<div>{{ proofInfo.applicantName }}</div>
</div>
<!-- 标协会员证书的缴费凭证类型根据paymentMethod字段决定1--图片2--pdf3--没有凭证 -->
<!-- proofType处理过的缴费凭证类型img--图片pdf--pdfnone--无缴费凭证 -->
<div class="info-item">
<label>缴费凭证</label>
<div class="proof-img" v-if="proofType === 'img'">
<template v-if="!!proofInfo.proof">
<div class="proof-img-item" v-for="(item, index) in proofInfo.proof.split(',')" :key="index">
<img :src="proofSrc(item)">
</div>
</template>
</div>
<div v-if="proofType==='pdf'">
<preview-file :fileId="proofInfo.proof"></preview-file>
</div>
<span v-if="proofType==='none'"></span>
</div>
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea
placeholder="请输入备注"
v-decorator="['remark']"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</div>
<h3 class="title">审核</h3>
<div>
<a-form-item label="审核人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入审核人"
v-decorator="['reviewerName',validatorRules.reviewerName]"
:maxLength='50'
:disabled="true"
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
<a-form-item label="审核" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['paymentStatus', validatorRules.paymentStatus]" @change="paymentStatusChange">
<a-radio value="completed">同意</a-radio>
<a-radio value="rejected">拒绝</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="说明" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="showInstructions">
<a-textarea
placeholder="请输入说明"
v-decorator="['reviewInstructions', validatorRules.reviewInstructions]"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</div>
</a-form>
</j-modal>
</template>
<script>
import pick from 'lodash.pick'
import { postAction } from '../../../../api/manage'
import Vue from 'vue'
import { USER_INFO } from '../../../../store/mutation-types'
import { getLastProofInfo, getStanderMemberLastProofInfo, getCertificateLastProofInfo } from '../../../../api/incomePaymentsApi'
import PreviewFile from '../../../../components/jero/PreviewFile.vue'
export default {
name: 'AuditProofModule',
components: { PreviewFile },
data() {
return {
title: '来款信息',
width: 600,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 21 }
},
validatorRules: {
reviewerName: {
rules: [{ required: true, message: '请输入审核人' }],
validateTrigger: 'blur'
},
paymentStatus: {
rules: [{ required: true, message: '请选择审核状态' }],
validateTrigger: 'blur'
},
reviewInstructions: {
rules: [{ required: true, message: '请输入说明' }],
validateTrigger: 'blur'
}
},
// 项目缴费凭证信息
proofInfo: {},
// 是否显示说明
showInstructions: false,
auditUrl: '/paymentCheck/payPaymentCheck/check',
// 缴费凭证的类型,默认为img,标协会员、证书根据paymentMethod字段决定:1--图片;2--pdf3--没有凭证
proofType: 'img'
}
},
methods: {
open(record) {
this.getProofInfo(record)
this.form.resetFields()
let userInfo = Vue.ls.get(USER_INFO)
// 默认隐藏说明
this.showInstructions = false
this.model = Object.assign({}, record)
this.model.reviewerName = userInfo.realname
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'reviewerName'))
})
},
/**
* 获取缴费凭证类型
* @param record
*/
getProofType(record) {
if (record.projectType && (record.projectType.toString() === '5' || record.projectType.toString() === '6')) {
if (this.proofInfo.paymentMethod === '1') {
this.proofType = 'img'
return
}
if (this.proofInfo.paymentMethod === '2') {
this.proofType = 'pdf'
return
}
if (this.proofInfo.paymentMethod === '3') {
this.proofType = 'none'
return
}
} else {
this.proofType = 'img'
}
},
/**
* 获取项目缴费凭证相关信息
* @param record
*/
getProofInfo(record) {
if (record && record.id) {
let param = {
projectId: record.id
}
let httpMethod
// 标协会员、证书和普通项目、工作组项目、资料网员使用的接口不一致
if (record.projectType.toString() === '5') {
httpMethod = getStanderMemberLastProofInfo
} else if (record.projectType.toString() === '6') {
httpMethod = getCertificateLastProofInfo
} else {
httpMethod = getLastProofInfo
}
httpMethod(param).then(res => {
if (res.success) {
this.proofInfo = res.result
// 标协会员、证书的缴费凭证文件、缴费金额、缴费日期、申请人字段和普通项目、工作组项目、资料网员的不一致
if (record.projectType.toString() === '5' || record.projectType.toString() === '6') {
this.proofInfo.proof = res.result.paymentRecord
this.proofInfo.amountReceived = res.result.amountReceivable
this.proofInfo.paymentDate = res.result.submissionTime
this.proofInfo.applicantName = res.result.liaisonMan
}
this.getProofType(record)
}
})
}
},
handleOk() {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
this.form.validateFields((err, values) => {
if (!err) {
values.projectId = this.model.id
values.projectType = this.model.projectType
// 当选了同意则把说明清空,防止出现错误信息
if (values.paymentStatus === 'completed') {
values.reviewInstructions = null
}
const formData = Object.assign(this.proofInfo, values)
postAction(this.auditUrl, formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.close()
},
close() {
this.visible = false
},
/**
* 审核通过拒绝变化
* @param value
*/
paymentStatusChange(e) {
if (e.target.value === 'rejected') {
this.showInstructions = true
} else {
this.showInstructions = false
}
},
/**
* 缴费凭证 src
*/
proofSrc(imgId) {
return `${ window._CONFIG['domianURL'] }/sys/common/download/${ imgId }`
}
}
}
</script>
<style scoped lang="less">
.ant-form-item {
margin-bottom: 10px;
}
.project-name {
font-size: 16px;
line-height: 30px;
font-weight: 700;
padding-bottom: 10px;
}
h3 {
position: relative;
}
h3.title::before {
position: absolute;
top: 4px;
left: -10px;
content: "";
height: 20px;
width: 2px;
background: #069f99;
}
.info-item {
display: flex;
padding: 5px 0;
label {
color: #666666;
flex-shrink: 0;
}
div {
color: black;
}
.proof-img {
&-item {
width: calc(100% - 6rem);
img {
max-width: 100%;
max-height: 200px;
}
}
}
}
</style>