HetongInfo.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <view class="hetong-tip-box" v-if="tId && info.status == 0">
  13. 请务必仔细阅读上述内容,确认已完全理解所有条款后,点击【我已阅读】按钮完成签字确认。
  14. </view>
  15. <button @click="handleQianming" v-if="tId && info.status == 0"
  16. class="phone-green-btn ht-btn" type="default">我已阅读</button>
  17. <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false">
  18. <view class="ht-qm-popup">
  19. <view class="icon-title-navBar-box">
  20. <view @click="goback2" class="nav-bar-icon"></view>
  21. <text class="nav-bar-title">签名</text>
  22. </view>
  23. <writeSign @getBase64="getBase64"></writeSign>
  24. </view>
  25. </uni-popup>
  26. </view>
  27. </template>
  28. <script setup>
  29. import {
  30. ref
  31. } from "vue";
  32. import * as httpApi from "@/api/hetong.js"
  33. import {
  34. onLoad
  35. } from "@dcloudio/uni-app"
  36. import writeSign from "@/components/writeSign/index.vue"
  37. import {throttleAdvanced} from "@/utils/common.js"
  38. const tId = ref(null)
  39. const pdfUrl1 = ref(null)
  40. const info = ref({})
  41. const show = ref(false)
  42. const popupRef = ref(null)
  43. onLoad((options) => {
  44. tId.value = options.id;
  45. init();
  46. })
  47. function handleQianming() {
  48. popupRef.value.open()
  49. }
  50. function init() {
  51. httpApi.getHetongInfo({id: tId.value}).then(res => {
  52. info.value = res.data;
  53. pdfUrl1.value = res.data.pdfUrl;
  54. })
  55. }
  56. function goUpPage() {
  57. uni.navigateBack()
  58. }
  59. const handleQM = throttleAdvanced((img) => {
  60. uni.showToast({
  61. title: "签名提交中...",
  62. mask: true,
  63. })
  64. httpApi.getHetongQianming({
  65. id: tId.value,
  66. fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
  67. }).then(res => {
  68. if (res.data) {
  69. uni.showToast({
  70. title: "签名成功",
  71. duration: 2000,
  72. mask: true,
  73. success() {
  74. setTimeout(() => goUpPage(),2000)
  75. }
  76. })
  77. }
  78. })
  79. })
  80. function getBase64(img) {
  81. if (!img) {
  82. uni.showToast({
  83. title: '签名异常'
  84. })
  85. return;
  86. }
  87. console.log(22222)
  88. handleQM(img)
  89. }
  90. function goback2() {
  91. popupRef.value.close()
  92. }
  93. </script>
  94. <style scoped>
  95. </style>