<template>
	<view>
		<u-navbar title="租户列表" title-color="#101010"></u-navbar>
		<view class="head-head">
			<u-search placeholder="请输入关键字" :show-action="false"		 v-model="keyword"></u-search>
			
		</view>
		<view class="head-head-placeholder ">
			
		</view>
		<view class="main">
			<view class="tenant" v-for="(item,i) in tenantList"
			  v-show="keyword==''||(item.name&&item.name.indexOf(keyword)!=-1)"
			 :key="i" 
			   @click="gotoUrl('/pages/deductionRecord/deductionRecord?id='+item.id)">
				<view class="tenant-name">
					{{item.name}}

				</view>
				<view class="tenant-icon">
					<u-icon name="arrow-right" color="#b2b2b2" size="28"></u-icon>
				</view>
			</view>
			
		</view>
		<u-divider :isnone="tenantList.length==0"  nonetext="无记录"
			border-color="#CFD2D5">已经到底了</u-divider>
	</view>
</template>

<script>
	import * as API from '@/apis/pagejs/tenantList.js'
	export default {
		data() {
			return {
				tenantList:[],
				getTenantListReady:false,
				keyword:""
			}
		},
		onReady() {
			// this.current=1
			 this.getTenantList()
		
		},
		methods: {
			getTenantList(){
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				API.tenantList().then((response) => {
					uni.hideLoading();
					this.getTenantListReady=true
					this.tenantList=response.data.tenantInfoList;
					
				}).catch(error => {
					uni.showToast({
						title: error,
						icon: "none"
					})
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		background-color: #fff;
		margin-top: 24rpx;
		.tenant{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 24rpx 32rpx;
			color: rgba(51,51,51,1);
			font-size: 32rpx;
		}
		
	}
	
	.head-head{
		box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
		background: #fff;
		padding:24rpx;
		position: fixed;
		    left: 0;
		    right: 0;
		    top: 80rpx;
		    z-index: 991;
	}
	.head-head-placeholder{
		height: 112rpx;
		
	}
	

</style>
