Ver Fonte

Merge remote-tracking branch 'origin/dev' into dev

LiChengjin há 2 meses atrás
pai
commit
b13a1faaa2

+ 23 - 71
mixins/bluetoothMixin.js

@@ -9,9 +9,7 @@ import {
 	hexStringToUint8Array
 } from "../utils/bluetoothUtils";
 import {
-	getCheckinInfoAndLockInfo,
-	getBluetoothKey,
-	remoteOpenDoor,
+	getOpenDoorInfo,
 	unloadBLEOpenDoorLog,
 	getCheckinInfo
 } from "../utils/api";
@@ -83,6 +81,8 @@ export const bluetooth = {
 				bluetoothAuthorized: false, // 蓝牙授权开启情况
 				errMessage: '',
 				// 剩下的为上传相关记录的操作
+				floor: Number(this.checkinInfo.floor),
+				room: this.checkinInfo.room
 			};
 
 			/**
@@ -907,83 +907,35 @@ export const bluetooth = {
 	async onLoad() {
 		// console.log("currentHotelId", this.currentHotelId);
 		// 先获取入住记录
-		let info = await getCheckinInfo({
-			userIdNumber: this.userInfo.idNumber,
-			hotelId: this.currentHotel.hotelId,
-			status: 1,
-			pageNo: 1,
-			pageSize: 1,
-		})
-		console.log("获取入住记录", info);
-		if (!info.data.data.records.length) {
-			console.log("获取入住记录失败", info.data.data);
+		let { data: infoRes } = await getCheckinInfo(this.currentHotel.hotelId)
+		// console.log("获取入住记录", infoRes);
+
+		if (infoRes.code !== 200 || !infoRes.success || !infoRes.data) {
+			console.log("获取入住记录失败", infoRes);
 			return
 		}
-		this.checkinInfo = info.data.data.records[0];
+
+		this.checkinInfo = infoRes.data;
 		this.checkinInfo.startTime = moment(this.checkinInfo.startTime).format("YYYY/MM/DD HH:mm:ss");
 		this.checkinInfo.endTime = moment(this.checkinInfo.endTime).format("YYYY/MM/DD HH:mm:ss");
 
-		// 然后获取门锁信息
-		let checkinInfoAndLockInfo = await getCheckinInfoAndLockInfo({
+		// 获取门锁信息
+		const { data:openDoorInfoRes } = await getOpenDoorInfo({
 			hotelId: this.currentHotel.hotelId,
+			floor: Number(this.checkinInfo.floor),
+			room: this.checkinInfo.room
 		})
-		console.log("获取入住记录和门锁记录", checkinInfoAndLockInfo);
-		let {
-			data
-		} = checkinInfoAndLockInfo.data;
-		// 没查询到入住
-		if (!checkinInfoAndLockInfo.data.success) {
-			if (checkinInfoAndLockInfo.data.msg === "账号的身份证号信息不全") {
-				uni.showModal({
-					title: "身份信息不全",
-					content: "请至我的账户页面,输入您的身份证号信息。",
-					success: (res) => {
-						if (res.confirm) {
-							uni.navigateTo({
-								url: "/subpkg/myAccount/myAccount"
-							})
-						}
-					},
-				});
-			} else {
-				uni.showModal({
-					title: "温馨提示",
-					content: checkinInfoAndLockInfo.data.msg,
-				});
-				uni.switchTab({
-					url: '/pages/home/home'
-				})
-			}
-
-			return;
-		}
-
-		// 查询到入住,更新信息,同时后台直接查询门锁秘钥
-		this.hotelId = data.hotelId;
-		this.openDoorInfo.gatewayDeviceId = data.gatewayDeviceId;
-		this.openDoorInfo.bluetoothDeviceId = data.deviceId;
-		this.openDoorInfo.bluetoothName = data.name;
+		// console.log("获取入住记录和门锁记录", openDoorInfoRes);
+		
+		const { data: doorLockInfo } = openDoorInfoRes 
+		// 更新门锁设备相关信息
+		this.openDoorInfo.bluetoothDeviceId = doorLockInfo.doorLockDeviceId;
+		this.openDoorInfo.bluetoothName = doorLockInfo.doorLockName;
 		this.openDoorInfo.androidOptimization =
-			data.androidOptimization === false ? false : true;
-		this.openDoorInfo.openDoorParam = JSON.parse(data.openDoorParam)
+			doorLockInfo.androidOptimization === false ? false : true;
+		this.openDoorInfo.openDoorParam = JSON.parse(doorLockInfo.openDoorParam)
 		// console.log("this.openDoorInfo.openDoorParam", this.openDoorInfo.openDoorParam);
-
-		// 查询门锁蓝牙秘钥
-		let bluetoothKey = await getBluetoothKey(data.hotelId)
-		console.log("获取蓝牙秘钥", bluetoothKey);
-		// 查询门锁蓝牙秘钥失败
-		if (!bluetoothKey.data.success) {
-			uni.showModal({
-				title: "获取门锁信息失败",
-				content: "获取门锁信息失败,请稍后重试。",
-			});
-			uni.switchTab({
-				url: '/pages/home/home'
-			})
-			return;
-		}
-		// 查询门锁蓝牙秘钥成功
-		this.openDoorInfo.bluetoothKey = bluetoothKey.data.data;
+		this.openDoorInfo.bluetoothKey = doorLockInfo.doorLockKey;
 		this.allowedOpenDoor = 0;
 	},
 };

+ 0 - 16
pages.json

@@ -374,22 +374,6 @@
 						}
 					}
 				}
-				// #ifdef MP-ALIPAY
-				,
-				{
-					"path": "alipayCheckPic/alipayCheckPic",
-					"style": {
-						"enablePullDownRefresh": false,
-						"mp-weixin": {
-							"navigationStyle": "custom"
-						},
-						"mp-alipay": {
-							"transparentTitle": "always",
-							"allowsBounceVertical": "NO"
-						}
-					}
-				}
-				// #endif
 			]
 		}
 	]

+ 2 - 2
pages/home/home.vue

@@ -155,7 +155,7 @@
 			}
 		},
 		async onLoad() {
-			console.log(__wxConfig)
+			// console.log(__wxConfig)
 			//获取openid
 			if (!this.userInfo.openid) {
 				// #ifdef MP-WEIXIN
@@ -183,7 +183,7 @@
 						const authCode = res.authCode;
 						// console.log("authCode",authCode);
 						//发起网络请求
-						uni.$http.post('/userInfo/aliOpenid', {
+						uni.$http.post('/user/aliOpenid', {
 							code: authCode,
 							appId: '2021004131662268'
 						}).then((res) => {

+ 1 - 1
pages/login/login.vue

@@ -162,7 +162,7 @@
 				})
 				// console.log("cipherText", cipherText);
 
-				let res = await uni.$http.post('/userInfo/login', {
+				let res = await uni.$http.post('/user/quickLogin', {
 					code: cipherText.response,
 					platform: "ALIPAY"
 				})

+ 8 - 13
subpkg/elevatorControl/elevatorControl.vue

@@ -12,7 +12,7 @@
 			<view class="info">
 				<view class="title">
 					<view class="hotel-name">
-						<u-text :text="checkinInfo.hotelName" bold color="#333333" size="30rpx"></u-text>
+						<u-text :text="currentHotel.name" bold color="#333333" size="30rpx"></u-text>
 					</view>
 					<view class="tips">
 						<u-text text="入住信息" color="#666666" size="24rpx"></u-text>
@@ -139,7 +139,7 @@
 					hotelId: this.currentHotel.hotelId,
 					building: 1,
 					floor: this.checkinInfo.floor,
-					customerId: this.checkinInfo.customerUserId,
+					customerId: this.userInfo.idNumber,
 					customerType: 1,
 					status: 1,
 					activeTime: moment().add(10, "m")
@@ -201,21 +201,16 @@
 			}
 		},
 		async onLoad() {
-			const info = await getCheckinInfo({
-				userIdNumber: this.userInfo.idNumber,
-				hotelId: this.currentHotel.hotelId,
-				status: 1,
-				pageNo: 1,
-				pageSize: 1,
-			})
-			// console.log("getCheckinInfo", info);
+			// 获取入住记录
+			let {data: infoRes} = await getCheckinInfo(this.currentHotel.hotelId)
+			console.log("获取入住记录", infoRes);
 
-			if (!info.data.data.records.length) {
-				console.log("未查询到入住记录");
+			if (infoRes.code !== 200 || !infoRes.success) {
+				console.log("获取入住记录失败", info.data.data);
 				return
 			}
 
-			this.checkinInfo = info.data.data.records[0];
+			this.checkinInfo = infoRes.data;
 			// console.log("入住记录", this.checkinInfo);
 
 			// #ifdef MP-WEIXIN

+ 1 - 1
subpkg/emergencyKey/emergencyKey.vue

@@ -12,7 +12,7 @@
 			<view class="info">
 				<view class="title">
 					<view class="hotel-name">
-						<u-text :text="checkinInfo.hotelName" bold color="#333333" size="30rpx"></u-text>
+						<u-text :text="currentHotel.name" bold color="#333333" size="30rpx"></u-text>
 					</view>
 					<view class="tips">
 						<u-text text="入住信息" color="#666666" size="24rpx"></u-text>

+ 0 - 406
subpkg_checkin/alipayCheckPic/alipayCheckPic.vue

@@ -1,406 +0,0 @@
-<template>
-	<view>
-		<view class="top">
-			<NavigateBar title="身份核验" bgcolor="#a09cc4"></NavigateBar>
-		</view>
-		<view class="face-area">
-			<view class="face-area--tips">
-				<view class="face-area--tips--title">
-					<u-text text="身份核验" color="#333333" bold size="34rpx"></u-text>
-				</view>
-				<view class="face-area--tips--context">
-					<u-text text="请根据页面提示进行操作" color="#CBCBCB" size="28rpx"></u-text>
-				</view>
-			</view>
-			<view class="face-area--line"></view>
-			<view class="camera-container">
-				<camera id="check-pic--cam__cam" flash="off" device-position="front" @ready="cameraContext" 
-				:style="[cameraStyle]"/>
-				<cover-image src="../../static/cover.png" :style="[coverImageStyle]"></cover-image>
-			</view>
-			<view v-if="!showTips" class="check-pic-result">
-				{{ result }}
-			</view>
-		</view>
-
-		<view class="precautions">
-			<view class="precautions--tips">
-				<view class="precautions--tips--title">
-					<u-text text="注意事项" color="#333333" bold size="34rpx"></u-text>
-				</view>
-				<view class="precautions--tips--context">
-					<u-text text="请遵守需注意事项" color="#CBCBCB" size="28rpx"></u-text>
-				</view>
-			</view>
-			<view class="precautions--line"></view>
-			<view class="precautions--context">
-				<u-text :text="'确认'+name+'本人操作;保持正脸在取景框中根据屏幕指示完成'" color="#666666" size="24rpx"></u-text>
-			</view>
-			<view class="img-list">
-				<view class="img-list--item" v-for="img in imgList">
-					<view class="img">
-						<u-image :src="img.src" :height="img.height" :width="img.width"></u-image>
-					</view>
-					<view class="tips">
-						<u-text :text="img.tips" color="#666666" size="20rpx"></u-text>
-					</view>
-				</view>
-			</view>
-		</view>
-
-		<view class="btn">
-			<u-button text="同意并开始验证" @click="takePhoto" :disabled="isCheckingFace" color="#9e97c3"></u-button>
-		</view>
-	</view>
-</template>
-
-<script>
-	import {
-		mapState,
-		mapMutations
-	} from "vuex";
-	import NavigateBar from "../../components/navigateBar/navigate-bar.vue";
-	export default {
-		components: {
-			NavigateBar
-		},
-		data() {
-			return {
-				name: '',
-				idNumber: '',
-				camContext: null,
-				result: "身份核验中....",
-				photoBase64: null,
-				fs: null,
-				checkFaceRes: false,
-				showTips: true,
-				isCheckingFace: false,
-				imgList: [{
-						src: '/static/check-face-phone.png',
-						width: '48rpx',
-						height: '70rpx',
-						tips: '正对手机'
-					},
-					{
-						src: '/static/check-face-light.png',
-						width: '78rpx',
-						height: '70rpx',
-						tips: '光线充足'
-					},
-					{
-						src: '/static/check-face-face.png',
-						width: '80rpx',
-						height: '80rpx',
-						tips: '脸部无遮挡'
-					}
-				],
-				faceAreaTipsHeight: 0,
-				faceAreaLineHeight: 0,
-				menuButtonTop: 0,
-				menuButtonHeight: 0,
-				menuButtonBottom: 0,
-				width: 0,
-				phone: ""
-			}
-		},
-		computed: {
-			...mapState('m_user', ['userInfo']),
-			...mapState('m_business', ['currentHotel', 'checkinInfo']),
-			cameraStyle() {
-				let style = {}
-				// 设置相机显示区域左右边框距屏幕左右边框为20px
-				let camWidth = this.width === 0 ? 0 : this.width - 20 * 2
-				style.width = camWidth + 'px'
-				style.height = camWidth + 'px'
-				return style
-			},
-			coverImageStyle() {
-				let style = {}
-				// 设置相机遮罩图片的左右边框距屏幕左右边框为16px
-				let imgWidth = this.width === 0 ? 0 : this.width - 16 * 2
-				style.width = imgWidth + 'px'
-				style.height = imgWidth + 'px'
-				style.left = "16px"
-				let top = 0
-				if (this.faceAreaTipsHeight && this.faceAreaLineHeight && this.menuButtonTop
-					&& this.menuButtonHeight && this.menuButtonBottom
-				) {
-					top = this.faceAreaTipsHeight + this.faceAreaLineHeight + this.menuButtonTop
-					+ this.menuButtonHeight + this.menuButtonBottom + 2
-					// console.log("顶部距离", top);
-				}
-				// console.log("computed");
-				style.top = top + "px"
-				return style
-			}
-		},
-		methods: {
-			...mapMutations('m_business', ['updateCheckinInfo']),
-			async cameraContext() {
-				this.camContext = my.createCameraContext('check-pic--cam__cam');
-			},
-			async takePhoto() {
-				const userSetting = await uni.getSetting()
-				// console.log("userSetting", userSetting);
-				let camAuth = userSetting[1].authSetting['camera'] ? userSetting[1].authSetting['camera'] : false
-				while (!camAuth) {
-					await new Promise(async (resolve, reject) => {
-						await uni.showModal({
-							title: "温馨提示",
-							content: "身份核验功能需要使用您的相机,请授权后重新点击核验。",
-							success: async (res) => {
-								if (res.confirm) {
-									await uni.openSetting().then(res => {
-										console.log("openSetting", res);
-										camAuth = res[1].authSetting['camera'] ? res[1]
-											.authSetting['camera'] : false
-										resolve()
-									})
-								}
-							}
-						})
-					})
-					setTimeout(() => {}, 200)
-				}
-				// console.log("进行了相机授权操作");
-				this.result = "身份核验中...."
-				this.showTips = false
-				this.isCheckingFace = true
-
-				// console.log("this.camContext",this.camContext);
-				while (!this.checkFaceRes) {
-					// console.log("开始takePhoto进行人脸检测");
-
-					let photo = await this.camContext.takePhoto({
-						quality: 'normal',
-					})
-					// console.log("完成takePhoto", this.photo.tempImagePath);
-					this.photoBase64 = await this.fs.readFile({
-						filePath: photo.tempImagePath,
-						encoding: "base64"
-					})
-					// console.log("photoBase64", photoBase64);
-
-					let checkPicRes = await uni.$http.post("/faceVerification/checkPic", {
-						hotelId: this.currentHotel.hotelId,
-						faceData: this.photoBase64.data,
-					})
-					// console.log("checkPicRes", checkPicRes);
-					if (!checkPicRes.data.success) {
-						// console.log("checkPicRes.data", checkPicRes.data.msg.split("原因:")[1]);
-						this.result = checkPicRes.data.msg.split("原因:")[1] + "请将面部完整放入拍摄区域。"
-					} else {
-						this.checkFaceRes = checkPicRes.data.success
-					}
-					setTimeout(() => {}, 100)
-				}
-				// 进行云极人证比对
-				await this.afterSuccessCheckPic()
-			},
-			async afterSuccessCheckPic() {
-				if (this.userInfo.skipIdMatching === true) {
-					this.result = "身份核验成功,将跳转确认订单页面"
-					let guestInfo={
-						name:this.name,
-						idNumber:this.idNumber,
-						faceData: this.photoBase64.data,
-						phone: this.phone,
-					}
-					this.checkinInfo.push(guestInfo)
-					this.updateCheckinInfo(this.checkinInfo)
-					setTimeout(() => {
-						uni.reLaunch({
-							url: '/subpkg_checkin/confirmOrder/confirmOrder'
-						})
-					}, 500)
-				} else {
-					let yunjiFaceCheckInfo = {
-						idNo: this.idNumber,
-						name: this.name,
-						image: this.photoBase64.data,
-					}
-					uni.showLoading({
-						title: "正在身份核验,请稍后",
-					});
-					let res = await uni.$http.post(
-						"/faceVerification/yunjiVerification",
-						yunjiFaceCheckInfo
-					);
-					if (res.data.success === true) {
-						uni.hideLoading();
-						this.result = "身份核验成功,将跳转确认订单页面"
-						this.checkinInfo.push({
-							name:this.name,
-							idNumber:this.idNumber,
-							faceData: this.photoBase64.data,
-							phone: this.phone,
-						})
-						this.updateCheckinInfo(this.checkinInfo)
-						setTimeout(() => {
-							this.isCheckingFace = false
-							uni.reLaunch({
-								url: '/subpkg_checkin/confirmOrder/confirmOrder'
-							})
-						}, 500)
-					} else {
-						uni.hideLoading();
-						this.isCheckingFace = false
-						this.result = "身份核验失败,请重新进行"
-					}
-				}
-			}
-		},
-		async onLoad(options) {
-			this.name=options.name
-			this.idNumber=options.idNumber
-			this.phone = options.phone
-
-			this.fs = my.getFileSystemManager();
-
-			let alipaySystemInfo = await uni.getSystemInfo()
-			this.width = alipaySystemInfo[1].screen.width
-			const menuButton = uni.getMenuButtonBoundingClientRect()
-			this.menuButtonTop = menuButton.top
-			this.menuButtonHeight = menuButton.height
-			this.menuButtonBottom = 8
-		},
-		onShow() {
-			this.result = "身份核验中...."
-			this.showTips = true
-			this.isCheckingFace = false
-		},
-		async beforeMount() {
-			let faceAreaTipsSize = await uni.$u.getRect('.face-area--tips')
-			// console.log("faceAreaTipsSize", faceAreaTipsSize);
-			this.faceAreaTipsHeight = faceAreaTipsSize.height
-			let faceAreaLineSize = await uni.$u.getRect('.face-area--line')
-			this.faceAreaLineHeight = faceAreaLineSize.height
-			// console.log("faceAreaLineSize", faceAreaLineSize);
-		}
-	}
-</script>
-
-<style lang="scss">
-	page {
-		background-color: #EFEFF4;
-		.top {
-			position: sticky;
-			background-color: #fff;
-			width: 100%;
-			top: 0;
-			z-index: 999;
-		}
-
-		.face-area {
-			display: flex;
-			flex-direction: column;
-			background-color: #FFFFFF;
-			border-radius: 50rpx;
-			overflow: hidden;
-
-			.face-area--tips {
-				display: flex;
-				padding: 10rpx 20rpx;
-				height: 60rpx;
-				align-items: flex-end;
-
-				.face-area--tips--title {
-					margin: 10rpx;
-				}
-
-				.face-area--tips--context {
-					margin: 10rpx;
-				}
-			}
-
-			.face-area--line {
-				margin-left: 40rpx;
-				width: 30rpx;
-				height: 6rpx;
-				margin-bottom: 4rpx;
-				background-color: #9e97c3;
-			}
-
-			.camera-container {
-				width: 100%;
-				display: flex;
-				align-items: center;
-				justify-content: center;
-				padding-bottom: 30rpx;
-
-				cover-image {
-					margin: 0;
-					padding: 0;
-					position: absolute;
-				}
-			}
-
-			.check-pic-result {
-				width: 100%;
-				padding: 10rpx 20rpx;
-				display: flex;
-				justify-content: center;
-				box-sizing: border-box;
-				color: red;
-			}
-		}
-
-		.precautions {
-			overflow: hidden;
-
-			.precautions--tips {
-				display: flex;
-				padding: 10rpx 20rpx;
-				align-items: flex-end;
-
-				.precautions--tips--title {
-					margin: 10rpx;
-				}
-
-				.precautions--tips--context {
-					margin: 10rpx;
-				}
-			}
-
-			.precautions--line {
-				margin-left: 40rpx;
-				width: 30rpx;
-				height: 6rpx;
-				margin-bottom: 4rpx;
-				background-color: #9e97c3;
-			}
-
-			.precautions--context {
-				margin: 0 20rpx;
-				margin-bottom: 20rpx;
-			}
-
-			.img-list {
-				display: flex;
-				justify-content: space-around;
-
-				.img-list--item {
-					display: flex;
-					flex-direction: column;
-					align-items: center;
-					width: 20%;
-
-					.img {
-						display: flex;
-						flex-direction: row;
-						border-radius: 20rpx;
-						background-color: #dcdce9;
-						width: 100%;
-						height: 140rpx;
-						justify-content: center;
-						align-items: center;
-					}
-				}
-			}
-		}
-
-		.btn {
-			margin: 20rpx;
-		}
-	}
-</style>

+ 2 - 4
subpkg_checkin/confirmOrder/confirmOrder.vue

@@ -199,7 +199,7 @@
 				}
 			},
 			async pay() {
-				console.log("pay start");
+				// console.log("pay start");
 
 				// #ifdef MP-WEIXIN
 				let res = await uni.$http.post('/order/payment/weChat', {
@@ -278,9 +278,7 @@
 				// 申请获取预付号
 				let alipayRes = await uni.$http.post('/hotelOrder/alipayPrepay', {
 					openid: this.userInfo.openid,
-					orderId: this.order.orderId,
-					platform: 'ALIPAY',
-					hotelId: this.currentHotel.hotelId
+					orderId: this.order.orderId
 				})
 				// console.log("获取预付号",alipayRes.data)
 				if (!alipayRes.data.success) {

+ 10 - 29
utils/api.js

@@ -1,38 +1,19 @@
-// /api/v1/mobile/checkinRoomInfo   获取入住房间和门锁设备信息
-export const getCheckinInfoAndLockInfo = (data) => {
-  return uni.$http.get(`/mobile/checkinRoomInfo`, data);
+// 获取门锁设备信息
+export const getOpenDoorInfo = (data) => {
+  return uni.$http.post(`/user/openDoorInfo`, data);
 };
 
-// /api/v1/mobile/lockKey/{hotelId}   获取蓝牙设备密钥
-export const getBluetoothKey = (hotelId) => {
-  return uni.$http.get(`/mobile/lockKey/${hotelId}`);
-};
-
-// /api/v1/mobile/uploadDoorLog/{hotelId}   上传开门记录
-export const uploadDoorLog = (hotelId, data) => {
-  return uni.$http.post(`/mobile/uploadDoorLog/${hotelId}`, data);
-};
-
-// /api/v1/mobile/uploadPowerLog/{hotelId}    上传门锁电量
-export const uploadPowerLog = (hotelId, data) => {
-  return uni.$http.post(`/mobile/uploadPowerLog/${hotelId}`, data);
-};
-
-// 远程开门
-export const remoteOpenDoor = (hotelId, bluetoothId) => {
-  return uni.$http.post(`/mobile/openDoor/${hotelId}/${bluetoothId}`);
-};
-
-// 小程序上传每次的蓝牙开门的记录 /api/v1/miniScmApp/bleOpLogs
+// 小程序上传每次的蓝牙开门的记录
 export const unloadBLEOpenDoorLog = (data) => {
-  return uni.$http.post(`/bleOpLogs`, data);
+  return uni.$http.post(`/user/bleOpLogs`, data);
 };
+
 // 获取顾客入住记录
-export const getCheckinInfo = (data) => {
-  return uni.$http.post("/checkinInfo/queryByCondition", data)
-}
+export const getCheckinInfo = (hotelId) => {
+  return uni.$http.get(`/user/checkinInfo/${hotelId}`)
+};
 
 // 获取顾客梯控二维码
 export const getElevatorQRCode = (data) => {
-  return uni.$http.post("/qrCode", data)
+  return uni.$http.post("/user/qrCode", data)
 }