HetongInfo.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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="aspectFit" :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. <!-- 加载提示 -->
  29. <view class="loading-overlay" v-if="isLoading">
  30. <view class="loading-spinner"></view>
  31. <text class="loading-text">加载中...</text>
  32. </view>
  33. </view>
  34. </template>
  35. <script setup>
  36. import {
  37. ref
  38. } from "vue";
  39. import * as httpApi from "@/api/hetong.js"
  40. import {
  41. onLoad
  42. } from "@dcloudio/uni-app"
  43. import writeSign from "@/components/writeSign/index.vue"
  44. import {throttleAdvanced} from "@/utils/common.js"
  45. const tId = ref(null)
  46. const info = ref({})
  47. const show = ref(false)
  48. const popupRef = ref(null)
  49. const imgList = ref([])
  50. const isLoading = ref(true)
  51. onLoad((options) => {
  52. tId.value = options.id;
  53. init();
  54. })
  55. function handleQianming() {
  56. popupRef.value.open()
  57. }
  58. function init() {
  59. httpApi.getHetongInfo({id: tId.value}).then(res => {
  60. info.value = res.data;
  61. imgList.value = res.data.base64List;
  62. }).finally(() => {
  63. isLoading.value = false;
  64. })
  65. }
  66. function goUpPage() {
  67. uni.navigateBack()
  68. }
  69. const handleQM = throttleAdvanced((img) => {
  70. uni.showToast({
  71. title: "签名提交中...",
  72. mask: true,
  73. })
  74. httpApi.getHetongQianming({
  75. id: tId.value,
  76. yifangBase64: img.replace(/^data:image\/\w+;base64,/,'')
  77. }).then(res => {
  78. if (res.data) {
  79. uni.showToast({
  80. title: "签名成功",
  81. duration: 2000,
  82. mask: true,
  83. success() {
  84. setTimeout(() => goUpPage(),2000)
  85. }
  86. })
  87. }
  88. })
  89. })
  90. function getBase64(img) {
  91. if (!img) {
  92. uni.showToast({
  93. title: '签名异常'
  94. })
  95. return;
  96. }
  97. console.log(22222)
  98. handleQM(img)
  99. }
  100. function goback2() {
  101. popupRef.value.close()
  102. }
  103. </script>
  104. <style scoped>
  105. </style>