Bladeren bron

带上一次数据

zhengkaixin 2 jaren geleden
bovenliggende
commit
d47a6fa914
1 gewijzigde bestanden met toevoegingen van 84 en 13 verwijderingen
  1. 84 13
      pagesFinance/user/withdrawal/signature.vue

+ 84 - 13
pagesFinance/user/withdrawal/signature.vue

@@ -2,9 +2,12 @@
 	<view class="sign">
 		<ujp-navbar title="签字"></ujp-navbar>
 		
-		<p>请在下方空白区域使用正楷字体进行电子签名</p>
+		<p>请在下方空白区域使用正楷字体进行电子签名</p>
+	
 		<view class="signature">
-			<l-signature disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize"
+			<l-signature 
+			 
+			 disableScroll ref="signatureRef" :penColor="penColor" :penSize="penSize"
 				:openSmooth="openSmooth"></l-signature>
 		</view>
 		<view class="clean-save">
@@ -17,10 +20,18 @@
 			<view class="save" @click="onClick('save')">
 				<img src="../../../assets/img/riLine-eraser-line.svg" alt="">
 				<view class="">
-					保存
+					保存并提交
 				</view>
-			</view>
-		</view>
+			</view>
+			
+		</view>
+		<view  v-if="info&&info.signUrl" style="margin-top: 20px;">使用上一次签字</view>
+		<img :src="info.signUrl" v-if="info&&info.signUrl" style="width: 100%;border: 1px solid;">
+		
+		<button v-if="info" :class="{
+			submit:info.signUrl,
+			submitNo:!info.signUrl
+		}"  @click="submit()">提交确认单</button>
 	</view>
 </template>
 
@@ -35,7 +46,8 @@
 		} from '@/utils'
 	export default {
 		data() {
-			return {
+			return {
+				init:true,
 				info: null,
 				detailList:null,
 				penColor: '',
@@ -52,12 +64,16 @@
 			//this.userInfo=this.carhelp.getPersonInfo()
 			this.uuid=op.uuid;
 			this.id=op.id
-			this.getInfo()
+			
 			// alert(this.carhelp.getToken({
 			// 						jp_identity:
 			// 					}))
+		},
+		onReady() {
+			this.getInfo()
 		},
-		methods: {
+		methods: {
+			
 			//上传图片
 			uploadpic() {
 				uni.showLoading({
@@ -88,7 +104,17 @@
 				})
 				
 				 
-			},
+			},
+			submit(){
+				if(this.info.signUrl){
+					this.submitFrom()
+				}else{
+					uni.showToast({
+						title: "请签字后提交"
+					})
+				}
+			},
+			
 			submitFrom(){
 				
 				
@@ -97,8 +123,7 @@
 					mask: true,
 				})
 				
-				//this.info.status=0;
-				
+				//this.info.status=5;
 				//var str=JSON.stringify();
 				API.applyWithdrawByAccounting({
 					
@@ -124,6 +149,26 @@
 						showCancel:false
 					})
 				})
+			},
+			getBase64(url,callback){
+			 //通过构造函数来创建的 img 实例,在赋予 src 值后就会立刻下载图片,相比 createElement() 创建 <img> 省去了 append(),也就避免了文档冗余和污染
+			 var Img = new Image(),
+			  dataURL='';
+			
+			 Img.src=url;
+			 Img.onload=function(){ //要先确保图片完整获取到,这是个异步事件
+			 
+			  var canvas = document.createElement("canvas"), //创建canvas元素
+			   width=Img.width, //确保canvas的尺寸和图片一样
+			   height=Img.height;
+			  canvas.width=width;
+			  canvas.height=height;
+			  canvas.getContext("2d").drawImage(Img,0,0,width,height); //将图片绘制到canvas中
+			  dataURL=canvas.toDataURL('image/jpeg'); //转换图片为dataURL
+			  
+			     callback?callback(dataURL):null; //调用回调函数
+			
+			 };
 			},
 			getInfo(){
 				uni.showLoading({
@@ -134,8 +179,10 @@
 					
 					this.info=res.data.record
 				
-					this.detailList=res.data.detailList
-					uni.hideLoading()
+					this.detailList=res.data.detailList
+					
+					uni.hideLoading()
+					
 				
 				}).catch(error => {
 					uni.showToast({
@@ -246,5 +293,29 @@
 				}
 			}
 		}
+	}
+	.submit{
+		   border-radius: 8px;
+		   background-color: rgba(24, 90, 198, 1);
+		   color: rgba(255, 255, 255, 1);
+		   font-size: 16px;
+		   line-height: 44px;
+		   margin: 0 16px;
+		   position: fixed;
+		   bottom: 12px;
+		   left: 0;
+		   right: 0;
+	}
+	.submitNo{
+		   border-radius: 8px;
+		   background-color: #185ac6a8;
+		   color: rgba(255, 255, 255, 1);
+		   font-size: 16px;
+		   line-height: 44px;
+		   margin: 0 16px;
+		   position: fixed;
+		   bottom: 12px;
+		   left: 0;
+		   right: 0;
 	}
 </style>