<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 === 'InvoicesManagement' }"
              @click="handlerOptions('InvoicesManagement')"
            >
              <div class="icon-box">
                <svg-icon icon-class="invoicesManagement" style="font-size: 38px;" />
              </div>
              <div>发票管理</div>
            </div>
            <div
              class="operation"
              :class="{ 'is-action': type === 'divideAccountsManage' }"
              @click="handlerOptions('divideAccountsManage')"
            >
              <div class="icon-box">
                <svg-icon icon-class="divideAccountsManage" />
              </div>
              <div>分账管理</div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <transition name="fade-transform" mode="out-in">
      <invoices-management v-if="type == 'InvoicesManagement'" />
      <divide-accounts-manage v-if="type == 'divideAccountsManage'" />
    </transition>

  </div>
</template>

<script>
export default {
  components: {
    InvoicesManagement: () => import('./invoicesManagement/index.vue'),
    DivideAccountsManage: () => import('./divideAccountsManage')
  },
  data() {
    return {
      type: 'InvoicesManagement'
    }
  },
  created() {
    // const { type } = this.$route.query
    this.type = this.$store.state.user.mySettlement || 'InvoicesManagement'
  },
  methods: {
    handlerOptions(name) {
      this.type = name
      this.$store.commit('user/SET_SETTLMENT_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

          }
          .icon-box {
            background: rgba(255, 255, 255, 0.2) !important;
            .svg-icon {
              color: #fff
            }
           }

        }
        .iconfont {
          font-size: 40px;
          margin-bottom: 15px;
        }
        .icon-box {
          width: 50px;
          height: 50px;
          margin: 0 auto;
          background: #f6dcc5;
          border-radius: 10px;
          position: relative;
          margin-bottom: 10px;
          color: #fe973c;
          .svg-icon {
            font-size: 50px;
            position: absolute;
            top: -8px;
            right: -5px;
          }
        }
      }
    }
  }
}
</style>
