<template>
  <section class="needsDetail">
    <ai-detail>
      <ai-title slot="title" title="融资详情" isShowBottomBorder isShowBack @onBackClick="$router.push({query:{}})">
        <template #rightBtn>
          <el-button type="danger" @click="handleCancel">取消发布</el-button>
          <el-button type="primary" @click="handleGrab">抢单</el-button>
        </template>
      </ai-title>
      <template #content>
        <el-form size="small" label-width="160px">
          <ai-card title="融资需求">
            <template #content>
              <el-row type="flex" class="flexWrap">
                <el-form-item label="意向金额">{{ detail.enterpriseName }}</el-form-item>
                <el-form-item label="期望使用期限">{{ detail.enterpriseName }}</el-form-item>
                <el-form-item label="资金用途">{{ detail.unifiedCode }}</el-form-item>
                <el-form-item label="企业主体">{{ detail.enterpriseName }}</el-form-item>
                <el-form-item label="联系人">{{ dict.getLabel('enterpriseType', detail.enterpriseType) }}</el-form-item>
                <el-form-item label="所在地区">{{ detail.address }}</el-form-item>
                <el-form-item label="联系方式">{{ detail.phone }}</el-form-item>
                <el-form-item label="身份证号">{{ detail.idNumber }}</el-form-item>
                <el-form-item label="发布时间">{{ detail.address }}</el-form-item>
              </el-row>
              <el-form-item label="备注">{{ detail.operationPeriod }}</el-form-item>
            </template>
          </ai-card>
        </el-form>
      </template>
    </ai-detail>
  </section>
</template>

<script>
export default {
  name: "needsDetail",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function
  },
  data() {
    return {
      dialog: false,
      detail: {},
      form: {},
      rules: {
        auditStatus: [{required: true, message: "请选择审批结果"}]
      }
    }
  },
  methods: {
    getDetail() {
      let {id} = this.$route.query
      this.instance.post("/appportaluserenterprise/queryDetailById", null, {
        params: {id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data
        }
      })
    },
    handleGrab() {

    },
    handleCancel() {
      this.$confirm("是否要取消本次融资需求发布?").then(() => {

      }).catch(() => 0)
    }
  },
  created() {
    this.dict.load("auditStatus")
    this.getDetail()
  }
}
</script>

<style lang="scss" scoped>
.needsDetail {
  height: 100%;

  .flexWrap {
    flex-wrap: wrap;

    .el-form-item {
      width: 50%;
    }
  }
}
</style>
