瀏覽代碼

代驾倒计时优化和订单进行中钩子调整

vaecebyZ 8 月之前
父節點
當前提交
38d689123c
共有 2 個文件被更改,包括 17 次插入3 次删除
  1. 2 2
      trip/index/index.vue
  2. 15 1
      trip/index/mixin/index.js

+ 2 - 2
trip/index/index.vue

@@ -12,7 +12,7 @@
 			<!-- 选择地址 -->
 			<template v-if="step == 1 || step == 2">
 				<image class="img"
-					src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/65fe8e5874d67a7dbd842c5a/ext/GOODS_INFO/j.png/1.png">
+					src="https://oss.dev.zonelife.cn/static/zshsh/img/ad.png">
 				</image>
 				<view class="operation">
 					<view class="start-box" @click="chooseAddress('start')">
@@ -750,7 +750,7 @@ export default {
 				that.form = JSON.parse(uni.getStorageSync('form'))
 			}
 			uni.hideLoading();
-			this.startTimer();
+			this.startTimer(true);
 		}
 
 	},

+ 15 - 1
trip/index/mixin/index.js

@@ -152,7 +152,7 @@ export const mixin = {
         }
       });
     },
-    startTimer() {
+    startTimer(rein) {
       // 保证只存在一个实例
       if (this.timer) {
         return;
@@ -234,6 +234,20 @@ export const mixin = {
                     duration: 2000,
                   });
                   this.go();
+                } else if (id == 0) {
+                  if (rein) {
+                    // 重新进入后如果是在呼叫状态需要同步呼叫后的时间
+                    const createTime = new Date(
+                      res.content.createTime
+                    ).getTime();
+                    const now = new Date().getTime();
+                    const diff = now - createTime;
+                    const seconds = Math.floor(diff / 1000);
+                    this.minutes = Math.floor(seconds / 60);
+                    this.seconds = seconds % 60;
+                  }
+                  // 呼叫中
+                  this.step = 3;
                 }
               }
             });