lilei vor 4 Jahren
Ursprung
Commit
e64d1940d4
3 geänderte Dateien mit 69 neuen und 35 gelöschten Zeilen
  1. 0 1
      pages/getOrder/getOrder.vue
  2. 13 3
      pages/index/index.vue
  3. 56 31
      pages/work/index/index.vue

+ 0 - 1
pages/getOrder/getOrder.vue

@@ -174,7 +174,6 @@
 				this.$store.state.vuex_orderInfo.storeId = storeId
 				// 判断当前门店是否已运营
 				this.getStoreStatus(storeId,bizId)
-				// this.dataInit()
 			} else {
 				// 判断是否扫码过
 				if (this.$store.state.vuex_orderInfo.bizId != '') {

+ 13 - 3
pages/index/index.vue

@@ -12,7 +12,7 @@
 			<map id="map" :latitude="lat" :longitude="lng" scale="10" show-compass :markers="markers" @markertap="markertap"
 			 show-location style="width: 100%; height:100%;">
 				<!-- 信息提示 -->
-				<cover-view class="work-message" v-if="workStatus=='working'" @click="toWork">
+				<cover-view class="work-message" v-if="workStatus=='show'" @click="toWork">
 					<cover-view class="work-message-in">
 						<cover-view class="view">洗车机正在工作中...</cover-view>
 						<cover-view class="view">点击进入</cover-view>
@@ -104,8 +104,8 @@
 			getUnFinishedOrder(){
 				getUnFinishedOrder().then(res => {
 					console.log(res)
-					if(res.status == 200){
-						this.workStatus = ''
+					if(res.status == 200 && res.data){
+						this.workStatus = 'show'
 					}
 				})
 			},
@@ -244,8 +244,13 @@
 			},
 			// 进入个人中心
 			toUserCenter() {
+				uni.showLoading({
+					title: "正在加载..."
+				})
 				// 检验是否登录或登录是否过期
 				checkLogin().then(res => {
+					console.log(res)
+					uni.hideLoading()
 					if (res.status == '200') {
 						uni.navigateTo({
 							url: '/pages/userCenter/index'
@@ -290,8 +295,13 @@
 			// 扫码洗车
 			scanCode () {
 				let _this = this
+				uni.showLoading({
+					title: "正在加载..."
+				})
 				// 检验是否登录或登录是否过期
 				checkLogin().then(res => {
+					console.log(res)
+					uni.hideLoading()
 					if (res.status == '200') {
 						uni.scanCode({
 						    success: function (res) {

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

@@ -124,7 +124,7 @@ export default {
 			rdeg: -135, // 进度条初始角度
 			ldeg: -135, /// 进度条初始角度
 			step: 0, // 进度条增值,共60步
-			status: 'linking', // 状态,linking 连接中,start 开始启动, starting 启动中,working 正在工作,stoping 停止中, reset 归位,reseting 归位中, end 洗车完成
+			status: 'linking', // 状态,linking 连接中,start 开始启动, starting 启动中,working 正在工作,stoping 停止中, reset 归位,reseting 归位中, end 洗车完成,error-end 异常结束
 			curWorkStutesText: '设备准备就绪', // 当前机器运行的进度提示
 			showError: false, // 错误提示
 			showStart: false ,// 启动弹框提示
@@ -136,13 +136,6 @@ export default {
 	},
 	onShow() {
 		console.log("onShow")
-		// 计算当前倒计时
-		let od = this.$store.state.vuex_orderDjs
-		if(od!=0){
-			let d = new Date().getTime() - od
-			this.timestamp = 300 - d/1000
-		}
-		
 		// 更新进度条
 		if(this.$store.state.vuex_workStatus == 'working'){
 			this.step = this.$store.state.vuex_workStep
@@ -181,11 +174,20 @@ export default {
 		// 电话客服
 		callPhone () {
 			uni.makePhoneCall({
-			    phoneNumber: '15202957025' 
+			    phoneNumber: '114' 
 			})
 		},
+		// 更新当前倒计时
+		updateDjs(){
+			let od = this.$store.state.vuex_orderDjs
+			if(od!=0){
+				let d = new Date().getTime() - od
+				this.timestamp = 300 - d/1000
+			}
+		},
 		// 倒计时结束时,自动完成洗车订单
 		endDtime() {
+			console.log('endDtime',this.status)
 			if(this.status == 'start'){
 				this.washCarSuccess()
 			}
@@ -193,21 +195,43 @@ export default {
 		// 监听socket消息
 		watchMessage(e){
 			if(typeof e == 'string'){
-				// 连接成功
+				// 连接成功
 				if(e=='connected'){
-					console.log('connected')
+					console.log('connected---')
 					uni.hideLoading()
 					this.status = 'start'
 					this.$store.state.vuex_workStatus = 'start'
 				}
+				// 连接开始重连,恢复状态为初始
+				if(e=='reconnect'){
+					console.log('reconnect---')
+					this.status = 'linking'
+					this.$store.state.vuex_workStatus = 'linking'
+				}
+				// 重连连接打开时发送获取当前状态的命令
+				if(e=='connectOpen'){
+					console.log('connectOpen---')
+					this.sendCmdRabt("order_run_status")
+				}
 			}
 			if(typeof e == 'object' && e.type == 'xcz'){
 				console.log(e.data.level,e.data.msgCodeInfo,e.data.msgCodeSrc)
-				// 启动超时
+				// 自定义消息,不是机器返回的
 				if(e.data.level == 'O'){
+					// 启动超时
 					if(e.data.msgCode == "PAUSE"){
 						this.startWashCarFail()
 					}
+					// 重新进入页面且还未启动洗车时
+					if(e.data.msgCode == "PAID"){
+						// 更新当前倒计时
+						this.updateDjs()
+					}
+					// 订单异常
+					if(e.data.msgCode == "0"){
+						// 更新当前倒计时
+						this.devError(e.data.msgCodeInfo)
+					}
 				}
 				// 进度消息
 				if(e.data.level == 'C'&&this.status!="reseting"&&e.data.msgCodeSrc){
@@ -219,7 +243,7 @@ export default {
 					 this.$store.state.vuex_workStep = this.step
 					 this.loading()
 					 // 洗车完成
-					 if(e.data.msgCode=="XCWC"){
+					 if(e.data.msgCode=="XCWC" && this.status != 'end'){
 						 this.washCarSuccess()
 					 }
 				}
@@ -238,7 +262,9 @@ export default {
 						// 显示复位提示弹框
 						this.showReset()
 					}else{
-						this.devError()
+						if(this.status != "error-end"){
+							this.devError()
+						}
 					}
 				}
 				// 复位状态
@@ -267,7 +293,9 @@ export default {
 					}
 					// 设备离线,设备异常,暂停营业或复位失败,设备使用中
 					else if(e.data.msgCode=="PAUSE" || e.data.msgCode == "FW_FAIL" || e.data.msgCode == 'ERROR' || e.data.msgCode == 'SB_SYZ'){
-						this.devError(e.data.msgCodeInfo)
+						if(this.status != "error-end"){
+							this.devError(e.data.msgCodeInfo)
+						}
 					}
 				}
 			}
@@ -320,12 +348,9 @@ export default {
 		},
 		// 启动成功
 		startWashCarSuccess(){
-			// 进度条,服务时间根据不同的服务类型而不同
-			if(this.step==0){
-				this.showStart = false;
-				this.status = 'working';
-				this.$store.state.vuex_workStatus = 'working';
-			}
+			this.showStart = false;
+			this.status = 'working';
+			this.$store.state.vuex_workStatus = 'working';
 		},
 		// 启动超时
 		startWashCarFail(){
@@ -384,8 +409,8 @@ export default {
 		},
 		// 洗车完成
 		washCarSuccess(){
-			this.status = "end";
-			this.$store.state.vuex_workStatus = 'end'
+			this.status = 'end';
+			this.$store.state.vuex_workStatus = 'end';
 			this.curWorkStutesText='洗车已结束';
 			this.resetLoadingStatus();
 			uni.showModal({
@@ -406,18 +431,18 @@ export default {
 		},
 		// 设备异常
 		devError(msg){
-			this.status = "end";
-			this.$store.state.vuex_workStatus = 'end'
+			this.status = "error-end";
+			this.$store.state.vuex_workStatus = 'error-end'
 			this.resetLoadingStatus();
 			uni.showModal({
-			    title: '提示',
-			    content: msg || '设备异常,请联系客服',
+				title: '提示',
+				content: msg || '设备异常,请联系客服',
 				showCancel: false,
-			    success: function (res) {
-			        if (res.confirm) {
+				success: function (res) {
+					if (res.confirm) {
 						uni.navigateBack()
-			        }
-			    }
+					}
+				}
 			});
 			// 关闭socket
 			this.$store.commit("$closeWebsocket");