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