<template>
  <div class="acceptance-management-view">
    <div v-if="advanceViewList.length" class="view-steps-box">
      <cy-steps :steps-data="advanceViewList"></cy-steps>
    </div>
    <div v-loading="loading">
      <el-collapse v-if="advanceViewList.length" v-model="activeNames" @change="handleChange">
        <el-collapse-item v-for="(item, index) in advanceViewList" :id="index" :key="index" :name="index">
          <template slot="title">
            <cy-view-bar
              :view-bar-data="{ ...item.businessProcessingLogVo, formBusinessName: item.formBusinessName, index: index + 1 }"
            >
            </cy-view-bar>
          </template>
          <legal-person
            v-if="item.formBusinessName === '提交苏商银行的申请'"
            :details-info="item.obj.financingFromInvestorsPerson"
            :disabled="true"
          ></legal-person>
          <company-info
            v-if="item.formBusinessName === '提交苏商银行的申请'"
            :details-info="item.obj"
            :disabled="true"
          ></company-info>
          <contract-file
            v-if="item.formBusinessName === '提交苏商银行的申请'"
            :details-info="item.obj.financingFromInvestorsContracts"
            :disabled="true"
          ></contract-file>
          <auth-book
            v-if="item.formBusinessName === '提交苏商银行的申请'"
            :details-info="item.obj.financingFromInvestorsEletronicContracts"
            :disabled="true"
          ></auth-book>
          <auth-info-detail
            v-if="item.formBusinessName === '苏商银行回调'"
            :details-info="item.obj"
            :disabled="true"
          >
          </auth-info-detail>
        </el-collapse-item>
      </el-collapse>
    </div>
  </div>
</template>

<script>
import { doBusinessHistoryView } from '@/api/dictionary'
import collapseSeeMix from '@/mixins/collapseSeeMix'

export default {
  components: {
    LegalPerson: () => import('./LegalPersonInfo.vue'),
    CompanyInfo: () => import('./CompanyInfo.vue'),
    ContractFile: () => import('./ContractFile.vue'),
    AuthBook: () => import('./AuthBook.vue'),
    AuthInfoDetail: () => import('./AuthInfoDetail.vue')
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.loading = true
      const { id } = this.$route.query
      doBusinessHistoryView({ businessKey: id, businessType: 'smb' }).then(({ data }) => {
        this.loading = false
        console.log('-------------')
        console.log(data)

        this.advanceViewList = data
      }).catch(res => {
        this.loading = false
      })
    }
  }
}
</script>

  <style scoped>
  .acceptance-management-view .tempalte-content {
    min-height: calc(100vh - 0.85rem - 120px);
  }
  </style>
