Kaynağa Gözat

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
下单修改

1004749546@qq.com 4 yıl önce
ebeveyn
işleme
9e332ea1cc
3 değiştirilmiş dosya ile 14 ekleme ve 1 silme
  1. 10 0
      App.vue
  2. 2 0
      pages/getOrder/getOrder.vue
  3. 2 1
      store/index.js

+ 10 - 0
App.vue

@@ -27,6 +27,16 @@
 			 console.log('App onLaunch')
 		},
 		onShow: function() {
+			const pages = getCurrentPages(); // 获取加载的页面
+			const currentPage = pages[pages.length - 1]; // 获取当前页面的对象
+			let url = currentPage.route; // 当前页面url
+			// console.log(url,'App Show')
+			// 用户扫描二维码后进入下单页面 未支付时,切换小程序至后台,再次显示时 进入首页
+			if(this.$store.state.vuex_orderInfo.orderStatus != 'PAID'&&url=='pages/getOrder/getOrder') {
+				uni.reLaunch({
+					url: '/pages/index/index'
+				})
+			}
 			console.log('App Show')
 		},
 		onHide: function() {

+ 2 - 0
pages/getOrder/getOrder.vue

@@ -380,6 +380,7 @@
 						let data = res.data
 						// 0元订单直接支付成功,不用吊微信支付
 						if (data.tradeStatus && data.tradeStatus == "PAID") {
+							this.$store.state.vuex_orderInfo.orderStatus = 'PAID'
 							// 付款成功后开始洗车
 							uni.redirectTo({
 								url: `/pages/work/index/index`
@@ -394,6 +395,7 @@
 								paySign: data.paySign,
 								success: function(res) {
 									console.log('success:' + JSON.stringify(res));
+									this.$store.state.vuex_orderInfo.orderStatus = 'PAID'
 									// 付款成功后开始洗车
 									uni.redirectTo({
 										url: `/pages/work/index/index`

+ 2 - 1
store/index.js

@@ -50,7 +50,8 @@ const store = new Vuex.Store({
 			bizId: '', // 设备编号
 			itemCode: '', // 服务类型
 			duration: 0, // 不同服务的机器运行时间
-			orderNo: ''// 订单编号
+			orderNo: '',// 订单编号
+			orderStatus: '' // 订单状态
 		}
 	},
 	mutations: {