apply.vue
7.64 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<template>
<div class="apply-wrap">
<template v-if="count">
<van-pull-refresh class="content" v-model="refreshing" @refresh="onRefresh">
<van-list v-model="loading" :finished="finished" finished-text="已经到底啦" @load="onLoad">
<template v-for="(i, index) in dataList">
<div class="apply-item" :key="index">
<div class="apply-item-head">
<div class="title flex">
<div class="maxWidth">{{ i.merchantName }}</div>
</div>
<div class="type">主营: {{ i.carModel ? i.carModel : '--' }}</div>
</div>
<div class="apply-item-content">
<div class="content-wrap flex">
<div class="title">申请场景</div>
<div class="info">{{ i.businessScenario ? i.businessScenario : '--' }}</div>
</div>
<div class="content-wrap flex-top">
<div class="title">申请活动</div>
<div class="info">{{ i.productItems ? i.productItems : '--' }}</div>
</div>
<div class="content-wrap flex">
<div class="title">申请时间</div>
<div class="info">{{ i.createdTime }}</div>
</div>
<div class="content-wrap flex">
<div class="title">申请人</div>
<div class="info linkman flex" @click="makePhone(i)">
<div style="max-width: 120px; overflow: hidden; white-space: nowrap">{{ i.contactName }}</div>
<span class="phone-num">{{ i.contactPhone }}</span>
<div class="sprite-icon icon-phone"></div>
</div>
</div>
</div>
<div class="apply-item-footer flex">
<div class="flex">
<template v-if="index == 0">
<van-popover v-model="showPopover" theme="dark" placement="top-start">
<div class="tip">点击可切换状态</div>
<template #reference>
<div :class="['sprite-icon', i.followType == 0 ? ' icon-remove' : ' icon-collect']" @click.stop="checkCollect(i)"></div>
</template>
</van-popover>
</template>
<div v-else :class="['sprite-icon', i.followType == 0 ? ' icon-remove' : ' icon-collect']" @click.stop="checkCollect(i)"></div>
<div :class="['follew-result', i.followType == 0 ? 'fail' : 'success']">{{ i.followType == 0 ? '未跟进' : '已跟进' }}</div>
</div>
<div class="record" @click.stop="popupShow(i)">访问记录</div>
</div>
</div>
</template>
</van-list>
</van-pull-refresh>
</template>
<van-empty description="暂无数据" v-else />
<popup-comp :show.sync="show" :list="detailList"></popup-comp>
</div>
</template>
<script>
import { Toast } from 'vant'
import { businessApi } from '@/api'
import popupComp from './popupComp.vue'
export default {
components: {
popupComp
},
data() {
return {
dataList: [],
detailList: [],
loading: false,
finished: false,
refreshing: false,
show: false,
count: 1,
pageNum: 0,
pageSize: 20,
showPopover: true,
uuid: ''
}
},
mounted() {
this.uuid = this.getLocalStorage('dj_scrm_userInfo').uuid ? this.getLocalStorage('dj_scrm_userInfo').uuid : null
setTimeout(() => {
this.showPopover = false
}, 3000)
},
methods: {
makePhone(item) {
this.makePhoneCall(item.contactPhone)
},
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.activityRecord()
this.loading = false
}
} else {
this.loading = false
this.finished = true
}
},
activityRecord(isdiff) {
this.loading = true
const { pageNum, pageSize, uuid } = this
businessApi.activityRecord({ pageNum, pageSize, userType: 2, uuid }).then(res => {
if (res) {
const dataList = res.data
this.dataList = this.dataList.concat(dataList)
this.count = res.count
if(isdiff) Toast('刷新成功');
if (this.dataList.length <= this.count) {
if (this.count === 0) {
this.finished = true
} else {
this.finished = false
}
}
this.loading = false
}
})
},
onRefresh() {
this.dataList = []
this.pageNum = 1
let isdiff = 1
this.activityRecord(isdiff)
if (this.refreshing) {
this.content = this.dataList
this.dataList = this.content
this.refreshing = false
}
this.loading = false
},
popupShow(item) {
let data = {
activityId: item.activityId
}
this.detailList = []
businessApi.getActivityRecord(data).then(res => {
this.show = true
this.detailList = res ? res : []
})
},
checkCollect(item) {
this.show = false
let data = {
activityId: item.activityId,
followType: item.followType == 0 ? 1 : 0
}
businessApi.activityFollow(data).then(res => {
if (res.code == 0) {
this.dataList = []
this.activityRecord()
Toast('跟进状态修改成功')
}
})
}
}
}
</script>
<style lang='scss' scoped>
.apply-wrap {
padding: 12px;
.content {
height: calc(100% - 80px);
overflow: scroll;
}
.apply-item {
box-sizing: border-box;
background: #fff;
box-shadow: 0 4px 8px 0 rgba(224, 224, 224, 0.5);
margin-bottom: 12px;
&-head {
padding: 10px 16px 12px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
.title {
font-weight: 600;
font-size: 16px;
color: #333333;
line-height: 24px;
}
.maxWidth {
max-width: 350px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.type {
font-weight: 400;
font-size: 12px;
color: #999999;
line-height: 16px;
}
}
&-content {
padding: 12px 16px 10px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
.content-wrap {
margin-bottom: 8px;
.title {
font-weight: 400;
font-size: 14px;
color: #999999;
width: 56px;
text-align: left;
white-space: nowrap;
}
.info {
font-weight: 400;
font-size: 14px;
color: #333333;
margin-left: 16px;
}
.linkman {
height: 32px;
background: #f5f7fa;
border-radius: 4px;
line-height: 32px;
padding: 0 8px;
box-sizing: border-box;
.phone-num {
color: #6e6e7a;
margin: 0 6px 0 4px;
}
}
}
}
&-footer {
height: 48px;
padding: 0 16px 0 12px;
box-sizing: border-box;
justify-content: space-between;
font-size: 14px;
.follew-result {
color: #f0aa06;
}
.fail {
color: #999999 !important;
}
.record {
color: #3975c6;
text-align: right;
}
}
.icon-remove,
.icon-collect {
margin-right: 8px;
}
}
}
</style>