HetongInfo.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="phone-hetong-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. <template v-if="tId">
  8. <view class="pdf-box"> pdf展示 </view>
  9. <!-- <web-view class="dljt-pdf-view" :src="pdfUrl1" v-if="show"
  10. webview-styles="height: 50vh;margin-top: 75px"></web-view> -->
  11. </template>
  12. <button @click="handleQianming" v-if="tId && info.status == 0"
  13. class="phone-green-btn ht-btn" type="default">我已阅读</button>
  14. <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false">
  15. <view class="ht-qm-popup">
  16. <view class="icon-title-navBar-box">
  17. <view @click="goback2" class="nav-bar-icon"></view>
  18. <text class="nav-bar-title">签名</text>
  19. </view>
  20. <writeSign @getBase64="getBase64"></writeSign>
  21. </view>
  22. </uni-popup>
  23. </view>
  24. </template>
  25. <script setup>
  26. import {
  27. ref
  28. } from "vue";
  29. import * as httpApi from "@/api/hetong.js"
  30. import {
  31. onLoad
  32. } from "@dcloudio/uni-app"
  33. import writeSign from "@/components/writeSign/index.vue"
  34. const tId = ref(null)
  35. const pdfUrl1 = ref(null)
  36. const info = ref({})
  37. const show = ref(false)
  38. const popupRef = ref(null)
  39. onLoad((options) => {
  40. tId.value = options.id;
  41. init();
  42. })
  43. function handleQianming() {
  44. popupRef.value.open()
  45. }
  46. function init() {
  47. httpApi.getHetongInfo({id: tId.value}).then(res => {
  48. info.value = res.data;
  49. pdfUrl1.value = res.data.pdfUrl;
  50. })
  51. }
  52. function goUpPage() {
  53. uni.navigateBack()
  54. }
  55. function getBase64(img) {
  56. if (!img) {
  57. uni.showToast({
  58. title: '签名异常'
  59. })
  60. return;
  61. }
  62. httpApi.getHetongQianming({
  63. id: info.id,
  64. fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
  65. }).then(res => {
  66. if (res.data) {
  67. uni.showToast({
  68. title: "签名成功",
  69. duration: 2000,
  70. success() {
  71. goUpPage()
  72. }
  73. })
  74. }
  75. })
  76. }
  77. function goback2() {
  78. popupRef.value.close()
  79. }
  80. </script>
  81. <style scoped>
  82. </style>