index.vue
5.63 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
<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">
<label>{{ item.nickName }}</label>
{{ item.type == 1 ? '@微信' : '' }}
</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>
<van-popup v-model="show" position="bottom" round :style="{ 'min-height': '40%', 'max-height': '80%', 'overflow-y': 'hidden', 'padding-bottom': '30px' }">
<div class="popup-header">
<div class="popup-title">访问记录</div>
<div class="popup-icon"><van-icon name="cross" @click="show = false" /></div>
</div>
<div class="popup-content">
<div class="popup-content-header">
<div class="popup-item">序号</div>
<div class="popup-item">访问页面</div>
<div class="popup-item">访问时间</div>
</div>
<div class="popup-content-body" v-for="(item, index) in detailList" :key="item.id">
<div class="popup-item">{{ index + 1 }}</div>
<div class="popup-item">{{ item.pageName }}</div>
<div class="popup-item">{{ item.createdTime }}</div>
</div>
</div>
</van-popup>
</template>
<van-empty description="暂无数据" v-else />
</div>
</template>
<script>
import { businessApi } from '@/api'
export default {
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 {
position: absolute;
top: 48px;
height: calc(100% - 48px);
width: 100%;
left: 0px;
::v-deep {
.van-pull-refresh__track {
overflow: auto;
}
}
}
.proxy-list {
height: 48px;
line-height: 48px;
background: #ffffff;
box-shadow: inset 0 -1px 0 0 #f2f2f2;
display: flex;
&.proxy-header {
position: fixed;
width: 100%;
top: 0px;
left: 0px;
background: #f2f2f2;
.proxy-item {
&:last-child {
color: #414141;
}
}
}
.proxy-item {
font-size: 13px;
color: #414141;
text-align: center;
&.proxy-nickname {
color: #2cca74;
label {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: #414141;
max-width: 70px;
}
}
&:first-child {
width: 120px;
display: flex;
align-items: center;
justify-content: center;
}
&:last-child,
&:nth-child(2),
&:nth-child(3) {
flex: 1;
}
&:last-child {
color: #3975c6;
}
}
}
.popup-header {
height: 56px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0px 16px;
.popup-title {
font-weight: 500;
font-size: 16px;
color: #222222;
}
}
.popup-content {
max-height: calc(80vh - 50px);
overflow: auto;
&-header {
display: flex;
height: 40px;
line-height: 48px;
background: #f2f2f2;
text-align: center;
.popup-item {
font-weight: 600;
font-size: 14px;
color: #333333;
}
}
&-body {
display: flex;
height: 48px;
line-height: 48px;
background: #ffffff;
border: 1px solid #e5e5e5;
text-align: center;
}
.popup-item {
font-size: 14px;
color: #666666;
&:first-child {
width: 60px;
}
&:nth-child(2),
&:nth-child(3) {
flex: 1;
}
}
}
</style>