<template>
	<view class="list">
		<view class="item" v-for="(item, index) in list" :key="index" @click="select(item)">
			<view class="address">
				<view class="con">
					<view class="title omit">云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路36号云南省普洱市思茅区普洱路云南省普洱市思茅区普洱路</view>
					<view class="desc">
						<text>陈晓东</text>
						<text>13481076556</text>
					</view>
				</view>
				<view class="icon">&#xe8f2;</view>
				<view class="clear"></view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [{}, {}, {}, {}, {}],
			param: { pageNo: 1, pageSize: 10 },
			loadMore: true
		};
	},
	onLoad(e) {
		//this.getData();
	},
	methods: {
		getData() {
			this.http.request({
				url: '/level-one-server/app/TbPortNews/getPortNewsList',
				data: this.param,
				loading: 'false',
				success: res => {
					this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
					this.list.push(...res.data.data);
				}
			});
		},
		select(item) {
			uni.$emit('selectAddress', item);
			uni.navigateBack();
		},
		//刷新数据
		refresh() {
			this.loadMore = true;
			this.param.pageNo = 1;
			this.list = [];
			this.getData();
		}
	},
	//下拉刷新
	onPullDownRefresh() {
		setTimeout(() => {
			this.refresh();
			uni.stopPullDownRefresh();
		}, 1000);
	},
	//上拉加载
	onReachBottom() {
		if (this.loadMore) {
			this.param.pageNo++;
			this.getData();
		}
	},
	onNavigationBarButtonTap() {
		uni.navigateTo({ url: 'add' });
	}
};
</script>

<style lang="scss">
page {
	background-color: $pg;
}
.list {
	padding: 12px;
	.item {
		padding: 5px;
		color: $font-c;
		background-color: white;
		border-radius: 10px;
		margin-bottom: 10px;
	}
}
</style>
