<style>
	.contanctMain {
		background-color: #F3F5F7;
	}

	.contanctIn {
		display: flex;
		padding: 20px;
	}

	.contancList {
		width: 118px;
		height: 180px;
		background-color: #fff;
		margin-right: 10px;
		text-align: center;
		border-radius: 3px;
		overflow: hidden;
	}

	.contancList:nth-child(3) {
		margin-right: 0;
	}

	.contanctImg {
		width: 100%;
		height: 131px;
	}

	.contanctImg img {
		width: 100%;
		height: 100%;
	}

	.contancName {
		color: #404040;
		font-size: 13px;
		margin:5px 0;
	}

	.contactNum {
		color: #999898;
		font-size: 12px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
</style>
<template>
	<view class="contanctMain" style="height:100vh;">
		<u-empty v-if="dataList.length==0" text="暂无数据" mode="data"></u-empty>
		<scroll-view v-else :scroll-y="true" style="background-color: #f0f4f7;" :enable-back-to-top="true" :enable-flex="true"
		 @scrolltolower="lower" :style="{ 'height': `calc(100%)`}">
			<view class="contanctIn">
					<view class="contancList" v-for="(item,index) in dataList" @click="goDetail(item.Id)" :key="index">
						<view class="contanctImg">
							<img :src="item.HeadIcon" alt="" />
						</view>
						<view>
							<view class="contancName">{{item.Name}}</view>
							<view class="contactNum">
								<image style="width:20px;height:20px;" src="../../static/images/call.png"></image>{{item.Tel}}
							</view>
						</view>
					</view>
			</view>
			<view style="padding:10px 0;">
				<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="0" :margin-bottom="0" bg-color="#f0f4f7" />
			</view>
		</scroll-view>
		<tabbar></tabbar>
	</view>
</template>

<script>
	import tabbar from "@/components/tabbar/index";
	export default {
		data() {
			return {
				pageTitle: "联系我们",
				msg:{
					pageIndex:1,
					pageSize:15
				},
				pageCount: 1,
				dataList: [],
				loadText: {
					loadmore: "轻轻上拉，加载更多",
					loading: "努力加载中",
					nomore: "没有更多了",
				},
			};
		},
		components: {
			tabbar
		},
		mounted() {
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
		},
		onLoad(options) {
			this.getList(1);
		},
		created() {},
		onShow() {
			this.mainColor = this.$uiConfig.mainColor;
		},
		methods: {
			//获取数据
			getList(num) {
				if (num == 1) {
					this.dataList = [];
				}
				uni.showLoading({
					title: '加载中'
				});
				this.request2({
						url: "/api/Trade/GetContractPageList",
						data: this.msg,
					},
					(res) => {
						uni.hideLoading();
						if (res.resultCode == 1) {
							console.log(res,'数据来也');
							this.dataList = this.dataList.concat(res.data.pageData);
							this.pageCount = res.data.pageCount;
						}
					}
				);
			},
			//滚动加载
			lower(e) {
				if (this.msg.pageIndex < this.pageCount) {
					this.msg.pageIndex++;
					this.status = "loading";
					this.getList();
				} else {
					this.status = "nomore";
				}
			},
			//跳转
			goDetail(Id) {
				uni.navigateTo({
					url: '/pages/kotra/contanctDetail?Id='+Id
				})
			},
		},
	}
</script>

<style>
</style>
