You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
245 lines
6.0 KiB
245 lines
6.0 KiB
3 years ago
|
<template>
|
||
3 years ago
|
<view class="page">
|
||
3 years ago
|
<view class="filter">
|
||
2 years ago
|
<uni-search-bar class="search" radius="30" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" />
|
||
2 years ago
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons>
|
||
3 years ago
|
</view>
|
||
3 years ago
|
<ul class="tab">
|
||
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
|
||
|
</ul>
|
||
3 years ago
|
|
||
3 years ago
|
<template v-if="list.length">
|
||
|
<ul class="list">
|
||
|
<li v-for="item in list" @click="toDetail(item)">
|
||
3 years ago
|
<view class="c-name">{{ item.customerName }}</view>
|
||
3 years ago
|
<view class="info">
|
||
|
<view class="left">
|
||
3 years ago
|
<view class="line">
|
||
|
<text class="name">联系人:</text>
|
||
|
<text class="val">{{ item.orderContact }}</text>
|
||
|
</view>
|
||
|
<view class="line">
|
||
|
<text class="name">账号:</text>
|
||
|
<text class="val">{{ item.account }}</text>
|
||
|
</view>
|
||
|
<view class="line">
|
||
|
<text class="name">产品到期时间:</text>
|
||
3 years ago
|
<text class="val">{{ item.expireDate.split(' ')[0] }}</text>
|
||
3 years ago
|
</view>
|
||
|
<view class="line">
|
||
|
<text class="name">商务经理:</text>
|
||
3 years ago
|
<text class="val">{{ item.businessManagerName }}</text>
|
||
3 years ago
|
</view>
|
||
3 years ago
|
</view>
|
||
|
<view class="type">
|
||
3 years ago
|
{{ filterData[0].data.find(e => e.value === item.customerType).title }}客户
|
||
3 years ago
|
</view>
|
||
3 years ago
|
</view>
|
||
3 years ago
|
</li>
|
||
|
</ul>
|
||
|
<uni-load-more :status="status" />
|
||
|
</template>
|
||
2 years ago
|
<empty v-else text="您当前暂无有下单的客户,请快去给客户下订单吧"></empty>
|
||
3 years ago
|
|
||
3 years ago
|
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons>
|
||
3 years ago
|
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
|
||
3 years ago
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { list, all } from '@/apis/modules/client.js'
|
||
3 years ago
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
3 years ago
|
popup: false,
|
||
|
//筛选表单数据
|
||
|
filterData: [
|
||
|
{
|
||
|
children: false,//是否有子项
|
||
|
title: "客户类型",
|
||
|
key: "customerType", //键名 接收对象名字
|
||
|
keyValue: "value", //获取的值是哪个
|
||
|
isRadio: true, //是否单选 否则多选
|
||
|
data: [
|
||
|
{
|
||
|
title: '正式',
|
||
|
value: 1
|
||
|
},
|
||
|
{
|
||
|
title: '试用',
|
||
|
value: 2
|
||
|
},
|
||
|
{
|
||
|
title: '到期',
|
||
|
value: 3
|
||
|
}
|
||
|
],
|
||
|
}
|
||
3 years ago
|
],
|
||
3 years ago
|
filterForm: {
|
||
|
customerType: []
|
||
|
},
|
||
3 years ago
|
curTab: 0,
|
||
3 years ago
|
tabs: [],
|
||
3 years ago
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
||
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
||
|
searchTimer: null,
|
||
|
customerType: '',
|
||
|
keyword: '',
|
||
3 years ago
|
list: [],
|
||
|
page: 1,
|
||
|
pageSize: 10
|
||
3 years ago
|
}
|
||
|
},
|
||
3 years ago
|
watch: {
|
||
3 years ago
|
keyword () {
|
||
3 years ago
|
clearTimeout(this.searchTimer)
|
||
|
this.searchTimer = setTimeout(() => {
|
||
|
this.initList()
|
||
|
}, 500)
|
||
|
}
|
||
|
},
|
||
3 years ago
|
// 下拉刷新
|
||
3 years ago
|
onPullDownRefresh() {
|
||
3 years ago
|
this.initList()
|
||
3 years ago
|
setTimeout(() => {
|
||
|
uni.stopPullDownRefresh()
|
||
|
}, 1500)
|
||
|
},
|
||
3 years ago
|
// 上拉加载
|
||
3 years ago
|
onReachBottom() {
|
||
3 years ago
|
if (this.reachBottom >= 0) {
|
||
|
this.reachBottom = 1
|
||
|
this.status = 'loading'
|
||
|
this.getList()
|
||
|
}
|
||
3 years ago
|
},
|
||
3 years ago
|
onShow() {
|
||
3 years ago
|
this.initRole()
|
||
3 years ago
|
},
|
||
3 years ago
|
methods: {
|
||
3 years ago
|
// 初始化权限
|
||
|
initRole() {
|
||
|
this.tabs = []
|
||
|
const auth = uni.getStorageSync('auth')
|
||
1 year ago
|
auth.includes('工作台:客户:我的客户') && this.tabs.push({
|
||
3 years ago
|
name: '我的客户',
|
||
|
id: 0
|
||
|
})
|
||
1 year ago
|
auth.includes('工作台:客户:团队全部客户') && this.tabs.push({
|
||
3 years ago
|
name: '团队全部客户',
|
||
|
id: 1
|
||
|
})
|
||
|
const len = this.tabs.length
|
||
|
// 只有一个的话,取第一个,而且不用显示tab
|
||
|
if (len === 1) {
|
||
|
this.curTab = this.tabs[0].id
|
||
|
this.tabs = []
|
||
|
}
|
||
|
this.initList()
|
||
|
},
|
||
|
// 获取列表
|
||
3 years ago
|
getList() {
|
||
3 years ago
|
const data = {
|
||
3 years ago
|
businessManagerId: this.$util.getBmId(),
|
||
2 years ago
|
teamId: uni.getStorageSync('team').id,
|
||
3 years ago
|
customerType: this.customerType,
|
||
|
keywords: this.keyword,
|
||
|
pageNum: this.page,
|
||
3 years ago
|
pageSize: this.pageSize,
|
||
|
type: this.curTab // 团队:1 / 个人:0
|
||
3 years ago
|
}
|
||
2 years ago
|
uni.showLoading({
|
||
|
title: '加载中'
|
||
|
})
|
||
3 years ago
|
all(data).then(({ data }) => {
|
||
2 years ago
|
uni.hideLoading()
|
||
3 years ago
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
|
||
3 years ago
|
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records
|
||
3 years ago
|
this.page++ // 每次获取了数据后page+1
|
||
3 years ago
|
const noMore = this.list.length === data.total // 是否加载完所有数据
|
||
3 years ago
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
||
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
||
2 years ago
|
}).catch(e => {
|
||
|
uni.hideLoading()
|
||
|
})
|
||
3 years ago
|
},
|
||
3 years ago
|
initList() {
|
||
3 years ago
|
this.page = 1
|
||
3 years ago
|
this.reachBottom = 0
|
||
3 years ago
|
this.getList()
|
||
|
},
|
||
3 years ago
|
// 筛选确定回调
|
||
3 years ago
|
subFinsh(val) {
|
||
|
const { customerType } = val
|
||
|
this.customerType = customerType.length ? customerType[0] : ''
|
||
3 years ago
|
this.initList()
|
||
3 years ago
|
},
|
||
3 years ago
|
// tab切换
|
||
|
tabChange(tab) {
|
||
|
this.curTab = tab.id
|
||
3 years ago
|
this.initList()
|
||
3 years ago
|
},
|
||
3 years ago
|
// 跳转详情
|
||
3 years ago
|
toDetail(item) {
|
||
|
this.$util.to(`../clientDetail/clientDetail?customerId=${item.customerId}&show=1`)
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped lang="scss">
|
||
3 years ago
|
.page {
|
||
|
padding-bottom: 90px;
|
||
|
}
|
||
3 years ago
|
.filter {
|
||
3 years ago
|
display: flex;
|
||
|
align-items: center;
|
||
|
.search {
|
||
|
flex: 1;
|
||
|
}
|
||
3 years ago
|
.sl-filter {
|
||
|
width: 30%;
|
||
|
margin-left: 10%;
|
||
|
}
|
||
3 years ago
|
}
|
||
|
.list {
|
||
3 years ago
|
margin-top: 20rpx;
|
||
3 years ago
|
background-color: #fff;
|
||
|
li {
|
||
3 years ago
|
padding: 20rpx 40rpx;
|
||
|
border-bottom: 1px solid #f1f1f1;
|
||
3 years ago
|
}
|
||
3 years ago
|
.c-name {
|
||
|
font-size: 30rpx;
|
||
3 years ago
|
color: #333;
|
||
|
}
|
||
|
.info {
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
3 years ago
|
margin-top: 10rpx;
|
||
3 years ago
|
}
|
||
3 years ago
|
.line {
|
||
|
display: flex;
|
||
|
padding: 10rpx 0;
|
||
|
}
|
||
|
.name {
|
||
|
width: 200rpx;
|
||
|
margin-right: 10rpx;
|
||
|
font-size: 28rpx;
|
||
|
color: #999;
|
||
|
}
|
||
|
.val {
|
||
|
max-width: 70%;
|
||
|
font-size: 28rpx;
|
||
|
color: #333;
|
||
3 years ago
|
}
|
||
|
.type {
|
||
3 years ago
|
font-size: 28rpx;
|
||
|
color: #ff7b2d;
|
||
|
white-space: nowrap;
|
||
3 years ago
|
}
|
||
|
}
|
||
|
</style>
|