comfirmedCredit.vue
21.4 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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
<template>
<v-layout id="comfirmedBorrow" column justify-center align-center>
<v-flex>
<v-card class="infoCards" flat height="6rem">
<v-card-title class="infoCardsTitle" >
<div class="infoCardsName">借款人:{{creditor}}</div>
<div class="infoCardsDetail" @click="$router.push(`/borrowContent?id=${info.id}`)">查看详情<v-icon>keyboard_arrow_right</v-icon></div>
</v-card-title>
<v-card-text class="infoCardsContent" >
<div class="infoCardsContentBlock total">
<div class="infoCardsContentKey">待收总额</div>
<div class="infoCardsContentValue">{{info.amount}}元</div>
</div>
<div class="infoCardsContentBlock amount">
<div class="infoCardsContentKey">出借本金</div>
<div class="infoCardsContentValue">{{info.amount}}元</div>
</div>
<div class="infoCardsContentBlock interest">
<div class="infoCardsContentKey">利息</div>
<div class="infoCardsContentValue">{{info.rate * 100}}元</div>
</div>
</v-card-text>
</v-card>
<v-card class="BorrowList" id="BorrowListContent" flat >
<v-tabs v-model="active" color="toolbarGrey" centered grow dark slider-color="gold">
<v-tab :key="1" ripple>待收金额</v-tab>
<v-tab :key="2" ripple>收款记录</v-tab>
<v-tab :key="3" ripple>展期记录</v-tab>
<v-tab-item :key="1">
<v-card id='waitToPay' class="itemsCard">
<div class="waitToPayInfo">
<v-progress-circular
id="progress"
:size="cycleSize"
:width="10"
:rotate="15"
:value="70"
color="gold"
>
<div class="InfoBlock">
<div class="InfoBlockTitle">待收金额</div>
<div class="total">{{info.amount}}元</div>
<div class="duration">剩余{{100}}天</div>
</div>
</v-progress-circular>
<v-btn depressed class="btn-deep" @click="passwordCheck('Confirm')">销账</v-btn>
<v-btn depressed class="btn-deep" @click="passwordCheck('Confirm')">展期</v-btn>
<v-btn depressed class="btn-light" @click="passwordCheck('Confirm')">举报违法</v-btn>
</div>
</v-card>
</v-tab-item>
<v-tab-item :key="2">
<v-card id='payRecordTitle' class="itemsCard">
<v-list class="list">
<v-list-tile class="listTitle listLine">
<v-list-tile-content class="BorrowListTitle">收款日期</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">还款人姓名</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">收款金额</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">收款状态</v-list-tile-content>
</v-list-tile>
</v-list>
</v-card>
<v-card id='payRecord' class="itemsCard" height="60vh">
<v-list class="list">
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
</v-list>
</v-card>
</v-tab-item>
<v-tab-item :key="3">
<v-card id='payRecordTitle' class="itemsCard">
<v-list class="list">
<v-list-tile class="listTitle listLine">
<v-list-tile-content class="BorrowListTitle">金额</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">利率</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">时间</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">状态</v-list-tile-content>
</v-list-tile>
</v-list>
</v-card>
<v-card id='payRecord' class="itemsCard" height="60vh">
<v-list class="list">
<v-list-tile class="listLine">
<v-list-tile-content class="BorrowListTitle">2018-04-17</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">邓欲国</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">10000</v-list-tile-content>
<v-list-tile-content class="BorrowListTitle">支付超时</v-list-tile-content>
</v-list-tile>
</v-list>
</v-card>
</v-tab-item>
</v-tabs>
</v-card>
<!-- <v-card id="ConfirmBlock" >
<div class="sponsorConfirm">
<v-btn depressed :loading="isLoading" class="btn-light" @click="passwordCheck('Cancel')">举报违法</v-btn>
<v-btn depressed :loading="isLoading" class="btn-deep" @click="passwordCheck('Confirm')">销账</v-btn>
<v-btn depressed :loading="isLoading" class="btn-deep" @click="passwordCheck('Confirm')">展期</v-btn>
</div>
</v-card> -->
<div id="FuckIphoneX"></div>
</v-flex>
<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'>
<p>{{dialogContent}}</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="black" flat @click.native="dialogDisplay = false">再看看</v-btn>
<v-btn color="black" flat @click.native="$router.push(redirect)">去设置</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<PopUp :display="passwordPannelDisplay" @close='passwordPannelDisplay = false'>
<template slot="content">
<PasswordInputer :display="passwordPannelDisplay" @passwordSubmit="passwordSubmit"/>
</template>
</PopUp>
</v-layout>
</template>
<script>
import PopUp from '@/components/PopUp'
import PasswordInputer from '@/components/PasswordInputer'
import {wechatShareSetting} from '@/helper'
export default {
async asyncData({store, query, app, redirect}) {
let {data} = await app.$axios.get(`/iou?id=${query.id}&userId=${store.state.user.id}`)
if (data.success) {
return {info: data.info}
} else {
store.dispatch('displayMessage', data.msg)
redirect(301, '/')
}
},
data:() => ({
dialogDisplay: false,
passwordPannelDisplay: false,
isLoading: false,
passwordSubmit: {},
dialogContent: '',
redirect: '',
cycleSize: 250,
active: null
}),
computed: {
userInfo() {
return this.$store.state.user
},
borrower() {
if (this.info.status === '待确认' || this.info.status === '未发起' || this.info.status === '已驳回') {
return (this.info.Borrower ? this.info.Borrower.name : this.info.targetName)
}
return this.info.Borrower.name
},
creditor() {
return (this.info.Creditor ? this.info.Creditor.name : this.info.targetName)
},
avatar() {
return (this.info.Creditor ? this.info.Borrower.headimgurl : '')
},
imgSrc() {
return this.info.imgs ? this.info.imgs.split(',') : []
}
},
head:() => ({
title: '借款内容'
}),
components: {
PopUp,
PasswordInputer
},
mounted() {
let windowHeight = document.body.offsetHeight
if (windowHeight < 600) {
this.cycleSize = 210
}
wechatShareSetting(this.$axios, this.$store)
if (this.userInfo.needPhoneBind) {
this.dialogContent = '您还没有绑定手机号码,无法进行该操作'
this.$store.commit('setRedirect', `/borrowContent?id=${this.info.id}`)
this.redirect = '/login'
this.dialogDisplay = true
return
}
if (this.userInfo.needIdBind) {
this.dialogContent = '您还没有验证身份信息,无法进行该操作'
this.$store.commit('setRedirect', `/borrowContent?id=${this.info.id}`)
this.redirect = '/idBind'
this.dialogDisplay = true
return
}
},
beforeRouteLeave (to, from, next) {
if (to.name === "createIOU") {
next('/')
} else {
next()
}
},
methods: {
async getData() {
let {data} = await this.$axios.get(`/iou?id=${this.info.id}&userId=${this.$store.state.user.id}`)
if (data.success) {
this.info = data.info
} else {
store.dispatch('displayMessage', data.msg)
}
},
getDate(source) {
let date = new Date(source)
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
},
passwordCheck(type) {
if (this.userInfo.needPhoneBind) {
this.dialogContent = '您还没有绑定手机号码,无法进行该操作'
this.$store.commit('setRedirect', `/borrowContent?id=${this.info.id}`)
this.redirect = '/login'
this.dialogDisplay = true
return
}
if (this.userInfo.needIdBind) {
this.dialogContent = '您还没有验证身份信息,无法进行该操作'
this.$store.commit('setRedirect', `/borrowContent?id=${this.info.id}`)
this.redirect = '/idBind'
this.dialogDisplay = true
return
}
if (this.userInfo.needSetPassword) {
this.dialogContent = '您还没有设置交易密码,无法进行该操作'
this.$store.commit('setRedirect', `/borrowContent?id=${this.info.id}`)
this.redirect = '/setPassword'
this.dialogDisplay = true
return
}
switch (type) {
case 'Confirm':
this.passwordSubmit = this.confirm
break
case 'Cancel':
this.passwordSubmit = this.cancel
break
default:
this.passwordSubmit = this.confirm
break
}
this.passwordPannelDisplay = true
},
async confirm(password) {
this.passwordPannelDisplay = false
this.isLoading = true
let url = ''
let redirect = ''
if (this.info.status === '未发起') {
url = '/iou/submit'
redirect = `/shareIOU?id=${this.info.id}`
} else if (this.info.status === '待确认') {
url = '/iou/comfirm'
redirect = `/borrowContent?id=${this.info.id}`
} else if (this.info.status === '已驳回') {
url = '/iou/submit'
redirect = `/shareIOU?id=${this.info.id}`
} else {
this.isLoading = false
return
}
const {data} = await this.$axios.post(url, {
userId: this.userInfo.id,
id: this.info.id,
password: password,
})
this.isLoading = false
if (data.success) {
this.$store.dispatch('displayMessage', '借条提交成功')
if (this.info.status === '待确认') {
return this.getData()
}
this.$router.push(redirect)
} else {
this.$store.dispatch('displayMessage', data.msg)
}
},
async cancel(password) {
this.passwordPannelDisplay = false
this.isLoading = true
let url = ''
let successMsg = ''
if (this.info.status === '未发起') {
url = '/iou/delete'
successMsg = '借条取消成功'
} else if (this.info.status === '待确认') {
url = '/iou/reject'
successMsg = '借条驳回成功'
} else if (this.info.status === '已驳回') {
url = '/iou/delete'
successMsg = '借条取消成功'
} else {
this.isLoading = false
return
}
const {data} = await this.$axios.post(url, {
userId: this.userInfo.id,
id: this.info.id,
password: password,
})
this.isLoading = false
if (data.success) {
this.$store.dispatch('displayMessage', successMsg)
this.$router.push(`/`)
} else {
this.$store.dispatch('displayMessage', data.msg)
}
}
}
}
</script>
<style lang="scss" scoped>
#comfirmedBorrow {
/deep/ .toolbarGrey {
background-color: #3A424A !important;
}
/deep/ .gold {
background-color: #dabb84 !important;
}
.infoCards {
background-color: $toolbar-grey;
color: $gold;
border-radius: 2px;
margin-bottom: 1rem;
position: relative;
overflow:hidden;
.infoCardsTitle {
height: 3rem;
box-sizing: border-box;
line-height: 3rem;
padding: 0;
border-bottom: 1px solid $gold;
.infoCardsName {
width: 50%;
padding-left: 0.8rem;
font-size: 16px;
}
.infoCardsDetail {
width: 50%;
padding-right: 0.8rem;
font-size: 16px;
text-align: right;
i {
color: $gold;
}
}
}
.infoCardsContent {
width: 100%;
padding: 0.3rem 0 0 0;
.infoCardsContentBlock {
width: 33%;
display: inline-block;
text-align: center;
.infoCardsContentKey {
font-size: 0.8rem;
color: #fff;
}
.infoCardsContentValue {
font-size: 0.8rem;
color: $gold;
margin: auto;
}
}
}
}
/deep/ .tabs__items {
background-color: $background-black;
}
.itemsCard {
// height: 50vh;
width: 100vw;
// margin: 3vh auto 0 auto;
background-color: $background-black;
}
#waitToPay {
.waitToPayInfo {
width: 100%;
text-align: center;
padding-top: 3vh;
#progress {
width: 100% !important;
}
.InfoBlockTitle {
color: #fff;
font-size: 2rem;
font-weight: 400;
}
.total {
font-size: 2rem;
color: $light-gold;
}
.duration {
color: #fff;
}
.btn-deep {
width: 42%;
margin-top: 2rem;
height: 3rem;
background-image: linear-gradient(-229deg, #DAB269 37%, #E7C78C 87%);
color: $toolbar-grey;
}
.btn-light {
background-color: $toolbar-grey;
width: 90%;
margin-top: 1rem;
height: 3rem;
color: $light-gold;
border: 1px solid $light-gold;
}
}
}
#payRecord {
overflow: auto;
height: 100%;
}
.BorrowList {
width: 100vw;
margin-top: 1.1rem;
border-top: 1px solid #666;
.list {
padding: 0;
background-color: $toolbar-grey;
.listLine.listTitle {
background-color: $background-black;
color: #fff;
}
.listLine {
background-color: $light-background-grey;
color: $background-black;
border-bottom: 1px solid #ccc;
}
.BorrowListTitle {
font-size: 0.8rem;
width: 25%;
align-items: center;
}
}
}
#ConfirmBlock {
width: 100vw;
border-top: 1px solid #979797;
background-color: $toolbar-grey;
position: fixed;
bottom: 0;
text-align: right;
margin-bottom: constant(safe-area-inset-bottom);
margin-bottom: env(safe-area-inset-bottom);
button {
height: 2.5rem;
}
.btn-light {
background-color: $toolbar-grey;
color: $light-gold;
border: 1px solid $light-gold;
}
.btn-deep {
background-image: linear-gradient(-229deg, #DAB269 37%, #E7C78C 87%);
color: $toolbar-grey;
}
}
#FuckIphoneX {
position: fixed;
bottom: 0;
width: 100%;
height: constant(safe-area-inset-bottom);
height: env(safe-area-inset-bottom);
background-color: #39424a;
}
}
.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>