<template>
  <div class="lakala-container">
    <el-container>
      <el-header height="60px">
        <el-menu
          :default-active="activeMenu"
          mode="horizontal"
          @select="handleMenuSelect"
          class="el-menu-horizontal"
        >
          <el-menu-item index="profitShareReceiver">
            <span>分账接收方申请</span>
          </el-menu-item>
          <el-menu-item index="profitShareOrder">
            <span>分帐申请</span>
          </el-menu-item>
          <el-menu-item index="tradeOrder">
            <span>拉卡拉交易记录</span>
          </el-menu-item>
        </el-menu>
      </el-header>
      
      <el-main>
        <component 
          :is="currentComponent" 
          :axios-instance="axiosInstance" 
        />
      </el-main>
    </el-container>
  </div>
</template>

<script>
import ProfitShareReceiver from './ProfitShareReceiver.vue'
import ProfitShareOrder from './ProfitShareOrder.vue'
import TradeOrder from './TradeOrder.vue'

export default {
  name: 'LakalaAdmin',
  components: {
    ProfitShareReceiver,
    ProfitShareOrder,
    TradeOrder
  },
  props: {
    axiosInstance: {
      type: Object,
      default: null
    }
  },
  data() {
    return {
      activeMenu: 'profitShareReceiver'
    }
  },
  computed: {
    currentComponent() {
      if (this.activeMenu === 'profitShareReceiver') {
        return 'ProfitShareReceiver'
      } else if (this.activeMenu === 'profitShareOrder') {
        return 'ProfitShareOrder'
      } else if (this.activeMenu === 'tradeOrder') {
        return 'TradeOrder'
      }
      return 'ProfitShareReceiver'
    }
  },
  methods: {
    handleMenuSelect(key) {
      this.activeMenu = key
    }
  }
}
</script>

<style scoped>
.lakala-container {
  padding: 0;
  height: calc(100vh - 120px);
}

.el-menu-horizontal {
  height: 60px;
  font-size: 16px;
}

.el-header {
  padding: 0;
  background-color: #fff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.el-main {
  padding: 30px;
  background: #fff;
  margin: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  flex: 1;
}
</style>