HetongInfo.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. import {throttleAdvanced} from "@/utils/common.js"
  35. const tId = ref(null)
  36. const pdfUrl1 = ref(null)
  37. const info = ref({})
  38. const show = ref(false)
  39. const popupRef = ref(null)
  40. onLoad((options) => {
  41. tId.value = options.id;
  42. init();
  43. })
  44. function handleQianming() {
  45. popupRef.value.open()
  46. }
  47. function init() {
  48. httpApi.getHetongInfo({id: tId.value}).then(res => {
  49. info.value = res.data;
  50. pdfUrl1.value = res.data.pdfUrl;
  51. })
  52. }
  53. function goUpPage() {
  54. uni.navigateBack()
  55. }
  56. const handleQM = throttleAdvanced((img) => {
  57. uni.showToast({
  58. title: "签名提交中...",
  59. mask: true,
  60. })
  61. httpApi.getHetongQianming({
  62. id: tId.value,
  63. fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
  64. }).then(res => {
  65. if (res.data) {
  66. uni.showToast({
  67. title: "签名成功",
  68. duration: 2000,
  69. mask: true,
  70. success() {
  71. setTimeout(() => goUpPage(),2000)
  72. }
  73. })
  74. }
  75. })
  76. })
  77. function getBase64(img) {
  78. if (!img) {
  79. uni.showToast({
  80. title: '签名异常'
  81. })
  82. return;
  83. }
  84. console.log(22222)
  85. handleQM(img)
  86. }
  87. function goback2() {
  88. popupRef.value.close()
  89. }
  90. </script>
  91. <style scoped>
  92. </style>