<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="农商批发订单" :name="0"></el-tab-pane>
      <el-tab-pane label="同城秒送订单" :name="1"></el-tab-pane>
      <el-tab-pane label="福利专区订单" :name="2"></el-tab-pane>
    </el-tabs>
    <component :is="componentName"></component>
  </div>
</template>
<script>
import wholesale from "./components/wholesale.vue";
import instantDelivery from "./components/instantDelivery.vue";
import welfareZone from "./components/welfareZone.vue";
export default {
  components: {
    wholesale,
    instantDelivery,
    welfareZone,
  },
  name: "order",
  data() {
    return {
      activeName: 0,
      componentName: wholesale,
    };
  },
  mounted() {},
  methods: {
    handleClick(tab) {
      switch (parseInt(tab.name)) {
        case 0:
          this.componentName = wholesale;
          break;
        case 1:
          this.componentName = instantDelivery;
          break;
        case 2:
          this.componentName = welfareZone;
          break;
        default:
          this.componentName = wholesale;
      }
    },
  },
};
</script>
