<template>
	<view class="content">
		<view class="block">
			<view class="block-title">统计数据</view>
			<view class="total-flex">
				<view class="total-item">
					<image class="icon" src="@/static/icons/work_icon_00.png"></image>
					<view class="title">诉讼委托单</view>
					<view class="number">{{orderAll.all}}<text>单</text></view>
				</view>
				<view class="total-item">
					<image class="icon" src="@/static/icons/work_icon_01.png"></image>
					<view class="title">已缴费</view>
					<view class="number">{{orderAll.payed}}<text>单</text></view>
				</view>
				<view class="total-item">
					<image class="icon" src="@/static/icons/work_icon_03.png"></image>
					<view class="title">已退款</view>
					<view class="number">{{orderAll.refund}}<text>单</text></view>
				</view>
				<view class="total-item">
					<image class="icon" src="@/static/icons/work_icon_05.png"></image>
					<view class="title">结算金额</view>
					<view class="number">{{orderAll.price}}<text>元</text></view>
				</view>
				
			</view>
		</view>
		<view class="block">
			<view class="block-title">委托订单管理</view>
			<view class="tool-flex">
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 0, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_06.png"></image>
					<view class="number" v-if="orderEntrust.init > 0">{{orderEntrust.init}}</view>
					<view class="text">待支付</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 1, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_21.png"></image>
					<view class="number" v-if="orderEntrust.audit > 0">{{orderEntrust.audit}}</view>
					<view class="text">待审核</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 2, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_07.png"></image>
					<view class="number" v-if="orderEntrust.sign > 0">{{orderEntrust.sign}}</view>
					<view class="text">待签约</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 3, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_10.png"></image>
					<view class="number" v-if="orderEntrust.signed > 0">{{orderEntrust.signed}}</view>
					<view class="text">已签约</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 4, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_08.png"></image>
					<view class="number" v-if="orderEntrust.complete > 0">{{orderEntrust.complete}}</view>
					<view class="text">已完成</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 5, type: 'entrust' })">
					<image class="icon" src="@/static/icons/work_icon_09.png"></image>
					<view class="number" v-if="orderEntrust.reject > 0">{{orderEntrust.reject}}</view>
					<view class="text">已驳回</view>
				</view>
			</view>
		</view>
		<view class="block">
			<view class="block-title">拓展订单管理</view>
			<view class="tool-flex">
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 0, type: 'expand' })">
					<image class="icon" src="@/static/icons/work_icon_06.png"></image>
					<view class="number" v-if="orderExpand.init > 0">{{orderExpand.init}}</view>
					<view class="text">待支付</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 1, type: 'expand' })">
					<image class="icon" src="@/static/icons/work_icon_10.png"></image>
					<view class="number" v-if="orderExpand.paid > 0">{{orderExpand.paid}}</view>
					<view class="text">已支付</view>
				</view>
				<view class="tool-flex-item" @click="onNav('SynthesizeOrder', { status: 2, type: 'expand' })">
					<image class="icon" src="@/static/icons/work_icon_08.png"></image>
					<view class="number" v-if="orderExpand.refund > 0">{{orderExpand.refund}}</view>
					<view class="text">已退款</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { synthesisAttorney } from '@/apis/interfaces/work.js'
	export default {
		data() {
			return {
				// 综法订单管理
				orderAll		: '',
				orderEntrust	: '',
				orderExpand	: ''
			};
		},
		onShow() {
			this.getIndex()
		},
		methods: {
			// 工作台信息
			getIndex(){
				uni.showLoading({
					title: '加载中...',
					mask : true
				})
				// 综法法律咨询单统计
				synthesisAttorney().then(res => {
					uni.hideLoading()
					this.orderAll	     = res.all
					this.orderEntrust	 = res.orders.entrust
					this.orderExpand	 = res.orders.expand
				}).catch(err => {
					uni.showToast({
						title: err.message,
						icon : 'none'
					})
				})
			},
			
			// 导航
			onNav(name, obj){
				let params = obj || {}
				this.$Router.push({name, params})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		padding: 30rpx 0;
	}
	// 登录提示
	.auth-null{
		height: 100vh;
		width: 100vw;
		background: white;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		.auth-null-btn{
			height: 90rpx;
			line-height: 90rpx;
			padding: 0;
			width: 70vw;
			background: $main-color;
			color: white;
			font-size: 32rpx;
			margin-top: 100rpx;
			font-weight: bold;
		}
	}
	// 弹出特权
	.privilege-lay{
		width: 70vw;
		.privilege-lay-img{
			width: 70vw;
			vertical-align: top;
		}
		.privilege-lay-content{
			background: white;
			border-radius: 0  0 20rpx 20rpx;
			width: 70vw;
			padding: 80rpx 30rpx 50rpx;
			box-sizing: border-box;
			margin-top: -50rpx;
			line-height: 50rpx;
			color: #111111;
			font-size: 30rpx;
		}
		.privilege-lay-remove{
			padding-top: 30rpx;
			text-align: center;
			.privilege-lay-icon{
				display: inline-block;
			}
		}
	}
	// header
	.work-bar{
		padding: 30rpx;
		margin-bottom: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		&-user{
			position: relative;
			line-height: 70rpx;
			height: 70rpx;
			width: calc(100% - 200rpx);
			padding-left: 90rpx;
			box-sizing: border-box;
			.cover{
				width: 70rpx;
				height: 70rpx;
				border-radius: 50%;
				position: absolute;
				left: 0;
				top: 0;
			}
			.nickname{
				font-weight: bold;
				font-size: 34rpx;
				.card{
					color: $main-color;
					font-size: 24rpx;
					display: inline-block;
					height: 40rpx;
					line-height: 38rpx;
					border-radius: 24rpx;
					padding: 0 15rpx;
					margin-left: 20rpx;
					margin-bottom: 2rpx;
					vertical-align: middle;
					border:solid 1rpx $main-color;
					font-weight: normal;
				}
			}
		}
		&-add{
			width: 200rpx;
			font-size: 30rpx;
			text-align: right;
			line-height: 70rpx;
			.icon{
				margin-right: 5rpx;
				font-weight: bold;
			}
		}
	}
	// 订单管理
	.tool-flex{
		padding: 0 10rpx;
		display: flex;
		flex-wrap: wrap;
		.tool-flex-item{
			width: 25%;
			text-align: center;
			margin-bottom: 30rpx;
			position: relative;
			.icon{
				width: 78rpx;
				height: 78rpx;
				background: #ddd;
				border-radius: 20rpx;
			}
			.number{
				position: absolute;
				right: 20%;
				background: #fe4444;
				top: -10rpx;
				height: 40rpx;
				line-height: 40rpx;
				min-width: 40rpx;
				font-size: 24rpx;
				color: white;
				border-radius: 50%;
			}
			.text{
				line-height: 40rpx;
				font-size: 26rpx;
				color: #111;
				text-align: center;
			}
		}
	}
	// 数据统计单
	.total-flex{
		padding: 0 20rpx 20rpx;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		.total-item{
			margin: 0 10rpx 20rpx;
			background: #f8f8f8;
			width: calc(50% - 20rpx);
			padding: 20rpx 20rpx 20rpx 120rpx;
			box-sizing: border-box;
			border-radius: $radius;
			position: relative;
			min-height: 140rpx;
			.icon{
				position: absolute;
				left: 20rpx;
				top: 50%;
				width: 70rpx;
				height: 70rpx;
				margin-top: -35rpx;
			}
			.title{
				font-size: 28rpx;
				color: #111;
				line-height: 40rpx;
				@extend .nowrap;
			}
			.number{
				padding-top: 5rpx;
				font-weight: bold;
				font-size: 34rpx;
				color: #111;
				font-family: Arial, Helvetica, sans-serif;
				line-height: 40rpx;
				@extend .nowrap;
				text{
					font-size: 80%;
					font-weight: normal;
					padding-left: 10rpx;
				}
			}
		}
	}
	// 通用板块
	.block{
		background: white;
		margin: 0 30rpx 20rpx;
		border-radius: $radius;
		.block-title{
			padding: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-weight: bold;
			color: '#111';
			font-size: 32rpx;
		}
	}
	// 开通业务员
	.open-interest{
		padding: 30rpx;
		margin-bottom: 30rpx;
		.title{
			text-align: center;
			font-size: 34rpx;
			font-weight: bold;
			line-height: 80rpx;
		}
		.open-interest-flex{
			display: flex;
			flex-wrap: wrap;
			padding-top: 30rpx;
			justify-content: space-between;
			.open-interest-item{
				text-align: center;
				.open-interest-icon{
					width: 88rpx;
					height: 88rpx;
					vertical-align: top;
					margin-bottom: 15rpx;
				}
				.open-interest-text{
					font-size: 28rpx;
					color: #111111;
					line-height: 40rpx;
				}
			}
		}
		// 开通步骤
		.open-interest-block{
			padding: 30rpx 0;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.open-interest-icon{
				width: 88rpx;
				height: 88rpx;
			}
			.open-interest-text{
				width: calc( 100% - 258rpx);
				padding:0 30rpx;
				box-sizing: border-box;
				.open-interest-title{
					font-weight: bold;
					color: #111111;
					line-height: 40rpx;
					font-size: 30rpx;
				}
				.open-interest-submit{
					color: #666666;
					font-size: 26rpx;
					line-height: 40rpx;
				}
			}
			.open-interest-btn[size="mini"]{
				width: 170rpx;
				height: 70rpx;
				line-height: 70rpx;
				padding: 0;
				border-radius: 35rpx;
				background: $main-color;
				color: white;
				font-size: 30rpx;
				&::after{
					display: none;
				}
				&[disabled]{
					background: #EEEEEE;
					color: #999999;
				}
			}
		}
	}
</style>
