浏览代码

Merge branch 'deploy' of http://git.chelingzhu.com/chelingzhu-web/qhsxKx-mini-html into deploy

lilei 4 年之前
父节点
当前提交
0f1fd4a07c
共有 6 个文件被更改,包括 68 次插入37 次删除
  1. 10 0
      App.vue
  2. 2 0
      pages/getOrder/getOrder.vue
  3. 46 34
      pages/login/login.vue
  4. 4 1
      pages/order/order.vue
  5. 4 1
      pages/store/storeList.vue
  6. 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 ? 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

@@ -388,6 +388,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`
@@ -402,6 +403,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`

+ 46 - 34
pages/login/login.vue

@@ -22,7 +22,8 @@
 		data() {
 			return {
 				path: '/pages/index/index',
-				lanuch: true
+				lanuch: true,
+				code: ''
 			}
 		},
 		onShow() {
@@ -30,7 +31,8 @@
 		},
 		mounted() {},
 		onLoad(option) {
-			console.log(option)
+			// 为解决首次登录异常问题 进入页面先调微信登录获取code
+			this.wxLogin()
 			const {
 				path,
 				lanuch
@@ -39,7 +41,7 @@
 			if (path) {
 				this.path = decodeURIComponent(path);
 			}
-			console.log(this.path,this.lanuch,'111111111')
+			
 		},
 		methods: {
 			getPhoneNumber(e) {
@@ -48,41 +50,40 @@
 					mask: true,
 					title: '加载中'
 				});
+				if (!this.code) {
+					this.wxLogin()
+				} 
 				console.log(e.target.encryptedData,'eeeeeee')
 				if (e.target.errMsg === 'getPhoneNumber:ok') {
-					uni.login({
-						provider: 'weixin',
-						success(res) {
-							login({
-								code: res.code,
-								encryptedData: e.target.encryptedData,
-								iv: e.target.iv
-							}).then(res => {
-								uni.hideLoading();
-								console.log(res, 'login data')
-								if (res.status == '200') {
-									console.log(res.data, 'login data')
-									getApp().globalData.token = res.data
-									_this.$u.vuex('vuex_token',res.data)
-									if (_this.path === '/pages/index/index' || _this.lanuch) {
-										uni.reLaunch({
-											url: _this.path
-										});
-									} else {
-										uni.redirectTo({
-											url: _this.path
-										});
-									}
-								} else {
-									uni.showToast({
-										title: res.message,
-										icon: 'none',
-										duration: 2500
-									});
-								}
+					login({
+						code: _this.code,
+						encryptedData: e.target.encryptedData,
+						iv: e.target.iv
+					}).then(res => {
+						uni.hideLoading();
+						_this.code = ''
+						console.log(res, 'login data')
+						if (res.status == '200') {
+							getApp().globalData.token = res.data
+							_this.$u.vuex('vuex_token',res.data)
+							if (_this.path === '/pages/index/index' || _this.lanuch) {
+								uni.reLaunch({
+									url: _this.path
+								});
+							} else {
+								uni.redirectTo({
+									url: _this.path
+								});
+							}
+						} else {
+							uni.showToast({
+								title: res.message,
+								icon: 'none',
+								duration: 2500
 							});
 						}
-					})
+					});
+					
 				} else {
 					uni.showToast({
 						title: '授权失败',
@@ -91,6 +92,17 @@
 					});
 				}
 			},
+			// 调微信登录 获取code
+			wxLogin () {
+				let _this = this
+				uni.login({
+					provider: 'weixin',
+					success(res) {
+						_this.code = res.code
+					}
+				})
+				console.log(this.code,'1111111111')
+			},
 			gotoHome () {
 			  wx.reLaunch({
 			    url: '/pages/index/index'

+ 4 - 1
pages/order/order.vue

@@ -34,7 +34,7 @@
 		data() {
 			return {
 				noDataText: '暂无数据',
-				status: 'loadmore',
+				status: 'loading',
 				list:[],
 				pageNo:1,
 				pageSize:15,
@@ -158,6 +158,9 @@
 					}
 				}
 			}
+			.u-empty.data-v-6938e513{
+				height: 90%;
+			}
 		}
 	}
 </style>

+ 4 - 1
pages/store/storeList.vue

@@ -45,7 +45,7 @@
 		data() {
 			return {
 				noDataText: '暂无数据',
-				status: 'loadmore',
+				status: 'loading',
 				storeList: [],
 				// 用户拒绝授权位置信息时默认展示青海西宁位置地图
 				currentPosition: {
@@ -196,6 +196,9 @@
 					align-items: center;
 				}
 			}
+			.u-empty.data-v-6938e513{
+				height: 90%;
+			}
 		}
 	}
 </style>

+ 2 - 1
store/index.js

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