或然中台小程序
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.
 
 
 
 

216 lines
5.5 KiB

<template>
<view>
<uni-card :is-shadow="false" :border="false" is-full spacing="0" margin="20">
<uni-search-bar class="search" radius="30" placeholder="请输入团队、合伙人名字" clearButton="auto" cancelButton="none" v-model="keyword" />
<view class="org-picker">
<uni-data-picker class="picker-input" placeholder="请选择组织" popup-title="请选择组织" preload :localdata="orgs" :map="{text: 'partnerClassificationName', value: 'id'}" v-model="org" @change="initList" @nodeclick="orgClick" @popupclosed="orgClose"></uni-data-picker>
</view>
</uni-card>
<template v-if="list.length">
<ul class="list">
<li v-for="item in list" @click="toTeam(item)">
<image class="avatar" :src="item.userAvatars || require('@/static/image/avatar.png')" mode=""></image>
<view class="info">
<view class="c-name">{{ item.userName }}</view>
<view class="line">
<text class="name">团队名称:</text>
<text class="val">{{ item.teamName }}</text>
</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.phone }}</text>
</view>
<view class="line">
<text class="name">加入时间:</text>
<text class="val">{{ item.lastLoginTime.split(' ')[0] }}</text>
</view>
<view class="line">
<text class="name">所属区域:</text>
<text class="val">{{ item.area }}</text>
</view>
<view class="line">
<text class="name">团队成员:</text>
<text class="val">{{ item.teamSize }}个</text>
</view>
<view class="line">
<text class="name">邀请人:</text>
<text class="val">{{ item.invitationAccount }}</text>
</view>
</view>
<view v-if="auth('合伙管理:账号管理:编辑分类')" class="iconfont icon-edit" @click.stop="toEdit(item)"></view>
</li>
</ul>
<uni-load-more :status="status" />
</template>
<empty v-else></empty>
<uni-icons v-if="auth('合伙管理:账号管理:添加城市合伙人')" class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('/team/addStaff/addStaff')"></uni-icons>
</view>
</template>
<script>
import { teamPartnerList, treeList } from '@/apis/modules/parner.js'
export default {
data() {
return {
orgs: [],
org: '',
orgTemp: '',
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
status: 'more', // 上拉加载状态 more|loading|noMore
searchTimer: null,
keyword: '',
list: [],
page: 1,
pageSize: 10,
isClose: 0
}
},
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() {
this.getOrg()
},
methods: {
// 获取组织
getOrg() {
treeList().then(({ treeList }) => {
this.orgs = treeList
this.initList()
}).catch(e => {})
},
orgClick(e) {
this.orgTemp = e.id
this.org = e.id
this.initList()
},
// 组织关闭回调
orgClose() {
// this.org = this.orgTemp
// this.isClose = 1
// this.initList()
},
// 获取列表
async getList() {
uni.showLoading({
title: '加载中'
})
teamPartnerList({
type: 1,
pageNum: this.page,
pageSize: this.pageSize,
keyWord: this.keyword,
partnerClassificationId: this.org || ''
}).then(({ pageList }) => {
uni.hideLoading()
const { records } = pageList
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
this.list = this.reachBottom > 0 ? [...this.list, ...records] : records
this.page++ // 每次获取了数据后page+1
const noMore = this.list.length === pageList.total // 是否加载完所有数据
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()
},
// 查看团队成员
toTeam(e) {
this.$util.to(`/team/teamDetail/teamDetail?id=${e.teamId}`)
},
// 编辑区域
toEdit(e) {
this.$util.to(`/team/editTeam/editTeam?id=${e.teamId}&areaId=${e.partnerClassificationId}`)
}
}
}
</script>
<style scoped lang="scss">
.org-picker {
padding: 10px;
background-color: #fff;
}
.list {
margin-top: 20rpx;
background-color: #fff;
li {
position: relative;
display: flex;
align-items: center;
padding: 20rpx 40rpx;
border-bottom: 1px solid #f7f7f7;
&:last-child {
border-bottom: 0;
}
}
.avatar {
width: 100rpx;
height: 100rpx;
margin-right: 30rpx;
border-radius: 50%;
}
.c-name {
margin-bottom: 6rpx;
font-size: 30rpx;
color: #333;
}
.line {
display: flex;
padding: 5rpx 0;
}
.name {
margin-right: 10rpx;
white-space: nowrap;
font-size: 28rpx;
color: #999;
}
.val {
font-size: 28rpx;
color: #333;
}
.iconfont {
position: absolute;
right: 50rpx;
font-size: 52rpx;
color: #0196ff;
}
}
.plus {
position: fixed;
bottom: 40rpx;
right: 40rpx;
}
</style>