Hetong.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="phone-zjzgs-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">合同</text>
  6. </view>
  7. <view @click="handleGoLishi">历史合同</view>
  8. <template v-if="info.id">
  9. <!-- -->
  10. <!-- <web-view class="dljt-pdf-view" :src="pdfUrl1" v-if="show"
  11. webview-styles="height: 50vh;margin-top: 75px"></web-view> -->
  12. </template>
  13. <template v-else>
  14. 暂无合同
  15. </template>
  16. <view @click="handleQianming" v-if="info.id && info.status == 0">合同签名</view>
  17. <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false"
  18. style="height: 100vh">
  19. <view style="height: 100vh;">
  20. <view>
  21. <view @click="goback2" class="nav-bar-icon">
  22. <text class="nav-bar-title">签名</text>
  23. </view>
  24. <writeSign @getBase64="getBase64"></writeSign>
  25. </view>
  26. </view>
  27. </uni-popup>
  28. </view>
  29. </template>
  30. <script setup>
  31. import {
  32. ref
  33. } from "vue";
  34. import * as httpApi from "@/api/hetong.js"
  35. import {
  36. onLoad
  37. } from "@dcloudio/uni-app"
  38. import writeSign from "@/components/writeSign/index.vue"
  39. const pdfUrl1 = ref('');
  40. const info = ref({})
  41. const show = ref(false)
  42. const popupRef = ref(null)
  43. function goUpPage() {
  44. uni.navigateBack()
  45. }
  46. onLoad(() => {
  47. init()
  48. })
  49. function init() {
  50. httpApi.getHetongLast().then(res => {
  51. info.value = res.data;
  52. pdfUrl1.value = `/hybrid/html/web/viewer.html?file=${encodeURIComponent(res.data.pdfUrl)}`;
  53. // let pdfUrl2 = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(res.data.pdfUrl)}`
  54. setTimeout(() => {
  55. console.log('xianshi')
  56. show.value = true;
  57. }, 3000)
  58. })
  59. }
  60. function handleGoLishi() {
  61. uni.redirectTo({
  62. url: ''
  63. })
  64. }
  65. function handleQianming() {
  66. popupRef.value.open()
  67. }
  68. function getBase64(img) {
  69. httpApi.getHetongQianming({
  70. id: info.id,
  71. fuzeren: img
  72. }).then(res => {
  73. if (res.data) {
  74. uni.showToast({
  75. title: "签名成功",
  76. duration: 2000,
  77. success() {
  78. goUpPage()
  79. }
  80. })
  81. }
  82. })
  83. }
  84. function goback2() {
  85. popupRef.value.close()
  86. }
  87. </script>
  88. <style>
  89. </style>