waitForDeal.vue
2.13 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
<template>
<v-layout column justify-center align-center>
<v-flex>
<div id="tabBlock">
<div id="isBorrowing" :class="tabChoose === 'borrow' ? 'isChoosing' : ''" @click="tabChange('borrow')">正在借款</div>
<span id="tabDivider"></span>
<div id="isLending" :class="tabChoose === 'credit' ? 'isChoosing' : ''" @click="tabChange('credit')">正在出借</div>
</div>
<HistoryList :list='displayList' jumpPrefix='borrowContent' height="87"/>
</v-flex>
<div id="FuckIphoneX"></div>
</v-layout>
</template>
<script>
import HistoryList from '@/components/HistoryList'
import {wechatShareSetting} from '@/helper'
export default {
async asyncData({store, query, app, redirect}) {
let {data} = await app.$axios.get(`/iou/unfinishList?userId=${store.state.user.id}`)
if (data.success) {
return {
borrow: data.list.borrow,
credit: data.list.credit,
}
} else {
// store.dispatch('displayMessage', data.msg)
return {
borrow: [],
credit: [],
}
}
},
data:() => ({
navTarget: 'buJieTiao',
}),
computed: {
userInfo () {
return this.$store.state.user
},
tabChoose() {
return this.$store.state.index.tab
},
displayList() {
return (this.tabChoose === 'borrow' ? this.borrow : this.credit)
}
},
components: {
HistoryList
},
mounted() {
wechatShareSetting(this.$axios, this.$store)
},
methods: {
tabChange(tab) {
if (this.tabChoose !== tab) {
this.$store.commit('changeIndexTab', tab)
}
},
}
}
</script>
<style lang="scss" scoped>
body {
height: 100%;
overflow: hidden;
}
#tabBlock {
width: 100%;
padding-top: 1.5rem;
div {
width: calc(50% - 2px);
display: inline-block;
text-align: center;
height: 18px;
font-size: 18px;
transition: color 0.3s ease-in-out;
-webkit-transition: color 0.3s ease-in-out;
}
#tabDivider:before {
content: "";
height: 18px;
width: 0;
border: 2px solid $gold;
}
.isChoosing {
color: $gold;
}
}
</style>