|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<view class="work-pages">
|
|
|
+ <u-no-network></u-no-network>
|
|
|
<!-- 工作控制按钮及进度 -->
|
|
|
<view class="work-cons flex-center" style="flex-direction: column;">
|
|
|
<!-- 操作按钮组件 -->
|
|
@@ -82,18 +83,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
- <!-- 错误提示 -->
|
|
|
- <u-popup v-model="showError" :mask-close-able="false" border-radius="10" mode="center" width="500rpx">
|
|
|
- <view style="padding: 30rpx;display: flex;justify-content: center;text-align: center;">
|
|
|
- <view>
|
|
|
- <u-image width="64px" height="64px" src="/static/img/end.png"></u-image>
|
|
|
- <view style="padding: 10px 0 20px;">洗车已完成</view>
|
|
|
- <view>
|
|
|
- <u-button long type="success">确定</u-button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </u-popup>
|
|
|
+ <!-- 洗车完成 -->
|
|
|
+ <u-modal v-model="showTips" @confirm="confirmFun" :content="content"></u-modal>
|
|
|
<!-- 急停提示弹框 -->
|
|
|
<u-popup v-model="showStop" :mask-close-able="false" border-radius="10" mode="center" width="80%">
|
|
|
<view style="padding: 30rpx;text-align: center;">
|
|
@@ -111,7 +102,7 @@
|
|
|
</view>
|
|
|
<view style="display: flex;padding: 20rpx 0;justify-content: center;">
|
|
|
<u-button @click="callPhone" style="width: 45%;border-radius: 0;margin-right: 5%;">联系客服</u-button>
|
|
|
- <u-button @click="sendCmdRabt('reset')" style="width: 45%;" type="error">洗车机归位</u-button>
|
|
|
+ <u-button :disabled="disabledResetBtn" @click="sendCmdRabt('reset')" style="width: 45%;" type="error">洗车机归位</u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -129,7 +120,10 @@ export default {
|
|
|
step: 0, // 进度条增值,共60步
|
|
|
status: 'linking', // 状态,linking 连接中,start 开始启动, starting 启动中,working 正在工作,stoping 停止中, reset 归位,reseting 归位中, end 洗车完成,error-end 异常结束
|
|
|
curWorkStutesText: '设备准备就绪', // 当前机器运行的进度提示
|
|
|
- showError: false, // 错误提示
|
|
|
+ showTips: false, // 错误提示
|
|
|
+ content: '', // 消息内容
|
|
|
+ confirmFun: function(){}, // 消息确认弹框
|
|
|
+ disabledResetBtn: false,
|
|
|
showStart: false ,// 启动弹框提示
|
|
|
showStop: false, // 急停提示
|
|
|
washCarType: '', // 洗车服务类型,不同的类型对应的时间不一样
|
|
@@ -149,21 +143,32 @@ export default {
|
|
|
console.log("onLoad")
|
|
|
// 创建websocket
|
|
|
this.$store.commit('$webSocket')
|
|
|
- // uni.showLoading({
|
|
|
- // title: '正在连接...',
|
|
|
- // mask: true
|
|
|
- // })
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在连接...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+
|
|
|
+ // 监听网络状态
|
|
|
+ uni.onNetworkStatusChange(function (res) {
|
|
|
+ console.log(res.isConnected);
|
|
|
+ console.log(res.networkType);
|
|
|
+ if(res.isConnected){
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在连接...',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// 第一次进入洗车页面
|
|
|
if(this.$store.state.vuex_orderDjs == 0){
|
|
|
// 记录当前的时间
|
|
|
- this.$store.state.vuex_orderDjs = new Date().getTime()
|
|
|
+ this.$u.vuex('vuex_orderDjs',new Date().getTime())
|
|
|
}
|
|
|
|
|
|
// 获取用户及订单信息
|
|
|
- let orderInfo = this.$store.state.vuex_orderInfo
|
|
|
- this.washCarType = orderInfo.itemCode
|
|
|
- this.orderNo = orderInfo.orderNo
|
|
|
+ this.washCarType = this.$store.state.vuex_itemCode
|
|
|
+ this.orderNo = this.$store.state.vuex_orderNo
|
|
|
|
|
|
// 监听消息
|
|
|
uni.$on('wsMessage', this.watchMessage)
|
|
@@ -174,6 +179,14 @@ export default {
|
|
|
uni.$off('wsMessage', this.watchMessage)
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 提示弹框
|
|
|
+ showModal(content, fun){
|
|
|
+ this.showTips = true
|
|
|
+ this.content = content
|
|
|
+ this.confirmFun = fun || function(){
|
|
|
+ this.showTips=false
|
|
|
+ }
|
|
|
+ },
|
|
|
// 电话客服
|
|
|
callPhone () {
|
|
|
uni.makePhoneCall({
|
|
@@ -204,7 +217,7 @@ export default {
|
|
|
uni.hideLoading()
|
|
|
if(this.$store.state.vuex_workStatus == 'linking'){
|
|
|
this.status = 'start'
|
|
|
- this.$store.state.vuex_workStatus = 'start'
|
|
|
+ this.$u.vuex('vuex_workStatus','start')
|
|
|
}
|
|
|
}
|
|
|
// 重连连接打开时发送获取当前状态的命令
|
|
@@ -223,11 +236,7 @@ export default {
|
|
|
}
|
|
|
// 停车位置不正确,
|
|
|
if(e.data.msgCode=="TCWZ_CW"){
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: e.data.msgCodeInfo,
|
|
|
- showCancel: false,
|
|
|
- });
|
|
|
+ this.showModal(e.data.msgCodeInfo)
|
|
|
}
|
|
|
// 重新进入页面且还未启动洗车时
|
|
|
if(e.data.msgCode == "PAID"){
|
|
@@ -243,8 +252,10 @@ export default {
|
|
|
// 进度消息
|
|
|
if(e.data.level == 'C'&&this.status!="reseting"){
|
|
|
this.curWorkStutesText= e.data.msgCodeInfo
|
|
|
- // 启动成功
|
|
|
- this.startWashCarSuccess()
|
|
|
+ if(e.data.msgCodeInfo != '开始洗车'){
|
|
|
+ // 启动成功
|
|
|
+ this.startWashCarSuccess()
|
|
|
+ }
|
|
|
// 更新进度条
|
|
|
this.step = e.data.msgCodeSrc?Number(e.data.msgCodeSrc.split('-')[1]):0
|
|
|
this.$store.state.vuex_workStep = this.step
|
|
@@ -269,8 +280,10 @@ export default {
|
|
|
// 显示复位提示弹框
|
|
|
this.showReset()
|
|
|
}else{
|
|
|
- if(this.status != "error-end"){
|
|
|
+ if(this.status == 'working'){
|
|
|
this.devError()
|
|
|
+ }else{
|
|
|
+ this.showModal(e.data.msgCodeInfo)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -286,9 +299,8 @@ export default {
|
|
|
}
|
|
|
// 设备离线,设备异常,暂停营业或复位失败,设备使用中
|
|
|
else if(e.data.msgCode=="PAUSE" || e.data.msgCode == "FW_FAIL" || e.data.msgCode == 'ERROR' || e.data.msgCode == 'SB_SYZ'){
|
|
|
- if(this.status != "error-end"){
|
|
|
- this.devError(e.data.msgCodeInfo)
|
|
|
- }
|
|
|
+ this.devError(e.data.msgCodeInfo)
|
|
|
+ this.disabledResetBtn = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -336,25 +348,22 @@ export default {
|
|
|
starting(){
|
|
|
this.showStart = true;
|
|
|
this.status = 'starting';
|
|
|
- this.$store.state.vuex_workStatus = 'starting';
|
|
|
+ this.$u.vuex('vuex_workStatus','starting')
|
|
|
this.curWorkStutesText='设备启动中';
|
|
|
},
|
|
|
// 启动成功
|
|
|
startWashCarSuccess(){
|
|
|
this.showStart = false;
|
|
|
this.status = 'working';
|
|
|
- this.$store.state.vuex_workStatus = 'working';
|
|
|
+ this.$u.vuex('vuex_workStatus','working')
|
|
|
},
|
|
|
// 启动超时
|
|
|
startWashCarFail(){
|
|
|
this.showStart = false;
|
|
|
this.status = 'start';
|
|
|
- this.$store.state.vuex_workStatus = 'start';
|
|
|
- this.curWorkStutesText='设备启动超时,请重新点击启动'
|
|
|
- uni.showToast({
|
|
|
- title: "设备启动超时",
|
|
|
- duration: 3000
|
|
|
- })
|
|
|
+ this.$u.vuex('vuex_workStatus','start')
|
|
|
+ this.curWorkStutesText='设备启动超时'
|
|
|
+ this.showModal('设备启动超时,请稍后重试或联系客服')
|
|
|
},
|
|
|
// 发送命令,start 启动,stop 急停,reset 归位
|
|
|
sendCmdRabt(cmdCode){
|
|
@@ -365,12 +374,17 @@ export default {
|
|
|
washType: this.washCarType,// 洗车模式
|
|
|
}
|
|
|
this.$store.commit("$sendWebsocket",JSON.stringify(cmd))
|
|
|
+
|
|
|
+ // 点击复位后
|
|
|
+ if(cmdCode == 'reset'){
|
|
|
+ this.disabledResetBtn = true
|
|
|
+ }
|
|
|
},
|
|
|
// 停止中
|
|
|
stoping(){
|
|
|
this.showStart = true;
|
|
|
this.status = 'stoping';
|
|
|
- this.$store.state.vuex_workStatus = 'stoping';
|
|
|
+ this.$u.vuex('vuex_workStatus','stoping')
|
|
|
this.curWorkStutesText='设备停止中';
|
|
|
},
|
|
|
// 停止成功后或有F类错误时,显示复位弹框
|
|
@@ -378,21 +392,22 @@ export default {
|
|
|
this.showStart = false;
|
|
|
this.showStop = true;
|
|
|
this.status = 'reset';
|
|
|
- this.$store.state.vuex_workStatus = 'reset'
|
|
|
+ this.$u.vuex('vuex_workStatus','reset')
|
|
|
this.resetLoadingStatus();
|
|
|
},
|
|
|
// 归位中
|
|
|
reseting(){
|
|
|
this.status = 'reseting';
|
|
|
- this.$store.state.vuex_workStatus = 'reseting';
|
|
|
+ this.$u.vuex('vuex_workStatus','reseting')
|
|
|
this.showStart = true;
|
|
|
this.showStop = false;
|
|
|
+ this.disabledResetBtn = false
|
|
|
},
|
|
|
// 归位结束后
|
|
|
resetRabtSuccess(){
|
|
|
this.curWorkStutesText='设备已归位';
|
|
|
this.status = 'end';
|
|
|
- this.$store.state.vuex_workStatus = 'end';
|
|
|
+ this.$u.vuex('vuex_workStatus','end')
|
|
|
// 关闭socket
|
|
|
this.$store.commit("$closeWebsocket");
|
|
|
// 跳转到复位成功页面
|
|
@@ -403,41 +418,28 @@ export default {
|
|
|
// 洗车完成
|
|
|
washCarSuccess(){
|
|
|
this.status = 'end';
|
|
|
- this.$store.state.vuex_workStatus = 'end';
|
|
|
+ this.$u.vuex('vuex_workStatus','end')
|
|
|
this.curWorkStutesText='洗车已结束';
|
|
|
this.resetLoadingStatus();
|
|
|
- // uni.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '洗车已结束',
|
|
|
- // showCancel: false,
|
|
|
- // success: function (res) {
|
|
|
- // if (res.confirm) {
|
|
|
- // // 跳转到成功页面
|
|
|
- // uni.redirectTo({
|
|
|
- // url:"/pages/work/success/success?type=0"
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- this.showError = true
|
|
|
+ // 显示弹框
|
|
|
+ this.showModal('洗车已结束',function(){
|
|
|
+ // 跳转到成功页面
|
|
|
+ uni.redirectTo({
|
|
|
+ url:"/pages/work/success/success?type=0"
|
|
|
+ })
|
|
|
+ })
|
|
|
// 关闭socket
|
|
|
this.$store.commit("$closeWebsocket")
|
|
|
},
|
|
|
// 设备异常
|
|
|
devError(msg){
|
|
|
this.status = "error-end";
|
|
|
- this.$store.state.vuex_workStatus = 'error-end'
|
|
|
+ this.$u.vuex('vuex_workStatus','error-end')
|
|
|
this.resetLoadingStatus();
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: msg || '设备异常,请联系客服',
|
|
|
- showCancel: false,
|
|
|
- success: function (res) {
|
|
|
- if (res.confirm) {
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ // 显示弹框
|
|
|
+ this.showModal(msg || '设备异常,请联系客服',function () {
|
|
|
+ uni.navigateBack()
|
|
|
+ })
|
|
|
// 关闭socket
|
|
|
this.$store.commit("$closeWebsocket");
|
|
|
},
|