<template>
  <div class="trade-main">
    <div class="title">
      <div class="name" />
    </div>
    <!-- <div style="margin-bottom: 25px">
      <div class="operation-box">
        <div class="operation-title">
          <div style="display: flex; justify-content: center;">
            <div
              class="operation"
              :class="{ 'is-action': type === 'SalesOrder' }"
              @click="handlerOptions('SalesOrder')"
            >
              <div class="icon-a-Group963 iconfont" />
              <div>销售订单</div>
            </div>
            <div
              class="operation"
              :class="{ 'is-action': type === 'SalesInvoice' }"
              @click="handlerOptions('SalesInvoice')"
            >
              <div class="icon-a-Group964 iconfont" />
              <div>销售发票</div>
            </div>
            <div
              class="operation"
              :class="{ 'is-action': type === 'SalesTransport' }"
              @click="handlerOptions('SalesTransport')"
            >
              <div class="icon-a-Group961 iconfont icon-orange" />
              <div>物流运输</div>
            </div>
          </div>
        </div>
      </div>
    </div> -->
    <el-tabs v-model="type" type="card" @tab-click="handlerOptions()">
      <el-tab-pane label="销售订单" :name="'SalesOrder'" />
      <el-tab-pane label="销售发票" :name="'SalesInvoice'" />
      <el-tab-pane label="物流运输" :name="'SalesTransport'" />
    </el-tabs>

    <transition name="fade-transform" mode="out-in">
      <salesOrder v-if="type === 'SalesOrder'" />
      <salesInvoice v-if="type === 'SalesInvoice'" />
      <salesTransport v-if="type === 'SalesTransport'" />
    </transition>

  </div>
</template>

<script>
export default {
  components: {
    SalesOrder: () => import('./salesOrder/index'),
    SalesInvoice: () => import('./salesInvoices/index'),
    SalesTransport: () => import('./salesTransport/index')
  },
  data() {
    return {
      type: 'SalesOrder'
    }
  },
  created() {
    const { type } = this.$route.query
    if (type) {
      this.type = type
    }
  },
  mounted() {
    this.type = this.$store.state.user.mySalesBillType || 'SalesOrder'
  },
  methods: {
    handlerOptions() {
      const name = this.type
      this.$store.commit('user/SET_SALES_BILL_TYPE', name)
    }
  }
}
</script>

<style lang="scss" scoped>
.trade-main {
  color: #222931;
  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    .name {
      font-size: 24px;
      font-weight: 700;
    }
  }
  .operation-box {
    width: 100%;
    background: #F5F6F6;
    margin-top: 20px;
    .operation-title {
      align-items: flex-end;
      margin-bottom: 10px;
      .operation {
        width: calc(25% - 40px);
        text-align: center;
        padding: 20px;
        cursor: pointer;
        // &:hover {
        //   background: #FE7D0B;
        //   color: #fff;
        //   .iconfont {
        //     color: #fff
        //   }
        // }
        &.is-action {
          background: #FE7D0B;
          color: #fff;
          .iconfont {
            color: #fff
          }
        }
        .iconfont {
          font-size: 40px;
          margin-bottom: 15px;
        }
      }
    }
  }
}
</style>
