<template>
|
<view :class="[Visible ? 'usable-popup user_open' : 'usable-popup user_close', theme() || '']" :data-theme='theme()'>
|
<view class="popup-bg" @click="closePopup(null)"></view>
|
<view class="main pt30" v-on:click.stop>
|
<view class="popup-search d-s-c pb30 pr border-b-e">
|
<view class="search-box d-s-c">
|
<text class="icon iconfont icon-sousuo"></text>
|
<input type="text" v-model="keyword" class="flex-1 ml10 f26 gray3" value="" placeholder-class="f26 gray9"
|
placeholder="请输入用户昵称/姓名/电话号码进行搜索" confirm-type="search" @confirm="searchFunc()" />
|
</view>
|
<view class="iconfont icon-guanbi" @click="closePopup(null)"></view>
|
</view>
|
<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" :show-scrollbar="false" lower-threshold="50" @scrolltolower="scrolltolowerFunc">
|
<view class="user-box">
|
<view class="user-item d-b-c" v-for="(item, index) in listData" :key="index">
|
<view class="title d-s-c f28">
|
<view>
|
<image :src="item.avatarUrl"></image>
|
</view>
|
<view class="ml10">{{item.nickName}}</view>
|
<view v-if="item.real_name">({{item.real_name}})</view>
|
</view>
|
<view class="select-box" @click="chooseUser(item)">
|
<i class="iconfont icon-xuanze theme-price" v-if="select_user['user_id'] == item.user_id"></i>
|
<view class="round" v-else></view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 没有记录 -->
|
<view class="none-data-box" v-if="listData.length==0">
|
<image :src="remoteImg('no_thing')" mode="widthFix"></image>
|
<text>暂无数据</text>
|
</view>
|
<uni-load-more v-else :loadingType="loadingType"></uni-load-more>
|
</scroll-view>
|
<view class="footer-btn bg-white p-0-30 pt20 pb20">
|
<button type="default" @click="onSubmit" class="btn-submit theme-btn">确定</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import uniLoadMore from '@/components/uni-load-more.vue';
|
export default {
|
components: {
|
uniLoadMore,
|
},
|
data() {
|
return {
|
/*手机高度*/
|
phoneHeight: 0,
|
/*可滚动视图区域高度*/
|
scrollviewHigh: 0,
|
/*是否可见*/
|
Visible: false,
|
listData: [],
|
/*最后一页码数*/
|
last_page: 0,
|
/*当前页面*/
|
page: 1,
|
/*每页条数*/
|
list_rows: 10,
|
/*有没有更多*/
|
no_more: false,
|
/*是否正在加载*/
|
loading: true,
|
select_user: {},
|
keyword: '', // 搜索关键词
|
};
|
},
|
props: ['isOpenUser'],
|
computed: {
|
/*加载中状态*/
|
loadingType() {
|
if (this.loading) {
|
return 1;
|
} else {
|
if (this.listData.length != 0 && this.no_more) {
|
return 2;
|
} else {
|
return 0;
|
}
|
}
|
}
|
},
|
onLoad() {},
|
mounted() {
|
this.init();
|
},
|
watch: {
|
isOpenUser: function(n, o) {
|
if (n != o) {
|
this.Visible = n;
|
}
|
}
|
},
|
created() {
|
this.getData();
|
},
|
methods: {
|
/*初始化*/
|
init() {
|
let self = this;
|
uni.getSystemInfo({
|
success(res) {
|
self.phoneHeight = res.windowHeight;
|
self.scrollviewHigh = self.phoneHeight * 0.7
|
}
|
});
|
},
|
|
/*初始化列表数据*/
|
initData() {
|
this.page = 1;
|
this.last_page = 0;
|
this.listData = [];
|
},
|
|
/*获取数据*/
|
getData() {
|
let self = this;
|
self.loading = true;
|
self._get(
|
'branch.admin.member/index', {
|
keyword: self.keyword,
|
page: self.page,
|
list_rows: self.list_rows,
|
},
|
function(res) {
|
self.loading = false;
|
self.listData = self.listData.concat(res.data.list.data);
|
self.last_page = res.data.list.last_page;
|
if (res.data.list.last_page <= 1) {
|
self.no_more = true;
|
} else {
|
self.no_more = false;
|
}
|
}
|
);
|
},
|
|
searchFunc() {
|
this.listData = [];
|
this.page = 1;
|
/*获取列表*/
|
this.getData();
|
},
|
|
chooseUser(item) {
|
this.select_user = {
|
nickName: item.nickName,
|
user_id: item.user_id,
|
real_name: item.real_name
|
};
|
},
|
|
onSubmit() {
|
this.closePopup(this.select_user);
|
},
|
|
/*可滚动视图区域到底触发*/
|
scrolltolowerFunc() {
|
let self = this;
|
if (self.no_more) {
|
return;
|
}
|
self.page++;
|
if (self.page <= self.last_page) {
|
self.getData();
|
} else {
|
self.no_more = true;
|
}
|
},
|
|
/*关闭弹窗*/
|
closePopup(e) {
|
this.$emit('close', e);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.usable-popup .popup-bg {
|
position: fixed;
|
top: 0;
|
right: 0;
|
bottom: 0;
|
left: 0;
|
background: rgba(0, 0, 0, 0.6);
|
z-index: 110;
|
}
|
|
.usable-popup .main {
|
position: fixed;
|
width: 100%;
|
bottom: 0;
|
min-height: 200rpx;
|
background-color: #ffffff;
|
transform: translate3d(0, 1380rpx, 0);
|
transition: transform 0.2s cubic-bezier(0, 0, 0.25, 1);
|
bottom: env(safe-area-inset-bottom);
|
z-index: 110;
|
border-radius: 30rpx 30rpx 0 0;
|
}
|
|
.usable-popup.user_open .main {
|
transform: translate3d(0, 0, 0);
|
}
|
|
.usable-popup.user_close .popup-bg {
|
display: none;
|
}
|
|
// .footer-btn .btn-submit {
|
// height: 88rpx;
|
// line-height: 88rpx;
|
// font-size: 30rpx;
|
// border: 1rpx solid #ff5704;
|
// border-radius: 88rpx;
|
// }
|
|
.user-box {
|
padding: 20rpx;
|
.user-item {
|
padding: 15rpx 0;
|
font-size: 28rpx;
|
height: 38rpx;
|
|
.title {
|
|
image {
|
width: 50rpx;
|
height: 50rpx;
|
border-radius: 50rpx;
|
}
|
}
|
|
.select-box {
|
.iconfont {
|
font-size: 42rpx;
|
}
|
.round {
|
width: 30rpx;
|
height: 30rpx;
|
border: 4rpx solid #999999;
|
border-radius: 30rpx;
|
}
|
}
|
}
|
}
|
|
.popup-search {
|
.search-box {
|
background: #f5f5f5;
|
padding: 10rpx 20rpx;
|
width: 500rpx;
|
border-radius: 60rpx;
|
}
|
|
.icon-guanbi {
|
position: absolute;
|
right: 30rpx;
|
top: 15rpx;
|
color: #666666;
|
}
|
}
|
|
</style>
|