lendHistory.vue
4.46 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>
<v-layout column justify-center align-center id="lendHistory">
<v-flex>
<HistoryStatisticsCard type="lend" :data="overview"/>
<div id="SearchBlock">
<input v-model="search" type="search" id="searchInput" @input="getData" placeholder="搜索姓名"/>
</div>
<div id="SortAndStatusBlock">
<div id="SortBlock">
<v-select
:items="sortItems"
v-model="sort"
label="Select"
color="light-gold"
:dense="true"
:hide-details="true"
@input="getData"
single-line
></v-select>
</div>
<div id="StatusBlock">
<v-select
:items="statusItems"
v-model="status"
label="Select"
color="light-gold"
:dense='true'
:hide-details="true"
@input="getData"
single-line
></v-select>
</div>
</div>
<div class="container">
<HistoryList :list="list" jumpPrefix="confirmedCredit"/>
</div>
</v-flex>
</v-layout>
</template>
<script>
import HistoryStatisticsCard from '@/components/HistoryStatisticsCard'
import HistoryList from '@/components/HistoryList'
import {wechatShareSetting} from '@/helper'
export default {
async asyncData({store, query, app, redirect}) {
let {data} = await app.$axios.get(`/iou/history?type=credit&userId=${store.state.user.id}`)
if (data.success) {
return {list: data.list, overview: data.overview}
} else {
store.dispatch('displayMessage', data.msg)
return {list: [], overview: {
total: '0.00',
interest: '0.00',
times: '0'
}}
}
},
data:() => ({
search: '',
sort: 'endDate,ASC',
status: '',
sortItems: [{text: '还款日期升序', value: 'endDate,ASC'}, {text: '还款日期降序', value: 'endDate,DESC'}, {text: '还款金额降序', value: 'amount,DESC'}, {text: '还款金额升序', value: 'amount,ASC'}],
statusItems: [{text: '默认', value: ''}, {text: '已生效', value: '已生效'}, {text: '已逾期', value: '已逾期'}, {text: '已还清', value: '已还清'}]
}),
head:() => ({
title: '借出记录'
}),
components: {
HistoryStatisticsCard,
HistoryList
},
mounted() {
wechatShareSetting(this.$axios, this.$store)
},
methods: {
async getData() {
let {data} = await this.$axios.get(`/iou/history?type=credit&userId=${this.$store.state.user.id}&sort=${this.sort}&status=${this.status}&search=${this.search}`)
if (data.success) {
this.list = data.list
} else {
this.$store.dispatch('displayMessage', data.msg)
}
}
}
}
</script>
<style lang="scss" scpoed>
#lendHistory {
#SearchBlock {
width: 100vw;
padding: 0.9rem 0.7rem;
#searchInput {
background-color: $menu-grey;
border: 1px solid #979797;
border-radius: 0.5rem;
width: 100%;
height: 2rem;
text-align: center;
outline: none;
color: $light-gold;
&.empty {
font-family: 'Material Icons';
}
}
::-moz-placeholder { color: $light-gold; opacity: 0.5; line-height: 1.2rem;}
::-webkit-input-placeholder { color:$light-gold; opacity: 0.5; line-height: 1.2rem; }
:-ms-input-placeholder { color:$light-gold; opacity: 0.5; line-height: 1.2rem; }
}
#SortAndStatusBlock {
width: 100%;
background-color: $menu-grey;
padding: 0.5rem 0;
.input-group {
padding-top: 0;
.input-group__selections {
.input-group__selections__comma {
color: $light-gold;
justify-content: center;
width: 100%;
}
}
.input-group__append-icon {
color: $light-gold;
}
.input-group__details {
display: none;
}
}
/deep/ .menu__content {
background-color: #fff;
a.list__tile--active {
color: $light-gold;
}
}
#SortBlock {
width: 50%;
display: inline-block;
}
#StatusBlock {
width: 50%;
display: inline-block;
border-left: 2px solid $light-gold;
}
}
}
.container {
height: 50vh;
padding: 0;
}
</style>