qianMing.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <!-- 合同模板 -->
  4. <view class="sfht-mt24">
  5. <view class="form-label-select form-radius-box">
  6. <view class="phone-form-label"><text class="form-label-require">
  7. <text class="form-label-require">*</text>
  8. </text>签名</view>
  9. <view class="form-radio-select" @click="handleQianming">
  10. <view>{{!!data.hetong.qianmingBase64? '已签名': ''}}</view>
  11. <icon></icon>
  12. </view>
  13. </view>
  14. </view>
  15. <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false">
  16. <view class="ht-qm-popup">
  17. <view class="icon-title-navBar-box">
  18. <view @click="goback2" class="nav-bar-icon"></view>
  19. <text class="nav-bar-title">签名</text>
  20. </view>
  21. <writeSign @getBase64="getBase64"></writeSign>
  22. </view>
  23. </uni-popup>
  24. </view>
  25. </template>
  26. <script setup>
  27. import {
  28. ref,
  29. reactive,
  30. nextTick
  31. } from "vue";
  32. import writeSign from "@/components/writeSign/index.vue"
  33. import {
  34. throttleAdvanced
  35. } from "@/utils/common.js"
  36. import {
  37. base64ToPath
  38. } from "image-tools";
  39. import {
  40. useHetong
  41. } from "../useHetong.js"
  42. const {
  43. injectHetong
  44. } = useHetong();
  45. const data = injectHetong()
  46. const popupRef = ref(null)
  47. const handleQM = throttleAdvanced((img) => {
  48. data.hetong.qianmingBase64 = img.replace(/^data:image\/\w+;base64,/, '')
  49. goback2();
  50. })
  51. function handleQianming() {
  52. popupRef.value.open()
  53. }
  54. function goback2() {
  55. popupRef.value.close()
  56. }
  57. function getBase64(img) {
  58. if (!img) {
  59. uni.showToast({
  60. title: '签名异常'
  61. })
  62. return;
  63. }
  64. handleQM(img)
  65. }
  66. </script>
  67. <style>
  68. </style>