<template>
	<view class="home-pages">
		<view class="home-content">
			<card v-for="(item,i) in list" :item="item" :key="i" :i="i"  @seeDetail="seeDetail"></card>
		</view>
	</view>
</template>

<script>
	import card from '@/components/active-card/order-list.vue'
	export default{
		components:{
			card,
		},
		data(){
			return{
				params:{
					pageNo:1,
					state:'0',
					pageSize:10,
					total: null,
					isLock: true
				},
				current:0,
				list:[{tranNo: "69732894782348932"},{tranNo: "69732894782348931"}],
			}
		},
		onLoad() {
			this.params.state = "0";
			this.params.pageNo = 1;
			this.params.total = null;
			this.params.isLock = true;
			this.queryPageListJobRelease();
		},
		onReady() {
			this.$com.displayNav()
		},
		onPullDownRefresh() {
			this.list = [];
			this.params.pageNo = 1;
			this.params.total = null;
			this.params.isLock = true;
			this.queryPageListJobRelease()
		},
		onReachBottom() {
			if(this.params.isLock){
				this.params.isLock = false;
				if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
					this.$Toast('没有更多数据了哦！');
					setTimeout(()=>{
						this.params.isLock = true;
					},3000)
					return
				}
				this.params.pageNo+=1;
				this.$Toast('数据加载成功！');
				this.queryPageListJobRelease();
			}
		},
		methods:{
			queryPageListJobRelease(){//学习列表
				// if(this.pageNo>1){
				// 	uni.showLoading({})
				// }
				// this.$api('getOrderList',this.params)
				// .then(res=>{
				// 	if(res.code == 200){
				// 		if(this.params.total== null) {
				// 			this.params.total = res.result.total
				// 		}
						
				// 		if(this.params.pageNo>1){
				// 			uni.hideLoading();
				// 		}
				// 		this.list = this.list.concat(res.result.records);
				// 		this.params.isLock = true;
				// 	}else {
				// 		if(this.params.pageNo>1){
				// 			uni.hideLoading();
				// 		}
				// 		this.params.isLock = true;
				// 	}	
				// })
			},
			tabClick(e){
				// this.params.state = e.id;
				// this.params.pageNo =1;
				// this.list = [];
				// this.queryPageListJobRelease();
			},
			seeDetail(item){
				uni.navigateTo({
					url:`/pages/my/orderdetails`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home-pages {
		padding: 28rpx 29rpx 0;
		background-color: #F7F7F7;
		min-height: 80vh;
		
		.home-content {
			min-height: 80vh;
			
			.active-card{
				margin-top: 20rpx;;
				border-radius: 0;
				border: none;
				border-style: none;
				box-shadow: none;
			}
		}
	}
	
</style>