<template>
	<view class="selSupplier">
		<view class="supplier-ul">
			<view class="supplier-li" v-for="(item, index) in reservoir_list" :key="index" @click="changeData(item)">
				{{ item.reservoirName }}
			</view>
		</view>
		<u-loadmore :status="load_status" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			load_status: 'nomore',
			reservoir_list: []
		};
	},
	onLoad() {
		this.getListReservoir();
	},
	onPullDownRefresh() {
		this.getListReservoir();
	},
	methods: {
		changeData(item) {
			// 选择供应商返回上一页
			this._prePage().reservoirData = item;
			uni.navigateBack();
		},
		getListReservoir() {
			this.$u.api
				.getListReservoir()
				.then(res => {
					uni.stopPullDownRefresh();
					this.reservoir_list = res.data;
				})
				.catch(err => {
					uni.stopPullDownRefresh();
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.supplier-ul {
	padding-bottom: 20rpx;
	.supplier-li {
		width: 702rpx;
		margin: 0 auto;
		background-color: #ffffff;
		border-radius: 10rpx;
		margin-top: 20rpx;
		font-weight: bold;
		line-height: 90rpx;
		padding: 0 30rpx;
	}
}
</style>
