<template>
	<view class="main">
		<view v-if="listItem.length>0" class="u-margin-top-30 text-center u-font-30 text-bold">
			总收入：{{total_commission/100}}元
		</view>
		<view class="list_item u-margin-top-30 margin-lr-sm" v-for="(item,index) in listItem" :key="index">
			<view class="order-num flex justify-between align-center u-font-28 u-padding-bottom-10 u-border-bottom"
				style="color:#909399;">
				<text class="u-font-24">订单号：{{item.orders.order_sn}}</text>
				<text class="u-font-24">联系电话：{{item.users.phone}}</text>
			</view>
			<view class="order-num u-margin-top-15 flex align-center u-padding-bottom-10">
				<u-avatar :src="item.users.avatar" size="100"></u-avatar>
				<view class="u-margin-left-20 flex-sub" style="color: #505559;">
					<view class="u-font-28">
						评估类型：{{item.type == 1?'个人信用问题咨询':'企业信用问题咨询'}}
					</view>
					<view class="u-font-28">
						评估用户：{{item.users.realname}}
					</view>
				</view>
				<view class="text-green text-bold">
					+ {{item.commission/100}}元
				</view>
			</view>
		</view>
		<!-- <view class="cu-tabbar-height"></view> -->
		<!-- <view class="cu-tabbar-height"></view> -->
		<uni-load-more :loadingType="loadingType" :contentText="contentText" />
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				loadingType: 0,
				contentText: {
					contentdown: '上拉显示更多',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				},
				indexPage: 1,
				listItem: [],
				total_commission: ''
			}
		},
		onLoad() {
			this.getUserAccountInfo()
		},
		onReachBottom() {
			if (this.loadingType !== 0) {
				return;
			}
			this.loadingType = 1;
			this.getUserAccountInfo();
		},
		methods: {
			async getUserAccountInfo() {
				let res = await this.$u.post("manager/income", {
					page: this.indexPage
				})
				if (res.code == 200) {
					this.total_commission = res.data.total_commission
					this.listItem = this.listItem.concat(res.data.data)
					this.indexPage++
					if (res.data.current_page == res.data.last_page) {
						this.loadingType = 2;
					} else {
						this.loadingType = 0;
					}
				} else {
					uni.showToast({
						icon: 'none',
						title: data.message
					});
					this.loadingType = 0;
				}
			}
		}
	}
</script>

<style>
	.list_item {
		padding: 20rpx;
		border-radius: 16rpx;
		box-shadow: 6rpx 6rpx 10rpx rgba(122, 122, 122, 0.2);
		background: #fff;
	}

	.order-num::after {
		border-color: #bbb;
	}

	button::after {
		display: none;
	}
</style>
