Bladeren bron

订单确认人脸认证

李书文 1 jaar geleden
bovenliggende
commit
1912795e04
3 gewijzigde bestanden met toevoegingen van 57 en 74 verwijderingen
  1. 1 35
      common/util.js
  2. 9 8
      pages/face/faceRegister.nvue
  3. 47 31
      pages/market/one/leader/handleThree.vue

+ 1 - 35
common/util.js

@@ -1,5 +1,4 @@
-
-import CryptoJS from '@/common/crypto-js.js'
+import CryptoJS from '@/common/crypto-js.js';
 function formatTime(time) {
 	if (typeof time !== 'number' || time < 0) {
 		return time
@@ -212,39 +211,7 @@ const format = (obj) => {
 	Minutes = Minutes > 9 ? Minutes : '0' + Minutes;
 	return `${year}-${month}-${day}` + ' ' + Hours + ':' + Minutes;
 }
-// 将时间戳转化为指定时间
-// way:方式(1=年月日,2=年月日时分秒)默认1,  也可以指定格式:yyyy-MM-dd HH:mm:ss  
-const forDate = (inputTime, way) => {
-	var date = new Date(inputTime);
-	var y = date.getFullYear();
-	var m = date.getMonth() + 1;
-	m = m < 10 ? ('0' + m) : m;
-	var d = date.getDate();
-	d = d < 10 ? ('0' + d) : d;
-	var h = date.getHours();
-	h = h < 10 ? ('0' + h) : h;
-	var minute = date.getMinutes();
-	var second = date.getSeconds();
-	minute = minute < 10 ? ('0' + minute) : minute;
-	second = second < 10 ? ('0' + second) : second;
-	var ms = date.getMilliseconds();
 
-	way = way || 1;
-	// way == 1  年月日
-	if (way === 1) {
-		return y + '-' + m + '-' + d;
-	}
-	// way == 1  年月日时分秒 
-	if (way === 2) {
-		return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
-	}
-	// way == 具体格式   标准格式: yyyy-MM-dd HH:mm:ss
-	if (typeof way == 'string') {
-		return way.replace("yyyy", y).replace("MM", m).replace("dd", d).replace("HH", h).replace("mm", minute)
-			.replace("ss", second).replace("ms", ms);
-	}
-	return y + '-' + m + '-' + d;
-}
 const encrypt = (word) => {
 	let key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
 	let srcs = CryptoJS.enc.Utf8.parse(word);
@@ -266,6 +233,5 @@ module.exports = {
 	getdiffdate: getdiffdate,
 	selectDictLabel: selectDictLabel,
 	hasPermi: hasPermi,
-	forDate:forDate,
 	encrypt:encrypt
 }

+ 9 - 8
pages/face/faceRegister.nvue

@@ -11,6 +11,7 @@
 	export default {
 		data() {
 			return {
+				type:1,
 				cameraId: 0,
 				height: "500rpx",
 				width: "750rpx",
@@ -18,8 +19,9 @@
 			}
 		},
 		onLoad(options) {
-			this.userId = options.id;
-			this.height = uni.getSystemInfoSync().screenHeight * 2 + 'rpx';
+			this.type=options.type||1;
+			this.userId =uni.getStorageSync('info').id;
+			this.height = uni.getSystemInfoSync().screenHeight+'px';
 			this.$nextTick(() => {
 				//这里可以做打开摄像头等功能
 				this.openCamera(1)
@@ -60,14 +62,13 @@
 						let res = JSON.parse(resp.data);
 						if (res.code == 200) {
 							that.release();
-							uni.showToast({
-								title: '录入成功'
-							})
+							uni.showToast({title: this.type==1?'录入成功':'验证成功'});
 							let user=uni.getStorageSync('info');
 							console.log(user);
 							user.face=1;
 							uni.setStorageSync('info',user)
 							setTimeout(()=>{
+								uni.$emit('face', true);
 								uni.navigateBack();
 								uni.hideLoading();
 							},500)
@@ -136,8 +137,8 @@
 						}
 						//this.width = data.sizes[max_index].height;
 						//计算出当前宽度下最适合的高度,然后修改组件的高
-						this.height = ((data.sizes[bestHeight_index].width / (data.sizes[bestHeight_index].height *
-							1.0)) * 750) + "rpx";
+						/* this.height = ((data.sizes[bestHeight_index].width / (data.sizes[bestHeight_index].height *
+							1.0)) * 750) + "rpx"; */
 						// 3 用最大分辨比率,不考虑拉伸	
 					} else if (type == 3) {
 						bestHeight_index = 0; //最大的一般是第一个,你也可以遍历后找出最大分辨比率
@@ -192,7 +193,7 @@
 				this.$refs.camera.flashClose();
 			},
 			changeSize() {
-				this.height = "1100rpx";
+				//this.height = "1100rpx";
 
 			},
 			getSupportedPreviewSizes() {

+ 47 - 31
pages/market/one/leader/handleThree.vue

@@ -239,6 +239,47 @@ export default {
 				this.getData2();
 			}
 		}
+		
+		//人脸认证回调
+		uni.$on('face',res=>{
+			if (this.current == 0){
+				 this.http.request({
+					url: '/level-one-server/app/TbOrder/confirmOrder',
+					method: 'POST',
+					data: { orderId: this.item.id },
+					success: res => {
+						uni.showToast({ title: '订单确认成功' });
+						this.current = 1;
+						uni.setNavigationBarTitle({ title: '互助委托确认' });
+					}
+				});
+			}
+			if (this.current == 1){
+				 this.http.request({
+				 	url: '/level-one-server/app/TbOrder/cooperOrder',
+				 	method: 'POST',
+				 	data: { orderId: this.item.id },
+				 	success: res => {
+				 		uni.showToast({ title: '互助委托确认成功' });
+				 		this.current = 2;
+				 		uni.setNavigationBarTitle({ title: '进口申报确认' }); 
+				 	}
+				 });
+			}
+			if (this.current == 2){
+				 this.http.request({
+				 	url: '/level-one-server/app/TbOrder/applyOrder',
+				 	method: 'POST',
+				 	data: { orderId: this.item.id },
+				 	success: res => {
+				 		uni.showToast({ title: '进口申报确认成功' });
+				 		setTimeout(() => {
+				 			uni.switchTab({ url: '/pages/index/index' });
+				 		}, 1000);
+				 	}
+				 });
+			}
+		})
 	},
 	methods: {
 		getData1() {
@@ -267,16 +308,8 @@ export default {
 					content: '我已核对信息无误',
 					success: res => {
 						if (res.confirm) {
-							this.http.request({
-								url: '/level-one-server/app/TbOrder/confirmOrder',
-								method: 'POST',
-								data: { orderId: this.item.id },
-								success: res => {
-									uni.showToast({ title: '订单确认成功' });
-									this.current = 1;
-									uni.setNavigationBarTitle({ title: '互助委托确认' });
-								}
-							});
+							//跳转到人脸认证
+							uni.navigateTo({url:'/pages/face/faceRegister?type=2'})
 						}
 					}
 				});
@@ -287,16 +320,8 @@ export default {
 					content: '我已核对信息无误',
 					success: res => {
 						if (res.confirm) {
-							this.http.request({
-								url: '/level-one-server/app/TbOrder/cooperOrder',
-								method: 'POST',
-								data: { orderId: this.item.id },
-								success: res => {
-									uni.showToast({ title: '互助委托确认成功' });
-									this.current = 2;
-									uni.setNavigationBarTitle({ title: '进口申报确认' });
-								}
-							});
+				          //跳转到人脸认证
+				          uni.navigateTo({url:'/pages/face/faceRegister?type=2'})
 						}
 					}
 				});
@@ -307,17 +332,8 @@ export default {
 					content: '我已核对信息无误',
 					success: res => {
 						if (res.confirm) {
-							this.http.request({
-								url: '/level-one-server/app/TbOrder/applyOrder',
-								method: 'POST',
-								data: { orderId: this.item.id },
-								success: res => {
-									uni.showToast({ title: '进口申报确认成功' });
-									setTimeout(() => {
-										uni.switchTab({ url: '/pages/index/index' });
-									}, 1000);
-								}
-							});
+							//跳转到人脸认证
+							uni.navigateTo({url:'/pages/face/faceRegister?type=2'})
 						}
 					}
 				});