hengmei-two/pagesB/customerList/customerList.vue

212 lines
6.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'客户列表'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy30">
<view class="radius20 fon28 col3 mar-sx20">
<view class="disac">
<view @tap="openXial" class="disjbac width100 radius10 pad-zy20 xialak posir">
<view class="" style="color: #B3B3B3;">{{category}}</view>
<image :class="isZhuan?'zhuan':'nozhuan'" src="/static/public/sanj.png" mode="aspectFill"></image>
<!-- 下拉列表 -->
<view v-if="isZhuan" class="posia bacf radius10 xial-box">
<view class="pad-zy20 xial-item-box">
<view @tap="chooseXia(indexl)" :class="xialCurrent==indexl?'pcol':''" v-for="(iteml,indexl) in xialone" :key="indexl">{{iteml.title}}</view>
</view>
</view>
</view>
<view @tap="searchEv" class="flexs tc mar-z30 colf radius10 customer-btn" :style="{background:publicColor}">搜索</view>
</view>
</view>
<!-- 列表 -->
<view v-if="dataList.length!=0" class="dis bacf radius10 pad20 mar-x20 posir" v-for="(item,index) in dataList" :key="index">
<image class="mar-y20 flexs" :src="item.imgSrc" style="width: 98rpx;height: 98rpx;" mode="aspectFill"></image>
<view class="fon24 col3 width100">
<view class="bold disjbac">
<view class="fon28 clips1">{{item.name}}</view>
<view class="flexs">来源{{item.come}}</view>
</view>
<view style="margin: 15rpx 0;">联系方式{{item.phone || '暂无'}}</view>
<view>客服{{item.customer || '暂无'}}</view>
<view class="col80 disjbac" style="margin: 15rpx 0 0 0;">
<view>{{item.time}}</view>
<view class="col3">{{item.qudao}}</view>
</view>
</view>
<view @tap="fenCustomer(index)" class="posia colf fon24 radius10 tc customer-btn"
style="right: 20rpx;bottom: 50rpx;" v-if="item.customer=='' || item.customer==null" :style="{background:publicColor}">分配客服</view>
</view>
<view v-if="dataList.length==0" class="disjcac fc" style="margin-top: 50%;">
<image class="zanw-img" src="/static/public/nothing.png" mode="aspectFill"></image>
<view class="fon24 col3">您搜索的内容暂无结果,换个关键词试试吧</view>
</view>
<!-- 弹框 -->
<pu-po :category="xialtList" @chooseXiaT="chooseXiaT" :isXiala="true" :isShowT="isShowT" :clearVal="'暂不分配'" :comfrimVal="'立即分配'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
<!-- 返回顶部 -->
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
category:'',
dataList:[],
showTop:false,
isShowT:false,
isXiala:true,
isZhuan:false,
xialCurrent:0,
xialone:['全部'],
xialtList:[],
staff_id:'',//员工ID
customer_id:'',//客户ID
page:1,
size:10,
total:'',
isZanw:true,
ntype:''
}
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
// for (let i = 0; i < 4; i++) {
// let obj = {imgSrc:'/static/public/like.png',name:'USER',come:'顾客分享',phone:'18888888888',customer:'恒美植发客服-01',time:'2021-07-15 14:25',qudao:'第二渠道'}
// this.dataList.push(obj)
// }
if(this.total!=this.dataList.length){
this.page++
this.checkCL()
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表数据')
this.isZanw = false
}
},
onShow() {
this.$toolAll.tools.isLogin()
},
onLoad() {
this.checkKF()//查询客服列表
this.checkCL()//客户列表
this.checkLY()//渠道来源
},
methods: {
checkKF(){//查看客户列表
this.$requst.post('user/servicer-list').then(res=>{
// console.log('查询客户列表:',res);
if(res.code==0){
if(res.data.length!=0){
res.data.forEach(item=>{
let obj = {
title:item.name,
id:item.id
}
this.xialtList.push(obj)
})
this.staff_id = this.xialtList[0].id
}
}
},error=>{})
},
searchEv(){//搜索事件
this.page = 1
this.isZanw = true
this.checkCL(this.ntype)
},
checkLY(){//查询来源渠道事件
this.$requst.post('user/channel').then(res=>{
// console.log('来源渠道:',res);
if(res.code==0){
for (let key in res.data) {
let lyObj = {
title:res.data[key],
name:key
}
this.xialone.push(lyObj)
}
this.xialone.unshift({title:"全部",name:'all'})
this.category = this.xialone[0].title
}
},error=>{})
},
checkCL(ntype){//查询客户列表事件
this.$requst.post('user/customer',{page:this.page,size:this.size,type:ntype}).then(res=>{
// console.log('客户列表:',res);
if(res.code==0){
if(this.page==1) this.dataList = []
this.total = res.data.total
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let cuObj = {
id:item.id,
imgSrc:item.headimgurl,
name:item.nickname,
come:item.channel_text,
phone:item.mobile,
customer:item.service[0],
time:item.created_at,
qudao:item.tag[0],
service:item.service
}
this.dataList.push(cuObj)
})
}
}
},error=>{})
},
fenCustomer(index){//分配弹框调起事件
// console.log('分配客服调起弹框');
this.isShowT = true
// 客服列表
this.customer_id = this.dataList[index].id//客户ID
if(this.xialtList.length==0) this.xialtList = ['暂无可分配客服']
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
comfirmev(){//立即分配执行事件
// console.log('立即分配');
this.isShowT = false
this.$requst.post('user/customer-allot',{staff_id:this.staff_id,customer_id:this.customer_id}).then(res=>{
// console.log('分配客服:',res);
if(res.code==0){
this.page = 1
this.$toolAll.tools.showToast('分配成功')
this.checkCL(this.ntype)//客户列表
}
},error=>{})
},
cancleev(){
this.isShowT = false
},
openXial(){
this.isZhuan = !this.isZhuan
// console.log('开启下拉');
},
chooseXia(index){
this.xialCurrent = index
this.ntype = this.xialone[index].name
this.category = this.xialone[index].title
},
chooseXiaT(e){
this.staff_id = e.id
}
}
}
</script>
<style>
</style>