dedsudiyu 3 months ago
parent
commit
3213006c08
2 changed files with 63 additions and 10 deletions
  1. 8 0
      pages_manage/api/index.js
  2. 55 10
      pages_manage/views/accessControl/remoteOpen.vue

+ 8 - 0
pages_manage/api/index.js

@@ -251,5 +251,13 @@ export function laboratoryApplyRemoteOpenLock(data) {
 		}
 	})
 }
+//开门5秒后状态查询
+export function applyRemoteOpenLockConfirm(data) {
+	return apiResquest({
+		url: '/laboratory/apply/remoteOpenLock/confirm',
+		method: 'GET',
+		data: data
+	})
+}
 
 

+ 55 - 10
pages_manage/views/accessControl/remoteOpen.vue

@@ -26,9 +26,10 @@
 		<view class="success" v-if="successVisible">
 			<view class="null-box" @click="closeTip()"></view>
 			<view class="panel">
-				<img class="panel-t" v-if="authorizeStatus==1" src="@/pages/images/icon_kcxq_cg.png" />
+				<img class="panel-t" v-if="authorizeStatus==1||authorizeStatus==3" src="@/pages/images/icon_kcxq_cg.png" />
 				<img class="panel-t" v-if="authorizeStatus==2" src="@/pages/images/icon_kcxq_sb.png" />
-				<view class="panel-m">{{authorizeStatus==1?'开门成功':'开门失败'}}</view>
+				<view class="panel-m">{{authorizeStatus==1?'开门成功':(authorizeStatus==2?'开门失败':(authorizeStatus==3?'开门中请稍后':''))}}
+				</view>
 				<view class="panel-b">({{count}}S)</view>
 			</view>
 		</view>
@@ -43,6 +44,7 @@
 	import {
 		systemSubjectGetAppSubject,
 		laboratoryApplyRemoteOpenLock,
+		applyRemoteOpenLockConfirm
 	} from '@/pages_manage/api/index.js'
 	export default {
 		components: {
@@ -71,7 +73,7 @@
 					adminId: uni.getStorageSync('userId'),
 				},
 				getDataType: false,
-
+				msgId:'',
 			}
 		},
 		onLoad(option) {
@@ -107,13 +109,37 @@
 					data
 				} = await laboratoryApplyRemoteOpenLock(obj);
 				if (data.code == 200) {
-					this.$set(this, 'authorizeStatus', 1)
-					this.$set(this, 'successVisible', true)
-					this.getCode();
-				} else {
-					this.$set(this, 'authorizeStatus', 2)
-					this.$set(this, 'successVisible', true)
-					this.getCode();
+					if (data.data[0]) {
+						this.$set(this, 'msgId', data.data[0])
+						this.$set(this, 'authorizeStatus', 3)
+						this.$set(this, 'successVisible', true)
+						this.getMsg();
+					}else{
+						this.$set(this, 'authorizeStatus', 2)
+						this.$set(this, 'successVisible', true)
+						this.getCode();
+					}
+				}
+			},
+			async applyRemoteOpenLockConfirm() {
+				let self = this;
+				let obj = {
+					messageId: this.msgId,
+				}
+				const {
+					data
+				} = await applyRemoteOpenLockConfirm(obj);
+				if (data.code == 200) {
+					if (data.data) {
+						this.$set(this, 'authorizeStatus', 1)
+						this.$set(this, 'successVisible', true)
+						this.getCode();
+					} else {
+						this.$set(this, 'authorizeStatus', 2)
+						this.$set(this, 'successVisible', true)
+						this.getCode();
+					}
+					this.$set(this, 'msgId','')
 				}
 			},
 			//滚动加载事件
@@ -168,6 +194,25 @@
 				this.systemSubjectGetAppSubject();
 			},
 			//关闭弹框倒计时
+			getMsg() {
+				let self = this;
+				const TIME_COUNT = 5;
+				if (!self.timer) {
+					self.count = TIME_COUNT;
+					self.show = false;
+					self.timer = setInterval(() => {
+						if (self.count > 0 && self.count <= TIME_COUNT) {
+							self.count -= 1;
+						} else {
+							self.successVisible = false;
+							clearInterval(self.timer);
+							self.timer = null;
+							self.applyRemoteOpenLockConfirm();
+						}
+					}, 1000);
+				}
+			},
+			//关闭弹框倒计时
 			getCode() {
 				let self = this;
 				const TIME_COUNT = 3;