lendHistory.vue
2.22 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
<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" :class="!!search ? '' : 'empty'" @input="getData" placeholder="搜索姓名 search"/>
</div>
<HistoryList :list="list"/>
</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: '',
}),
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}&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; line-height: 1.2rem;}
::-webkit-input-placeholder { color:$light-gold; line-height: 1.2rem; }
:-ms-input-placeholder { color:$light-gold; line-height: 1.2rem; }
}
}
</style>