<template>
  <section class="pumDetail">
    <ai-detail>
      <ai-title slot="title" title="经营主体详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})"/>
      <template #content>
        <el-form size="small" label-width="160px">
          <ai-card title="营业执照">
            <template #content>
              <el-form-item label="企业名称">{{ detail.enterpriseName }}</el-form-item>
              <el-form-item label="统一社会信用代码">{{ detail.unifiedCode }}</el-form-item>
              <el-form-item label="企业类型">{{ dict.getLabel('enterpriseType', detail.enterpriseType) }}</el-form-item>
              <el-form-item label="所在地区">{{ detail.areaName }}</el-form-item>
              <el-form-item label="详细地址">{{ detail.address }}</el-form-item>
              <el-form-item label="经营范围">{{ detail.businessScope }}</el-form-item>
              <el-form-item label="营业期限">{{ detail.operationPeriod }}</el-form-item>
              <el-form-item label="营业执照">
                <el-image class="thumb" :src="detail.businessLicense" :preview-src-list="[detail.businessLicense]"/>
              </el-form-item>
            </template>
          </ai-card>
          <ai-card title="法人信息">
            <template #content>
              <el-form-item label="法人姓名">{{ detail.legalPersonName }}</el-form-item>
              <el-form-item label="身份证号">{{ detail.idNumber }}</el-form-item>
              <el-form-item label="联系方式">{{ detail.phone }}</el-form-item>
              <el-form-item label="身份证照片">
                <el-row type="flex" align="middle">
                  <el-image class="thumb" :src="detail.idNumberTopside" :preview-src-list="[detail.idNumberTopside]"/>
                  <el-image class="thumb" :src="detail.idNumberBackside" :preview-src-list="[detail.idNumberBackside]"/>
                </el-row>
              </el-form-item>
            </template>
          </ai-card>
          <ai-card title="审核结果" v-if="!isAuthing">
            <template #content>
              <el-form-item label="审核人">{{ detail.auditUserName }}</el-form-item>
              <el-form-item label="联系方式">{{ detail.auditPhone }}</el-form-item>
              <el-form-item label="备注说明">{{ detail.auditDescription }}</el-form-item>
            </template>
          </ai-card>
        </el-form>

      </template>
    </ai-detail>
  </section>
</template>

<script>
export default {
  name: "pumDetail",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function
  },
  computed: {
    isAuthing() {
      return this.detail.status == "0"
    }
  },
  data() {
    return {
      detail: {},
    }
  },
  methods: {
    getDetail() {
      let {id} = this.$route.query
      this.instance.post("/appportaluserenterprise/queryDetailById", null, {
        params: {id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data
        }
      })
    },
  },
  created() {
    this.getDetail()
  }
}
</script>

<style lang="scss" scoped>
.pumDetail {
  height: 100%;

  .thumb {
    width: 120px;
    height: 120px;

    & + .thumb {
      margin-left: 8px;
    }
  }
}
</style>
