HetongInfo.vue 2.5 KB

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