|
@@ -36,6 +36,7 @@
|
|
|
<view class="work-dtime" v-if="status=='start'">
|
|
|
距离订单强制完成还剩
|
|
|
<u-count-down
|
|
|
+ v-if="timestamp>0"
|
|
|
@end="endDtime"
|
|
|
separator="zh"
|
|
|
font-size="36"
|
|
@@ -110,7 +111,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- timestamp: 300, // 初始情况下5分钟后自动结束
|
|
|
+ timestamp: 0, // 初始情况下5分钟后自动结束
|
|
|
rdeg: -135, // 进度条初始角度
|
|
|
ldeg: -135, /// 进度条初始角度
|
|
|
step: 0, // 进度条增值,共60步
|
|
@@ -124,20 +125,45 @@ export default {
|
|
|
orderNo: '',// 订单编号
|
|
|
};
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ console.log("onShow")
|
|
|
+ // 计算当前倒计时
|
|
|
+ let od = this.$store.state.orderDjs
|
|
|
+ if(od!=0){
|
|
|
+ let d = new Date().getTime() - od
|
|
|
+ this.timestamp = 300 - d/1000
|
|
|
+ }
|
|
|
+ // 计算当前进度条步数
|
|
|
+ let ld = this.$store.state.loadingDjs
|
|
|
+ let serverTime = this.washDuration / 60 * 1000
|
|
|
+ if(ld!=0){
|
|
|
+ let lod = new Date().getTime() - ld
|
|
|
+ this.step = this.step + Math.floor(lod/serverTime)
|
|
|
+ }
|
|
|
+ },
|
|
|
onLoad(options) {
|
|
|
+ console.log("onLoad")
|
|
|
// 创建websocket
|
|
|
this.$store.commit('$webSocket')
|
|
|
+
|
|
|
// 获取用户及订单信息
|
|
|
let orderInfo = this.$store.state.vuex_orderInfo
|
|
|
this.washCarType = orderInfo.itemCode
|
|
|
this.orderNo = orderInfo.orderNo
|
|
|
this.washDuration = orderInfo.duration
|
|
|
-
|
|
|
+ // 记录当前的时间
|
|
|
+ this.$store.state.orderDjs = new Date().getTime()
|
|
|
// 监听消息
|
|
|
uni.$on('wsMessage',(e)=>{
|
|
|
- console.log(e.data.level,e.data.msgCode,e.data.msgCodeInfo)
|
|
|
- console.log("--------------------------------------------")
|
|
|
- if(e.type == 'xcz'){
|
|
|
+ if(typeof e == 'string'){
|
|
|
+ // 连接成功
|
|
|
+ if(e=='connected'){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(typeof e == 'object' && e.type == 'xcz'){
|
|
|
+ console.log(e.data.level,e.data.msgCode,e.data.msgCodeInfo)
|
|
|
+ console.log("--------------------------------------------")
|
|
|
// 进度消息
|
|
|
if(e.data.level == 'C'&&this.status!="reseting"){
|
|
|
// 启动成功
|
|
@@ -245,7 +271,9 @@ export default {
|
|
|
this.curWorkStutesText='设备已启动';
|
|
|
this.showStart = false;
|
|
|
this.step = 0;
|
|
|
- let serverTime = 0.5
|
|
|
+ let serverTime = this.washDuration / 60; // 转换成分钟
|
|
|
+ // 记录当前的开始时间
|
|
|
+ this.$store.state.loadingDjs = new Date().getTime()
|
|
|
this.interId = setInterval(()=>{
|
|
|
// 小于60时说明洗车机正在工作中
|
|
|
if(this.step<=60){
|