|
|
|
<template>
|
|
|
|
<view class="page">
|
|
|
|
<ul class="tab">
|
|
|
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
|
|
|
|
<view class="filter">
|
|
|
|
<uni-search-bar class="search" radius="5" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" @confirm="search" />
|
|
|
|
<sl-filter class="sl-filter" :independence="true" :menuList="menuList" @result="result"></sl-filter>
|
|
|
|
</view>
|
|
|
|
</uni-card>
|
|
|
|
|
|
|
|
<ul class="list">
|
|
|
|
<li v-for="item in list" @click="toDetail(item)">
|
|
|
|
<view class="name">{{ item.customerName }}</view>
|
|
|
|
<view class="info">
|
|
|
|
<view class="left">
|
|
|
|
<view class="text">联系人:海文</view>
|
|
|
|
<view class="text">账号:海文</view>
|
|
|
|
<view class="text">产品到期时间:海文</view>
|
|
|
|
<view class="text">商务经理:海文</view>
|
|
|
|
</view>
|
|
|
|
<view class="type">
|
|
|
|
试用客户
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<uni-load-more :status="status" />
|
|
|
|
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { queryCustomer } from '@/apis/modules/client.js'
|
|
|
|
import slFilter from '@/components/sl-filter/sl-filter.vue'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
menuList: [
|
|
|
|
{
|
|
|
|
'title': '客户类型',
|
|
|
|
'detailTitle': '请选择客户类型',
|
|
|
|
'key': 'customerType',
|
|
|
|
'isMutiple': false,
|
|
|
|
'detailList': [
|
|
|
|
{
|
|
|
|
'title': '正式',
|
|
|
|
'value': 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '试用',
|
|
|
|
'value': 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '到期',
|
|
|
|
'value': 3
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
curTab: 0,
|
|
|
|
tabs: [
|
|
|
|
{
|
|
|
|
name: '我的客户',
|
|
|
|
id: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '团队全部客户',
|
|
|
|
id: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
|
|
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
|
|
|
searchTimer: null,
|
|
|
|
customerType: '',
|
|
|
|
keyword: '',
|
|
|
|
list: [],
|
|
|
|
page: 1,
|
|
|
|
pageSize: 10
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
slFilter
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
keyword (newName, oldName) {
|
|
|
|
clearTimeout(this.searchTimer)
|
|
|
|
this.searchTimer = setTimeout(() => {
|
|
|
|
this.initList()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 下拉刷新
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.initList()
|
|
|
|
setTimeout(() => {
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
}, 1500)
|
|
|
|
},
|
|
|
|
// 上拉加载
|
|
|
|
onReachBottom() {
|
|
|
|
if (this.reachBottom >= 0) {
|
|
|
|
this.reachBottom = 1
|
|
|
|
this.status = 'loading'
|
|
|
|
this.getList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.initList()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getList() {
|
|
|
|
queryCustomer({
|
|
|
|
countries: '中国',
|
|
|
|
provinceId: '',
|
|
|
|
cityId: '',
|
|
|
|
searchContent: this.keyword,
|
|
|
|
page: this.page,
|
|
|
|
size: this.pageSize
|
|
|
|
}).then(({ message }) => {
|
|
|
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
|
|
|
|
this.list = this.reachBottom > 0 ? [...this.list, ...message.list] : message.list
|
|
|
|
this.page++ // 每次获取了数据后page+1
|
|
|
|
const noMore = this.list.length === message.totalCount // 是否加载完所有数据
|
|
|
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
|
|
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
initList() {
|
|
|
|
this.page = 1
|
|
|
|
this.reachBottom = 0
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
// 筛选确定回调
|
|
|
|
result(val) {
|
|
|
|
this.customerType = val.customerType
|
|
|
|
},
|
|
|
|
// tab切换
|
|
|
|
tabChange(tab) {
|
|
|
|
this.curTab = tab.id
|
|
|
|
},
|
|
|
|
// 跳转详情
|
|
|
|
toDetail(item) {
|
|
|
|
this.$util.to(`../clientDetail/clientDetail?customerId=${item.customerId}&show=1`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.page {
|
|
|
|
padding-bottom: 90px;
|
|
|
|
}
|
|
|
|
.filter {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
.search {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
.sl-filter {
|
|
|
|
width: 30%;
|
|
|
|
margin-left: 10%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.list {
|
|
|
|
margin-top: 10px;
|
|
|
|
background-color: #fff;
|
|
|
|
li {
|
|
|
|
padding: 10px 20px;
|
|
|
|
border-bottom: 2px solid #f1f1f1;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
font-size: 16px;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.info {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
font-size: 13px;
|
|
|
|
line-height: 24px;
|
|
|
|
color: #ccc;
|
|
|
|
}
|
|
|
|
.type {
|
|
|
|
font-size: 14px;
|
|
|
|
color: $uni-primary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|