Commit fe8fda2f by 王志慧

commit

1 parent 88cd0e24
// const url = 'http://192.168.3.191:8064/rop-scrm-entmicro/router' // const url = 'http://192.168.2.42:8064//rop-scrm-entmicro/router'
const url = '/rop-scrm-entmicro/router' const url = '/rop-scrm-entmicro/router'
const returnAll = true const returnAll = true
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
}) })
}, },
/**标签数据获取 */ /**标签数据获取 */
gettaggingList(data={}) { gettagList(data={}) {
data.method = 'entmicro.api.qywechat.tagging.info' data.method = 'entmicro.api.qywechat.tagging.info'
return window.$HTTP({ return window.$HTTP({
url, url,
...@@ -22,4 +22,13 @@ export default { ...@@ -22,4 +22,13 @@ export default {
returnAll returnAll
}) })
}, },
/**给客户打标签 */
putCustomertag (data={}) {
data.method = 'entmicro.api.qywechat.tagging.put.customer'
return window.$HTTP({
url,
data,
returnAll
})
},
} }
...@@ -27,7 +27,9 @@ export default { ...@@ -27,7 +27,9 @@ export default {
add, add,
tag tag
}, },
created() {}, created() {
},
methods: { methods: {
changeTabs(e) { changeTabs(e) {
let tabTop = document.querySelector('#tabId').offsetTop let tabTop = document.querySelector('#tabId').offsetTop
......
<template> <template>
<div class="tagContainer"> <div class="tagContainer">
<search placeholder="请输入关键字" v-if="isTitle" :keyword="keyword" @search="searchKeyword"></search> <search placeholder="请输入关键字" v-if="isTitle" :keyword="keyWord" @search="searchkeyWord"></search>
<tip :title="title"></tip> <tip :title="title"></tip>
<template v-if="customerList && customerList.length > 0"> <template v-if="customerList && customerList.length > 0">
<div class="customerList"> <div class="customerList">
<scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView"> <scroll-view class="content" @ReachBottom="onReachBottom" ref="scrollView">
<div class="customer" v-for="(item, index) in customerList" :key="item.id" @click="gotoInfo(item)"> <div class="customer" v-for="(item, index) in customerList" :key="item.id" @click="gotoInfo(item)">
<!-- <div class="checked-box"> <div class="checked-box">
<template v-if="item.isChecked"> <template v-if="item.isChecked">
<div class="sprite-icon icon-customer-active" @click.stop="toggleHandle(index)"></div> <div class="sprite-icon icon-customer-active" @click.stop="toggleHandle(index)"></div>
</template> </template>
<template v-else> <template v-else>
<div class="checked" @click.stop="toggleHandle(index)"></div> <div class="checked" @click.stop="toggleHandle(index)"></div>
</template> </template>
</div> --> </div>
<div class="customer-portrait"> <div class="customer-portrait">
<img :src="item.avatar" alt="" /> <img :src="item.avatar" alt="" />
</div> </div>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="buttomLine"></div> <div class="buttomLine"></div>
</div> </div>
</scroll-view> </scroll-view>
<template v-if="isTitle"> <template>
<div class="footer"> <div class="footer">
<div class="checked-box"> <div class="checked-box">
<template v-if="allChecked"> <template v-if="allChecked">
...@@ -52,18 +52,20 @@ ...@@ -52,18 +52,20 @@
</div> </div>
</template> </template>
<empty v-else description="暂无数据" /> <empty v-else description="暂无数据" />
<make @success="successHandle" ref="popRefs"></make> <make @success="successHandle" :externalUserIds="externalUserIds" ref="popRefs"></make>
</div> </div>
</template> </template>
<script> <script>
import make from './make.vue' import make from './make.vue'
import { groupTag, ssoApi, groupCustomer, wxConfig } from '@/api' import { groupTag, ssoApi, groupCustomer, wxConfig } from '@/api'
import { Toast } from 'vant'
export default { export default {
components: { make }, components: { make },
data() { data() {
return { return {
keyword: '', keyWord: '',
customerList: [], customerList: [],
externalUserIds: [],
checkList: [], checkList: [],
allChecked: false, allChecked: false,
title: '', title: '',
...@@ -113,10 +115,11 @@ export default { ...@@ -113,10 +115,11 @@ export default {
}, },
init() { init() {
//获取打标签客户列表 //获取打标签客户列表
let seacrh = { let obj = {
keyword: this.keyword keyWord: this.keyWord
} }
groupTag.getcustomerList(seacrh).then(res => { this.allChecked = false
groupTag.getcustomerList(obj).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.customerList = res.data this.customerList = res.data
this.title = `您共有 ${this.customerList.length}位客户暂未添加标签` this.title = `您共有 ${this.customerList.length}位客户暂未添加标签`
...@@ -134,7 +137,7 @@ export default { ...@@ -134,7 +137,7 @@ export default {
toggleHandle(index) { toggleHandle(index) {
this.customerList[index].isChecked = !this.customerList[index].isChecked this.customerList[index].isChecked = !this.customerList[index].isChecked
let array = [] let array = []
this.customerList.map(item => { this.customerList.forEach(item => {
if (item.isChecked) { if (item.isChecked) {
array.push(item) array.push(item)
} }
...@@ -147,17 +150,29 @@ export default { ...@@ -147,17 +150,29 @@ export default {
this.customerList.forEach(item => { this.customerList.forEach(item => {
item.isChecked = this.allChecked item.isChecked = this.allChecked
}) })
this.toggleHandle()
}, },
searchKeyword(e) { searchkeyWord(e) {
this.keyword = e this.keyWord = e
this.init() this.init()
}, },
handleTag() { handleTag() {
this.$refs.popRefs.toggle() this.externalUserIds = []
this.customerList.forEach(item => {
item.isChecked ? this.externalUserIds.push(item.userid) : ''
})
console.log(this.externalUserIds)
if (this.externalUserIds.length > 0) {
this.$refs.popRefs.toggle()
} else {
Toast('请先选择客户')
}
}, },
successHandle() { successHandle() {
this.$refs.popRefs.toggle() this.$refs.popRefs.toggle()
this.checkList = []
this.externalUserIds = []
this.keyWord = ''
this.init()
}, },
//打开会话 //打开会话
gotoInfo(item) { gotoInfo(item) {
......
<template> <template>
<van-popup v-model="tagShow" position="bottom" :style="{ height: '90%' }"> <van-popup v-model="tagShow" position="bottom" :style="{ height: '90%' }">
<div class="container-pop"> <div class="container-pop">
<!-- <search placeholder="请输入关键字" :keyword="keyword" @search="searchKeyword"></search> --> <search placeholder="请输入关键字" :keyword="keyWord" @search="searchkeyWord"></search>
<div class="close-container" v-if="checkAll.length > 0"> <div class="close-container" v-if="checkAll.length > 0">
<div class="nav-icon"> <div class="nav-icon">
<img src="../../assets/images/icon/nav-icon.png" /> <img src="../../assets/images/icon/nav-icon.png" />
</div> </div>
<template v-for="(closeTag, i) in checkAll"> <template v-for="(closeTag, i) in checkAll">
<div class="close-tag" @click="close(closeTag, i)" :key="i"> <div class="close-tag" @click="close(closeTag, i)" :key="i">
{{ closeTag.text }} {{ closeTag.taggingName }}
<img src="../../assets/images/icon/close-icon.png" /> <img src="../../assets/images/icon/close-icon.png" />
</div> </div>
</template> </template>
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<div class="tag-container"> <div class="tag-container">
<template v-if="tagList.length > 0"> <template v-if="tagList.length > 0">
<div class="tag-type" v-for="(item, index) in tagList" :key="index"> <div class="tag-type" v-for="(item, index) in tagList" :key="index">
<div class="tag-title">{{ item.type }}</div> <div class="tag-title">{{ item.groupName }}</div>
<div class="tag-list"> <div class="tag-list">
<template v-for="(tag, ids) in item.tags"> <template v-for="(tag, ids) in item.taggingList">
<div :key="ids" :class="{ tag: true, active: tag.isChecked }" @click="chooseTag(index, ids)">{{ tag.text }}</div> <div :key="ids" :class="{ tag: true, active: tag.isChecked }" @click="chooseTag(index, ids)">{{ tag.taggingName }}</div>
</template> </template>
</div> </div>
</div> </div>
...@@ -35,103 +35,139 @@ ...@@ -35,103 +35,139 @@
</template> </template>
<script> <script>
import { groupTag } from '@/api' import { groupTag } from '@/api'
import { Toast } from 'vant'
export default { export default {
name: 'make', name: 'make',
data() { data() {
return { return {
keyword: '', keyWord: '',
tagList: [ tagList: [],
{
type: '客户等级',
tags: [
{ text: '核心' },
{
text: '重要'
},
{
text: '一般'
}
]
},
{
type: '保养周期',
tags: [
{ text: '半年' },
{
text: '一年'
}
]
},
{
type: '客户意向',
tags: [
{
text: '意见非常好,可以立即跟进'
},
{
text: '重要'
}
]
}
],
checkAll: [], checkAll: [],
tagShow: false tagShow: false
} }
}, },
created() { created() {
console.log(this.externalUserIds)
this.init() this.init()
}, },
props: {
externalUserIds: {
type: Array,
default: () => []
}
},
methods: { methods: {
chooseTag(index, ids) { chooseTag(index, ids) {
this.tagList[index].tags[ids].isChecked = !this.tagList[index].tags[ids].isChecked this.tagList[index].taggingList[ids].isChecked = !this.tagList[index].taggingList[ids].isChecked
this.add(index, ids) this.add(index, ids)
this.judge(index)
},
judge() {
this.tagList.forEach(item => {
item.checked = false
if (item.taggingList.some(tag => tag.isChecked)) {
item.checked = true
}
})
}, },
add(index, ids) { add(index, ids) {
this.checkAll.push(this.tagList[index].tags[ids]) if (this.tagList[index].taggingList[ids].isChecked) {
this.checkAll.push(this.tagList[index].taggingList[ids])
} else {
this.checkAll.splice(index, 1)
}
}, },
close(data, value) { close(data, value) {
console.log(data)
this.checkAll.splice(value, 1) this.checkAll.splice(value, 1)
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
for (let j = 0; j < this.tagList[i].tags.length; j++) { for (let j = 0; j < this.tagList[i].taggingList.length; j++) {
if (this.tagList[i].tags[j].text == data.text) { if (this.tagList[i].taggingList[j].taggingId == data.taggingId) {
this.tagList[i].tags[j].isChecked = false this.tagList[i].taggingList[j].isChecked = false
} }
} }
} }
this.judge()
}, },
toggle() { toggle() {
this.tagShow = !this.tagShow this.tagShow = !this.tagShow
}, },
init() { init() {
let obj = {
keyWord: this.keyWord
}
groupTag.gettagList(obj).then(res => {
console.log(res)
if (res.data&&res.data.length > 0) {
this.tagList = res.data
if (this.tagList.length > 0) {
for (let i = 0; i < this.tagList.length; i++) {
this.tagList[i].checked = false
for (let j = 0; j < this.tagList[i].taggingList.length; j++) {
this.$set(this.tagList[i].taggingList[j], 'isChecked', false)
}
}
}
} else {
this.tagList = []
}
console.log( this.tagList)
})
},
searchkeyWord(e) {
this.keyWord = e
this.init()
},
clearData() {
if (this.tagList.length > 0) { if (this.tagList.length > 0) {
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
for (let j = 0; j < this.tagList[i].tags.length; j++) { this.tagList[i].checked = false
this.$set(this.tagList[i].tags[j], 'isChecked', false) for (let j = 0; j < this.tagList[i].taggingList.length; j++) {
this.$set(this.tagList[i].taggingList[j], 'isChecked', false)
} }
} }
} }
// groupTag.gettaggingList().then(res => { this.keyWord = ''
// console.log(res) this.checkAll = []
// this.tagList = res.data
// })
},
searchKeyword(e) {
this.keyword = e
}, },
//打标签 //打标签
handleTag() { handleTag() {
this.$emit('success') console.log(this.externalUserIds)
let taggingInfo = []
for (let i = 0; i < this.tagList.length; i++) {
if (this.tagList[i].checked) {
let tagIds = []
this.tagList[i].taggingList.forEach(tag => {
tag.isChecked ? tagIds.push(tag.taggingId) : ''
})
taggingInfo.push({
labelType: this.tagList[i].labelType,
groupId: this.tagList[i].groupId,
tagIds: tagIds.join(',')
})
}
}
if (taggingInfo.length > 0) {
let obj = {
externalUserIds: this.externalUserIds.join(','),
taggingInfo: JSON.stringify(taggingInfo)
}
groupTag.putCustomertag(obj).then(res => {
if (res.data) Toast('标签批量添加成功')
this.clearData()
})
this.$emit('success')
} else {
Toast('请先选择标签')
}
}, },
//重置 //重置
reset() { reset() {
this.checkAll = [] this.checkAll = []
for (let i = 0; i < this.tagList.length; i++) { for (let i = 0; i < this.tagList.length; i++) {
for (let j = 0; j < this.tagList[i].tags.length; j++) { this.tagList[i].checked = false
if (this.tagList[i].tags[j].isChecked) { for (let j = 0; j < this.tagList[i].taggingList.length; j++) {
this.tagList[i].tags[j].isChecked = false this.tagList[i].taggingList[j].isChecked = false
}
} }
} }
} }
...@@ -156,6 +192,7 @@ export default { ...@@ -156,6 +192,7 @@ export default {
.tag-list { .tag-list {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
.tag { .tag {
padding: 4px 12px; padding: 4px 12px;
font-size: 14px; font-size: 14px;
...@@ -165,6 +202,7 @@ export default { ...@@ -165,6 +202,7 @@ export default {
background: #eeeeee; background: #eeeeee;
border-radius: 14px; border-radius: 14px;
margin-left: 12px; margin-left: 12px;
margin-bottom: 10px;
} }
.active { .active {
color: #5850ff; color: #5850ff;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!