lookCustomer.vue
7.15 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
<template>
<div class="customer-container" v-if="flag">
<div class="customer-container-head">
<div class="font-16 color54 line-24 title text-hide">{{ groupName }}</div>
<div class="search-head flex">
<van-dropdown-menu active-color="#3369B1">
<van-dropdown-item v-model="searchType" :options="seachArray" @change="selectType" />
</van-dropdown-menu>
<search :keyword="keyWord" placeholder="请输入关键字" @search="searchkeyWord"></search>
</div>
<drop-down :selectOption1="statusList" :selectOption2="resultList" :currentValue1="status" :currentValue2="result" @changeFirst="changeFirst" @changeSecond="selectSecondChange"></drop-down>
</div>
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<customer-card v-if="customerInfo.length > 0" :customerInfo="customerInfo" @showFollowPop="showFollowPop" @showInfoPop="showInfoPop" @showAction="showAction"></customer-card>
<empty v-else></empty>
</scroll-view>
<!-- 跟进弹窗 -->
<customer-follow-popup ref="customerFollowRef" :info="followCustomerData" @changeIndexEvent="changeIndexEvent"></customer-follow-popup>
<!-- 客户信息弹窗 -->
<customer-info-popup ref="customerInfoRef"></customer-info-popup>
<van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" cancel-text="取消" close-on-click-action @cancel="onCancel" />
</div>
</template>
<script>
import { mapState } from 'vuex'
import { solicitApi } from '@/api'
import { Notify } from 'vant'
export default {
data() {
return {
// 电话营销弹窗
show: false,
actions: [{ name: '呼叫' }, { name: '复制' }],
phoneNumber: '',
flag: false,
keyWord: '',
status: 0,
result: 0,
searchType: 0,
seachArray: [
{ text: '客户姓名', value: 0 },
{ text: '车牌号', value: 1 },
{ text: '车架号', value: 2 },
{ text: '手机号码', value: 3 }
],
customerInfo: [],
statusList: [
{ text: '全部状态', value: 0 },
{ text: '已跟进', value: 1 },
{ text: '未跟进', value: 2 }
],
resultList: [{ text: '全部结果', value: 0 }],
followCustomerData: {},
customerIndex: 0
}
},
computed: {
...mapState({
followResultList: state => state.solicit.followResultList,
staffId: state => state.solicit.staffId,
activityId: state => state.solicit.activityId
})
},
created() {
this.groupId = this.getQuery().groupId
this.groupName = this.getQuery().groupName ? this.getQuery().groupName : ''
},
mounted() {
this.initOption()
this.showLoading()
this.getSendCustomerList()
},
methods: {
// 初始化微信接口
initWx() {
window.$wx = wxConfig
window.$wx.init(['setClipboardData', 'navigateToAddCustomer', 'openEnterpriseChat', 'makePhoneCall']).then(() => {})
},
// 电话招揽弹窗关闭
onCancel() {
this.show = false
},
// 选择电话营销方式
onSelect(e) {
// 呼叫
if (e.name === '呼叫') {
// window.location.href = 'tel://' + this.telNumber
this.makePhoneCall(this.phoneNumber)
return
}
// 复制
this.setClipboardData(this.phoneNumber)
},
showFollowPop(data) {
this.$refs.customerFollowRef.init()
this.customerIndex = data.customerIndex
this.followCustomerData = data.followCustomerData
},
showInfoPop(data) {
this.$refs.customerInfoRef.getCustomerDetail(data.followCustomerData)
},
showAction(data) {
this.show = true
this.phoneNumber = data.phoneNumber
},
changeIndexEvent() {
let params = {
customerId: this.followCustomerData.actCutId
}
solicitApi.getCustomerDetail(params).then(({ code, data, message }) => {
if (code == 0) {
data.solicitTime = data.solicitTime ? data.solicitTime.slice(0, 11) : data.solicitTime
data.updatedTime = data.updatedTime ? data.updatedTime.slice(0, 11) : data.updatedTime
this.customerInfo[this.customerIndex] = data
if (data.followFlag == 2) {
this.customerInfo.splice(this.customerIndex, 1)
} else {
this.$set(this.customerInfo, this.customerIndex, data)
}
} else {
Notify(message)
}
})
},
// 获取送达客户信息
getSendCustomerList(index) {
this.hideLoading()
let params = {
keyWord: this.keyWord,
type: this.searchType + 1,
customerGroupType: 2,
id: this.activityId,
staffId: this.staffId,
groupId: this.groupId,
followFlag: this.status == 0 ? 10 : this.status == 2 ? 0 : this.status //0未跟进、1已跟进
}
if (this.status != 2) {
params.followResult = this.result != 0 ? this.result : ''
}
solicitApi.getCustomerList(params).then(({ code, data, message }) => {
if (code == 0) {
data.map(item => {
item.solicitTime = item.solicitTime ? item.solicitTime.slice(0, 11) : item.solicitTime
item.updatedTime = item.updatedTime ? item.updatedTime.slice(0, 11) : item.updatedTime
})
this.customerInfo = data
} else {
Notify(message)
}
this.flag = true
})
},
onReachBottom() {
this.$refs.scrollView.loading = false
this.$refs.scrollView.finished = true
},
searchkeyWord(e) {
this.keyWord = e
if (this.searchType != 0 && this.keyWord.length <= 2 && this.keyWord != '') {
return
}
this.getSendCustomerList()
},
selectType() {
this.keyWord = ''
},
changeFirst(index) {
this.status = index
this.result = 0
this.getSendCustomerList()
},
selectSecondChange(index) {
this.result = index
this.getSendCustomerList()
},
initOption() {
this.followResultList.forEach(item => {
this.resultList.push({
text: item.dictLabel,
value: item.dictValue
})
})
}
}
}
</script>
<style lang="scss" scoped>
.customer-container {
&-head {
height: 142px;
background: #fff;
margin-bottom: 12px;
.search-head {
padding: 0 16px;
height: 50px;
box-sizing: border-box;
border-bottom: 1px solid rgba(216, 216, 216, 0.3);
/deep/.van-dropdown-menu__bar {
box-shadow: 0 0 0 #fff;
font-weight: 400;
margin-right: 13px;
}
/deep/ .van-dropdown-menu__title {
font-size: 14px !important;
color: #333333 !important;
}
/deep/ .van-search {
width: 250px;
padding: 0;
}
/deep/ .van-dropdown-item__content {
width: 160px;
background: #ffffff;
border-radius: 8px;
margin: 4px 0 0 8px;
/deep/ .van-cell__title {
text-align: center;
}
/deep/ .van-cell__value {
display: none;
width: 0;
}
}
}
.title {
padding: 10px 16px;
}
}
.content {
height: calc(100vh - 154px);
/deep/ .van-list {
background: #f7f7f7;
}
}
}
</style>