<template>
  <d2-container class="ct">
    <div class="test">
      <!-- <div class="tac"> -->
        <el-menu
          :default-active="index"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-menu-item index="1" @click="handleMenuChange('1')">
            <span class="circle"><d2-icon-svg name="mail"/></span>
            <span slot="title">通讯录管理</span>
          </el-menu-item>
          <el-menu-item index="2" @click="handleMenuChange('2')">
            <span class="circle"><d2-icon-svg name="counters"/></span>
            <span slot="title">柜组管理</span>
          </el-menu-item>
          <el-menu-item index="3" @click="handleMenuChange('3')">
            <span class="circle"><d2-icon-svg name="store"/></span>
            <span slot="title">门店管理</span>
          </el-menu-item>
        </el-menu>
      <!-- </div> -->
    </div>
    <div class="content">
      <mail v-if="index == '1' && isHistoryShow == false"  @isShow="contorlHistoryShow"></mail>
      <counter v-if="index == '2'"></counter>
      <store v-if="index == '3'"></store>
      <history v-if="isHistoryShow == true" @isShow="contorlHistoryShow"></history>
    </div>
  </d2-container>
</template>

<script>
import Mail from "./mail";
import Store from "./store";
import Counter from "./counter";
import History from "./components/history";
export default {
  components: {
    Mail,
    Store,
    Counter,
    History
  },
  data () {
    return {
      index: '1',
      isHistoryShow: false
    }
  },
  methods: {
    handleClose () {},
    handleOpen (index) {
    },
    handleMenuChange (index) {
      this.index = index
      this.isHistoryShow = false
    },
    contorlHistoryShow (val) {
      this.isHistoryShow = val
    }
  }
}
</script>
<style></style>
<style scoped>
.ct >>> .d2-container-full__body{
  overflow: visible !important;
}
.ct >>> .d2-container-full {
  padding: 0 !important;
}
.d2-theme-container-main {
  background-color: #f8f8f8;
}
.test {
  width: 13%;
  min-height: 100%;
  display: flex;
  box-shadow:0px 2px 4px 0px rgba(221,221,221,1);
}
.content {
  width: 82%;
  display: flex;
}
.ct >>> .d2-container-full__body {
  display: flex;
  justify-content: space-between;
  padding: 0 !important;
}
/* .tac {
  width: 99%;
  height: 100%;
  box-shadow:0px 2px 4px 0px rgba(221,221,221,1);
} */
.test >>> .el-menu {
  border-right: none;
}
.test >>> .el-menu-item.is-active{
  border-left: 2px solid rgba(78,89,199,1);
}
.test >>> .el-menu {
  width: 100%;
  box-shadow: 0px 2px 4px 0px #ddd;
} 
.content {
  flex: 6;
  padding: 16px;
  background-color: #f8f8f8;
}
.circle {
  display: inline-block;
  width: 24px;
  height: 24px;
  background:rgba(255,255,255,1);
  box-shadow: 0px 1px 2px 0px rgba(78,89,199,1);
  border-radius: 50%;
  line-height: 24px;
  text-align: center;
  margin-right: 12px;
}
.theme-d2 .el-menu-item svg, .theme-d2 .el-submenu__title svg {
  margin-right: 0;
}
.ct >>> .d2-layout-header-aside-group .d2-layout-header-aside-content .d2-theme-container .d2-theme-container-main .d2-theme-container-main-layer {
  left: 0 !important;
}
</style>
