extensionPreiod.vue
9.26 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<template>
<v-layout id="CreateIOU" column justify-center align-center>
<v-flex>
<v-card id="IOUInfoBlock" class="IOUList" flat height="15.5rem">
<div class="BankBlock FormLine">
<div class="labelBlock">
<span>借款金额</span>
</div>
<div class="pickerValueBlockValue">
<span>{{info.amount}}元</span>
</div>
</div>
<div class="BankBlock FormLine">
<div class="labelBlock">
<span>展期开始日期</span>
</div>
<div class="pickerValueBlockValue">
<span>{{dateParse(info.endDate)}}</span>
</div>
</div>
<div class="BankBlock FormLine" @click="endPickerDislpay = true">
<div class="labelBlock">
<span>展期结束日期</span>
</div>
<div class="pickerValueBlock" v-if="!form.end" >{{'请选择'}}
<v-icon class="addCardIcon">keyboard_arrow_right</v-icon>
</div>
<div class="pickerValueBlockValue" v-if="!!form.end" >
<span>{{form.end}}</span>
</div>
<DatePicker title="请选择还款日期"
@pickerClose="endPickerDislpay = false"
v-model="form.end"
:startDate="new Date(info.endDate)"
:display="endPickerDislpay"/>
</div>
<div class="BankBlock FormLine">
<div class="labelBlock">
<span>年化利率</span>
</div>
<div class="pickerValueBlockValue">
<span>{{info.rate * 100}}%</span>
<span class="rateInterest">{{interest}}元</span>
</div>
</div>
<div class="HintLine">
本金{{info.amount}}+利息{{interest}}=到期本息<span>{{info.amount + interest}}</span>元
</div>
</v-card>
<v-card id="IOUUsageBlock" class="IOUList" flat height="3.1rem">
<div class="NameBlock FormLine">
<div class="labelBlock">
<span>借款用途</span>
</div>
<div class="pickerValueBlockValue">
{{info.usage}}
</div>
</div>
</v-card>
<v-card id="IOUTargetBlock" class="IOUList" flat height="4.2rem">
<div class="BankBlock FormLine" >
<div class="labelBlock">
<span>借款人姓名</span>
</div>
<div class="pickerValueBlockValue">
<span>{{borrower}}</span>
</div>
</div>
</v-card>
<div class="ConfirmButtonBlock">
<v-btn depressed id="ConfirmButton" :loading="isLoading" @click.native="formCheck">确认展期</v-btn>
</div>
<v-dialog v-model="dialogDisplay" persistent max-width="290">
<v-card class="hintDialog">
<v-card-title class="headline">提示</v-card-title>
<v-card-text class='dialogContent'>{{dialogInfo}}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="black" flat @click.native="dialogDisplay = false">知道了</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<PopUp :display="passwordPannelDisplay" @close='passwordPannelDisplay = false'>
<template slot="content">
<PasswordInputer :display="passwordPannelDisplay" @passwordSubmit="submitIOU"/>
</template>
</PopUp>
</v-flex>
</v-layout>
</template>
<script>
import DatePicker from '@/components/DatePicker'
import PopUp from '@/components/PopUp'
import PasswordInputer from '@/components/PasswordInputer'
import {wechatShareSetting, dateParse, interest} from '@/helper'
export default {
async asyncData({store, query, app, redirect}) {
let {data} = await app.$axios.get(`/confirmedInfo?kind=credit&id=${query.id}&userId=${store.state.user.id}`)
if (data.success) {
return {info: data.info}
} else {
store.dispatch('displayMessage', data.msg)
redirect(301, '/')
return
}
},
layout: 'lightGold',
data:() => ({
form: {
end: '',
},
dialogDisplay: false,
dialogInfo: '',
endPickerDislpay: false,
passwordPannelDisplay: false,
isLoading: false
}),
head:() => ({
title: '借条展期'
}),
computed: {
borrower() {
return (this.info.Borrower ? this.info.Borrower.name : '')
},
interest () {
const rate = this.info.rate
return interest(this.info.amount, rate , this.info.startDate, this.form.end)
}
},
components: {
DatePicker,
PopUp,
PasswordInputer
},
mounted() {
wechatShareSetting(this.$axios, this.$store)
},
methods: {
dateParse: dateParse,
showDialog(info) {
this.dialogInfo = info
this.dialogDisplay = true
},
formCheck() {
if (!this.form.end) {
this.showDialog('请选择展期结束日期!')
return false
}
if (new Date(this.form.end).getTime() < new Date().getTime() - 86400000) {
this.showDialog('展期结束日期不能早于今天!')
return false
}
if (new Date(this.info.endDate).getTime() > new Date(this.form.end).getTime()) {
this.showDialog('展期结束日期最早为展期开始当日')
return false
}
this.passwordPannelDisplay = true
},
async submitIOU(password) {
this.isLoading = true
this.passwordPannelDisplay = false
let {data} = await this.$axios.post('/extendPreiod', {
startDate: this.info.endDate,
endDate: this.form.end,
password: password,
id: this.info.id,
userId: this.$store.state.user.id
})
this.isLoading = false
if (data.success) {
this.$store.dispatch('setMessageRedirect', `confirmedCredit?id=${this.info.id}&active=2`)
this.$store.dispatch('displayMessage', '展期发起成功')
} else {
this.$store.dispatch('displayMessage', data.msg)
}
}
}
}
</script>
<style lang="scss" scoped>
#CreateIOU {
.IOUList {
width: 90vw;
margin-top: 1.5rem;
background: #FFFFFF;
border-radius: 2px;
padding: 0 1.3rem;
.FormLine {
height: 3.3rem;
position: relative;
.labelBlock {
line-height: 3.3rem;
height: 3.3rem;
position: absolute;
font-size: 1rem;
font-weight: bold;
}
.BindCardInput {
padding-top: 0.75rem;
}
.pickerValueBlock {
padding-top: 0.75rem;
text-align: right;
font-size: 1rem;
.addCardIcon {
color: $light-gold;
}
}
.pickerValueBlockValue {
padding-top: 0.75rem;
padding-left: 6.7rem;
text-align: right;
font-size: 1rem;
.rateInterest {
margin-left: 0.5rem;
color: $light-gold;
}
}
}
/deep/ #AmountInput {
margin-left: 6.7rem;
text-align: right;
}
/deep/ #NameInput {
margin-left: 6.7rem;
text-align: right;
}
.BankBlock {
border-bottom: 1px solid rgba(0, 0, 0, .87);
}
.HintLine {
font-size: 0.9rem;
line-height: 2rem;
text-align: right;
color: #9D9D9D;
span {
color: $light-gold;
}
}
::-moz-placeholder { color: #9D9D9D; }
::-webkit-input-placeholder { color:#9D9D9D; }
:-ms-input-placeholder { color:#9D9D9D; }
}
#IOUUsageBlock {
margin-top: 1rem;
}
#IOUTargetBlock {
margin-top: 1rem;
}
.Agreement {
text-align: center;
font-size: 12px;
color: #666;
font-weight: bold;
height: 1.5rem;
line-height: 1.5rem;
margin-top: 1rem;
.AgreementCheckBox {
border: 2px solid #666;
color: #fff;
width: 1.2rem;
height: 1.2rem;
border-radius: 1.2rem;
transition: all 0.3s ease-in-out;
display: inline-block;
margin-right: 0.8rem;
position: relative;
top: 3px;
&.AgreementChecked {
background-image: linear-gradient(-229deg, #DAB269 37%, #E7C78C 87%);
border-color: #E7C78C;
}
#CheckBoxCheck {
position: absolute;
left: 0;
font-size: 15px;
font-weight: bold;
}
}
}
.ConfirmButtonBlock {
width: 90vw;
margin: 2.5rem auto;
#ConfirmButton {
color: #484646;
background-image: linear-gradient(-213deg, #DAB269 0%, #E7C78C 92%);
border-radius: 2px;
width: 100%;
height: 2.8rem;
font-size: 18px;
margin: auto;
transition: 0.2s all ease-in-out;
&:disabled {
background-image: none;
}
}
}
}
.hintDialog {
background-color: #fff;
color: #000;
.headline {
justify-content: center;
font-weight: bold;
padding-bottom: 0;
}
.dialogContent {
justify-content: center;
text-align: center;
.warningIcon {
margin-bottom: 0.5rem;
color: red;
font-size: 5rem;
}
.bold {
font-weight: bold;
}
p {
margin-bottom: 0;
}
}
.btn {
width: 100%;
}
}
</style>