<template>
  <div id="detail-2">
    <van-row>
      <van-col span="24" class="main">
        <van-col span="24" class="one">
          <van-form label-width="5em">
            <van-field v-model="form.create_number" name="create_number" label="申请号" readonly />
            <van-field v-model="form.patent_name" name="patent_name" label="专利名称" type="textarea" autosize readonly />
            <van-field v-model="form.contact" name="contact" label="联系人" readonly />
            <van-field v-model="form.phone" name="phone" label="联系电话" readonly />
            <van-field v-model="form.email" name="email" label="电子邮箱" readonly />
            <van-field v-model="form.budget" name="budget" type="digit" label="意向价格" readonly />
            <van-field v-model="form.type" name="type" label="交易类型" readonly />
            <van-field name="is_report" label="评估报告">
              <template #input>
                <van-radio-group v-model="form.is_report" direction="horizontal" disabled>
                  <van-radio :name="true">有</van-radio>
                  <van-radio :name="false">无</van-radio>
                </van-radio-group>
                <van-button type="info" size="small" v-if="form.is_report == true" @click="download(form.report)">下载报告</van-button>
              </template>
            </van-field>
            <van-field v-model="form.requirementdesc" name="requirementdesc" label="技术说明" rows="2" autosize type="textarea" readonly />
            <van-field v-model="form.expect" name="expect" label="商业预期" rows="2" autosize type="textarea" readonly />
            <van-field v-model="form.condition" name="condition" label="条件及要求" rows="2" autosize type="textarea" readonly />
          </van-form>
        </van-col>
      </van-col>
    </van-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'detail-2',
  props: {
    form: { type: Object },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    // 填写合同
    addContract() {
      this.$emit('addContract');
    },
    // 撤回交易
    revoke() {
      this.$emit('revoke');
    },
    // 用户确认
    confirm() {
      this.$emit('confirm');
    },
    download(data) {
      window.location.href = `${process.env.VUE_APP_HOST}/${data[0].url}`;
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .two {
    text-align: center;
    margin: 10px 0;
    .van-button {
      margin: 0 10px;
    }
  }
}
</style>
