<template>
	<view>
		<uni-load-more :status="loadingType" v-if="list.length>0"></uni-load-more>
		<picker-view v-if="true" :value="single" @change="bindChange" class="picker-view">
			<picker-view-column>
				<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
			</picker-view-column>
			<picker-view-column>
				<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
			</picker-view-column>
		</picker-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				pageSize: 10,
				applyDate: '',
				type: 0, //0 综合  100 收入  200 支出
				loadingType: 'more',
				single: '',
				months: [1,2,3,4,5,6,7,8,9,10,11,12],
				years: [2022, 2023, 2024]
			};
		},
		methods: {
			getList() {
				let params = {'page':this.page, 'pageSize':this.pageSize, 'type': this.type}
				if (this.applyDate.length > 0) {
					params.applyDate = this.applyDate
				}
				this.$net.post('/integral/index', params).then(res => {
					if (res.code === 200) {
						this.applyDate = res.data.applyDate
						this.list = this.list.concat(res.data.list)
						let paginate = res.data.paginate
						if (this.page == paginate.lastPage || this.list.length==0) {
							this.loadingType = 'noMore'
						} else {
							this.loadingType = 'more'
							this.page++
						}
					} else {
						uni.showToast({
							title:res.message
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.picker-view {
	width: 100%;
	height: 400rpx;
	position: absolute;
	bottom: 0;
	left: 0;
}
</style>
