index.vue
4.06 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
<template>
<div>
<template v-if="count">
<div class="proxy-list proxy-header">
<div class="proxy-item">访客</div>
<div class="proxy-item">联系电话</div>
<div class="proxy-item">最后访问日期</div>
<div class="proxy-item">操作</div>
</div>
<div class="proxy-body">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list v-model="loading" :finished="finished" finished-text="已经到底啦" @load="onLoad">
<div class="proxy-list" v-for="item in dataList" :key="item.id">
<div class="proxy-item proxy-nickname">
<div class="label">{{ item.nickName }}</div>
<div>{{ item.type == 1 ? '@微信' : '' }}</div>
</div>
<div class="proxy-item">{{ item.phone }}</div>
<div class="proxy-item">{{ item.lastTime }}</div>
<div class="proxy-item" @click="popupShow(item)">访问记录</div>
</div>
</van-list>
</van-pull-refresh>
</div>
<popup-comp :show.sync="show" :list="detailList"></popup-comp>
</template>
<van-empty description="暂无数据" v-else />
</div>
</template>
<script>
import { businessApi } from '@/api'
import popupComp from './popupComp.vue'
export default {
components: {
popupComp
},
name: 'index',
data() {
return {
dataList: [],
detailList: [],
loading: false,
finished: false,
refreshing: false,
show: false,
count: 1,
pageNum: 0,
pageSize: 20
}
},
methods: {
cardRecordPage() {
this.loading = true
const { pageNum, pageSize } = this
businessApi.cardRecordPage({ pageNum, pageSize }).then(res => {
if (res) {
const dataList = res.data
this.dataList = this.dataList.concat(dataList)
this.count = res.count
if (this.dataList.length <= this.count) {
if (this.count === 0) {
this.finished = true
} else {
this.finished = false
}
}
this.loading = false
}
})
},
popupShow(item) {
this.show = true
this.detailList = item.recordRelationList
},
onLoad() {
this.pageNum++
this.loading = true
const num = this.count / this.pageSize
if (Number.isInteger(num)) {
this.number = num
} else {
this.number = parseInt(num) + 1
}
if (this.dataList.length < this.count) {
if (this.pageNum <= this.number) {
this.cardRecordPage()
this.loading = false
}
} else {
this.loading = false
this.finished = true
}
},
onRefresh() {
this.dataList = []
this.pageNum = 1
this.cardRecordPage()
if (this.refreshing) {
this.content = this.dataList
this.dataList = this.content
this.refreshing = false
}
this.loading = false
}
}
}
</script>
<style lang="scss" scoped>
.proxy-body {
height: calc(100% - 90px);
width: 100%;
left: 0px;
::v-deep {
.van-pull-refresh__track {
overflow: auto;
}
}
}
.proxy-list {
height: 56px;
background: #ffffff;
box-shadow: inset 0 -1px 0 0 #f2f2f2;
display: flex;
align-items: center;
padding: 12px;
box-sizing: border-box;
&.proxy-header {
height: 40px;
background: #f2f2f2;
.proxy-item {
&:last-child {
color: #414141;
}
}
}
.proxy-item {
font-size: 14px;
color: #414141;
text-align: left;
&.proxy-nickname {
color: #2cca74;
font-size: 11px;
.label {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: #414141;
max-width: 70px;
font-size: 14px;
}
}
&:first-child {
width: 84px;
}
&:last-child {
width: 56px;
white-space: nowrap;
}
&:nth-child(2),
&:nth-child(3) {
flex: 1;
}
&:last-child {
color: #3975c6;
}
}
}
</style>