wangxy hai 1 semana
pai
achega
f51571e466

+ 4 - 4
components/writeSign/index.vue

@@ -36,16 +36,16 @@
 			base64(tempFilePath) {
 				let base64Code;
 				let path = plus.io.convertLocalFileSystemURL(tempFilePath);
-				console.log('tempFilePath',tempFilePath);
-				console.log('path',path);
+				// console.log('tempFilePath',tempFilePath);
+				// console.log('path',path);
 				let fileReader = new plus.io.FileReader();
 				fileReader.readAsDataURL(path);
 				fileReader.onloadend = res => {
-					console.log('res',res);
+					// console.log('res',res);
 					base64Code = res.target.result;
 					this.url = res.target.result
 					this.$emit('getBase64',this.url)
-					console.log('base64Code',base64Code);
+					// console.log('base64Code',base64Code);
 				}
 		
 			},

+ 9 - 10
pages/admin/Hetong/Hetong.vue

@@ -3,13 +3,12 @@
 		<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>
-				
+			<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">
-				
+
 			</view>
 			<!-- -->
 			<!-- 	<web-view class="dljt-pdf-view" :src="pdfUrl1" v-if="show"
@@ -19,7 +18,8 @@
 			<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>
+		<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">
@@ -61,7 +61,7 @@
 			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;
@@ -87,17 +87,16 @@
 			})
 			return;
 		}
-		
 		httpApi.getHetongQianming({
-			id: info.id,
-			fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
+			id: info.value.id,
+			fuzeren: img.replace(/^data:image\/\w+;base64,/, '')
 		}).then(res => {
 			if (res.data) {
 				uni.showToast({
 					title: "签名成功",
 					duration: 2000,
 					success() {
-						goUpPage()
+						uni.navigateBack()
 					}
 				})
 			}

+ 55 - 1
pages/admin/Hetong/HetongInfo.vue

@@ -10,6 +10,21 @@
         <!-- 	<web-view class="dljt-pdf-view" :src="pdfUrl1" v-if="show"
           webview-styles="height: 50vh;margin-top: 75px"></web-view> -->
       </template>
+	  
+	  
+	  <view @click="handleQianming" v-if="tId && info.status == 0">合同签名</view>
+	  
+	  <uni-popup ref="popupRef" type="bottom" background-color="#fff" :is-mask-click="false" :mask-click="false"
+	  	style="height: 100vh">
+	  	<view style="height: 100vh;">
+	  		<view>
+	  			<view @click="goback2" class="nav-bar-icon">
+	  				<text class="nav-bar-title">签名</text>
+	  			</view>
+	  			<writeSign @getBase64="getBase64"></writeSign>
+	  		</view>
+	  	</view>
+	  </uni-popup>
     </view>
   </template>
 </template>
@@ -22,25 +37,64 @@ import * as httpApi from "@/api/hetong.js"
 import {
   onLoad
 } from "@dcloudio/uni-app"
+import writeSign from "@/components/writeSign/index.vue"
 
 const tId = ref(null)
 const pdfUrl1 = ref(null)
 
+const info = ref({})
+const show = ref(false)
+const popupRef = ref(null)
+
 onLoad((options) => {
   tId.value = options.id;
   init();
 })
 
+function handleQianming() {
+  popupRef.value.open()
+}
 
 function init() {
   httpApi.getHetongInfo({id: tId.value}).then(res => {
-    pdfUrl1.value = res.pdfUrl
+	info.value = res.data;
+    pdfUrl1.value = res.data.pdfUrl;
   })
 }
 
 function goUpPage() {
   uni.navigateBack()
 }
+
+function getBase64(img) {
+	if (!img) {
+		uni.showToast({
+			title: '签名异常'
+		})
+		return;
+	}
+	
+	httpApi.getHetongQianming({
+		id: info.id,
+		fuzeren: img.replace(/^data:image\/\w+;base64,/,'')
+	}).then(res => {
+		if (res.data) {
+			uni.showToast({
+				title: "签名成功",
+				duration: 2000,
+				success() {
+					goUpPage()
+				}
+			})
+		}
+	})
+}
+
+
+function goback2() {
+	popupRef.value.close()
+}
+
 </script>
 
 <style scoped>