CustomerCard.vue
8.17 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<template>
<div>
<div class="customer-box" v-for="(item, index) in customerData" :key="index">
<div class="customer-title">
<div class="customer-name text-hide">{{ item.customerName }}</div>
<div class="customer-carnumber">{{ item.cars && item.cars.length > 0 && item.cars[0].carNumber }}</div>
</div>
<div class="customer-info">
<div class="customer-info-left">
<div class="customer-info-label">
<div class="customer-info-name">车系:</div>
<div class="customer-info-message customer-info-car text-hide">{{ item.cars && item.cars.length > 0 && item.cars[0].carSeries }}</div>
</div>
<div class="customer-info-label">
<div class="customer-info-name">招揽结果:</div>
<div class="customer-info-message">{{ item.followResultEcho }}</div>
</div>
<div class="customer-info-label">
<div class="customer-info-name">企微营销:</div>
<div class="customer-info-message">
{{ item.receiveStatus == 1 ? '已领取' : item.checkStatus == 1 ? '已查看' : item.sendStatus == 1 ? '已送达' : item.sendStatus == 0 ? '未送达' : '' }}
</div>
</div>
</div>
<div class="customer-info-right">
<div class="customer-info-label">
<div class="customer-info-name">企微账号:</div>
<div v-if="item.type">
<span class="customer-info-message customer-info-wechatnick text-hide">{{ item.nickName }}</span>
<span class="customer-info-message" :class="[item.type == 1 ? 'customer-info-wechat' : 'customer-info-qiwechat']">{{ item.type == 1 ? '@微信' : item.type == 2 ? '@企微' : '' }}</span>
</div>
<div class="customer-info-message" v-else>未添加</div>
</div>
<div class="customer-info-label">
<div class="customer-info-name">招揽日期:</div>
<div class="customer-info-message text-hide">{{ item.solicitTime }}</div>
</div>
<div class="customer-info-label">
<div class="customer-info-name">更新日期:</div>
<div class="customer-info-message text-hide">{{ item.updatedTime }}</div>
</div>
</div>
</div>
<div class="customer-marketing">
<div class="sprite-icon icon-tel" @click="callCustomer(item)"></div>
<div class="sprite-icon icon-fllow" @click="followCustomer(item, index)"></div>
<div class="sprite-icon icon-message" @click="sendMessage(item)"></div>
<div class="sprite-icon icon-sendwechat" @click="sendWechat(item)"></div>
</div>
</div>
<!-- 电话营销弹窗 -->
<!-- <van-action-sheet v-model:show="show" :actions="actions" @select="onSelect" cancel-text="取消" close-on-click-action @cancel="onCancel" /> -->
</div>
</template>
<script>
import { Toast } from 'vant'
import { wxConfig } from '@/api'
import CustomerInfoPopup from './CustomerInfoPopup.vue'
import CustomerFollowPopup from './CustomerFollowPopup.vue'
import { ssoApi } from '@/api'
export default {
components: { CustomerInfoPopup, CustomerFollowPopup },
name: 'CustomerCard',
props: {
customerInfo: {
type: Array,
default: () => {
return []
}
},
groupId: {
type: String,
default: () => {
return null
}
},
groupName: {
type: String,
default: () => {
return ''
}
}
},
watch: {
customerInfo(n) {
this.customerData = n
}
},
data() {
return {
// 电话营销弹窗
show: false,
actions: [{ name: '呼叫' }, { name: '复制' }],
chatParams: {
externalUserIds: [],
groupName: '',
userIds: [],
chatId: ''
},
phoneNumber: null,
customerData: this.customerInfo,
customerIndex: 0,
workUserId: ''
}
},
mounted() {
this.initWx()
this.getuserInfo()
},
methods: {
// 初始化微信接口
initWx() {
window.$wx = wxConfig
window.$wx.init(['setClipboardData', 'navigateToAddCustomer', 'openEnterpriseChat', 'makePhoneCall']).then(() => {})
},
getuserInfo() {
ssoApi.getuserInfo().then(res => {
this.workUserId = res.data.workUserId
})
},
changeTab(index) {
this.isShow = false
if (index === 0) {
this.isShow = true
}
},
// 电话招揽
callCustomer(val) {
console.log(val)
if (!val.phoneNumber) {
Toast('系统尚未查询到该用户的电话号码')
return
}
this.phoneNumber = val.phoneNumber
// 打开电话营销弹窗
// this.show = true
this.$emit('showAction', { phoneNumber: this.phoneNumber })
},
// 选择电话营销方式
onSelect(e) {
// 呼叫
if (e.name === '呼叫') {
// window.location.href = 'tel://' + this.telNumber
this.makePhoneCall(this.phoneNumber)
return
}
// 复制
this.setClipboardData(this.phoneNumber)
},
// 电话招揽弹窗关闭
onCancel() {
this.show = false
},
// 招揽跟进
followCustomer(val, index) {
this.$emit('showFollowPop', { customerIndex: index, followCustomerData: val })
},
// 客户详情
sendMessage(val) {
this.$emit('showInfoPop', { followCustomerData: val })
},
// 企微沟通
sendWechat(val) {
// 如果未添加企微客户
if (!val.userId) {
if (val.phoneNumber) {
wx.setClipboardData({
data: val.phoneNumber,
success(res) {
Toast('已复制手机号,请尝试通过用户手机号来添加好友')
},
fail(res) {}
})
} else {
Toast('尚未添加好友,请尝试添加客户为好友')
}
// 如果没有手机号,跳转到添加好友页面
setTimeout(() => {
window.$wx.navigateToAddCustomer().then(res => {
// console.log(res)
})
}, 1000)
return
}
let seach = {
userIds: [], // 参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
externalUserIds: [val.userId], // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
chatId: ''
}
// console.log(seach, 'seach')
wxConfig.openEnterpriseChat(seach).then(res => {
// console.log(res)
})
}
}
}
</script>
<style lang="scss" scoped>
.customer-box {
// width: 100%;
background: #ffffff;
box-shadow: 0px 2px 10px 0px rgba(224, 224, 224, 0.8);
border-radius: 4px;
margin: 0 16px 12px 16px;
}
.customer-title {
display: flex;
justify-content: space-between;
height: 39px;
}
.customer-name {
width: calc(100% - 120px);
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #282829;
line-height: 39px;
padding-left: 12px;
}
.customer-carnumber {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 39px;
white-space: nowrap;
padding-right: 12px;
}
.customer-info {
display: flex;
padding: 12px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
border-top: 1px solid rgba(195, 195, 195, 0.3);
&-left,
&-right {
width: 50%;
}
&-label {
display: flex;
}
&-name {
font-size: 12px;
width: 40%;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
line-height: 18px;
}
&-message {
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 18px;
}
&-wechatnick {
display: inline-block;
max-width: 58px;
}
&-car {
max-width: 80px;
}
&-wechat {
vertical-align: bottom;
color: #2cca74;
}
&-qiwechat {
vertical-align: bottom;
color: #3975c6;
}
}
.customer-marketing {
display: flex;
justify-content: space-around;
padding: 11px 0;
}
.customer-info-qiwechat {
vertical-align: bottom;
// color: #2cca74;
}
</style>