invoiceCode.vue 1.75 KB
<template>
  <div class="invoiceCode">
    <div class="invoice-header">
      <el-tabs v-model="activeName"
               @tab-click="handleClick">
        <el-tab-pane v-for="(item, index) in tabPaneList"
                     :label="item.label"
                     :name="item.name"
                     :key="index">
        </el-tab-pane>
      </el-tabs>
      <components :is="tabName" @handleChangeTab="handleChangeTab"></components>
    </div>
  </div>
</template>
<script>
import editInvoice from "./editInvoice.vue"
import invoiceCodeList from "./invoiceCodeList.vue"
export default {
  name: "OrderList",
  components: {
    editInvoice,
    invoiceCodeList
  },
  data() {
    return {
      activeName: "1",
      tabPaneList: [
        {
          label: "生成发票二维码",
          name: "1"
        },
        {
          label: "管理开票二维码",
          name: "2"
        }
      ],
      tabName: "editInvoice"
    }
  },
  mounted() {
    if (this.$route.params.tabPane) {
      this.activeName = this.$route.params.tabPane
      this.tabName = this.$route.params.tabLabel
    }
  },
  watch: {},
  methods: {
    async getBaseData() {
      this.baseData.channelTypeList = await this.get(BaseData.channelType)
      this.getOptionsList()
    },
    handleClick() {
      const arr = {
        1: "editInvoice",
        2: "invoiceCodeList"
      }
      this.tabName = arr[+this.activeName]
    },
    handleChangeTab(e) {
      if(!e) {
        return true
      }
      let { activeTab } = e
      this.activeName = activeTab
      this.handleClick()
    },
  }
}
</script>
<style lang="scss" scoped>
.invoiceCode {
  padding: 0 20px;

  .invoice-header {
    ::v-deep .el-tabs__header {
      margin: 0;
      padding: 0 20px;
    }
  }
}
</style>