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.
209 lines
5.1 KiB
209 lines
5.1 KiB
2 years ago
|
<template>
|
||
|
<view class="page">
|
||
|
<view class="filter">
|
||
|
<uni-search-bar class="search" radius="30" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" />
|
||
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="22" color="#007eff" @click="popup = true"></uni-icons>
|
||
|
</view>
|
||
|
<template v-if="list.length">
|
||
|
<ul class="list">
|
||
|
<li v-for="item in list" @click="toDetail(item)">
|
||
|
<view class="c-name">{{ item.customerName }}</view>
|
||
|
<view class="info">
|
||
|
<view class="left">
|
||
|
<view class="line">
|
||
|
<text class="name">联系人:</text>
|
||
2 years ago
|
<text class="val">{{ item.contacts }}</text>
|
||
2 years ago
|
</view>
|
||
|
<view class="line">
|
||
|
<text class="name">账号:</text>
|
||
|
<text class="val">{{ item.account }}</text>
|
||
|
</view>
|
||
|
<view class="line">
|
||
|
<text class="name">产品到期时间:</text>
|
||
|
<text class="val">{{ item.expireDate.split(' ')[0] }}</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="type">
|
||
|
{{ filterData[0].data.find(e => e.value === item.customerType).title }}客户
|
||
|
</view>
|
||
|
</view>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<uni-load-more :status="status" />
|
||
|
</template>
|
||
|
<empty v-else text="您当前暂无有下单的客户,请快去给客户下订单吧"></empty>
|
||
|
|
||
2 years ago
|
<uni-icons class="plus" v-if="auth('客户管理:新增')" type="plus-filled" size="60" color="#007eff" @click="$util.to('../clientDetail/clientDetail')"></uni-icons>
|
||
2 years ago
|
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
2 years ago
|
import { queryCustomer } from '@/apis/modules/client.js'
|
||
2 years ago
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
popup: false,
|
||
|
//筛选表单数据
|
||
|
filterData: [
|
||
|
{
|
||
|
children: false,//是否有子项
|
||
|
title: "客户类型",
|
||
|
key: "customerType", //键名 接收对象名字
|
||
|
keyValue: "value", //获取的值是哪个
|
||
|
isRadio: true, //是否单选 否则多选
|
||
|
data: [
|
||
|
{
|
||
|
title: '正式',
|
||
|
value: 1
|
||
|
},
|
||
|
{
|
||
|
title: '试用',
|
||
|
value: 2
|
||
|
},
|
||
|
{
|
||
|
title: '到期',
|
||
|
value: 3
|
||
|
}
|
||
|
],
|
||
|
}
|
||
|
],
|
||
|
filterForm: {
|
||
|
customerType: []
|
||
|
},
|
||
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
||
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
||
|
searchTimer: null,
|
||
|
customerType: '',
|
||
|
keyword: '',
|
||
|
list: [],
|
||
|
page: 1,
|
||
|
pageSize: 10
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
keyword () {
|
||
|
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() {
|
||
2 years ago
|
this.initList()
|
||
2 years ago
|
},
|
||
|
methods: {
|
||
|
// 获取列表
|
||
|
getList() {
|
||
2 years ago
|
const per = (uni.getStorageSync('dataPermission') || []).find(e => e.permissionName === '客户管理')
|
||
2 years ago
|
const data = {
|
||
|
customerType: this.customerType,
|
||
2 years ago
|
searchContent: this.keyword,
|
||
|
page: this.page,
|
||
|
size: this.pageSize,
|
||
|
supplierId: per?.supplierId,
|
||
2 years ago
|
}
|
||
|
uni.showLoading({
|
||
|
title: '加载中'
|
||
|
})
|
||
2 years ago
|
queryCustomer(data).then(({ message }) => {
|
||
2 years ago
|
uni.hideLoading()
|
||
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
|
||
2 years ago
|
this.list = this.reachBottom > 0 ? [...this.list, ...message.list] : message.list
|
||
2 years ago
|
this.page++ // 每次获取了数据后page+1
|
||
2 years ago
|
const noMore = this.list.length === message.totalCount // 是否加载完所有数据
|
||
2 years ago
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
||
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
||
|
}).catch(e => {
|
||
|
uni.hideLoading()
|
||
|
})
|
||
|
},
|
||
|
initList() {
|
||
|
this.page = 1
|
||
|
this.reachBottom = 0
|
||
|
this.getList()
|
||
|
},
|
||
|
// 筛选确定回调
|
||
|
subFinsh(val) {
|
||
|
const { customerType } = val
|
||
|
this.customerType = customerType.length ? customerType[0] : ''
|
||
|
this.initList()
|
||
|
},
|
||
|
// 跳转详情
|
||
|
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: 20rpx;
|
||
|
background-color: #fff;
|
||
|
li {
|
||
|
padding: 20rpx 40rpx;
|
||
|
border-bottom: 1px solid #f1f1f1;
|
||
|
}
|
||
|
.c-name {
|
||
|
font-size: 30rpx;
|
||
|
color: #333;
|
||
|
}
|
||
|
.info {
|
||
|
display: flex;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
margin-top: 10rpx;
|
||
|
}
|
||
|
.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;
|
||
|
}
|
||
|
.type {
|
||
|
font-size: 28rpx;
|
||
|
color: #ff7b2d;
|
||
|
white-space: nowrap;
|
||
|
}
|
||
|
}
|
||
|
</style>
|