<template>
	<view class="container">
		<view class="list-box">
			<view class="list-item" v-for="(item,index) in listData" :key="index">
				<view class="person-info">
					<image class="icon" src="/static/kehu/person_gray.png" mode="" />
					<view class="name u-line-1">{{item.personName}}</view>
				</view>
				<view class="right">
					<view class="house">{{item.createTime}}</view>
				</view>
			</view>
			<view class="empty-box" v-if="listData.length==0&&!loading">
				<image class="img" src="http://images.2weisou.com/20221031114904TSF6jF4S.png" mode=""/>
				<view class="no-data">暂无数据</view>
			</view>
			<view class="loading" v-if="loading">
				<u-loading size="40" :show="loading"/>
				正在加载中
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				listData: [],
				pageNo: 1,
				pageSize: 10,
				loadDone: false,
				loading: false,
			};
		},
		onLoad(options) {
			this.mediacyId = options.mediacyId
			this.getList()
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getList(){
				if (this.loadDone) return;
				this.loading = true;
				let params = {
					pageNo:this.pageNo,
					pageSize:this.pageSize,
					mediacyId: this.mediacyId
				}
				this.$u.api.findDetailHistory({body:params}).then((res)=>{
					// console.log(res)
					this.loading = false
					if(res.result&&res.result.length){
						if(this.pageNo==1){
							this.listData = res.result
						}else{
							this.listData = [...this.listData, ...res.result];
						}
						if(res.result.length<this.pageSize){
							this.loadDone = true;
							return ;
						}
						this.pageNo += 1;
						this.loadDone = false
					}else{
						this.loadDone = true;
						if(this.pageNo==1){
							this.listData = []
						}
					}
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
.container{
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	.list-box{
		padding-top: 20rpx;
		.list-item{
			padding: 0 112rpx 0 30rpx;
			height: 100rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-size: 28rpx;
			font-weight: 400;
			color: #333333;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;
			background: #fff;
			.person-info{
				display: flex;
				align-items: center;
				.icon{
					width: 28rpx;
					height: 30rpx;
					margin-right: 12rpx;
				}
				.name{
					width: 150rpx;
				}
			}
		}
	}
}
</style>
