customer.vue
3.32 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
<template>
<div class="tagContainer">
<template v-if="customerInfoList && customerInfoList.length > 0">
<div class="customerList">
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<div class="customer" v-for="(item) in customerInfoList" :key="item.id" @click="gotoInfo(item)">
<div class="customer-portrait">
<img :src="item.avatar" alt="" v-if="item.avatar" />
<img src="../../assets/images/user.png" alt="" v-else />
</div>
<div class="customer-info">
<div class="customer-info-name">
<label class="name text-hide">
{{ item.customerName }}
</label>
<label class="origin">{{ item.type == 1 ? '@微信' : item.type == 2 ? '@企微' : '' }}</label>
</div>
</div>
<div class="buttomLine"></div>
</div>
</scroll-view>
</div>
</template>
<empty v-else description="暂无数据" />
</div>
</template>
<script>
import { wxConfig } from '@/api'
import { mapState } from 'vuex'
export default {
data() {
return {
}
},
name: 'customer',
computed: {
...mapState({
customerInfoList: state => state.solicit.customerInfoList
})
},
mounted() {
// this.initWx()
},
methods: {
//初始化微信接口
initWx() {
wxConfig.init(['openEnterpriseChat']).then(() => { })
},
//打开会话
gotoInfo(item) {
let seach = {
userIds: [this.workUserId], //参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
externalUserIds: [item.userid], // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
chatId: ''
}
wxConfig.openEnterpriseChat(seach).then(res => {
// console.log(res)
})
},
onReachBottom() {
this.$refs.scrollView.loading = false
this.$refs.scrollView.finished = true
}
}
}
</script>
<style lang="scss" scoped>
.tagContainer {
.customerList {
// background: #fff;
.customer {
padding: 0 8px;
box-sizing: border-box;
display: flex;
align-items: center;
position: relative;
.customer-portrait {
width: 44px;
height: 44px;
padding: 12px 16px;
img {
width: 100%;
}
}
.customer-info {
padding: 16px 0;
width: calc(100% - 130px);
.customer-info-name {
font-size: 16px;
line-height: 22px;
color: #333333;
display: flex;
.name {
max-width: 70%;
}
.origin {
font-size: 14px;
color: #2cca74;
margin-left: 6px;
}
}
}
}
}
.buttomLine {
position: absolute;
left: 0;
bottom: 0;
width: 375px !important;
height: 1px;
opacity: 0.3;
background-color: #c3c3c3 !important;
}
}
.tagContainer /deep/ .van-checkbox__icon--checked .van-icon {
color: #fff;
background-color: #3975c6 !important;
border-color: #3975c6 !important;
}
.tagContainer /deep/.van-checkbox__icon .van-icon {
width: 16px;
height: 16px;
}
</style>