<template>
  <div class="financing-see">
    <div v-if="stepList.length" class="view-steps-box">
      <cy-steps :steps-data="stepList" />
    </div>
    <div v-loading="loading" class="tempalte-content">
      <el-collapse v-if="stepList.length" v-model="activeNames" @change="handleChange">
        <el-collapse-item v-for="(item, index) in stepList" :id="index" :key="index" :name="index">
          <template slot="title">
            <cy-view-bar
              :view-bar-data="{ ...item.businessProcessingLogVo, formBusinessName: item.formBusinessName, index: index + 1 }"
            />
          </template>
          <template v-if="item.formBusinessName == '申请融资'">
            <apply-financing :details-info="item.obj" />
          </template>
          <template v-if="item.formBusinessName == '合同签署'">
            <contract-sign :details-info="item.obj" />
          </template>
        </el-collapse-item>
      </el-collapse>
    </div>
  </div>
</template>

<script>
import { getHistoricalProcess } from '@/api/common.js'
import collapseSeeMix from '@/mixins/collapseSeeMix'
export default {
  components: {
    ApplyFinancing: () => import('./applyFinancing/index.vue'),
    ContractSign: () => import('./contractSign.vue')
  },
  mixins: [collapseSeeMix],
  data() {
    return {
      stepList: [],
      activeNames: [],
      loading: false
    }
  },
  mounted() {
    this.getStepList()
  },
  methods: {
    getStepList() {
      this.loading = true
      const params = {
        businessKey: this.$route.params.id,
        businessType: 'FinancingApply'
      }
      getHistoricalProcess(params).then(({ data }) => {
        this.stepList = data || []
        this.loading = false
      })
    }
  }
}
</script>

<style lang="scss">

</style>
