<!--
  @description: 营业执照详情
  @Modifier: ht
  @date: 2021-01-19-10:57
-->
<template>
    <div>
        <div class="title p0-16 clearfix">
            <div class="title-back pointer" @click="back">
                <i class="iconfont icon-fanhui mr10" />营业执照
            </div>
        </div>
        <div :class="invitationDetailType = 'view'">
            <!--项目信息-->
            <dl class="projectInfoDetail">
                <dt>
                    <p class="projectInfoDetail_icon">
                        <i class="iconfont icon-xiangmujibenxinxi" />
                    </p>
                    营业执照
                </dt>
                <dd>
                    <table class="tableData">
                        <tr>
                            <td>统一社会信用代码</td>
                            <td>{{ formData.registerNumber }}</td>
                            <td>名称</td>
                            <td>{{ formData.companyName }}</td>
                        </tr>
                        <tr>
                            <td>类型</td>
                            <td>{{ formData.companyType }}</td>
                            <td>住所</td>
                            <td>{{ formData.companyAddress }}</td>
                        </tr>
                        <tr>
                            <td>法定代表人</td>
                            <td>{{ formData.legalRepresentative }}</td>
                            <td>注册资本</td>
                            <td>{{ formData.registerCapital }}</td>
                        </tr>
                        <tr>
                            <td>成立日期</td>
                            <td>{{ formData.establishDate }}</td>
                            <td>营业期限起</td>
                            <td>{{ formData.busnissTermStartDate }}</td>
                        </tr>
                        <tr>
                            <td>营业期限止</td>
                            <td>{{ formData.busnissTermEndDate }}</td>
                            <td>营业范围</td>
                            <td>{{ formData.businessScope }}</td>
                        </tr>
                        <tr>
                            <td>登记机关</td>
                            <td>{{ formData.registerInstitution }}</td>
                            <td>是否为永久经营</td>
                            <td>{{ formData.isPerpetual }}</td>
                        </tr>
                        <tr>
                            <td>是否为区内企业</td>
                            <td>{{ formData.isinAreaEnterprises }}</td>
                        </tr>
                    </table>
                </dd>
            </dl>
            <!--邀请函信息-->
            <dl class="projectInfoDetail">
                <dt>
                    <p class="projectInfoDetail_icon">
                        <i class="iconfont icon-xiangmujibenxinxi" />
                    </p>
                    附件信息
                </dt>
                <dd>
                    <table class="tableData">
                        <tr class="singleRow">
                            <td>附件下载</td>
                            <td colspan="3">
                                <div v-for="(item,index) in scanCertificate" :key="index" class="file">
                                    <a ref="downLoads" class="inline-file">
                                      <span @click="downLoadClick(item)">
                                        <i class="iconfont icon-icon_file" />
                                        {{ item.fileName }}
                                      </span>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    </table>
                </dd>
            </dl>
        </div>
        <!--当前页面从哪进来的  01 驱动内列表页 并且不是工作流-->
        <div class="but_footer">
            <div class="but_footer-h" />
            <div class="but_footer-but">
                <el-button @click="back()">
                    返 回
                </el-button>
            </div>
        </div>
    </div>
</template>
<script>
/* 接口*/
import { findBusinessLicenseInfo, downAttachmentLoadFile } from '@api/bidding/bidderRepresentative'
import { download } from '@/assets/js/utils/index'
/* 公用方法*/
import { filterObj } from '@/assets/js/utils'// 常用方法

export default {
  name: 'AchievemenyInfo',
  data() {
    return {
      loading: true,
      searchForm: {
        id: this.$route.query.id
      },
      formData: {
        registerNumber: '', // 统一社会信用代码
        companyName: '', // 采购单位
        companyType: '', // 类型
        companyAddress: '', // 住所
        legalRepresentative: '', // 法定代表人
        registerCapital: '', // 注册资本
        establishDate: '', // 成立日期
        busnissTermStartDate: '', // 营业期限起
        busnissTermEndDate: '', // 营业期限止
        businessScope: '', // 营业范围
        registerInstitution: '', // 登记机关
        isPerpetual: '', // 是否为永久经营
        isinAreaEnterprises: '' // 是否为区内企业
      },
      scanCertificate: []
    }
  },
  created() {
    this.loadData()
  },
  methods: {
    loadData() {
      const params = this.getQueryParams() // 查询条件
      findBusinessLicenseInfo(params).then(response => {
        this.loading = false
        this.formData = response.data
        this.scanCertificate = response.data.scanCertificate
      }).catch(() => {
        this.loading = false
      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      return filterObj(param)
    },
    // 返回
    back() {
      this.$router.push('/bidderRepresentative/businessLicenseList')
    },
    downLoadClick(item) {
      const params = {
        fileName: item.fileName,
        fileId: item.fileId
      }
      downAttachmentLoadFile(params).then(res => {
        download(res, item.fileName)
      }).catch(() => {
        this.loading = false
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
