<template>
  <div>
    <j-nav-bar />
    <div class="contract" v-if="contractHtml" v-html="contractHtml"></div>
    <div v-else class="noData">暂无合同</div>
  </div>
</template>

<script lang="ts" setup>
import {onMounted, ref} from 'vue'
import {getContract} from "@/api";
import {showToast} from "vant";
import {useRoute} from "vue-router";

const route = useRoute()

const contractHtml = ref('')



const _getContract = () => {
  if (route.query.tradeNo) {
    getContract({tradeNo: route.query.tradeNo}).then(res => {
      contractHtml.value = res
    })
  } else {
    showToast('暂无合同')
  }
}

onMounted(() => {
  _getContract()
})
</script>

<style lang="scss" scoped>
.contract {
  //width: 100%;
  padding: 20px ;
}
.noData {
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #cccccc;
  font-size: 50px;
  font-weight: bold;
}
</style>