<template>
  <div class="auditing">
    <cy-up-down-drag>
      <div slot="top">
        <supplier-manage-view></supplier-manage-view>
      </div>
      <div slot="bar">
        <div>
          供应商审核
        </div>
      </div>
      <div slot="bottom">
        <auditing-main ref="auditingMain" />
        <div class="submit-btn">
          <el-button @click="() => { $router.go(-1) }">关闭</el-button>
          <el-button type="primary" @click="nextClick('temp')">暂存</el-button>
          <el-button type="primary" @click="nextClick('submit')">下一步</el-button>
        </div>
      </div>
    </cy-up-down-drag>
  </div>
</template>

<script>
import { firstReviewSubmit } from '@/api/creditManage/supplierManage'
export default {
  name: 'SupplierAuditing',
  components: {
    auditingMain: () => import('./auditingMain.vue'),
    SupplierManageView: () => import('../components/SupplierManageView.vue')
  },
  data() {
    return {
      firstDetailsInfo: {
        data: {}
      }
    }
  },

  methods: {
    async nextClick(type) {
      const data = await this.$refs.auditingMain.getParams(type)
      const params = {
        Loading: true,
        ...data,
        visible: type === 'submit'
      }
      firstReviewSubmit(params).then(() => {
        this.$message.success(`${type === 'temp' ? '暂存成功' : '提交成功'}`)
        this.$router.push({
          name: 'SupplierManage'
        })
        // this.$router.push({
        //   name: 'SupplierAuditingTwo',
        //   params: { id: data.id },
        //   query: {
        //     taskId: data.taskId
        //   }
        // })
      })
    }

  }
}
</script>

<style lang="scss" scoped>
.auditing {
  height: calc(100vh - 250px);
}

</style>
