<template>
	<!-- 底部tab导航 -->
	<view>
		<Home v-if="nowchos === 0"></Home>
		<Order v-else-if="nowchos === 1 && isorders == 0 && userType == 3"></Order>
		<Information v-else-if="nowchos === 2  && isorders == 0 && userType == 3">
		</Information>
		<Mine v-else-if="nowchos === 3  && isorders == 0 && userType == 3"></Mine>
		<Mine v-else-if="nowchos === 1 && userType != 3"></Mine>
		<view class="bottomboxs">
			<x-navbottom :nowchos='nowchos' @botomchos='botomchos'></x-navbottom>
		</view>
	</view>
</template>

<script>
	import Home from './home/index.vue' // 引入首页
	import Order from './order/index.vue' // 引入收益首页
	import Information from './information/index.vue' // 记录
	import Mine from './mine/index.vue' // 记录
	export default {
		components: { //在这里注册相应的组件
			Home,
			Order,
			Information,
			Mine,
		},
		data() {
			return {
				nowchos: 0, //当前选择了那个底部菜单
				userInfo: {},
				isorders: 0,
				userType: 3,
			}
		},
		mounted() {
			var userInfo = this.$cache.getCache('userInfo')
			if (userInfo.provUser) {
				this.isorders = userInfo.provUser.isorders
				this.userType = userInfo.provUser.userType
			}
			this.userInfo = userInfo
		},
		methods: {
			// tab
			botomchos(e) {
				uni.setStorageSync('nowchos', e);
				this.nowchos = e
			},
		}
	}
</script>

<style lang="scss">
	.bottomboxs {
		position: relative;
		bottom: 0;
		z-index: 2023;
		height: 100rpx;
	}
</style>