<template>
	<view class="content">
		<view class="topItem">
			<view class="topItem-label" @click="$Router.push({name: 'SeekOrder'})">
				<view class="topItem-name" v-if="synthesisData.synthesis">
					咨询单({{synthesisData.synthesis.all}})
				</view>
				<image class="topItem-arrow" src="@/static/imgs/payArrow.png" mode="widthFix"></image>
			</view>
			<view class="topItem-label" @click="$Router.push({name: 'YearOrder'})">
				<view class="topItem-name" v-if="synthesisData.service">
					年费单({{synthesisData.service.all}})
				</view>
				<image class="topItem-arrow" src="@/static/imgs/payArrow.png" mode="widthFix"></image>
			</view>
			<view class="topItem-label" @click="$Router.push({name: 'EntrustOrder'})">
				<view class="topItem-name" v-if="synthesisData.entrust">
					委托单({{synthesisData.entrust.all}})
				</view>
				<image class="topItem-arrow" src="@/static/imgs/payArrow.png" mode="widthFix"></image>
			</view>
			<view class="topItem-label" @click="$Router.push({name: 'ExpandOrder'})">
				<view class="topItem-name" v-if="synthesisData.expand">
					拓展单({{synthesisData.expand.all}})
				</view>
				<image class="topItem-arrow" src="@/static/imgs/payArrow.png" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import { synthesisCount } from '@/apis/interfaces/synthesis'
	export default {
		data() {
			return {
				userLogin     : '',     // 登录状态
				synthesisData : '',     // 综法数量
			}
		},

		onShow() {
		    if(this.$store.getters.getToken) {
		        this.userLogin = true
				
				// 获取综法订单数据数量
				this.synthesisInfo();
		    }
		},

		methods: {
			// 综法订单数据数量
			synthesisInfo() {
			    synthesisCount({channel: 'self'}).then(res => {
					this.synthesisData = res
			    }).catch(err => {
					uni.showToast({
						title: err.message,
						icon: "none"
					})
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.topItem-label {
		display: flex;
		line-height: 110rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		border-bottom: 2rpx solid #e8e8e8;
	}
	
	.topItem-name {
		flex: 1;
	}

	.topItem-arrow {
		width: 18rpx;
		height: 18rpx;
		margin-top: 40rpx;
	}
</style>
