<template>
	<view class="content">
		<view class="grxx" v-for="(item,index) in userList" :key="index">
			<view class="grxxItem">
				<view class="ygxm">姓名：{{item.name}}</view>
				<view class="sfzhm">
					<text>所属单位</text>
					<text>{{item.companyName}}</text>
				</view>
				<view class="sfzhm">
					<text>联系电话</text>
					<text>{{item.phone}}</text>
				</view>
			</view>
		</view>
		<view class="ydd" v-if="isReachBottom">
			~<没有了>~
		</view>
	</view>
</template>

<script>
	import {
		postRequest,
		getRequest
	} from '../../api/api.js'
	export default {
		data() {
			return {
				userList: [],
				isReachBottom:false,
				type:'',        //院内人员  院外人员标识
				listData: {
					areaType: "",
					schedul: "",
					officeId: "",
					type: "",
					current: 1,
					orders: [{
						asc: true,
						column: ""
					}],
					size: 10,
				}
			}
		},
		onLoad(option) {
			this.type=option.type;
			let data = JSON.parse(option.data);
			Object.assign(this.listData,data)
			if (option.type == 'yn') {
				this.getYnList()
			} else if (option.type == 'yw') {
				this.getYwList()
			}
		},
		onReachBottom(){
			if(this.isReachBottom==true){
				return
			}else{
				this.listData.current++
				if(this.type=='yn'){
					this.getYnList()
				}else if (option.type == 'yw'){
					this.getYwList()
				}
			}
		},
		methods: {
			getYnList(){
				postRequest('/statistics/sysUserReportedList', this.listData).then(res => {
					if (res.code == '200') {
						this.userList = res.data.records;
						if(res.data.pages==this.listData.current){
							this.isReachBottom=true
						}
					}else{
						this.isReachBottom=true
					}
				})
			},
			getYwList(){
				postRequest('/statistics/thirdUserReportedList', this.listData).then(res => {
					if (res.code == '200') {
						this.userList = res.data.records;
						if(res.data.pages==this.listData.current){
							this.isReachBottom=true
						}
					}else{
						this.isReachBottom=true
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		padding: 0 10px;
	}

	.content .grxxTitle {
		padding: 5% 0;
		font-size: 14px;
	}

	.grxx {
		padding-top: 36rpx;
	}

	.grxxItem {
		border-radius: 5px;
		box-shadow: 0px 0px 15px 3px rgba(0, 0, 0, 0.1);
	}

	.grxxItem .ygxm {
		padding: 10px;
		background-color: #3297ff;
		color: white;
	}

	.grxxItem .sfzhm {
		margin: 0 10px;
		border-bottom: 1px solid #CCCCCC;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;
		font-size: 84%;
		color: #999999;
		position: relative;
	}

	.grxxItem .mdd {
		justify-content: left;
	}

	.grxxItem .mdd input {
		width: 70%;
		margin-left: 10px;
	}

	.hxx {
		position: absolute;
		color: red;
		left: 3px;
		top: 25%;
	}

	.grxxItem .sfzhm:last-of-type {
		border: none;
	}
	.ydd {
		text-align: center;
		padding: 5px;
		color: #cac5c5;
	}
</style>
