<template>
  <merchantXc v-if="roleType == 0" :titleTop="titleTop" :statusBarHeight="statusBarHeight" :nowTab1="nowTab" ></merchantXc>
  <employeeXc v-else-if="roleType == 1" :titleTop="titleTop" :statusBarHeight="statusBarHeight" :nowTab1="nowTab"></employeeXc>
</template>

<script>
  import merchantXc from "../components/merchantXc";
  import employeeXc from "../components/employeeXc";
  export default {
    components: {
      merchantXc,
      employeeXc
    },
    data() {
      return {
        roleType: -1,
        nowTab: 1,
        titleTop: 1,
        statusBarHeight: 1,
      };
    },
    onLoad: function(options) {
      this.roleType = this.$store.state.user.roleType;
      const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
      const { top, height } = menuButtonInfo;
      this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
      // 计算标题需要偏移的位置
      this.titleTop = top + (height - this.statusBarHeight) / 2;

      if (options.self == 'true'){
        this.nowTab = 2;
      }
    },
    methods: {


    }
  }
</script>
