<template>
|
<div class="apply-info">
|
<CommForm
|
:inline="true"
|
:list="formList"
|
ref="claimApply"
|
@updateValue="updateValue"
|
: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 { mapState } from 'vuex'
|
import CommForm from '@/components/CommForm'
|
import Dialog from '@/components/Dialog'
|
import queryDiscoutFeeApplyInfo from '@/controller/queryDiscoutFeeApplyInfo' // 息费减免
|
import queryReductionApplyInfo from '@/controller/queryReductionApplyInfo' // 息费退款
|
import createDiscountFee from '@/controller/createDiscountFee' // 息费减免申请信息提交
|
import feeReductionApply from '@/controller/feeReductionApply' // 息费退款申请信息提交
|
import queryCodeValueList from '@/controller/queryCodeValueList' // 退款方式
|
|
const specialKeys = [
|
'waiveprepaypenaltyamt',
|
'waiveinterestamt',
|
'waiverenewalfee',
|
'waiveprincipalpenaltyamt',
|
'waivepoundage',
|
'waiveguarantee',
|
'waiveservicefee',
|
'waiverepaymentplanchangefee'
|
]
|
|
export default {
|
components: {
|
CommForm,
|
Dialog
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
info: {},
|
query: {},
|
formList: [],
|
model: null,
|
submitModel: null,
|
isShowDialog: false
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
// const { model, initValue, transCode } = this
|
// const model = queryReductionApplyInfo()
|
const { query } = this.$route
|
this.query = query
|
// this.formList = model.getFormList();
|
this.getDetail()
|
},
|
|
setSelectOptions() {
|
const { formList } = this
|
formList.forEach(({ name }) => {
|
if (name === 'refundway') {
|
this.queryCodeValueList(name, { codeno: 'WaiveTransCode' })
|
}
|
})
|
},
|
|
// 退款方式下拉值
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request(info)
|
this.updateValue(name, { options: list })
|
},
|
|
async getDetail() {
|
const { query, conf, acctLoanInfo } = this
|
const { edit } = conf
|
const { transLogSerialno, pageId, transCode, isApplyPhase } = query
|
let model = null
|
if (pageId === '36' || transCode === '5002') {
|
model = queryReductionApplyInfo()
|
this.submitModel = feeReductionApply()
|
} else if (pageId === '37' || transCode === '5001' || transCode === 'T5001') {
|
model = queryDiscoutFeeApplyInfo()
|
this.submitModel = createDiscountFee()
|
}
|
const info = await model.request({
|
transLogSerialno
|
})
|
// this.formList = model.getFormList(info)
|
// this.model = model
|
// this.submitModel = claimApplySubmit()
|
const formList = model.getFormList(info)
|
// 申请阶段设置默认值
|
if (pageId === '37' && isApplyPhase === 1) {
|
const { umPayInterestAmtA4Sum } = acctLoanInfo
|
let res = formList.find(item => item.name === 'payAmt6')
|
res.value = umPayInterestAmtA4Sum
|
}
|
if (edit === 'Y') {
|
this.formList = formList
|
} else {
|
this.formList = formList.map(item => {
|
return {
|
...item,
|
attrs: ['readonly'],
|
rules: []
|
}
|
})
|
// this.formList.map(item => {
|
// if (item.name === 'refundway') {
|
// item.attrs = ['disabled']
|
// }
|
// })
|
}
|
this.model = model
|
this.setSelectOptions()
|
// this.submitModel = createDiscountFee();
|
},
|
|
// 更新表单数据
|
updateValue(index, info) {
|
const { formList, acctLoanInfo, query, conf } = this
|
const { pageId } = query
|
const { edit } = conf
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
// if (preInfo.name === 'productid') {
|
// this.qryDimensionList()
|
// }
|
}
|
if (pageId === '37' && edit === 'Y') {
|
const { umPayInterestAmtA4Sum } = acctLoanInfo // vuex 中取数据
|
// actualwaiveamt = waiveprepaypenaltyamt+waiveinterestamt+waiverenewalfee+waiveprincipalpenaltyamt
|
// +waivepoundage+waiveguarantee+waiveservicefee+waiverepaymentplanchangefee
|
// payAmt6(罚息减免后金额) = waiveprincipalpenaltyamt 罚息减免金额 逾期罚息余额 umPayInterestAmtA4Sum
|
// 过滤 payAmt6 remark inputDate inputTime inputUserName inputOrgName
|
const payAmtIndex = formList.find(item => item.name === 'payAmt6')
|
// console.log(payAmtIndex.value)
|
const waiveprincipalpenaltyamtIndex = formList.find(
|
item => item.name === 'waiveprincipalpenaltyamt'
|
)
|
if (
|
waiveprincipalpenaltyamtIndex.value * 1 >
|
umPayInterestAmtA4Sum * 1
|
) {
|
this.$message.warning('罚息减免金额不能大于逾期罚息余额')
|
waiveprincipalpenaltyamtIndex.value = ''
|
}
|
// 每次进来必须置空。不然会拿到上一次更新的值进行相加
|
// payAmtIndex.value = ''
|
if (waiveprincipalpenaltyamtIndex.value !== '') {
|
payAmtIndex.value = (
|
umPayInterestAmtA4Sum * 1 -
|
waiveprincipalpenaltyamtIndex.value * 1
|
).toFixed(2)
|
} else {
|
payAmtIndex.value = umPayInterestAmtA4Sum
|
}
|
//
|
const actualwaiveamtIndex = formList.find(
|
item => item.name === 'actualwaiveamt'
|
)
|
actualwaiveamtIndex.value = ''
|
const actualwaiveamtArray = formList.filter(({ name }) =>
|
specialKeys.includes(name)
|
)
|
actualwaiveamtArray.forEach(item => {
|
if (item.value) {
|
// 转正number类型。字符串会进行拼接
|
actualwaiveamtIndex.value = (
|
actualwaiveamtIndex.value * 1 +
|
item.value * 1
|
).toFixed(2)
|
}
|
})
|
}
|
if (pageId === '36' && edit === 'Y') {
|
const { balance } = acctLoanInfo // vuex 中取数据
|
// 已还息费总金额
|
const actualwaiveamtIndex = formList.find(
|
item => item.name === 'actualwaiveamt'
|
)
|
actualwaiveamtIndex.value = ''
|
const actualwaiveamtArray = formList.filter(({ name }) =>
|
specialKeys.includes(name)
|
)
|
actualwaiveamtArray.forEach(item => {
|
if (item.value) {
|
// 转正number类型。字符串会进行拼接
|
actualwaiveamtIndex.value = (
|
actualwaiveamtIndex.value * 1 +
|
item.value * 1
|
).toFixed(2)
|
}
|
})
|
// 退款比例 rate = actualwaiveamt(息费退款总金额) / balance(已还息费总金额) balance
|
// const actualwaiveamtIndex = formList.find(item => item.name === 'actualwaiveamt')
|
const rateIndex = formList.find(item => item.name === 'rate')
|
if (actualwaiveamtIndex.value) {
|
rateIndex.value =
|
Math.round(
|
((actualwaiveamtIndex.value * 1) / (balance * 1)) * 100
|
) / 100
|
} else {
|
rateIndex.value = ''
|
}
|
}
|
//
|
},
|
// 表单按钮事件处理
|
async submit() {
|
const { submitModel, query, conf } = this
|
const { transLogSerialno, transCode } = query
|
const { edit } = conf
|
const values = this.$refs.claimApply.validate()
|
// const actualwaiveamtIndex = formList.find(
|
// item => item.name === 'actualwaiveamt'
|
// )
|
if (values) {
|
try {
|
if (edit === 'Y') {
|
// if (actualwaiveamtIndex.value > 0) {
|
await submitModel.request({
|
...values,
|
logSerialno: transLogSerialno,
|
transCode
|
})
|
this.isShowDialog = true
|
// } else {
|
// this.$message('息费退款总金额必须大于0')
|
// }
|
// console.log(1)
|
}
|
} catch (error) {}
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录取错误,请检查!')
|
}
|
},
|
// 提交成功后返回原列表页
|
commitSuccess() {
|
this.isShowDialog = false
|
this.$router.go(-1)
|
}
|
},
|
computed: {
|
// 表单值信息 控制表单的values值
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
// 控制rules属性
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
},
|
...mapState({
|
acctLoanInfo: state => state.tabsModule.acctLoanInfo
|
})
|
},
|
watch: {
|
$route() {
|
const { transLogSerialno } = this.$route.query
|
if (transLogSerialno) {
|
this.init()
|
}
|
},
|
acctLoanInfo() {
|
this.init()
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
</style>
|