| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <view class="phone-hetong-page">
- <view class="phone-navBar-box">
- <view @click="goUpPage" class="nav-bar-icon"></view>
- <text class="nav-bar-title">合同</text>
- <uni-icons class="nav-bar-right-icon bar-ml10" type="list" @click="handleGoLishi" size="30"></uni-icons>
- </view>
- <template v-if="info.id">
- <view class="pdf-box"> pdf展示 </view>
- <!-- -->
- <!-- <web-view class="dljt-pdf-view" :src="pdfUrl1" v-if="show"
- webview-styles="height: 50vh;margin-top: 75px"></web-view> -->
- </template>
- <template v-else>
- <view class="no-hetong-box">暂无合同</view>
- </template>
- <button v-if="info.id && info.status == 0" type="default" class="phone-green-btn ht-btn"
- @click="handleQianming">我已阅读</button>
- <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false">
- <view class="ht-qm-popup">
- <view class="icon-title-navBar-box">
- <view @click="goback2" class="nav-bar-icon"></view>
- <text class="nav-bar-title">签名</text>
- </view>
- <writeSign @getBase64="getBase64"></writeSign>
- </view>
- </uni-popup>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from "vue";
- import * as httpApi from "@/api/hetong.js"
- import {
- onLoad
- } from "@dcloudio/uni-app"
- import writeSign from "@/components/writeSign/index.vue"
- import {throttleAdvanced} from "@/utils/common.js"
- const pdfUrl1 = ref('');
- const info = ref({})
- const show = ref(false)
- const popupRef = ref(null)
- function goUpPage() {
- uni.navigateBack()
- }
- onLoad(() => {
- init()
- })
- function init() {
- httpApi.getHetongLast().then(res => {
- info.value = res.data;
- pdfUrl1.value = `/hybrid/html/web/viewer.html?file=${encodeURIComponent(res.data.pdfUrl)}`;
- // let pdfUrl2 = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(res.data.pdfUrl)}`
- console.log('info', info.value)
- setTimeout(() => {
- console.log('xianshi')
- show.value = true;
- }, 3000)
- })
- }
- function handleGoLishi() {
- uni.redirectTo({
- url: '/pages/admin/Hetong/HetongList'
- })
- }
- function handleQianming() {
- popupRef.value.open()
- }
- const handleQM = throttleAdvanced((img) => {
- uni.showToast({
- title: "签名提交中...",
- mask: true,
- })
- httpApi.getHetongQianming({
- id: info.value.id,
- fuzeren: img.replace(/^data:image\/\w+;base64,/, '')
- }).then(res => {
- if (res.data) {
- uni.showToast({
- title: "签名成功",
- duration: 2000,
- mask: true,
- success() {
- setTimeout(() => uni.navigateBack(),2000)
- }
- })
- }
- })
- })
- function getBase64(img) {
- if (!img) {
- uni.showToast({
- title: '签名异常'
- })
- return;
- }
- handleQM(img)
- }
- function goback2() {
- popupRef.value.close()
- }
- </script>
- <style>
- </style>
|