<template>
  <div class="company-admittance">
    <cy-info-title>核心企业</cy-info-title>
    <owner type="company" :details="ownerInfo" />
    <cy-info-title>负面清单</cy-info-title>
    <negative-list :details="negativeInfo" />
    <cy-info-title>历史合作情况</cy-info-title>
    <history-cooperation :details="historyInfo" />
    <cy-info-title>综合评估</cy-info-title>
    <company-assess :details="evaluationInfo" />
    <div class="submit-btn">
      <el-button @click="closePage"> 关闭</el-button>
    </div>
  </div>
</template>

<script>
import { getEnterpriseReport } from '@/api/creditManage/projectManage'
export default {
  components: {
    Owner: () => import('./components/Owner'),
    NegativeList: () => import('./components/NegativeList'),
    HistoryCooperation: () => import('./components/HistoryCooperation'),
    CompanyAssess: () => import('./components/CompanyAssess')
  },
  data() {
    return {
      detailsInfo: {},
      ruleForm: {},
      ownerInfo: {},
      negativeInfo: {},
      historyInfo: {},
      evaluationInfo: {}
    }
  },
  created() {
    this.getDetails()
  },
  methods: {
    getDetails() {
      const { id } = this.$route.query
      getEnterpriseReport({ id }).then(({ data }) => {
        this.detailsInfo = data
        // 项目信息
        const {
          projectCoreEnterprise,
          projectCoreEnterpriseComprehensiveEvaluation
        } = data

        // 核心企业
        this.ownerInfo = {
          corporateName: projectCoreEnterprise.enterprise.corporateName,
          socialCreditCode: projectCoreEnterprise.enterprise.socialCreditCode,
          yearsDiff: projectCoreEnterprise.enterprise.yearsDiff,
          centralizedProcurementPlatform: projectCoreEnterprise.centralizedProcurementPlatform === 1 ? '是' : '否',
          establishmentPeriodScore: data.establishmentPeriodScore,
          registeredCapital: projectCoreEnterprise.enterprise.registeredCapital,
          registeredCapitalScore: data.registeredCapitalScore,
          address: projectCoreEnterprise.enterprise.address,
          registeredAddressScore: data.registeredAddressScore,
          businessAddress: projectCoreEnterprise.enterprise.businessAddress,
          businessAddressScore: data.businessAddressScore,
          enterpriseNature: data.projectCoreEnterpriseAuditInfo.enterpriseNature + ' ' + data.projectCoreEnterpriseAuditInfo.enterpriseNatureDetail,
          enterpriseNatureScore: data.enterpriseNatureScore,
          holdingRatio: data.projectCoreEnterpriseAuditInfo.holdingRatio,
          holdingRatioScore: data.holdingRatioScore,
          equityHierarchy: data.projectCoreEnterpriseAuditInfo.equityHierarchy + ' ' + data.projectCoreEnterpriseAuditInfo.equityHierarchyDetail,
          equityHierarchyScore: data.equityHierarchyScore,
          creditRating: data.projectCoreEnterpriseAuditInfo.creditRating,
          creditRatingScore: data.creditRatingScore
        }

        // 负面清单
        this.negativeInfo = data

        // 历史合作情况
        this.historyInfo = {
          historicalCooperationDuration: projectCoreEnterprise.historicalCooperationDuration,
          historicalCooperationScale: projectCoreEnterprise.historicalCooperationScale,
          historicalCooperationInvoicingAmount: projectCoreEnterprise.historicalCooperationInvoicingAmount,
          historicalCooperationMaximumAccountingPeriod: projectCoreEnterprise.historicalCooperationMaximumAccountingPeriod,
          historicalCooperationTimes: projectCoreEnterprise.historicalCooperationTimes,
          historicalCooperationDurationScore: data.historicalCooperationDurationScore,
          historicalCooperationScaleScore: data.historicalCooperationScaleScore,
          historicalCooperationInvoicingAmountScore: data.historicalCooperationInvoicingAmountScore,
          historicalCooperationMaximumAccountingPeriodScore: data.historicalCooperationMaximumAccountingPeriodScore,
          historicalCooperationTimesScore: data.historicalCooperationTimesScore
        }

        // 综合
        this.evaluationInfo = { ...projectCoreEnterpriseComprehensiveEvaluation, evaluationOpinions: data.projectCoreEnterpriseAuditInfo.evaluationOpinions }
      })
    },
    closePage() {
      this.$router.push({
        name: 'ProjectCredit'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.company-admittance {

}
</style>
