|
@@ -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");
|