<template>
  <el-dialog :visible.sync="visible">
    <el-form :model="dataForm" ref="dataForm" inline class="demo-table-expand">
      <div v-if="dataForm.dataInvo!=null && dataForm.dataInvo!=''">
        <el-form-item label="是否需要">
          <span v-if="dataForm.dataInvo.isNeed == 0">不需要</span>
          <span v-if="dataForm.dataInvo.isNeed == 1">需要</span>
        </el-form-item>
        <el-form-item label="提前开发票">
          <span v-if="dataForm.dataInvo.isPrepare == 0">不需要</span>
          <span v-if="dataForm.dataInvo.isPrepare == 1">需要</span>
        </el-form-item>
        <el-form-item label="创建时间">
          <span>{{ dataForm.dataInvo.submTime }}</span>
        </el-form-item>
        <el-form-item label="需要时间">
          <span>{{ dataForm.dataInvo.wantTime }}</span>
        </el-form-item>
        <el-form-item label="领取方式">
          <span v-if="dataForm.dataInvo.postType == 0">前台自取</span>
          <span v-if="dataForm.dataInvo.postType == 1">邮寄</span>
          <span v-if="dataForm.dataInvo.postType == 2">电子发票</span>
          <span v-if="dataForm.dataInvo.postType == 3">送至房间</span>
        </el-form-item>
        <el-form-item label="发票类型">
          <span v-if="dataForm.dataInvo.type == 1">增值税普通发票</span>
          <span v-if="dataForm.dataInvo.type == 2">增值税专用发票</span>
        </el-form-item>
        <el-form-item label="开票项目">
          <span>{{ dataForm.dataInvo.itemComt }}</span>
        </el-form-item>
        <el-form-item label="发票抬头">
          <span>{{ dataForm.dataInvo.tittle }}</span>
        </el-form-item>
        <el-form-item label="公司电话">
          <span>{{ dataForm.dataInvo.compPhone }}</span>
        </el-form-item>
        <el-form-item label="公司税号">
          <span>{{ dataForm.dataInvo.taxNo }}</span>
        </el-form-item>
        <el-form-item label="公司地址">
          <span>{{ dataForm.dataInvo.compAdd }}</span>
        </el-form-item>
        <el-form-item label="开户行">
          <span>{{ dataForm.dataInvo.bank }}</span>
        </el-form-item>
        <el-form-item label="银行账号">
          <span>{{ dataForm.dataInvo.bankAcc }}</span>
        </el-form-item>
        <el-form-item label="邮寄地址">
          <span>{{ dataForm.dataInvo.postAdd }}</span>
        </el-form-item>
        <el-form-item label="收件人姓名">
          <span>{{ dataForm.dataInvo.receiverName }}</span>
        </el-form-item>
        <el-form-item label="收件人电话">
          <span>{{ dataForm.dataInvo.receiverPhone }}</span>
        </el-form-item>
      </div>
    </el-form>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        id: 0,
        dataInvo: ""
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0
      this.visible = true
      this.$nextTick(() => {
        this.$refs["dataForm"].resetFields()
        this.$http({
          url: this.$http.adornUrl("/ord/order/invo"),
          method: "get",
          params: this.$http.adornParams({
            'ordCode': id
          })
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.dataForm.dataInvo = data.invo_info
          } else {
            this.$message.error(data.msg)
          }
        })
      })
    }
  }
}
</script>
<style>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>
