HetongInfo.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. })
  60. httpApi.getHetongQianming({
  61. id: tId.value,
  62. fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
  63. }).then(res => {
  64. if (res.data) {
  65. uni.showToast({
  66. title: "签名成功",
  67. duration: 2000,
  68. mask: true,
  69. success() {
  70. setTimeout(() => goUpPage(),2000)
  71. }
  72. })
  73. }
  74. })
  75. })
  76. function getBase64(img) {
  77. if (!img) {
  78. uni.showToast({
  79. title: '签名异常'
  80. })
  81. return;
  82. }
  83. handleQM(img)
  84. }
  85. function goback2() {
  86. popupRef.value.close()
  87. }
  88. </script>
  89. <style scoped>
  90. </style>