<template>
  <div class="supplier-manage-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>
          <apply-financing v-if="item.formBusinessName === '申请融资'" :details-info="item.obj" disabled />
          <limit-expenditure v-if="item.formBusinessName === '额度支用'" :details-info="item.obj" disabled />
          <disburse-approval-content v-if="item.formBusinessName === '支用审核'" :details-info="item.obj" disabled />
          <contract-preparation-content v-if="item.formBusinessName === '合同制作'" :details-info="item.obj" disabled />
          <contract-sign v-if="item.formBusinessName === '合同签署'" :details-info="item.obj" disabled />
          <contract-approval-content v-if="item.formBusinessName === '合同审核'" :details-info="item.obj" disabled />
          <payment-application v-if="item.formBusinessName === '付款申请'" :details-info="item.obj" disabled />
          <approve-content v-if="item.formBusinessName === '豁免-业务审核'" :details-info="item.obj" disabled />
          <approve-content v-if="item.formBusinessName === '豁免-风控审核'" :details-info="item.obj" disabled />
          <payment-approve-content v-if="item.formBusinessName === '付款审核'" :details-info="item.obj" disabled />
        </el-collapse-item>
      </el-collapse>   
      <!-- <el-empty v-else style="height: calc(100vh - 0.85rem - 90px)"></el-empty> -->
    </div>
  </div>
</template>

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

export default {
  components: {
    ApplyFinancing: () => import('./ApplyFinancing.vue'),
    LimitExpenditure: () => import('../limitExpenditure/mainContent.vue'),
    DisburseApprovalContent: () => import('./DisburseApprovalContent.vue'),
    ContractPreparationContent: () => import('./ContractPreparationContent.vue'),
    ContractSign: () => import('./ContractSign.vue'),
    ContractApprovalContent: () => import('./ContractApprovalContent.vue'),
    PaymentApplication: () => import('../paymentApplication/components/Content.vue'),
    ApproveContent: () => import('./ApproveContent.vue'),
    PaymentApproveContent: () => import('./PaymentApproveContent.vue')

  },
  mixins: [collapseSeeMix],
  provide() {
    return {
      disabled: true
    }
  },
  data() {
    return {
      activeNames: [],
      advanceViewList: [],
      loading: true,
      disabled: true
    }
  },
  created() {
    this.featchData()
  },
  methods: {
    featchData() {
      const { id } = this.$route.params
      doBusinessHistoryView({ businessKey: id, businessType: 'FinancingApply' }).then(({ data }) => {
        this.loading = false
        this.advanceViewList = data
      })
    }
  }
}
</script>

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