HetongInfo.vue 2.0 KB

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