lilei před 4 roky
rodič
revize
ef6878a87c
2 změnil soubory, kde provedl 23 přidání a 19 odebrání
  1. 4 2
      pages/getOrder/getOrder.vue
  2. 19 17
      pages/work/index/index.vue

+ 4 - 2
pages/getOrder/getOrder.vue

@@ -189,6 +189,7 @@
 		},
 		},
 		onUnload() {
 		onUnload() {
 			uni.removeStorageSync('stepIndex')
 			uni.removeStorageSync('stepIndex')
+			uni.$off('couponChoose', this.couponChoose)
 		},
 		},
 		onShow() {
 		onShow() {
 			const index = uni.getStorageSync('stepIndex')
 			const index = uni.getStorageSync('stepIndex')
@@ -265,7 +266,7 @@
 						this.itemList = res.data
 						this.itemList = res.data
 						this.serverIndex = 0
 						this.serverIndex = 0
 						// 获取用户可用优惠券
 						// 获取用户可用优惠券
-						this.getCouponList()
+						// this.getCouponList()
 					} else {
 					} else {
 						this.itemList = []
 						this.itemList = []
 					}
 					}
@@ -275,7 +276,7 @@
 			chooseItem(index) {
 			chooseItem(index) {
 				this.serverIndex = index
 				this.serverIndex = index
 				// 获取用户可用优惠券
 				// 获取用户可用优惠券
-				this.getCouponList()
+				// this.getCouponList()
 			},
 			},
 			// 下一步
 			// 下一步
 			nextStep() {
 			nextStep() {
@@ -424,6 +425,7 @@
 				this.$store.state.vuex_orderInfo.orderStatus = 'PAID'
 				this.$store.state.vuex_orderInfo.orderStatus = 'PAID'
 				this.$store.state.vuex_orderDjs = 0
 				this.$store.state.vuex_orderDjs = 0
 				this.$store.state.vuex_workStep = 0
 				this.$store.state.vuex_workStep = 0
+				this.$store.state.vuex_workStatus = 'linking'
 				// 付款成功后开始洗车
 				// 付款成功后开始洗车
 				uni.redirectTo({
 				uni.redirectTo({
 					url: `/pages/work/index/index`
 					url: `/pages/work/index/index`

+ 19 - 17
pages/work/index/index.vue

@@ -133,24 +133,28 @@ export default {
 			let d = new Date().getTime() - od
 			let d = new Date().getTime() - od
 			this.timestamp = 300 - d/1000
 			this.timestamp = 300 - d/1000
 		}
 		}
+		
+		// 更新进度条
+		if(this.$store.state.vuex_workStatus == 'working'){
+			this.step = this.$store.state.vuex_workStep
+			this.loading()
+		}
 	},
 	},
 	onLoad(options) {
 	onLoad(options) {
 		console.log("onLoad")
 		console.log("onLoad")
 		// 创建websocket
 		// 创建websocket
-		if(!this.$store.vuex_socket){
-			this.$store.commit('$webSocket')
-			// uni.showLoading({
-			// 	title: '正在连接...',
-			// 	mask: true
-			// })
+		this.$store.commit('$webSocket')
+		uni.showLoading({
+			title: '正在连接...',
+			mask: true
+		})
+		
+		// 第一次进入洗车页面
+		if(this.$store.state.vuex_workStatus == 'linking'){
 			// 记录当前的时间
 			// 记录当前的时间
 			this.$store.state.vuex_orderDjs = new Date().getTime()
 			this.$store.state.vuex_orderDjs = new Date().getTime()
 		}
 		}
-		
-		// 更新进度条
-		this.step = this.$store.state.vuex_workStep
-		this.loading()
-		
+		 
 		// 获取用户及订单信息
 		// 获取用户及订单信息
 		let orderInfo = this.$store.state.vuex_orderInfo
 		let orderInfo = this.$store.state.vuex_orderInfo
 		this.washCarType = orderInfo.itemCode
 		this.washCarType = orderInfo.itemCode
@@ -160,11 +164,8 @@ export default {
 		uni.$on('wsMessage', this.watchMessage)
 		uni.$on('wsMessage', this.watchMessage)
 	},
 	},
 	onUnload() {
 	onUnload() {
-		// 开始复位时关闭当前页面
-		if(this.status = 'reseting'){
-			// 关闭socket
-			this.$store.commit("$closeWebsocket");
-		}
+		// 关闭socket
+		this.$store.commit("$closeWebsocket")
 	},
 	},
 	onUnload() {
 	onUnload() {
 		uni.$off('wsMessage', this.watchMessage)
 		uni.$off('wsMessage', this.watchMessage)
@@ -188,8 +189,9 @@ export default {
 				// 连接成功
 				// 连接成功
 				if(e=='connected'){
 				if(e=='connected'){
 					console.log('connected')
 					console.log('connected')
-					// uni.hideLoading()
+					uni.hideLoading()
 					this.status = 'start'
 					this.status = 'start'
+					this.$store.state.vuex_workStatus = 'start'
 				}
 				}
 			}
 			}
 			if(typeof e == 'object' && e.type == 'xcz'){
 			if(typeof e == 'object' && e.type == 'xcz'){