<template>
	<view class="box">

		<view v-if="writeList.length != 0">
			<view class="writeItem" v-for="(item, index) in writeList" :key="index">
				<view class="rows">
					<view class="rows_tit">订单编号</view>
					<view class="rows_con">{{item.order_no}}</view>
				</view>

				<view class="rows">
					<view class="rows_tit">商品名称</view>
					<view class="rows_con">{{item.activity.title}}</view>
				</view>

				<view class="rows">
					<view class="rows_tit">商品数量</view>
					<view class="rows_con">{{item.num}}</view>
				</view>

				<view class="rows">
					<view class="rows_tit">核销时间</view>
					<view class="rows_con">{{item.create_time}}</view>
				</view>

				<view class="rows">
					<view class="rows_tit">核销地点</view>
					<view class="rows_con">{{item.activity.addr}}</view>
				</view>

			</view>
		</view>

		<van-empty description="暂无内容" v-if="writeList.length == 0" />
	</view>
</template>

<script>
	import { request } from '../../utils';
	import { apiArr } from '../../api/reservation';
	export default {
		data() {
			return {
				writeList:[],
				page_num:1,
				page_size:10,
				flag:false
			}
		},
		methods: {
			async init(){
				const res = await request(apiArr.eliminateList, 'POST', {
					page_num: this.page_num,
					page_size: this.page_size,
					shop_id: Number(uni.getStorageSync('shopId'))
				});
				console.log('asdadad', res);
				let flag = false
				if(res.rows.length == this.page_size){
					flag = true
				}else{
					flag=  false
				}
				this.writeList = this.writeList.concat(res.rows || []);
				this.page_num = this.page_num + 1;
				this.flag = flag;
			},
		},
		onLoad(options) {
			this.init()
		},
		onReachBottom() {
			if(this.flag){
					that.init()
			}
		},
	}
</script>

<style>
	@import url("./index.css");
</style>