瀏覽代碼

获取机器运行时间

lilei 4 年之前
父節點
當前提交
cd6f2f489b
共有 3 個文件被更改,包括 33 次插入39 次删除
  1. 1 0
      pages/getOrder/getOrder.vue
  2. 31 39
      pages/work/index/index.vue
  3. 1 0
      store/index.js

+ 1 - 0
pages/getOrder/getOrder.vue

@@ -291,6 +291,7 @@
 						this.getPayData(data)
 						this.$store.state.vuex_orderInfo.itemCode = data.itemCode
 						this.$store.state.vuex_orderInfo.orderNo = data.orderNo
+						this.$store.state.vuex_orderInfo.duration = item.duration
 					} else {
 						uni.hideLoading()
 						// 刷新服务项

+ 31 - 39
pages/work/index/index.vue

@@ -115,6 +115,7 @@ export default {
 			showStart: false ,// 启动弹框提示
 			showStop: false, // 急停提示
 			washCarType: '', // 洗车服务类型,不同的类型对应的时间不一样
+			washDuration: 0, // 机器运行时间
 			orderNo: '',// 订单编号
 		};
 	},
@@ -124,6 +125,7 @@ export default {
 		let orderInfo = this.$store.state.vuex_orderInfo
 		this.washCarType = orderInfo.itemCode
 		this.orderNo = orderInfo.orderNo
+		this.washDuration = orderInfo.duration
 		
 		// 监听消息
 		uni.$on('wsMessage',(e)=>{
@@ -131,7 +133,9 @@ export default {
 			// 进度消息
 			// 错误消息
 			// 启动成功
+			this.startWashCarSuccess()
 			// 紧急停止成功
+			this.stopWashCarSuccess()
 			// 复位成功
 		})
 	},
@@ -143,35 +147,39 @@ export default {
 		// 操作按钮
 		startWork() {
 			let _this = this
+			let cmd = {
+				orderNo: this.orderNo, // 订单编号
+				washType: this.washCarType,// 洗车模式
+			}
 			// 启动
 			if (this.status == 'start') {
-				_this.startWashCar()
+				cmd.operateType = 'start' //操作命令
+				this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
 			}
 			// 急停
 			if (this.status == 'working') {
-				_this.stopWashCar()
+				uni.showModal({
+				    title: '提示',
+				    content: '确定紧急停止洗车机?',
+				    success: function (res) {
+				        if (res.confirm) {
+							cmd.operateType = 'stop' //操作命令
+							_this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
+				        }
+				    }
+				});
 			}
 		},
-		// 开始启动机器洗车
-		startWashCar(){
-			// 启动命令
-			let cmd = {
-				orderNo: this.orderNo, // 订单编号
-				operateType: 'start', //操作命令
-				washType: this.washCarType,// 洗车模式
-			}
-			this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
-			
+		// 启动成功
+		startWashCarSuccess(){
 			this.step= 0;
 			this.showStart = true;
-			// 启动成功
 			setTimeout(() => {
 				this.status = 'working';
 				this.curWorkStutesText='设备已启动';
 				this.showStart = false;
 				// 进度条,服务时间根据不同的服务类型而不同
-				let serverTime = 7
-				console.log(this.step,'step')
+				let serverTime = this.washDuration/60
 				this.interId = setInterval(()=>{
 					// 小于60时说明洗车机正在工作中
 					if(this.step<=60){
@@ -183,34 +191,18 @@ export default {
 				},1000*serverTime)
 			}, 3000);
 		},
-		// 紧急停止
-		stopWashCar(){
-			let _this = this
-			uni.showModal({
-			    title: '提示',
-			    content: '确定紧急停止洗车机?',
-			    success: function (res) {
-			        if (res.confirm) {
-						// 停止命令
-						let cmd = {
-							orderNo: _this.orderNo, // 订单编号
-							operateType: 'stop', //操作命令
-							washType: _this.washCarType,// 洗车模式
-						}
-						_this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
-						// 显示急停提示弹框
-						_this.showStop = true;
-						_this.status = 'stop';
-						_this.curWorkStutesText='设备正在紧急停止';
-						_this.resetLoadingStatus();
-			        }
-			    }
-			});
+		// 紧急停止成功
+		stopWashCarSuccess(){
+			// 显示急停提示弹框
+			this.showStop = true;
+			this.status = 'stop';
+			this.curWorkStutesText='设备已紧急停止';
+			this.resetLoadingStatus();
 		},
 		// 洗车完成
 		washCarSuccess(){
 			this.status = "success";
-			this.curWorkStutesText='洗车完成';
+			this.curWorkStutesText='洗车已完成';
 			this.resetLoadingStatus();
 			// 关闭socket
 			this.$store.commit("$closeWebsocket")

+ 1 - 0
store/index.js

@@ -46,6 +46,7 @@ const store = new Vuex.Store({
 			storeId: '', // 网点id
 			bizId: '', // 设备编号
 			itemCode: '', // 服务类型
+			duration: 0, // 不同服务的机器运行时间
 			orderNo: ''// 订单编号
 		}
 	},