<template>
	<view class="safe-area-inset-bottom">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
			:up="upOption">
			<card  :list="dataList" ></card>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
	import card from "./comps/card.vue"
	export default {
		mixins: [MescrollMixin],
		components:{
			card
		},
		data() {
			return {
				id:'',
				dataList:[]
			}
		},
		onLoad(options) {
			this.id=options.id
			console.log(options.id);
		},
		methods:{
			downCallback(){
				this.mescroll.resetUpScroll();
			},
			upCallback(mescroll) {
				let params = {
					auditStatus:'PASS',
					current:mescroll.num,
					size:mescroll.size,
					mallId:this.id,
				}
				try {
					this.$api.activity.list(params).then(res => {
						let data = res.data.records
						let total = res.data.total
						mescroll.endBySize(data.length, total);
						if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
						this.dataList = this.dataList.concat(data); //追加新数据
					})
				} catch (e) {
					this.mescroll.endErr()
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	
</style>
