Commit 97e4bb72 by 匡雅琴

群发客户列表分页

1 parent 58d4243e
......@@ -137,7 +137,7 @@ const staffList = params => {
}
// 客户群发客户列表
const customerDetailList = params => {
params.method = `${path}customer.list`
params.method = `${path}customer.list.page`
return http({
url: URL,
method: 'GET',
......
......@@ -48,14 +48,14 @@
<div class="detail-modular">
<div class="title">客户详情</div>
<div class="detail-info">
<el-menu :default-active="customIndex" class="el-menu-demo" mode="horizontal" @select="handleCustomSelect">
<el-menu :default-active="customIndex" class="el-menu-demo" mode="horizontal" @select="handleCustomSelect" infinite-scroll-distance="10">
<el-menu-item index>全部</el-menu-item>
<el-menu-item index="1">已送达客户</el-menu-item>
<el-menu-item index="0">未送达客户</el-menu-item>
<el-menu-item index="2">客户送达失败</el-menu-item>
</el-menu>
<div class="detail-total">共 {{ customerlist.length || 0 }} 人</div>
<div v-if="customerlist.length != 0" class="info-list">
<div class="detail-total">共 {{ customerCount || 0 }} 人</div>
<div v-if="customerCount != 0" class="info-list" v-infinite-scroll="customerDetailLoad" immediate-check="false">
<div class="info-item" v-for="item in customerlist" :key="item.id">
<img class="info-avatar" :src="item.avatar ? item.avatar : require('@/assets/guestCustom/default-avatar.png')" alt />
<div class="info-content info-custom">
......@@ -108,7 +108,14 @@ export default {
eventBus: new Vue(),
isDisabled: false,
footerLeft: 0,
footerWidth: 0
footerWidth: 0,
// 客户详情分页
customerPage: {
pageSize: 10,
pageNum: 1
},
// 客户详情总数
customerCount: 0
}
},
mounted() {
......@@ -126,8 +133,19 @@ export default {
this.activeIndex = val
this.getStaffList(val)
},
// 客户详情选择切换
handleCustomSelect(val) {
this.customIndex = val
this.customerlist = []
// 获取滑动高度清0,防止tab切换时记录滚动条位置问题
var scrolltopList = document.querySelectorAll('.info-list')
if (scrolltopList) {
scrolltopList[1] ? (scrolltopList[1].scrollTop = 0) : ''
}
this.customerPage = {
pageSize: 10,
pageNum: 1
}
this.getCustomerList(val)
},
remind(data, index) {
......@@ -163,10 +181,28 @@ export default {
this.employeelist = res ? res : []
})
},
// 客户详情下拉加载
customerDetailLoad() {
// 详情列表有数据时才触发
if (this.customerlist.length > 0) {
this.customerPage.pageNum++
// 详情数组数量小于总数才触发,带上切换的tab值
if (this.customerlist.length < this.customerCount) this.getCustomerList(this.customIndex)
}
},
// 获取客户详情列表
getCustomerList(status = null) {
const id = this.$route.params.id
this.$apis.customerTransform.customerDetailList({ id, status }).then(res => {
this.customerlist = res ? res : []
var params = JSON.parse(JSON.stringify(this.customerPage))
params.status = status
params.id = id
this.$apis.customerTransform.customerDetailList(params).then(res => {
this.customerCount = res.count
if (!res.data.length) {
this.customerlist = []
return
}
this.customerlist.push(...res.data)
})
},
remindUserGroup() {
......@@ -276,7 +312,7 @@ export default {
margin-top: 0;
margin-left: 10px;
&.send {
width: 70px;
width: 80px;
}
span {
vertical-align: middle;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!