<template>
  <div class="invoice-detail">
    <el-dialog title="发票详情" :visible.sync="showInvoiceDetailDialog" @close="onClose">
      <div>
        <div>
          <span class="bold">发票申请单号：</span>
          <span>{{ invoiceDetailInfo.applyNo }}</span>
        </div>
      </div>
      <div style="margin-top: 20px;">
        <div class="bold title">发票信息</div>
        <div class="item">
          <div class="sub-item">
            <span class="bold">发票抬头：</span>
            <span>{{ invoiceDetailInfo.title }}</span>
          </div>
          <div class="sub-item">
            <span class="bold">发票类型：</span>
            <span>{{ invoiceDetailInfo.fapiaoType === 0 ? '普通发票' : '专用发票' }}</span>
          </div>
        </div>
        <div class="item">
          <div class="sub-item">
            <span class="bold">发票抬头类型：</span>
            <span>{{ invoiceDetailInfo.titleType === 0 ? '个人' : '企业' }}</span>
          </div>
          <div class="sub-item">
            <span class="bold">发票金额：</span>
            <span>￥ {{ invoiceDetailInfo.amount }}</span>
          </div>
        </div>
        <div class="item">
          <div class="sub-item" v-if="invoiceDetailInfo.taxNo">
            <span class="bold">企业税号：</span>
            <span>{{ invoiceDetailInfo.taxNo }}</span>
          </div>
          <div class="sub-item" v-if="invoiceDetailInfo.bankName">
            <span class="bold">开户银行：</span>
            <span>{{ invoiceDetailInfo.bankName }}</span>
          </div>
        </div>
        <div class="item">
          <div class="sub-item" v-if="invoiceDetailInfo.bankAccount">
            <span class="bold">银行账号：</span>
            <span>{{ invoiceDetailInfo.bankAccount }}</span>
          </div>
          <div class="sub-item" v-if="invoiceDetailInfo.address">
            <span class="bold">企业地址：</span>
            <span>{{ invoiceDetailInfo.address }}</span>
          </div>
        </div>
        <div class="item">
          <div class="sub-item" v-if="invoiceDetailInfo.phone">
            <span class="bold">企业电话：</span>
            <span>{{ invoiceDetailInfo.phone }}</span>
          </div>
        </div>
      </div>
      <div style="margin-top: 20px;">
        <div class="bold title">联系信息</div>
        <div class="item">
          <div class="sub-item">
            <span class="bold">联系邮箱：</span>
            <span>{{ invoiceDetailInfo.email }}</span>
          </div>
        </div>
      </div>
      <div style="margin-top: 20px;">
        <div class="item">
          <div class="sub-item">
            <span class="bold">开票状态：</span>
            <span>{{ invoiceDetailInfo.fapiaoStatus === 0 ? '未开票' : '已开票' }}</span>
          </div>
        </div>
      </div>
      <div style="margin-top: 20px;">
        <div class="item">
          <div class="sub-item">
            <span class="bold">发票备注：</span>
            <span>{{ invoiceDetailInfo.remark }}</span>
          </div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: ['showInvoiceDetailDialog', 'invoiceDetailInfo'],

  methods: {
    onClose() {
      this.$emit('closeInvoiceDetailDialog')
    }
  }
}
</script>

<style lang="scss" scoped>
.invoice-detail {
  .bold {
    font-weight: bold;
  }

  .title {
    border-bottom: 1px solid #EEEEEE;
    padding-bottom: 10px
  }

  .item {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;

    .sub-item {
      flex: 1
    }
  }
}
</style>