lilei 4 years ago
parent
commit
9771ab5833
4 changed files with 60 additions and 21 deletions
  1. 2 2
      App.vue
  2. 1 1
      manifest.json
  3. 8 8
      pages/getOrder/getOrder.vue
  4. 49 10
      pages/work/index/index.vue

+ 2 - 2
App.vue

@@ -1,6 +1,6 @@
 <script>
-	// const uat_URL = 'http://carwash.test.zyucgj.com/cw-wechat' // 预发布
-	const uat_URL = 'http://192.168.16.102:8103/cw-wechat/' // 本地
+	const uat_URL = 'http://carwash.test.zyucgj.com/cw-wechat/' // 预发布
+	// const uat_URL = 'http://192.168.16.102:8103/cw-wechat/' // 本地
 	const pro_URL = 'https://car.zyucgj.com/saas/clz/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 1 - 1
manifest.json

@@ -57,7 +57,7 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "wxb6f09597a1545d81",
+        "appid" : "wx3c26d022890f7c2b",
         "setting" : {
             "urlCheck" : false,
             "es6" : true,

+ 8 - 8
pages/getOrder/getOrder.vue

@@ -177,17 +177,16 @@
 			} else {
 				// 判断是否扫码过
 				if (this.$store.state.vuex_orderInfo.bizId != '') {
-
+					// 监听点击已阅读事件
+					uni.$once('read', this.read)
+					// 获取用户信息
+					this.getUserPhone()
+					// 获取服务项目
+					this.getServerList()
 				} else {
 					// 返回首页
 				}
 			}
-			// 监听点击已阅读事件
-			uni.$once('read', this.read)
-			// 获取用户信息
-			this.getUserPhone()
-			// 获取服务项目
-			this.getServerList()
 		},
 		onUnload() {
 			uni.removeStorageSync('stepIndex')
@@ -209,7 +208,8 @@
 					deviceNo: bizId
 				}).then(res => {
 					uni.hideLoading()
-					if(res.status != 200) {
+					console.log(res)
+					if(res.status != 200 && res.status != 401) {
 						this.toashMsg(res.message)
 						setTimeout(()=>{
 							uni.reLaunch({

+ 49 - 10
pages/work/index/index.vue

@@ -135,18 +135,40 @@ export default {
 			if(e.type == 'xcz'){
 				// 进度消息
 				if(e.data.level == 'c'){
-					// 启动成功
-					this.startWashCarSuccess()
+					 this.curWorkStutesText= e.data.message
+					 // 洗车完成
+					 if(e.data.code=="XCWC"){
+						 this.washCarSuccess()
+					 }
 				}
 				// 错误消息
 				if(e.data.level == 'f'){
-					
+					this.curWorkStutesText= e.data.message
+					this.devError()
+				}
+				// 复位状态
+				if(e.data.leve == 'd'){
+					this.curWorkStutesText= e.data.message
+					// 开始复位
+					if(e.data.code=="FW_START"){
+						this.showStart = true;
+						this.showStop = false;
+					}
+					// 复位成功
+					if(e.data.code=="FW_SUCC"){
+						this.resetRabtSuccess()
+					}
+				}
+				// 停止
+				if(e.data.level == 'a'){
+					if(e.data.code=="JJTZ"||e.data.code=="XCX_JJTZ"){
+						this.curWorkStutesText= e.data.message
+						this.stopWashCarSuccess()
+					}else{
+						this.devError()
+					}
 				}
 			}
-			// 紧急停止成功
-			// this.stopWashCarSuccess()
-			// 复位成功
-			// this.resetRabtSuccess()
 		})
 	},
 	methods: {
@@ -172,6 +194,9 @@ export default {
 				cmd.operateType = 'start' //操作命令
 				this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
 				this.showStart = true;
+				setTimeout(()=>{
+					this.startWashCarSuccess()
+				},3000)
 			}
 			// 急停
 			if (this.status == 'working') {
@@ -182,6 +207,7 @@ export default {
 				        if (res.confirm) {
 							cmd.operateType = 'stop' //操作命令
 							_this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
+							// 显示急停提示弹框
 							_this.showStop = true;
 				        }
 				    }
@@ -209,12 +235,27 @@ export default {
 		},
 		// 紧急停止成功
 		stopWashCarSuccess(){
-			// 显示急停提示弹框
+			// 关闭socket
+			this.$store.commit("$closeWebsocket")
 			this.status = 'stop';
 			this.$store.state.vuex_workStatus = 'stop'
 			this.curWorkStutesText='设备已紧急停止';
 			this.resetLoadingStatus();
 		},
+		// 设备异常
+		devError(){
+			this.stopWashCarSuccess();
+			uni.showModal({
+			    title: '提示',
+			    content: '设备异常,请联系客服',
+				showCancel: false,
+			    success: function (res) {
+			        if (res.confirm) {
+						uni.navigateBack()
+			        }
+			    }
+			});
+		},
 		// 洗车完成
 		washCarSuccess(){
 			this.status = "success";
@@ -262,8 +303,6 @@ export default {
 				washType: this.washCarType,// 洗车模式
 			}
 			this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
-			this.showStart = true;
-			this.showStop = false;
 		},
 		// 归位结束后
 		resetRabtSuccess(){