<template>
	<view>
		<uni-list>
			<uni-list-item :key="index" v-for="(item, index) in dataList" :title="`订单号：${item.orderNo}`" 
			:note="`${orderType[item.scene]}:+ ${item.money}元`" :rightText="item.createTime"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import * as LogApi from '@/api/shop/profitLog.js'
	import {mapGetters} from 'vuex'
	export default {
		data() {
			return {
				dataList: [],
				hasMore: true,
				page: 1,
				limit: 10,
				where: {
				},
				orderType:{
					1: "投资收益",
					3: "推广收益",
					4: "门店收益",
					5: "门店业绩",
				}
			};
		},
		computed: {
			...mapGetters(['userId'])
		},
		onLoad() {
			this.queryList()
		},
		methods: {
			queryList() {
				LogApi.list({
					page: this.page,
					limit: this.limit,
					userId: this.userId
				}).then(res => {
					if(res.code == 0){
						res.data.list.forEach(item => {
							item.createTime = this.$u.timeFormat(item.createTime, 'yyyy-mm-dd');
						})
						this.dataList.push(...res.data.list)
						this.hasMore = this.dataList.length < res.data.count
						
					}
				}).finally(()=>{
					uni.stopPullDownRefresh()
				})
			},
			scrolltolower(e) {
				console.log(e);
			}
		},
		onPullDownRefresh() {
			this.page == 1;
			this.dataList = [];
			this.queryList();
			this.hasMore = true
		},
		onReachBottom() {
			if(this.hasMore){
				this.page ++
				this.queryList();
			}
		}
	}
</script>

<style lang="scss">

</style>