shenpiModal.vue 17 KB
<template>
    <a-modal title="授信审批" :width="1000" :centered="false" :visible="visible" :confirmLoading="confirmLoading"
        @ok="handleOk" @cancel="handleCancel" cancelText :maskClosable="false" style="top:20px;" class="scope-loan">
        <a-form :form="form">
            <a-row :gutter="24">
                <a-col :span="12">
                    <a-form-item label="审批结果" :labelCol="labelCol" :wrapperCol="wrapperCol">
                        <a-radio-group @change="examine" :disabled="disabled"
                            v-decorator="['approvalResult', { initialValue: validatorRules ? validatorRules.approvalResult : '', rules: [{ required: true, message: '请选择审批结果' }] }]">
                            <a-radio :value="1">通过</a-radio>
                            <a-radio :value="2">拒绝</a-radio>
                            <a-radio :value="3">退件待补</a-radio>
                        </a-radio-group>
                    </a-form-item>
                </a-col>
            </a-row>
            <a-card class="card" :title="table" :bordered="false">
                <div v-if="examineNum == 1">
                    <a-row :gutter="24">
                        <a-col :span="12">
                            <a-form-item label="客户申请借款(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="true"
                                    v-decorator="['transAmount', { initialValue: validatorRules ? validatorRules.transAmount : '' }]"
                                    placeholder="请输入审批额度" :min="1" :precision='0' />
                            </a-form-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-item label="风控建议授信额度(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="true"
                                    v-decorator="['riskAmount', { initialValue: validatorRules ? validatorRules.riskAmount : '' }]"
                                    placeholder="请输入审批额度" :min="1" :precision='0' />
                            </a-form-item>
                        </a-col>
                    </a-row>
                    <a-row :gutter="24">
                        <a-col :span="12">
                            <a-form-item label="审批额度(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="disabled"
                                    v-decorator="['approvalAmount', { initialValue: validatorRules ? validatorRules.approvalAmount : '', rules: [{ required: true, message: '请输入审批额度' }] }]"
                                    placeholder="请输入审批额度" :min="1" :precision='0' />
                            </a-form-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-item label="审批年化利率(%)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="disabled"
                                    v-decorator="['interestRate', { initialValue: validatorRules ? validatorRules.interestRate : '', rules: [{ required: true, message: '请输入审批年化利率' }] }]"
                                    placeholder="请输入审批年化利率" />
                            </a-form-item>
                        </a-col>
                    </a-row>
                    <a-row :gutter="24">
                        <a-col :span="12">
                            <a-form-item label="审批年化逾期利率(%)" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="disabled"
                                    v-decorator="['penaltyRate', { initialValue: validatorRules ? validatorRules.penaltyRate : '', rules: [{ required: true, message: '请输入审批年化逾期利率' }] }]"
                                    placeholder="请输入审批年化逾期利率" />
                            </a-form-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-item label="账单期限" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-input-number style="width:100%;" :disabled="disabled"
                                    v-decorator="['term', { initialValue: validatorRules ? validatorRules.term : '', rules: [{ required: true, message: '请输入账单期限' }] }]"
                                    placeholder="请输入账单期限" :min="1" :precision='0' />
                            </a-form-item>
                        </a-col>
                    </a-row>
                    <a-row :gutter="24">
                        <a-col :span="12">
                            <a-form-item label="账单期限类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-select :disabled="disabled" @change="dateType"
                                    v-decorator="['termType', { initialValue: validatorRules ? validatorRules.termType : '', rules: [{ required: true, message: '请输入账单期限类型' }] }]">
                                    <a-select-option :value="1">日</a-select-option>
                                    <a-select-option :value="2">月</a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                        <a-col :span="12" v-if="dateTypeNum == 2">
                            <a-form-item label="还款方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-select placeholder="请选择" :disabled="disabled"
                                    v-decorator="['repaymentType', { initialValue: validatorRules ? validatorRules.repaymentType : '', rules: [{ required: true, message: '请输入还款方式' }] }]">
                                    <a-select-option v-for="item in repaymentTypeDict" :key="item.name"
                                        :disabled="disabled" :value="item.name">
                                        {{ item.title }}
                                    </a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                        <a-col :span="12" v-if="dateTypeNum == 1">
                            <a-form-item label="还款方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-select placeholder="请选择" :disabled="disabled"
                                    v-decorator="['repaymentType', { initialValue: validatorRules ? validatorRules.repaymentType : '', rules: [{ required: true, message: '请输入还款方式' }] }]">
                                    <a-select-option v-for="item in repaymentTypeDict2" :key="item.name"
                                        :disabled="disabled" :value="item.name">
                                        {{ item.title }}
                                    </a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                    </a-row>
                    <a-row :gutter="24">
                        <a-col :span="12">
                            <a-form-item label="还款日" :labelCol="labelCol" :wrapperCol="wrapperCol">
                                <a-select placeholder="请选择" :disabled="disabled"
                                    v-decorator="['repaymentDayType', { initialValue: validatorRules ? validatorRules.repaymentDayType : '', rules: [{ required: true, message: '请输入还款日' }] }]"
                                    @change="handleSelectChange">
                                    <a-select-option v-for="item in repaymentDayTypeDict" :key="item.label"
                                        :value="item.value">
                                        {{ item.label }}
                                    </a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-col>
                        <a-col v-if="repaymentDayFlag == 3" :span="3">
                            <a-form-item label="" :labelCol="{ span: 0 }" :wrapperCol="{ span: 24 }">
                                <a-input-number :disabled="disabled"
                                    v-decorator="['repaymentDay', { initialValue: validatorRules ? validatorRules.repaymentDay : '', rules: [{ required: true, message: '请输入还款日' }] }]"
                                    :min="1" :precision='0' :max="31" />
                            </a-form-item>
                        </a-col>
                        <a-col v-if="repaymentDayFlag == 3" :span="2">
                            <div class="repaymentDay">日</div>
                        </a-col>
                    </a-row>
                </div>
                <a-row :gutter="24">
                    <a-col :span="24">
                        <a-form-item label="审批意见" :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }" hasFeedback>
                            <a-textarea :disabled="disabled"
                                v-decorator="['approvalNote', { initialValue: validatorRules ? validatorRules.approvalNote : '', rules: [{ required: true, message: '请输入审批意见' }] }]"
                                placeholder="审批结果为退件待补时,需要在审批意见中说明要补成的资料或信息" />
                        </a-form-item>
                    </a-col>
                </a-row>
            </a-card>
        </a-form>
        <template slot="footer">
            <span>
                <a-button key="back" @click='visible = false'>
                    取消
                </a-button>
                <a-button key="save" @click="saveOrUpdateApprovalTransTemp" :disabled="show">
                    暂存审批
                </a-button>
                <a-button key="submit" type="primary" :loading="confirmLoading" @click="handleOk" :disabled="show">
                    确定
                </a-button>
            </span>
        </template>
    </a-modal>
</template>
<script>
import { JeecgListMixin } from '@/mixins/CoreListMixin'
import { submitApprovalTrans, saveOrUpdateApprovalTransTemp, queryApprovalTransById } from '@/api/insys'
export default {
    name: 'CommonBillListModal',
    mixins: [JeecgListMixin],
    data() {
        return {
            visible: false,
            confirmLoading: false,
            title: '',
            disableSubmit: false,
            disabled: false,
            model: {},
            examineNum: 1,
            table: '',
            repaymentDayFlag: '',
            validatorRules: {},
            applyNo: '',
            transNo: '',
            currentItem: '',
            show: false,
            labelCol: {
                span: 8
            },
            wrapperCol: {
                span: 16
            },
            form: this.$form.createForm(this),
            currentItem: {},   // 当前审批任务信息
            confirmLoading: false,  // 审批提交loading
            repaymentTypeDict: [
                { title: '等额本息', name: 1 },
                { title: '先息后本', name: 2 },
                { title: '等额本金', name: 5 },
                // { title: '到期还本付息(算头算尾)', name: 3 },
                // { title: '到期还本付息(算头不算尾)', name: 4 },
            ],
            repaymentTypeDict2: [
                // { title: '等额本息', name: 1 },
                // { title: '先息后本', name: 2 },
                // { title: '等额本金', name: 5 },
                { title: '到期还本付息(算头算尾)', name: 3 },
                { title: '到期还本付息(算头不算尾)', name: 4 },
            ],
            repaymentDayTypeDict: [   // 还款日枚举
                { label: '放款日对日(29/30/31统一设为28号)', value: 1 },
                { label: '放款日对日(若无对日统一设为月末)', value: 2 },
                { label: '固定日', value: 3 },
                { label: '放款日对前一日', value: 4 },
            ],
            dateTypeNum:''
        }
    },
    methods: {
        handleSelectChange(value) {
            this.repaymentDayFlag = value;
        },
        examine(value) {
            this.examineNum = value.target.value
            if (value.target.value == 2 || value.target.value == 3) {
                this.table = ""
            } else {
                this.table = "授信审批信息"
            }
        },
        edit(res, lis, num) {
            console.log(res)
            this.dateTypeNum = lis.termType
            if (num == 1) {
                this.applyNo = res.applyNo
                this.transNo = res.transNo
                this.currentItem = res
                this.validatorRules = lis
                this.repaymentDayFlag = lis.repaymentDayType
            } else if (num == 2) {
                this.applyNo = res.applyNo
                this.transNo = res.transNo
                this.currentItem = res;
                this.validatorRules = lis
                this.repaymentDayFlag = lis.repaymentDayType
            }
            this.show = false
            this.form.resetFields()
            this.visible = true
            this.$nextTick(() => { })
        },
        look(lis) {
            console.log(lis)
            this.show = true
            this.form.resetFields()
            this.visible = true
            this.disabled = true
            queryApprovalTransById({ id: lis.id }).then(res => {
                if (res.status.statusCode == 0) {
                    this.validatorRules = res.result
                    this.dateTypeNum = res.result.termType
                    this.repaymentDayFlag = res.result.repaymentDayType
                } else {
                    this.$message.warning(res.status.statusReason)
                }
            })
            this.$nextTick(() => { })
        },
        close() {
            this.$emit('close')
            this.visible = false
            this.disableSubmit = false
            this.selectedRole = []
        },
        handleCancel() {
            this.close()
        },
        handleSubmit() {

        },
        dateType(val){
            this.dateTypeNum = val
        },
        // 暂存审批信息
        saveOrUpdateApprovalTransTemp() {
            this.form.validateFields((err, values) => {
                if (!err) {
                    let param = {
                        ...values,
                        applyNo: this.applyNo,
                        transNo: this.transNo,
                    }
                    if (param.repaymentDay) {
                        param.repaymentDay = Number(param.repaymentDay)
                    }
                    saveOrUpdateApprovalTransTemp(param).then(res => {
                        if (res.status.statusCode == 0) {
                            this.$message.success('审批信息暂存成功')
                        } else {
                            this.$message.warning(res.status.statusReason)
                        }
                    })
                }
            })
        },
        // 审批提交
        handleOk(e) {
            this.form.validateFields((err, values) => {
                console.log(err)
                if (!err) {
                    this.confirmLoading = true
                    let param = {
                        ...values,
                        id: this.currentItem.id
                    }
                    if (param.repaymentDay) {
                        param.repaymentDay = Number(param.repaymentDay)
                    }
                    submitApprovalTrans(param)
                        .then(res => {
                            if (res.status.statusCode == 0) {
                                this.$message.success(res.status.statusReason)
                                this.visible = false;
                                this.$emit('getModle')
                            } else {
                                this.$message.warning(res.status.statusReason)
                            }
                        })
                        .finally(() => {
                            this.confirmLoading = false
                        })
                }
            })
        },
        // tabs 回调
        callback(key) {
            if (key == 2) {
                this.$refs.msg.loadData()
            } else if (key == 3) {
                this.$refs.backMsg.loadData()
            }
        },
    }
}
</script>
<style>
.scope-loan .ant-form-item {
    margin-bottom: 12px;
}

.scope-loan .ant-card-body {
    padding: 20px 24px 0;
}

.scope-loan .c189 {
    color: #1890ff;
}

.scope-loan .fw {
    font-weight: bold;
}
.repaymentDay{
    line-height: 40px;
    margin-left: -20px;
}
</style>