listLoanModal.vue
6.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
<a-modal title="登记放款" :width="600" :centered="true" :maskClosable="false" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" @cancel="handleCancel" cancelText="关闭" style="top:20px;" class="scope-link-man">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="借款金额(元)" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="[ 'remitFee', {'initialValue':model.applyMoney,rules:[{required: true, message: '请输入借款金额(元)'}]}]" :read-only="true" />
</a-form-item>
<a-form-item label="是否拒绝放款" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['remitStatus',{'initialValue':'',rules:[{required: true, message: '请选择是否拒绝放款'}]}]" @change="handleRefuseRemark">
<a-radio :value="0">是</a-radio>
<a-radio :value="1">否</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="放款方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="['paymentWay', {'initialValue':'',rules:[{required: !refuseDis, message: '请选择放款方式'}]}]" placeholder="请选择" @change="handlePayment" :disabled="refuseDis">
<a-select-option v-for="(item, index) in dbPaymentWay" :key="index" :value="item.name">{{item.title}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="请选择放款账户" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="['remitAccountType', {'initialValue':'',rules:[{required: !refuseDis && !paymentDis, message: '请选择放款账户'}]}]" placeholder="请选择" :disabled="refuseDis||paymentDis">
<a-select-option v-for="(item, index) in dbRemitAccountType" :key="index" :value="item.name">{{item.title}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item v-show="!paymentDis" label="放款日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker style="width: 100%" :disabledDate="disabledDate" v-decorator="['birthday',{'initialValue':null,rules:[{required: !refuseDis && !paymentDis, message: '请选择放款日期'}]}]" @change="onChangeDate" :disabled="refuseDis||paymentDis" />
</a-form-item>
<a-form-item v-show="paymentDis" label="放款日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker style="width: 100%" :defaultValue="moment(new Date(), 'YYYY-MM-DD')" :disabled="refuseDis||paymentDis" />
</a-form-item>
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea rows="4" placeholder="备注" v-decorator="['remark', {'initialValue':'',rules:[{required: refuseDis, message: '拒绝放款请输入理由'}]}]" maxlength="60" />
</a-form-item>
<div style="color:red;text-align:center;">注:系统会根据输入的放款日期去设置起息日和生成还款计划,请正确登记放款日期。</div>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { submitLoanApply } from '@/api/makeLoan'
import pick from 'lodash.pick'
import moment from 'moment'
export default {
name: 'personLinkManModal',
data () {
return {
visible: false,
confirmLoading: false,
refuseDis: false, // 拒绝放款
paymentDis: false, // 线上线下
dbPaymentWay: JSON.parse(sessionStorage.getItem('DB_PAYMENT_WAY')), // 放款方式
dbRemitAccountType: JSON.parse(sessionStorage.getItem('DB_REMIT_ACCOUNT_TYPE')), // 放款账户类型
title: '',
model: {},
orderNo: '',
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
},
loanDate: undefined,
dateFormat: 'YYYY-MM-DD 00:00:00',
disableMixinCreated: true
}
},
methods: {
moment,
edit (data) {
this.orderNo = data.orderNo
this.model = Object.assign({}, data)
this.form.resetFields()
this.visible = true
this.$nextTick(() => { })
},
close () {
this.$emit('close')
this.visible = false
this.disableSubmit = false
this.selectedRole = []
},
handleSubmit () {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
let formData = Object.assign({ 'orderNo': this.orderNo, 'loanDate': this.loanDate }, values)
delete formData.birthday
delete formData.remitFee
this.confirmLoading = false
submitLoanApply(formData)
.then(res => {
if (res.status.statusCode == 0) {
this.$message.success(res.status.statusReason)
this.$emit('ok')
} else {
this.$message.warning(res.status.statusReason)
}
})
.finally(() => {
this.confirmLoading = false
this.close()
this.$emit('ok')
})
}
})
},
disabledDate (current) {
return current && current >= moment().endOf('day');
},
handleRefuseRemark (e) {
let val = e.target.value
if (val == 0) {
this.refuseDis = true
this.form.setFieldsValue({
paymentWay: null,
bankCardName: null,
remitAccountType: null,
birthday: null,
});
this.loanDate = ''
} else {
this.refuseDis = false
}
},
handleCancel () {
this.close()
},
// 线上线下判断 0:线上 1:线下
handlePayment (key) {
if (key == 0) {
let Year = new Date().getFullYear(),
Month = new Date().getMonth() + 1 <= 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
Day = new Date().getDate() <= 10 ? '0' + new Date().getDate() : new Date().getDate();
this.loanDate = Year + '-' + Month + '-' + Day
this.paymentDis = true
this.form.setFieldsValue({
bankCardName: null,
remitAccountType: null,
birthday: null
});
} else {
this.paymentDis = false
}
},
// 时间处理
onChangeDate (value, dateString) {
this.loanDate = dateString
},
}
}
</script>
<style>
</style>