<template>
	<view>
		<view class="cmain">
			<view class="box order_detail" style="margin-top: 0px">
				<u-divider text="购买边民"></u-divider>
				<view class="item" style="padding-top: 0px" v-for="(item,index) in list">
					<text class="label" style="line-height: 50rpx;">
						{{item.borderName}}
						<view style="font-size: 30rpx;color: #9c9999;">
							订单确认：
							<text v-if="item.peopleConfirmStatus==0">未确认</text>
							<text v-if="item.peopleConfirmStatus==1">已确认</text>
							<view v-if="item.peopleConfirmTime">时间:{{item.peopleConfirmTime}}</view>
						</view>
					</text>
					<text class="desc" style="width: 120rpx;">{{item.buyAmount}}</text>
				</view>
				<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
				<u-empty v-if="!loadMore && list.length == 0"></u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				param: {
					pageNo: 1,
					pageSize: 10,
					saleMainId: ''
				},
				loadMore: true,
			};
		},
		onLoad(e) {
			this.param.saleMainId = e.id
			this.getData();
			uni.$on("refreshPage", res => {
				this.refresh();
			})

		},
		methods: {
			getData() {
				this.http.request({
					url: '/level-one-server/app/TbOrder/getList',
					data: this.param,
					success: res => {
						this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
						if (res.data.data) {
							this.list.push(...res.data.data);
						}
					}
				});
			},
			refresh() {
				this.loadMore = true;
				this.param.pageNo = 1;
				this.list = [];
				this.getData();
			},
		}
	};
</script>

<style lang="scss">
	page {
		background-color: $pg;
	}
</style>