<template>
	<view :style="colorStyle">
		<goodsCate1 v-show="category==1" ref="classOne"></goodsCate1>
	</view>
</template>

<script>
	import colors from "@/mixins/color";
	import goodsCate1 from './goods_cate1';
	import {
		mapGetters
	} from 'vuex';
	export default {
		computed: mapGetters(['isLogin', 'uid']),
		components: {
			goodsCate1
		},
		mixins: [colors],
		data() {
			return {
				category: '',
				is_diy: uni.getStorageSync('is_diy'),
				status: 0,
			}
		},
		onLoad() {
			this.classStyle();
		},
		onReady() {

		},
		onShow() {
			if (this.status == 2 || this.status == 3) {
				uni.hideTabBar();
			} else if (this.status == 1) {
				if (!this.is_diy) {
					uni.hideTabBar();
				} else {
					this.$refs.classOne.getNav();
				}
			}
		},
		methods: {
			jumpIndex() {
				if (this.is_diy) {
					if (!uni.getStorageSync('FOOTER_BAR')) {
						uni.showTabBar()
					}
				}
			},
			classStyle() {
				let res = {
					data:{
						status: 1
					}
				}
				// colorChange('category').then(res => {
					let status = res.data.status;
					this.status = res.data.status
					this.category = status
					if (status == 2) {
						if (this.isLogin) {
							this.$refs.classTwo.getCartNum();
							this.$refs.classTwo.getCartList(1);
						}
						this.$refs.classTwo.getAllCategory()
					}
					if (status == 3) {
						if (this.isLogin) {
							this.$refs.classThree.getCartNum();
							this.$refs.classThree.getCartList(1);
						}
						this.$refs.classThree.getAllCategory()
					}
					if (status == 2 || status == 3) {
						uni.hideTabBar()
					} else {
						if (!this.is_diy) {
							uni.hideTabBar()
						} else {
							this.$refs.classOne.getNav();
						}
					}
				// })
			}
		},
		onReachBottom: function() {
			if (this.category == 2) {
				this.$refs.classTwo.productslist();
			}
			if (this.category == 3) {
				this.$refs.classThree.productslist();
			}
		}
	}
</script>
<style scoped lang="scss">
	/deep/.mask {
		z-index: 99;
	}
</style>
