<template>
|
<div class="apply-info">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
ref="applyForm"
|
:formValues="formValues"
|
:formRules="formRules"
|
formType="info"
|
title="申请信息"
|
></CommForm>
|
<Dialog
|
v-model="isShowDialog"
|
icon="succ"
|
iconText="提交成功"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="commitSuccess"
|
></Dialog>
|
</div>
|
</template>
|
<script>
|
// 中航信托线下转账还款通知-申请信息查询
|
import { mapActions, mapState, mapMutations } from 'vuex'
|
import CommForm from '@/components/CommForm'
|
import Dialog from '@/components/Dialog'
|
|
// import queryCodeValueList from '@/controller/queryCodeValueList'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
|
// import queryZhPaymentNoticeInfo from '@/controller/queryZhPaymentNoticeInfo'
|
// import queryZhApplyHistoryDetail from '@/controller/queryZhApplyHistoryDetail'
|
import payMentZhTrustSubmit from '@/controller/payMentZhTrustSubmit'
|
|
export default {
|
components: {
|
CommForm,
|
Dialog
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
query: {},
|
formList: [],
|
codeUrl: '',
|
detailModel: null,
|
model: null,
|
selectModel: null,
|
codeModel: null,
|
bankModel: null,
|
moneyModel: null,
|
isShowDialog: false,
|
visible: false,
|
timmer: null
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
const { query } = this.$route
|
this.query = query
|
this.paymentMethodModel = queryCodeValueList()
|
this.model = payMentZhTrustSubmit()
|
this.getDetail()
|
},
|
getDetail() {
|
const { query } = this
|
const {
|
serialNo,
|
pageId,
|
isApplyPhase,
|
payNoticeSerialNo,
|
useDetail
|
} = query
|
this.queryZhPaymentInfo({
|
pageId,
|
isApplyPhase,
|
loanSerialNo: serialNo,
|
payNoticeSerialNo,
|
useDetail
|
})
|
},
|
|
setForm() {
|
const { model, conf, info } = this
|
const formList = model.getFormList({ applyAmount: info.crtAmt, ...info })
|
const { edit } = conf
|
if (edit === 'Y') {
|
this.formList = formList
|
this.setSelectOptions()
|
} else {
|
this.formList = formList
|
.filter(
|
({ name }) =>
|
!['paymentDate', 'termid', 'waivePayinterestAmta5'].includes(name)
|
)
|
.map(item => {
|
const { value, descName } = item
|
return {
|
...item,
|
// type: 'text',
|
value: descName ? info[descName] : value,
|
rules: []
|
}
|
})
|
}
|
},
|
|
updateForm() {
|
const { formList, termInitData } = this
|
Object.keys(termInitData).forEach(key => {
|
const index = formList.findIndex(({ name }) => name === key)
|
if (index > -1) {
|
this.$set(formList, index, {
|
...formList[index],
|
value: termInitData[key]
|
})
|
this.updateAmount()
|
}
|
})
|
},
|
|
updateAmount() {
|
const { formList, formValues, termInitData } = this
|
const amountIndex = formList.findIndex(
|
({ name }) => name === 'paymentAmount'
|
)
|
const mixValues = { ...formValues, ...termInitData }
|
let amount = [
|
'payPrincipalAmt',
|
'payInterestAmt',
|
'payInterestAmtA4',
|
'payInterestAmtA5'
|
].reduce((pre, curr) => {
|
return pre + (Number(mixValues[curr]) || 0)
|
}, 0)
|
|
amount =
|
amount -
|
(Number(mixValues['waivePayInterestAmtA4']) || 0) -
|
(Number(mixValues['waivePayinterestAmta5']) || 0)
|
|
this.$set(formList, amountIndex, {
|
...formList[amountIndex],
|
value: isNaN(amount) ? '' : amount.toFixed(2)
|
})
|
},
|
|
// 更新表单数据
|
updateValue(index, info, flg = true) {
|
const { formList, formValues, info: detail } = this
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
}
|
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
const detailDate = detail.inputDate ? detail.inputDate.split(' ')[0] : ''
|
if (
|
preInfo.name === 'waivePayinterestAmta5' &&
|
Number(info.value) > Number(formValues.payInterestAmtA5)
|
) {
|
this.$message.warning('减免违约金不能大于应还违约金')
|
return false
|
}
|
if (
|
preInfo.name === 'paymentDate' &&
|
detailDate &&
|
new Date(info.value).getTime() <=
|
new Date(detailDate).getTime()
|
) {
|
this.$message.warning('还款日期<=还款计划当前期的还款日期')
|
// this.$message.warning('未逾期贷款不支持部分还款,必须整期结清')
|
// return false
|
}
|
|
this.$set(formList, index, { ...preInfo, ...info })
|
|
if (preInfo.name === 'termid' && info.value) {
|
this.setTermid(info.value)
|
this.updateInfo(info.value)
|
}
|
this.updateAmount()
|
}
|
},
|
|
updateInfo(termid) {
|
const { query } = this
|
const { serialNo, customerId } = query
|
if (!termid) {
|
return false
|
}
|
this.paymentZhTermInitData({
|
customerId,
|
loanSerialNo: serialNo
|
})
|
},
|
|
setFetch(info) {
|
const { timmer } = this
|
clearTimeout(timmer)
|
this.timmer = setTimeout(() => {
|
this.getMoneyInfo(info)
|
}, 500)
|
},
|
|
// 表单按钮事件处理
|
async submit() {
|
const { model, query, info, conf } = this
|
const {
|
serialNo,
|
transCode,
|
objectNo,
|
objectType,
|
paymentSerialNo
|
} = query
|
const { edit } = conf
|
if (edit !== 'Y') {
|
return false
|
}
|
|
const values = this.$refs.applyForm.validate()
|
|
if (values) {
|
// const loading = this.$loading({
|
// fullscreen: true
|
// })
|
try {
|
await model.request({
|
...info,
|
imagObjectNo: objectNo,
|
imagObjectType: objectType,
|
loanSerialNo: serialNo,
|
paymentSerialNo,
|
transCode,
|
...values
|
})
|
// loading.close()
|
this.getDetail()
|
this.isShowDialog = true
|
} catch (e) {
|
// loading.close()
|
}
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
}
|
},
|
|
// 设置表单下拉菜单
|
setSelectOptions() {
|
const { formList } = this
|
formList.forEach(({ name, attrs = [] }) => {
|
if (
|
attrs.some(
|
item =>
|
(typeof item === 'object' && item.readonly) || item === 'readonly'
|
)
|
) {
|
return false
|
}
|
if (name === 'termid') {
|
this.queryCodeValueList(name, 'ZHTermType')
|
}
|
})
|
},
|
|
// 贷后交易名称下拉列表
|
async queryCodeValueList(name, codeNo) {
|
const { paymentMethodModel } = this
|
const { list } = await paymentMethodModel.request({
|
codeNo
|
})
|
this.updateValue(name, { options: list })
|
},
|
|
// 提交成功后返回原列表页
|
commitSuccess() {
|
this.isShowDialog = false
|
this.$router.go(-1)
|
},
|
...mapMutations(['setTermid']),
|
...mapActions(['queryZhPaymentInfo', 'paymentZhTermInitData'])
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
},
|
...mapState({
|
info: state => state.tabsModule.paymentInfo,
|
termInitData: state => state.tabsModule.termInitData
|
})
|
},
|
watch: {
|
$route() {
|
const { serialNo } = this.$route.query
|
if (serialNo) {
|
this.init()
|
}
|
},
|
info() {
|
this.setForm()
|
},
|
termInitData() {
|
this.updateForm()
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
.apply-top-button {
|
& >>> .el-button {
|
margin-left: 20px;
|
}
|
}
|
|
.qrcode-content {
|
text-align: center;
|
& .qrode-close {
|
margin: 0;
|
padding: 0;
|
margin-bottom: 10px;
|
& i {
|
cursor: pointer;
|
font-size: 18px;
|
}
|
/* text-align: right; */
|
}
|
}
|
</style>
|