Browse Source

地磁/微信登录

空白格 3 years ago
parent
commit
4d76da24f4

+ 45 - 35
common/apiurl.js

@@ -1,70 +1,70 @@
 const apiurl = {
 const apiurl = {
 	//反馈
 	//反馈
-	feedbackAddUrl:'/client/articleFeedback/add',
+	feedbackAddUrl: '/client/articleFeedback/add',
 	// 获取微信用户信息
 	// 获取微信用户信息
-	getuseinfourl:'/client/wechat/h5/user',
+	getuseinfourl: '/client/wechat/h5/user',
 	// 公众号支付
 	// 公众号支付
-	payurl:'/client/app/pay',
+	payurl: '/client/app/pay',
 	// 创建订单
 	// 创建订单
-	createOrderurl:'/client/order/createOrder',
+	createOrderurl: '/client/order/createOrder',
 	// 退款
 	// 退款
-	refundurl:'/client/app/order/refund',
+	refundurl: '/client/app/order/refund',
 	// 绑定手机号
 	// 绑定手机号
-	bindphoneurl:'/client/app/order/refund2',
+	bindphoneurl: '/client/app/order/refund2',
 	// 手机登录验证码
 	// 手机登录验证码
-	phoneLoginCodeUrl:'/client/auth/sendSmsCode',
+	phoneLoginCodeUrl: '/client/auth/sendSmsCode',
 	// 手机登录验证码验证
 	// 手机登录验证码验证
-	phoneLoginAuthUrl:'/client/auth/verifyCode',
+	phoneLoginAuthUrl: '/client/auth/verifyCode',
 	// code换取微信信息
 	// code换取微信信息
-	getWXInfoUrl:'/client/wechat/h5/code/',
+	getWXInfoUrl: '/client/wechat/h5/code/',
 	// 微信支付 在pay.js中使用
 	// 微信支付 在pay.js中使用
-	wxPayUrl:'/client/wechat/pay',
+	wxPayUrl: '/client/wechat/pay',
 	// 客户端首页
 	// 客户端首页
-	getIndexDataUrl:'/client/index',
+	getIndexDataUrl: '/client/index',
 	//获取路段信息
 	//获取路段信息
-	roadInfoById:'/client/roadinfo/selectById/',
-	
+	roadInfoById: '/client/roadinfo/selectById/',
+
 	// 用户车辆
 	// 用户车辆
-	mycarsUrl:'/client/membervehicle',
+	mycarsUrl: '/client/membervehicle',
 	// 设置为默认车辆
 	// 设置为默认车辆
-	setDefaultCarUrl:'/client/membervehicle/modifyDefault/',
-	
+	setDefaultCarUrl: '/client/membervehicle/modifyDefault/',
+
 	// 获取订单列表
 	// 获取订单列表
-	getOrderListUrl:'/client/orderinfo',
+	getOrderListUrl: '/client/orderinfo',
 	// 获取支付订单详情
 	// 获取支付订单详情
-	getOrderinfoUrl:'/client/orderinfo/paydetail/',
+	getOrderinfoUrl: '/client/orderinfo/paydetail/',
 	// 获取订单详情
 	// 获取订单详情
-	getOrderDetailUrl:'/client/orderinfo/detail/',
+	getOrderDetailUrl: '/client/orderinfo/detail/',
 	//获取信息列表
 	//获取信息列表
-	getMessageListUrl:'/client/membernews',
+	getMessageListUrl: '/client/membernews',
 	//消息已读接口
 	//消息已读接口
-	messageReadUrl:'/client/membernews/read/',
+	messageReadUrl: '/client/membernews/read/',
 	// 获取附近的路段
 	// 获取附近的路段
-	nearRoadslUrl:'/client/roadinfo/nearRoads',
+	nearRoadslUrl: '/client/roadinfo/nearRoads',
 	// 获取路段收费规则
 	// 获取路段收费规则
-	roadsChargeRuleUrl:'/client/roadinfo/feeRule/',
+	roadsChargeRuleUrl: '/client/roadinfo/feeRule/',
 	//包月信息
 	//包月信息
-	monthInfoUrl:'/client/memberinfo/monthInfo/',
+	monthInfoUrl: '/client/memberinfo/monthInfo/',
 	//创建包月
 	//创建包月
-	createMonthUrl:'/client/memberinfo/createMonth',
+	createMonthUrl: '/client/memberinfo/createMonth',
 	//包月支付
 	//包月支付
-	monthPayUrl:'/client/monthpay/gzbank/quick',
+	monthPayUrl: '/client/monthpay/gzbank/quick',
 	//包月支付查询
 	//包月支付查询
-	getMonthPayUrl:'/client/monthpay/query/',
+	getMonthPayUrl: '/client/monthpay/query/',
 	//包月列表
 	//包月列表
-	getMonthListUrl:'/client/memberinfo/monthList',
+	getMonthListUrl: '/client/memberinfo/monthList',
 	//取消包月订单
 	//取消包月订单
-	cancelMonthUrl:'/client/memberinfo/cancelMonth/',
-	
+	cancelMonthUrl: '/client/memberinfo/cancelMonth/',
+
 	//启动无感支付
 	//启动无感支付
 	feePayUrl: '/client/membervehicle/enable/feepay/',
 	feePayUrl: '/client/membervehicle/enable/feepay/',
 	//贵州银行快捷支付
 	//贵州银行快捷支付
 	payGzbankUrl: '/client/pay/gzbank/quick',
 	payGzbankUrl: '/client/pay/gzbank/quick',
-	
+
 	// 贵州银行支付
 	// 贵州银行支付
-	gzbankurl:'http://wx.hw.hongweisoft.com/pay/client/gzbank/paygate',
+	gzbankurl: 'http://wx.hw.hongweisoft.com/pay/client/gzbank/paygate',
 	// 订单查询
 	// 订单查询
-	getOrderInfoApi:'/client/pay/query/',
+	getOrderInfoApi: '/client/pay/query/',
 	// 查询设备状态
 	// 查询设备状态
 	getEqupmentStatusApi: '/client/hardware/deviceInfo/',
 	getEqupmentStatusApi: '/client/hardware/deviceInfo/',
 	// 订单退款
 	// 订单退款
@@ -78,9 +78,19 @@ const apiurl = {
 	// 获取条款须知
 	// 获取条款须知
 	getSystermsApi: '/client/systerms/getByType/',
 	getSystermsApi: '/client/systerms/getByType/',
 	//车位锁新增车牌信息
 	//车位锁新增车牌信息
-	bindVehicleNoApi: '/client/orderinfo/bindVehicleNo'
+	bindVehicleNoApi: '/client/orderinfo/bindVehicleNo',
+	codeV2Url: {
+		// 发送验证码V2
+		sendSmsCodeV2Url: '/client/auth/sendSmsCodeV2',
+		// 验证短信验证码V2
+		verifyCodeV2Url: '/client/auth/verifyCodeV2',
+		// 登出
+		logoutUrl: '/client/auth/loginout'
+	},
+	// 地磁获取小票详情
+	geomaLockDetailsUrl: '/client/orderinfo/detailByQrcode'
 }
 }
 
 
 export {
 export {
 	apiurl
 	apiurl
-}
+}

+ 3 - 5
common/config.js

@@ -1,9 +1,7 @@
 const config = {
 const config = {
-	// wxAppid:'wxbe90cc7c5233dd84',// 测试wxAppid 
-	// wxAppid: 'wx45c3cf2b632f5fd5', // 正式wxAppid
-	
-	// baseUrl:'https://wx.hw.hongweisoft.com/parking',// 64服务器
-	baseUrl: 'https://parking.pdzhtc.com', //正式接口访问地址
+	wxAppid: 'wx45c3cf2b632f5fd5', // 正式wxAppid
+	baseUrl:'https://wx.hw.hongweisoft.com/parking',// 64服务器
+	// baseUrl: 'https://parking.pdzhtc.com', //正式接口访问地址
 }
 }
 export {
 export {
 	config
 	config

+ 62 - 41
common/http.api.js

@@ -1,56 +1,65 @@
-import {apiurl} from "./apiurl.js"
+import {
+	apiurl
+} from "./apiurl.js"
 
 
 // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
 // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
 // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
 // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
 const install = (Vue, vm) => {
 const install = (Vue, vm) => {
 	// 反馈提交
 	// 反馈提交
 	let feedbackAdd = (params = {}) => vm.$u.post(apiurl.feedbackAddUrl, params);
 	let feedbackAdd = (params = {}) => vm.$u.post(apiurl.feedbackAddUrl, params);
-	
-	let getuseinfo = (params = {}) => vm.$u.get(apiurl.getuseinfourl+'/'+params);
-	
+
+	let getuseinfo = (params = {}) => vm.$u.get(apiurl.getuseinfourl + '/' + params);
+
 	let createOrder = (params = {}) => vm.$u.post(apiurl.createOrderurl, params);
 	let createOrder = (params = {}) => vm.$u.post(apiurl.createOrderurl, params);
-	
+
 	let bindphone = (params = {}) => vm.$u.post(apiurl.bindphoneurl, params);
 	let bindphone = (params = {}) => vm.$u.post(apiurl.bindphoneurl, params);
-	
+
 	let getPhoneLoginCode = (params = {}) => vm.$u.post(apiurl.phoneLoginCodeUrl, params);
 	let getPhoneLoginCode = (params = {}) => vm.$u.post(apiurl.phoneLoginCodeUrl, params);
-	
-	let phoneLoginAuth = (params = {}) => vm.$u.post(apiurl.phoneLoginAuthUrl, {code:params.code},{Authorization:`Bearer ${params.accessToken}`,user_id:params.userId});
-	
-	let getWXInfo = (params = {}) => vm.$u.get(apiurl.getWXInfoUrl+params);
-	
-	let wxPay = (params = {}) => vm.$u.post(apiurl.wxPayUrl,params);
-	
-	let getIndexData = (params = {}) => vm.$u.post(apiurl.getIndexDataUrl,params);
-	
-	let roadInfoById = (params = {}) => vm.$u.get(apiurl.roadInfoById+params.id);
-	
-	let getMycars = (params = {}) => vm.$u.get(apiurl.mycarsUrl,params);
-	let addCar = (params = {}) => vm.$u.post(apiurl.mycarsUrl,params);
-	let delCar = (params = {}) => vm.$u.delete(apiurl.mycarsUrl+'/'+params);
-	let setDefaultCar = (params = {}) => vm.$u.put(apiurl.setDefaultCarUrl+params.id);
-	
-	let getOrderList = (params = {}) => vm.$u.get(apiurl.getOrderListUrl,params);
-	let getOrderinfo = (params = {}) => vm.$u.get(apiurl.getOrderinfoUrl+params.id);
-	let getOrderDetail = (params = {}) => vm.$u.get(apiurl.getOrderDetailUrl+params.id,{showLoading: false});
-	
-	let getMessageList = (params = {}) => vm.$u.get(apiurl.getMessageListUrl,params);
-	let messageRead = (params ={}) => vm.$u.put(apiurl.messageReadUrl+params.newId);
-	
-	let nearRoadsl = (params = {}) => vm.$u.post(apiurl.nearRoadslUrl,params);
+
+	let phoneLoginAuth = (params = {}) => vm.$u.post(apiurl.phoneLoginAuthUrl, {
+		code: params.code
+	}, {
+		Authorization: `Bearer ${params.accessToken}`,
+		user_id: params.userId
+	});
+
+	let getWXInfo = (params = {}) => vm.$u.get(apiurl.getWXInfoUrl + params);
+
+	let wxPay = (params = {}) => vm.$u.post(apiurl.wxPayUrl, params);
+
+	let getIndexData = (params = {}) => vm.$u.post(apiurl.getIndexDataUrl, params);
+
+	let roadInfoById = (params = {}) => vm.$u.get(apiurl.roadInfoById + params.id);
+
+	let getMycars = (params = {}) => vm.$u.get(apiurl.mycarsUrl, params);
+	let addCar = (params = {}) => vm.$u.post(apiurl.mycarsUrl, params);
+	let delCar = (params = {}) => vm.$u.delete(apiurl.mycarsUrl + '/' + params);
+	let setDefaultCar = (params = {}) => vm.$u.put(apiurl.setDefaultCarUrl + params.id);
+
+	let getOrderList = (params = {}) => vm.$u.get(apiurl.getOrderListUrl, params);
+	let getOrderinfo = (params = {}) => vm.$u.get(apiurl.getOrderinfoUrl + params.id);
+	let getOrderDetail = (params = {}) => vm.$u.get(apiurl.getOrderDetailUrl + params.id, {
+		showLoading: false
+	});
+
+	let getMessageList = (params = {}) => vm.$u.get(apiurl.getMessageListUrl, params);
+	let messageRead = (params = {}) => vm.$u.put(apiurl.messageReadUrl + params.newId);
+
+	let nearRoadsl = (params = {}) => vm.$u.post(apiurl.nearRoadslUrl, params);
 	let roadChargeRule = (params = {}) => vm.$u.get(apiurl.roadsChargeRuleUrl + params.roadNo);
 	let roadChargeRule = (params = {}) => vm.$u.get(apiurl.roadsChargeRuleUrl + params.roadNo);
-	
-	let monthInfo = (params = {}) => vm.$u.get(apiurl.monthInfoUrl,params)
+
+	let monthInfo = (params = {}) => vm.$u.get(apiurl.monthInfoUrl, params)
 	let createMonth = (params = {}) => vm.$u.post(apiurl.createMonthUrl, params);
 	let createMonth = (params = {}) => vm.$u.post(apiurl.createMonthUrl, params);
 	let monthPay = (params = {}) => vm.$u.post(apiurl.monthPayUrl, params);
 	let monthPay = (params = {}) => vm.$u.post(apiurl.monthPayUrl, params);
 	let getMonthPay = (params = {}) => vm.$u.get(apiurl.getMonthPayUrl + params.id);
 	let getMonthPay = (params = {}) => vm.$u.get(apiurl.getMonthPayUrl + params.id);
-	let getMonthList= (params = {}) => vm.$u.get(apiurl.getMonthListUrl,params);
-	let cancelMonth= (params = {}) => vm.$u.put(apiurl.cancelMonthUrl+params.monthId);
-	
-	let feePay = (params = {}) => vm.$u.put(apiurl.feePayUrl+params.vehicleId);
+	let getMonthList = (params = {}) => vm.$u.get(apiurl.getMonthListUrl, params);
+	let cancelMonth = (params = {}) => vm.$u.put(apiurl.cancelMonthUrl + params.monthId);
+
+	let feePay = (params = {}) => vm.$u.put(apiurl.feePayUrl + params.vehicleId);
 	let payGzbank = (params = {}) => vm.$u.post(apiurl.payGzbankUrl, params);
 	let payGzbank = (params = {}) => vm.$u.post(apiurl.payGzbankUrl, params);
-	
-	let bindVehicleNo = (params = {}) => vm.$u.post(apiurl.bindVehicleNoApi,params);
-	
+
+	let bindVehicleNo = (params = {}) => vm.$u.post(apiurl.bindVehicleNoApi, params);
+
 	//贵州银行支付
 	//贵州银行支付
 	let gzbank = (params = {}) => vm.$u.post(apiurl.gzbankurl, params);
 	let gzbank = (params = {}) => vm.$u.post(apiurl.gzbankurl, params);
 	// 订单查询
 	// 订单查询
@@ -67,6 +76,16 @@ const install = (Vue, vm) => {
 	let monthlyWxPay = (params = {}) => vm.$u.post(apiurl.monthlyWxPayApi, params);
 	let monthlyWxPay = (params = {}) => vm.$u.post(apiurl.monthlyWxPayApi, params);
 	// 获取自定义富文本内容: 0-包月须知 1-用户服务条款 2-隐私权政策信息 3-收费标准 4-退款温馨提示
 	// 获取自定义富文本内容: 0-包月须知 1-用户服务条款 2-隐私权政策信息 3-收费标准 4-退款温馨提示
 	let getSysterms = (params = {}) => vm.$u.get(apiurl.getSystermsApi + params.termsType);
 	let getSysterms = (params = {}) => vm.$u.get(apiurl.getSystermsApi + params.termsType);
+	// 通过微信登录获取openid
+	let codeV2Api = {
+		// 发送验证码V2
+		sendSmsCodeV2api: (params = {}) => vm.$u.post(apiurl.codeV2Url.sendSmsCodeV2Url, params),
+		// 验证短信验证码V2
+		verifyCodeV2Api: (params = {}) => vm.$u.post(apiurl.codeV2Url.verifyCodeV2Url, params),
+		// 登出
+		logoutApi: (params = {}) => vm.$u.post(apiurl.codeV2Url.logoutUrl, params)
+	};
+	let geomaLockDetailsApi = (params = {}) => vm.$u.post(apiurl.geomaLockDetailsUrl, params)
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 	vm.$u.api = {
 		feedbackAdd,
 		feedbackAdd,
@@ -106,10 +125,12 @@ const install = (Vue, vm) => {
 		ordinaryWxPay,
 		ordinaryWxPay,
 		monthlyWxPay,
 		monthlyWxPay,
 		getSysterms,
 		getSysterms,
-		bindVehicleNo
+		bindVehicleNo,
+		codeV2Api,
+		geomaLockDetailsApi
 	};
 	};
 }
 }
 
 
 export default {
 export default {
 	install
 	install
-}
+}

+ 83 - 0
common/http.interceptor - 副本.js

@@ -0,0 +1,83 @@
+import { config } from '@/common/config.js';
+import store  from '../store/index.js'
+// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
+// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
+const install = (Vue, vm) => {
+	Vue.prototype.$u.http.setConfig({
+		baseUrl: config.baseUrl,
+		// 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data
+		// 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值
+		// originalData: true, 
+		// 设置自定义头部content-type
+		// header: {
+		// 	'content-type': 'xxx'
+		// }
+	});
+	// 请求拦截,配置Token等参数
+	Vue.prototype.$u.http.interceptor.request = (config) => {
+		// config.header.Token = 'xxxxxx';
+		// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
+		// config.header.token = vm.vuex_token;
+		
+		if(vm.vuex_token){config.header.Authorization = `Bearer ${vm.vuex_token}`;}
+		
+		// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
+		// config.header.token = vm.$store.state.token;
+		
+		// 方式三,如果token放在了globalData,通过getApp().globalData获取
+		// config.header.token = getApp().globalData.username;
+		
+		// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
+		// const token = uni.getStorageSync('token');
+		// config.header.token = token;
+		// url加时间戳
+		config.url = config.url + '?t=' + Date.now()
+		// 此url参数为this.$u.get(url)中的url值
+		let noTokenList = ['/wechat/h5/user','/client/auth/verifyCode'];
+		if(noTokenList.includes(config.url)) config.header.noToken = true;
+		// console.log('noTokenList.includes(config.url)',noTokenList.includes(config.url));
+		// console.log('config.url',config.url);
+		return config; 
+	}
+	// 响应拦截,判断状态码是否通过
+	Vue.prototype.$u.http.interceptor.response = (res) => {
+		// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
+		// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
+		// console.log('interceptor res',res);
+		if(res.code == 200) {
+			// 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么
+			return res;  
+		} else if(res.code == 401 || res.code == 400){
+			const backUrl = location.href
+			const loginUrl = 'phoneLogin'
+			if (backUrl.indexOf(loginUrl) > 0) {
+				localStorage.clear()
+			} else {
+				localStorage.setItem('backUrl', location.href)
+				localStorage.removeItem('lifeData')
+				uni.showModal({
+					title: '提示',
+					content: '未查询到登录信息或信息已失效, 请重新登录',
+					showCancel: false,
+					success: function(res) {
+						if (res.confirm) {
+							uni.navigateTo({
+								url: "/pages/center/phoneLogin/phoneLogin"
+							})
+						}
+					}
+				});
+			}
+		} else {
+			uni.showToast({
+				title: res.msg || '程序错误!',
+				duration: 2000,
+				icon: 'none'
+			})
+		};
+	}
+}
+
+export default {
+	install
+}

+ 13 - 44
common/http.interceptor.js

@@ -1,59 +1,35 @@
 import { config } from '@/common/config.js';
 import { config } from '@/common/config.js';
 import store  from '../store/index.js'
 import store  from '../store/index.js'
-// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
-// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
+// vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
 const install = (Vue, vm) => {
 const install = (Vue, vm) => {
 	Vue.prototype.$u.http.setConfig({
 	Vue.prototype.$u.http.setConfig({
-		baseUrl: config.baseUrl,
-		// 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data
-		// 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值
-		// originalData: true, 
-		// 设置自定义头部content-type
-		// header: {
-		// 	'content-type': 'xxx'
-		// }
+		baseUrl: config.baseUrl
 	});
 	});
 	// 请求拦截,配置Token等参数
 	// 请求拦截,配置Token等参数
 	Vue.prototype.$u.http.interceptor.request = (config) => {
 	Vue.prototype.$u.http.interceptor.request = (config) => {
-		// config.header.Token = 'xxxxxx';
-		// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
-		// config.header.token = vm.vuex_token;
-		
-		if(vm.vuex_token){config.header.Authorization = `Bearer ${vm.vuex_token}`;}
-		
-		// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
-		// config.header.token = vm.$store.state.token;
-		
-		// 方式三,如果token放在了globalData,通过getApp().globalData获取
-		// config.header.token = getApp().globalData.username;
-		
-		// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
-		// const token = uni.getStorageSync('token');
-		// config.header.token = token;
-		// url加时间戳
+		if(vm.vuex_token){
+			config.header.Authorization = `Bearer ${vm.vuex_token}`;
+		}
+		// 请求地址加时间戳
 		config.url = config.url + '?t=' + Date.now()
 		config.url = config.url + '?t=' + Date.now()
-		// 此url参数为this.$u.get(url)中的url值
 		let noTokenList = ['/wechat/h5/user','/client/auth/verifyCode'];
 		let noTokenList = ['/wechat/h5/user','/client/auth/verifyCode'];
 		if(noTokenList.includes(config.url)) config.header.noToken = true;
 		if(noTokenList.includes(config.url)) config.header.noToken = true;
-		// console.log('noTokenList.includes(config.url)',noTokenList.includes(config.url));
-		// console.log('config.url',config.url);
 		return config; 
 		return config; 
 	}
 	}
 	// 响应拦截,判断状态码是否通过
 	// 响应拦截,判断状态码是否通过
 	Vue.prototype.$u.http.interceptor.response = (res) => {
 	Vue.prototype.$u.http.interceptor.response = (res) => {
-		// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
-		// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
-		// console.log('interceptor res',res);
 		if(res.code == 200) {
 		if(res.code == 200) {
-			// 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么
 			return res;  
 			return res;  
 		} else if(res.code == 401 || res.code == 400){
 		} else if(res.code == 401 || res.code == 400){
 			const backUrl = location.href
 			const backUrl = location.href
-			const loginUrl = 'phoneLogin'
-			if (backUrl.indexOf(loginUrl) > 0) {
-				localStorage.clear()
+			// 判断浏览器
+			const ua = window.navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+				// 微信中打开
+				vm.$u.route('pages/wechatLogin/wechatLogin', { backUrl })
 			} else {
 			} else {
-				localStorage.setItem('backUrl', location.href)
+				// 普通浏览器中打开
+				localStorage.setItem('backUrl', backUrl)
 				localStorage.removeItem('lifeData')
 				localStorage.removeItem('lifeData')
 				uni.showModal({
 				uni.showModal({
 					title: '提示',
 					title: '提示',
@@ -65,13 +41,6 @@ const install = (Vue, vm) => {
 								url: "/pages/center/phoneLogin/phoneLogin"
 								url: "/pages/center/phoneLogin/phoneLogin"
 							})
 							})
 						}
 						}
-						// else if (res.cancel) {
-						// 	uni.showToast({
-						// 		title: '您已取消跳转到登录页',
-						// 		icon: 'none',
-						// 		duration: 3000
-						// 	})
-						// }
 					}
 					}
 				});
 				});
 			}
 			}

+ 17 - 1
pages.json

@@ -224,7 +224,7 @@
 			"path": "pages/applyRefundDetails/applyRefundDetails",
 			"path": "pages/applyRefundDetails/applyRefundDetails",
 			"style": {
 			"style": {
 				"navigationBarTitleText": "申请退款",
 				"navigationBarTitleText": "申请退款",
-				"navigationStyle":"custom",
+				"navigationStyle": "custom",
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 
 
@@ -241,6 +241,22 @@
 				"enablePullDownRefresh": false
 				"enablePullDownRefresh": false
 			}
 			}
 
 
+		}, {
+			"path": "pages/wechatLogin/wechatLogin",
+			"style": {
+				"navigationBarTitleText": "微信登录",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/geomagnetismLock/geomagnetismLock",
+			"style": {
+				"navigationBarTitleText": "地磁",
+				"enablePullDownRefresh": false,
+				"navigationBarBackgroundColor": "#008CFF",
+				"navigationBarTextStyle": "white"
+			}
+
 		}
 		}
 	],
 	],
 	"globalStyle": {
 	"globalStyle": {

+ 19 - 35
pages/center/index.vue

@@ -125,7 +125,6 @@ export default {
       pic: '/static/img/default-avatar.png',
       pic: '/static/img/default-avatar.png',
       // 用户信息
       // 用户信息
       userInfo: [],
       userInfo: [],
-      code: null,
       phoneNo: '0851-38222696',
       phoneNo: '0851-38222696',
       logoutPop: false,
       logoutPop: false,
       messageNum: 0
       messageNum: 0
@@ -141,12 +140,7 @@ export default {
       }
       }
     } else {
     } else {
       this.userInfo = [];
       this.userInfo = [];
-    };
-    // let locationLocaturl = window.location.search;
-    // this.code = getUrlParams(locationLocaturl, "code");
-    // if (this.code && !this.$store.state.vuex_wxinfo.openId) {
-    //   this.handleGetWXInfo(this.code)
-    // };
+    }
   },
   },
   methods: {
   methods: {
 		/**
 		/**
@@ -186,21 +180,6 @@ export default {
             })
             })
           }
           }
         })
         })
-        .catch(err => {
-          this.$refs.uToast.show({
-            title: '系统错误!',
-            type: 'error'
-          })
-        })
-    },
-    //登录判断
-    login(status) {
-      console.log('this.$store.state.vuex_hasLogin', this.$store.state.vuex_hasLogin);
-      if (!status) {
-        this.$u.route({
-          url: 'pages/center/phoneLogin/phoneLogin'
-        });
-      }
     },
     },
 		// tabbar 返回
 		// tabbar 返回
     customBack() {
     customBack() {
@@ -217,19 +196,24 @@ export default {
     },
     },
 		// 登出
 		// 登出
     loginOut() {
     loginOut() {
-      this.$u.vuex('vuex_hasLogin', false);
-      this.$u.vuex('vuex_wxinfo', null);
-      this.$u.vuex('vuex_token', '');
-      this.$u.vuex('vuex_user', null);
-      this.userInfo = []
-      this.code = ''
-      localStorage.clear()
-      setTimeout(() => {
-        this.logoutPop = false
-        uni.navigateTo({
-          url: '/pages/center/phoneLogin/phoneLogin'
-        })
-      }, 500)
+			this.$u.api.codeV2Api.logoutApi().then(res => {
+				if (res.code === 200) {
+					this.$u.vuex('vuex_hasLogin', false);
+					this.$u.vuex('vuex_token', '');
+					this.$u.vuex('vuex_user', null);
+					setTimeout(() => {
+					  this.logoutPop = false
+					  uni.navigateTo({
+					    url: '/pages/center/phoneLogin/phoneLogin'
+					  })
+					}, 500)
+				} else {
+					this.$refs.uToast.show({
+					  title: res.msg || '登出失败',
+					  type: 'error'
+					})
+				}
+			})
     },
     },
 		// 点击头像
 		// 点击头像
     clickHead() {
     clickHead() {

+ 298 - 0
pages/center/phoneLogin/phoneLogin - 副本.vue

@@ -0,0 +1,298 @@
+<template>
+	<view class="wrap">
+		<view class="content">
+			<view class="title">手机号登录</view>
+			<input class="u-border-bottom" type="number" maxlength="11" v-model="tel" placeholder="请输入手机号" />
+			<view class="u-text-center u-type-error u-m-t-20" v-if="telError">手机号输入错误</view>
+			<button @tap="submit" :style="[inputStyle]" class="getCaptcha">获取短信验证码</button>
+			<u-message-input v-if="show" :focus="true" :value="messageCode" @change="change" @finish="finish"
+				mode="bottomLine" :maxlength="codelength"></u-message-input>
+		</view>
+		<!-- <view class="u-text-center u-type-error" v-if="phoneError">手机号输入错误</view> -->
+		<view class="captcha">
+			<!-- <text v-if="show&&this.messageDisable==false" @tap="noCaptcha">收不到验证码点这里</text> -->
+			<text v-if="messageShow">{{ second }}秒后可重新获取验证码</text>
+		</view>
+		<view class="buttom">
+			<view class="hint u-text-center">
+				登录代表同意
+				<text class="link" @tap="jumpToPage(1)">《用户服务条款》</text>和
+				<text class="link" @tap="jumpToPage(2)">《隐私政策》</text>
+				并授权使用您的账号信息(如昵称、头像、收货地址)以便您统一管理
+			</view>
+		</view>
+		<u-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	import getUrlParams from "./../../../utils/getUrlParams.js";
+	export default {
+		data() {
+			return {
+				tel: '',
+				messageCode: '',
+				messageShow: false,
+				messageDisable: false,
+				codelength: 4,
+				show: false,
+				second: 60,
+				toastMsg: '',
+				toastUrl: '',
+				toastType: '',
+				accessToken: '',
+				userId: '',
+				telError: false,
+				// messageError:false
+			}
+		},
+		onLoad(page) {
+			//  如果存在code 则认为是微信登录完成后跳转过来的,直接获取信息跳转首页或者指定页面
+			let locationLocaturl = window.location.search;
+			this.code = getUrlParams(locationLocaturl, "code"); // 截取code
+			if (this.code) {
+				this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+			}
+		},
+		computed: {
+			inputStyle() {
+				let style = {};
+				if (this.tel.length == 11 && this.messageDisable == false && this.$u.test.mobile(this.tel)) {
+					style.color = "#fff";
+					style.backgroundColor = '#5295F5';
+					this.telError = false;
+					// style.backgroundColor = this.$u.color['warning'];
+				} else if (this.tel.length == 11 && !this.$u.test.mobile(this.tel)) {
+					this.telError = true;
+				}
+				return style;
+			}
+		},
+		methods: {
+			showToast() {
+				this.$refs.uToast.show({
+					title: this.toastMsg,
+					type: this.toastType,
+					url: this.toastUrl
+				})
+			},
+			submit() {
+				if (this.$u.test.mobile(this.tel) && this.messageDisable == false) {
+					let that = this;
+					this.$u.api.getPhoneLoginCode({
+							mobile: this.tel
+						})
+						.then(res => {
+							this.messageDisable = true;
+							this.messageShow = true;
+							this.show = true;
+							let interval = setInterval(() => {
+								that.second--;
+								if (that.second <= 0) {
+									that.messageDisable = false
+									that.messageShow = false;
+									if (that.messageCode.lenth != 4) {
+										// this.messageError = true;
+									}
+									clearInterval(interval);
+									that.second = 60;
+								}
+							}, 1000);
+							this.accessToken = res.data.accessToken;
+							this.userId = res.data.userId;
+						}).catch(err => {
+							this.toastMsg = err.code + ":" + err.msg;
+							this.showToast();
+						});
+				}
+			},
+			// 收不到验证码选择时的选择
+			// noCaptcha() {
+			// 	uni.showActionSheet({
+			// 		itemList: ['重新获取验证码', '接听语音验证码'],
+			// 		success: function(res) {
+
+			// 		},
+			// 		fail: function(res) {
+
+			// 		}
+			// 	});
+			// },
+			// change事件侦听
+			change(value) {
+				// console.log('change', value);
+			},
+			// 输入完验证码最后一位执行
+			finish(value) {
+				let params = {
+					accessToken: this.accessToken,
+					userId: this.userId,
+					code: value
+				};
+				this.$u.api.phoneLoginAuth(params)
+					.then(res => {
+						if (res.code == '200') {
+							this.$u.vuex('vuex_token', this.accessToken);
+							this.$u.vuex('vuex_user', res.data);
+							this.$u.vuex('vuex_hasLogin', true);
+							this.wechatLogin()
+
+						} else {
+							this.toastMsg = res.msg;
+							this.showToast();
+						}
+					}).catch(err => {
+						this.toastMsg = err.msg;
+						this.showToast();
+					});
+			},
+			// 微信登录
+			wechatLogin() {
+				this.jumpIndex()
+				// const openId = this.$store.state.vuex_wxinfo?.openId
+				// if (openId) {
+				// 	this.jumpIndex()
+				// } else {
+				// 	this.getCode()
+				// }
+			},
+			// 微信已登录则跳转到首页
+			jumpIndex() {
+				let ret = localStorage.getItem('backUrl')
+				if (ret && ret.indexOf('phoneLogin') < 0) {
+					// 截取url
+					const pagesIndex = ret.indexOf('pages')
+					if (pagesIndex > (-1)) {
+						const pageUrl = ret.slice(pagesIndex)
+						const tabbarUrl = ['pages/center/index', 'pages/parkingLists/parkingLists']
+						if (tabbarUrl.indexOf(pageUrl) > (-1)) {
+							setTimeout(() => {
+								uni.switchTab({
+									url: '../../index/index'
+								})
+							}, 100)
+						} else {
+							setTimeout(() => {
+								uni.navigateTo({
+									url: '/' + pageUrl
+								})
+							}, 100)
+						}
+					} else {
+						uni.switchTab({
+							url: '../../index/index'
+						})
+					}
+				} else {
+					uni.switchTab({
+						url: '../../index/index'
+					})
+				}
+			},
+			// 获取code
+			getCode() {
+				const local = window.location.href // 获取页面url
+				let locationLocaturl = window.location.search;
+				this.code = getUrlParams(locationLocaturl, "code"); // 截取code
+				if (this.code) { // 如果没有code,则去请求
+					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+				} else {
+					window.location.href =
+						`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
+				}
+			},
+			// 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
+			handleGetWXInfo(code) {
+				uni.showLoading({
+			  title: '加载中'
+				})
+				this.$u.api.getWXInfo(code).then((res) => {
+					if (res.code === 200) {
+						this.$u.vuex('vuex_wxinfo', res.data);
+						this.jumpIndex()
+					} else {
+						this.$refs.uToast.show({
+							title: '获取用户信息失败!',
+							type: 'error',
+						});
+					}
+					uni.hideLoading()
+				}).catch((err) => {
+					this.$refs.uToast.show({
+						title: '获取用户信息失败!',
+						type: 'error',
+					});
+				})
+			},
+			/**
+			 * 跳转页面
+			 * */
+			jumpToPage(flag) {
+				uni.navigateTo({
+					url: "/pages/privacyPolicy/privacyPolicy?termsType=" + flag,
+				})
+			}
+		}
+	};
+</script>
+
+<style lang="scss" scoped>
+	.hide {
+		display: none !important;
+	}
+
+	.wrap {
+		font-size: 28rpx;
+
+		.content {
+			width: 600rpx;
+			margin: 80rpx auto 0;
+
+			.title {
+				text-align: left;
+				font-size: 60rpx;
+				font-weight: 500;
+				margin-bottom: 100rpx;
+			}
+
+			input {
+				text-align: left;
+				margin-bottom: 10rpx;
+				padding-bottom: 20rpx;
+				border-bottom: 1px solid #ddd;
+			}
+
+			.getCaptcha {
+				margin: 45rpx auto 130rpx;
+				background-color: #a8c6f1;
+				color: $u-tips-color;
+				border: none;
+				font-size: 30rpx;
+				padding: 12rpx 0;
+
+				&::after {
+					border: none;
+				}
+			}
+		}
+
+		.buttom {
+			.hint {
+				padding: 20rpx 40rpx;
+				font-size: 20rpx;
+				color: $u-tips-color;
+
+				.link {
+					color: $u-type-warning;
+				}
+			}
+		}
+
+		.captcha {
+			color: $u-type-warning;
+			font-size: 30rpx;
+			margin-top: 40rpx;
+			text-align: center;
+		}
+	}
+</style>

+ 55 - 101
pages/center/phoneLogin/phoneLogin.vue

@@ -43,15 +43,21 @@
 				accessToken: '',
 				accessToken: '',
 				userId: '',
 				userId: '',
 				telError: false,
 				telError: false,
-				// messageError:false
+				openId: ''
 			}
 			}
 		},
 		},
 		onLoad(page) {
 		onLoad(page) {
-			//  如果存在code 则认为是微信登录完成后跳转过来的,直接获取信息跳转首页或者指定页面
-			let locationLocaturl = window.location.search;
-			this.code = getUrlParams(locationLocaturl, "code"); // 截取code
-			if (this.code) {
-				this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+			this.openId = this.vuex_wxinfo?.openId
+			const backUrl = location.href
+			if (!this.openId) {
+				// 判断浏览器
+				const ua = window.navigator.userAgent.toLowerCase()
+				if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+					// 微信中打开
+					this.$u.route('pages/wechatLogin/wechatLogin', {
+						backUrl
+					})
+				}
 			}
 			}
 		},
 		},
 		computed: {
 		computed: {
@@ -61,7 +67,6 @@
 					style.color = "#fff";
 					style.color = "#fff";
 					style.backgroundColor = '#5295F5';
 					style.backgroundColor = '#5295F5';
 					this.telError = false;
 					this.telError = false;
-					// style.backgroundColor = this.$u.color['warning'];
 				} else if (this.tel.length == 11 && !this.$u.test.mobile(this.tel)) {
 				} else if (this.tel.length == 11 && !this.$u.test.mobile(this.tel)) {
 					this.telError = true;
 					this.telError = true;
 				}
 				}
@@ -79,45 +84,35 @@
 			submit() {
 			submit() {
 				if (this.$u.test.mobile(this.tel) && this.messageDisable == false) {
 				if (this.$u.test.mobile(this.tel) && this.messageDisable == false) {
 					let that = this;
 					let that = this;
-					this.$u.api.getPhoneLoginCode({
-							mobile: this.tel
-						})
-						.then(res => {
-							this.messageDisable = true;
-							this.messageShow = true;
-							this.show = true;
-							let interval = setInterval(() => {
-								that.second--;
-								if (that.second <= 0) {
-									that.messageDisable = false
-									that.messageShow = false;
-									if (that.messageCode.lenth != 4) {
-										// this.messageError = true;
-									}
-									clearInterval(interval);
-									that.second = 60;
+					let mobile = this.tel,
+						openId = this.openId
+					this.$u.api.codeV2Api.sendSmsCodeV2api({
+						mobile,
+						openId
+					}).then(res => {
+						this.messageDisable = true;
+						this.messageShow = true;
+						this.show = true;
+						let interval = setInterval(() => {
+							that.second--;
+							if (that.second <= 0) {
+								that.messageDisable = false
+								that.messageShow = false;
+								if (that.messageCode.lenth != 4) {
+									// this.messageError = true;
 								}
 								}
-							}, 1000);
-							this.accessToken = res.data.accessToken;
-							this.userId = res.data.userId;
-						}).catch(err => {
-							this.toastMsg = err.code + ":" + err.msg;
-							this.showToast();
-						});
+								clearInterval(interval);
+								that.second = 60;
+							}
+						}, 1000);
+						this.accessToken = res.data.accessToken;
+						this.userId = res.data.userId;
+					}).catch(err => {
+						this.toastMsg = err.code + ":" + err.msg;
+						this.showToast();
+					});
 				}
 				}
 			},
 			},
-			// 收不到验证码选择时的选择
-			// noCaptcha() {
-			// 	uni.showActionSheet({
-			// 		itemList: ['重新获取验证码', '接听语音验证码'],
-			// 		success: function(res) {
-
-			// 		},
-			// 		fail: function(res) {
-
-			// 		}
-			// 	});
-			// },
 			// change事件侦听
 			// change事件侦听
 			change(value) {
 			change(value) {
 				// console.log('change', value);
 				// console.log('change', value);
@@ -125,36 +120,30 @@
 			// 输入完验证码最后一位执行
 			// 输入完验证码最后一位执行
 			finish(value) {
 			finish(value) {
 				let params = {
 				let params = {
-					accessToken: this.accessToken,
-					userId: this.userId,
-					code: value
+					token: this.accessToken,
+					code: value,
+					openId: this.vuex_wxinfo?.openId,
+					mobile: this.tel
 				};
 				};
-				this.$u.api.phoneLoginAuth(params)
-					.then(res => {
-						if (res.code == '200') {
-							this.$u.vuex('vuex_token', this.accessToken);
-							this.$u.vuex('vuex_user', res.data);
-							this.$u.vuex('vuex_hasLogin', true);
-							this.wechatLogin()
+				this.$u.api.codeV2Api.verifyCodeV2Api(params).then(res => {
+					if (res.code == '200') {
+						this.$u.vuex('vuex_token', this.accessToken);
+						this.$u.vuex('vuex_user', res.data);
+						this.$u.vuex('vuex_hasLogin', true);
+						this.wechatLogin()
 
 
-						} else {
-							this.toastMsg = res.msg;
-							this.showToast();
-						}
-					}).catch(err => {
-						this.toastMsg = err.msg;
+					} else {
+						this.toastMsg = res.msg;
 						this.showToast();
 						this.showToast();
-					});
+					}
+				}).catch(err => {
+					this.toastMsg = err.msg;
+					this.showToast();
+				});
 			},
 			},
 			// 微信登录
 			// 微信登录
 			wechatLogin() {
 			wechatLogin() {
 				this.jumpIndex()
 				this.jumpIndex()
-				// const openId = this.$store.state.vuex_wxinfo?.openId
-				// if (openId) {
-				// 	this.jumpIndex()
-				// } else {
-				// 	this.getCode()
-				// }
 			},
 			},
 			// 微信已登录则跳转到首页
 			// 微信已登录则跳转到首页
 			jumpIndex() {
 			jumpIndex() {
@@ -189,41 +178,6 @@
 					})
 					})
 				}
 				}
 			},
 			},
-			// 获取code
-			getCode() {
-				const local = window.location.href // 获取页面url
-				let locationLocaturl = window.location.search;
-				this.code = getUrlParams(locationLocaturl, "code"); // 截取code
-				if (this.code) { // 如果没有code,则去请求
-					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
-				} else {
-					window.location.href =
-						`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
-				}
-			},
-			// 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
-			handleGetWXInfo(code) {
-				uni.showLoading({
-			  title: '加载中'
-				})
-				this.$u.api.getWXInfo(code).then((res) => {
-					if (res.code === 200) {
-						this.$u.vuex('vuex_wxinfo', res.data);
-						this.jumpIndex()
-					} else {
-						this.$refs.uToast.show({
-							title: '获取用户信息失败!',
-							type: 'error',
-						});
-					}
-					uni.hideLoading()
-				}).catch((err) => {
-					this.$refs.uToast.show({
-						title: '获取用户信息失败!',
-						type: 'error',
-					});
-				})
-			},
 			/**
 			/**
 			 * 跳转页面
 			 * 跳转页面
 			 * */
 			 * */

+ 300 - 0
pages/geomagnetismLock/geomagnetismLock.scss

@@ -0,0 +1,300 @@
+.parking-lock {
+	height: calc(100vh - 88rpx);
+	background-color: #F6F6FF;
+	padding-top: 133rpx;
+	.parking-lock-title {
+		font-size: 46rpx;
+		color: #292929;
+		text-align: center;
+		padding-top: 31rpx;
+		line-height: 65rpx;
+		font-family: PingFangSC-Regular, PingFang SC;
+		font-weight: 400;
+	}
+	.parking-lock-tips {
+		width: calc(100% - 72rpx);
+		font-size: 30rpx;
+		color: #777777;
+		text-align: center;
+		margin: 10rpx auto;
+		line-height: 47rpx;
+	}
+	.parking-lock-info {
+		width: calc(100% - 72rpx);
+		margin: 31rpx auto 54rpx;
+		background-color: #fff;
+		border-radius: 15rpx;
+		padding: 39rpx 41rpx;
+		.parking-lock-info-item {
+			display: flex;
+			margin-bottom: 16rpx;
+			view {
+				font-size: 28rpx;
+				&:first-child {
+					width: 30%;
+					color: #2A2A2A;
+					font-weight: 500;
+				}
+				&:last-child {
+					color: #6E6E6E;
+				}
+			}
+			.weight {
+				color: #2A2A2A!important;
+				font-weight: 500;
+			}
+			.really-money {
+				color: #FA7319!important;
+			}
+		}
+	}
+	.parking-lock-pay-btn {
+		width: calc(100% - 72rpx);
+		margin: 0 auto;
+		button {
+			width: 100%;
+			height: 100rpx;
+			line-height: 100rpx;
+			background-color: #008CFF;
+			border: none;
+			color: #fff;
+			box-shadow: 0px 7px 13px 0px rgba(16, 153, 250, 0.31);
+			font-size: 28rpx;
+			font-weight: 500;
+		}
+	}
+	.parking-lock-begin-box {
+		width: 441rpx;
+		height: 441rpx;
+		line-height: 441rpx;
+		background: #31A2FF;
+		background: linear-gradient(270deg, rgba(49,162,255,0.1) 20%, rgba(49,162,255,1) 100%);
+		border-radius: 50%;
+		text-align: center;
+		margin: 0 auto;
+		// animation: spin 3s linear infinite;
+		.parking-lock-begin-bg {
+			display: inline-block;
+			width: 420rpx;
+			height: 420rpx;
+			line-height: 420rpx;
+			vertical-align: middle;
+			border: solid 12rpx #fff;
+			background: linear-gradient(346deg, #008CFF 0%, #95CFFF 100%);
+			border-radius: 50%;
+			image {
+				width: 194rpx;
+				height: 239rpx;
+				vertical-align: middle;
+			}
+		}
+	}
+	.parking-lock-begin-info {
+		text-align: center;
+		font-size: 50rpx;
+		color: #008CFF;
+		margin-top: 57rpx;
+	}
+	.parking-lock-loading-box {
+		width: 441rpx;
+		height: 441rpx;
+		line-height: 441rpx;
+		background: #31A2FF;
+		background: linear-gradient(0deg, rgba(49,162,255,0.1) 20%, rgba(49,162,255,1) 100%);
+		border-radius: 50%;
+		text-align: center;
+		margin: 0 auto;
+		animation: spin 3s linear infinite;
+		.parking-lock-loading-bg {
+			display: inline-block;
+			width: 420rpx;
+			height: 420rpx;
+			line-height: 420rpx;
+			vertical-align: middle;
+			border: solid 12rpx #fff;
+			background: linear-gradient(346deg, #008CFF 0%, #95CFFF 100%);
+			border-radius: 50%;
+			image {
+				width: 194rpx;
+				height: 239rpx;
+				vertical-align: middle;
+			}
+		}
+	}
+	.parking-lock-loading-info {
+		text-align: center;
+		font-size: 50rpx;
+		color: #008CFF;
+		margin-top: 57rpx;
+	}
+	.parking-lock-success {
+		.parking-lock-success-box {
+			width: 441rpx;
+			height: 441rpx;
+			margin: 0 auto;
+			image {
+				width: 100%;
+				height: 100%;
+			}
+		}
+		.parking-lock-success-info {
+			color: #4CCD8A;
+			font-size: 50rpx;
+			text-align: center;
+			margin: 56rpx 0 202rpx;
+		}
+		.parking-lock-success-button {
+			width: calc(100% - 80rpx);
+			margin: 0 auto;
+			button {
+				width: 100%;
+				height: 100rpx;
+				line-height: 100rpx;
+				background-color: #008CFF;
+				font-size: 28rpx;
+				color: #fff;
+			}
+		}
+	}
+}
+.pay-way {
+	display: flex;
+	justify-content: space-between;
+	width: calc(100% - 34rpx);
+	border-top: solid 1px #979797;
+	margin: 23rpx auto;
+	padding: 38rpx 86rpx;
+	.pay-way-item {
+		text-align: center;
+		font-size: 30rpx;
+		color: #5F5F5F;
+		image {
+			width: 143rpx;
+			height: 143rpx;
+		}
+	}
+}
+.pay-way-close-btn {
+	width: calc(100% - 34rpx);
+	margin: 0 auto 68rpx;
+	border: none;
+	background-color: #3397FA;
+	color: #fff;
+	border-radius: 10rpx;
+}
+@keyframes rotate {
+    0%{
+        transform: rotate(0);
+    }
+    50% {
+    	transform:rotate(200deg);
+    }
+    100% {
+        transform: rotate(0);
+	}
+}
+@keyframes spin {
+  from {
+    transform: rotate(0);
+  }
+  to{
+    transform: rotate(359deg);
+  }
+}
+.loadingSelect{
+	    text-align: center;
+	    margin-top: 20rpx;
+}
+.spinner {
+  margin: auto;
+  width: 50px;
+  height: 60px;
+  text-align: center;
+  font-size: 10px;
+}
+ 
+.spinner > view {
+  background-color: #6495ED;
+  height: 100%;
+  width: 10rpx;
+  margin-right: 2rpx;
+  display: inline-block;
+   
+  -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
+  animation: stretchdelay 1.2s infinite ease-in-out;
+}
+ 
+.spinner .rect2 {
+  -webkit-animation-delay: -1.1s;
+  animation-delay: -1.1s;
+}
+ 
+.spinner .rect3 {
+  -webkit-animation-delay: -1.0s;
+  animation-delay: -1.0s;
+}
+ 
+.spinner .rect4 {
+  -webkit-animation-delay: -0.9s;
+  animation-delay: -0.9s;
+}
+ 
+.spinner .rect5 {
+  -webkit-animation-delay: -0.8s;
+  animation-delay: -0.8s;
+}
+ 
+@-webkit-keyframes stretchdelay {
+  0%, 40%, 100% { -webkit-transform: scaleY(0.4) } 
+  20% { -webkit-transform: scaleY(1.0) }
+}
+ 
+@keyframes stretchdelay {
+  0%, 40%, 100% {
+    transform: scaleY(0.4);
+    -webkit-transform: scaleY(0.4);
+  }  20% {
+    transform: scaleY(1.0);
+    -webkit-transform: scaleY(1.0);
+  }
+}
+.new-plate-number{	
+	margin-bottom: 70rpx;
+}
+.message-input-wrap{
+	margin: 0 -40rpx;
+}
+.message-input-wrap /deep/ .u-input ~ uni-view:last-of-type .u-char-item{
+	background-color: #E8FFE8;
+}
+.really-license-txt{
+	color: #008CFF;
+}
+.really-license-txt1{
+	color: #008CFF;
+	margin: 20rpx;
+}
+.popup-vehicleNo-title{
+	font-size: 48rpx;
+	text-align: center;
+	padding-top: 20rpx;
+}
+.popup-vehicleNo-center{
+	width: 95%;
+	height: 2rpx;
+	border-top: solid rgb(146, 146, 146) 2rpx;
+	margin: 30rpx 20rpx 50rpx 20rpx;
+}
+.popup-vehicleNo-select{
+	text-align: center;
+	color: #777777;
+}
+.vehicleNo-btn{
+	display: flex;
+	margin: 40rpx 0;
+}
+.parking-lock-pay-attention{
+	margin: 50rpx;
+	line-height: 48rpx;
+	color: #777777;
+}

+ 482 - 0
pages/geomagnetismLock/geomagnetismLock.vue

@@ -0,0 +1,482 @@
+<template>
+	<!-- 地磁 -->
+	<view class="parking-lock">
+		<!-- 地磁支付 -->
+		<template v-if="parkingLockStatus === 1">
+			<view class="parking-lock-pay">
+				<view class="parking-lock-title">支付停车费</view>
+				<view class="parking-lock-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view>
+				<view class="parking-lock-info">
+					<view class="parking-lock-info-item">
+						<view>车牌号</view>
+						<view class="weight">{{ orderInfo.vehicleNo }}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>停车场名称</view>
+						<view>{{orderInfo.roadName }}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>停车泊位</view>
+						<view>{{orderInfo.spaceName}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>入场时间</view>
+						<view>{{orderInfo.inTime}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>出场时间</view>
+						<view>{{orderInfo.outTime}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>免费时长</view>
+						<!-- <view>{{ orderInfo.freeDuration || '0天0时15分0秒' }}</view> -->
+						<view>{{ '0天0时15分0秒' }}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>计费时长</view>
+						<view>{{orderInfo.calcDuration || 0}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>累计停车时长</view>
+						<view>{{ orderInfo.duration || 0 }}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>应缴金额</view>
+						<view class="really-money">{{ orderInfo.payAmount || 0 }} 元</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>订单编号</view>
+						<view>{{ orderInfo.orderId }}</view>
+					</view>
+				</view>
+				<view class="parking-lock-pay-btn" v-if="is_pay">
+					<button type="default" @click="payMoney">立即支付</button>
+				</view>
+			</view>
+		</template>
+		<!-- 车位锁开始状态 -->
+		<template v-else-if="parkingLockStatus === 2">
+			<view class="parking-lock-begin">
+				<view class="parking-lock-begin-box">
+					<view class="parking-lock-begin-bg">
+						<image src="../../static/img/parking-lock-bg.png" mode=""></image>
+					</view>
+				</view>
+				<view class="parking-lock-begin-info">车位锁正在动作,还未到位</view>
+			</view>
+		</template>
+		<!-- 车位锁正在状态 -->
+		<template v-else-if="parkingLockStatus === 3">
+			<view class="parking-lock-loading">
+				<view class="parking-lock-loading-box">
+					<view class="parking-lock-loading-bg">
+						<image src="../../static/img/parking-lock-bg.png" mode=""></image>
+					</view>
+				</view>
+				<view class="parking-lock-loading-info">开锁中,请等待!</view>
+			</view>
+		</template>
+		<!-- 开锁完成 -->
+		<template v-else-if="parkingLockStatus === 4">
+			<view class="parking-lock-success">
+				<view class="parking-lock-success-box">
+					<image src="../../static/img/parking-lock-achieve.png" mode=""></image>
+				</view>
+				<view class="parking-lock-success-info">开锁已完成</view>
+				<view class="parking-lock-success-button">
+					<button @click="cancel">返回</button>
+				</view>
+			</view>
+		</template>
+		<template v-else-if="parkingLockStatus === 5">
+			<view class="parking-lock-pay">
+				<view class="parking-lock-tips">{{tipsMsg}}</view>
+			</view>
+		</template>
+		<!-- 支付方式 -->
+		<PaymentMethod :payWayPop="payWayPop" :curOrderList="[orderId]" :jumpUrl="jumpUrl" :payeeId="payeeId" :payeeName="payeeName"
+			@closePaymentMethod="closePaymentMethod"></PaymentMethod>
+		<u-toast ref="uToast" />
+		<u-popup v-model="show" mode="center" border-radius="14" width="200rpx" height="200rpx">
+			<view class="loadingSelect">订单查询中...</view>
+			<view class="spinner">
+				<view class="rect1"></view>
+				<view class="rect2"></view>
+				<view class="rect3"></view>
+				<view class="rect4"></view>
+				<view class="rect5"></view>
+			</view>
+		</u-popup>
+		<u-popup class="popup-vehicleNo" v-model="ShowaddvehicleNo" mode="center" border-radius="20" width="710rpx"
+			height="auto">
+			<view class="popup-vehicleNo-title">添加车牌</view>
+			<view class="popup-vehicleNo-center"></view>
+			<view class="popup-vehicleNo-content">
+				<view class="new-plate-number">
+					<view class="message-input-wrap" @click="messageInputClick">
+						<u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true"
+							v-model="newPlateNumber"></u-message-input>
+					</view>
+				</view>
+			</view>
+			<view class="popup-vehicleNo-select">暂无绑定车牌</view>
+			<view class="vehicleNo-btn">
+				<u-button type="primary" @click="handleAddCar">确认</u-button>
+				<u-button type="primary" plain @click="ShowaddvehicleNo=false">取消</u-button>
+			</view>
+		</u-popup>
+
+		<u-popup class="popup-vehicleNo" v-model="ShowchangevehicleNo" mode="center" border-radius="20" width="710rpx"
+			height="auto">
+			<view class="popup-vehicleNo-title">更换车牌</view>
+			<view class="popup-vehicleNo-center"></view>
+			<view class="popup-vehicleNo-content">
+				<view class="new-plate-number">
+					<view class="message-input-wrap" @click="messageInputClick">
+						<u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true"
+							v-model="newPlateNumber"></u-message-input>
+					</view>
+				</view>
+			</view>
+			<view class="popup-vehicleNo-select">
+				<u-collapse ref="refValue">
+					<u-collapse-item title="点击选择车牌" align="center">
+						<u-cell-group>
+							<u-cell-item :title="item.vehicleNo" v-for="(item, index) in groupList" :key="index"
+								:arrow="false">
+								<u-radio-group v-model="selectvalue" @change="radioGroupChange">
+									<u-radio :name="item.vehicleNo" :key="index"></u-radio>
+								</u-radio-group>
+							</u-cell-item>
+						</u-cell-group>
+					</u-collapse-item>
+				</u-collapse>
+			</view>
+			<view class="vehicleNo-btn">
+				<u-button type="primary" @click="handleAddCar">确认</u-button>
+				<u-button type="primary" plain @click="ShowchangevehicleNo=false">取消</u-button>
+			</view>
+		</u-popup>
+		<u-action-sheet :list="colorList" @click="confirmColor" v-model="colorShow"></u-action-sheet>
+		<u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @confirm="keyboardConfirm"
+			@backspace="backspace" v-model="keyboardshow"></u-keyboard>
+	</view>
+</template>
+
+<script>
+	import getUrlParams from "../../utils/getUrlParams.js";
+	import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
+	export default {
+		components: {
+			PaymentMethod
+		},
+		data() {
+			return {
+				selectvalue: null,
+				groupList: [],
+				radiogroupList: [],
+				keyboardshow: false,
+				colorShow: false,
+				colorList: [{
+					text: '蓝色',
+					colorCode: 0
+				}, {
+					text: '黄色',
+					colorCode: 1
+				}, {
+					text: '黑色',
+					colorCode: 2
+				}, {
+					text: '白色',
+					colorCode: 3
+				}, {
+					text: '绿色',
+					colorCode: 4
+				}, {
+					text: '其他',
+					colorCode: 99
+				}],
+				vehicleColor: 0,
+				newPlateNumber: '',
+				//更换车牌弹窗
+				ShowchangevehicleNo: false,
+				//添加车牌弹窗
+				ShowaddvehicleNo: false,
+				// 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
+				parkingLockStatus: 0,
+				// 支付方式选择弹框
+				payWayPop: false,
+				// 订单编号
+				orderList: [],
+				// 提示信息
+				tipsMsg: null,
+				// 设备编号
+				deviceNo: null,
+				// 轮询
+				timer: null,
+				timer1: null,
+				// 订单信息
+				orderInfo: {},
+				// 订单id
+				orderId: null,
+				// 重定向地址
+				jumpUrl: location.href + '&isBack=1',
+				show: true,
+				isBack: '',
+				polyOrderId: '',
+				// 地磁
+				spaceId: '',
+				payeeId: '',
+				payeeName: '',
+				is_pay: false
+			}
+		},
+		onLoad(page) {
+			if (page.orderId) {
+				this.orderId = page?.orderId
+				this.spaceId = page?.orderId
+				this.payeeId = page?.payeeId
+				this.polyOrderId = page?.polyOrderId
+				this.isBack = page?.isBack
+			} else {
+				this.tipsMsg = page.msg || '参数丢失!';
+				this.parkingLockStatus = 5
+			}
+		},
+		onShow() {
+			if (this.orderId) {
+				this.getOrderDetails(this.spaceId, this.orderId, this.payeeId)
+				if (this.polyOrderId && this.isBack == 1) {
+					this.timer1 = setInterval(() => {
+						this.show = true
+						this.handlePayStatus(this.polyOrderId)
+					}, 1000)
+				}
+			} else {
+				this.show = false
+			}
+		},
+		onUnload() {
+			if (this.timer) {
+				clearInterval(this.timer)
+			}
+			if (this.timer1) {
+				clearInterval(this.timer1)
+			}
+		},
+		methods: {
+			radioGroupChange(e) {
+				this.newPlateNumber = e
+			},
+			// 获取车辆列表
+			handlegetMycars() {
+				let that = this;
+				this.$u.api.getMycars()
+					.then(res => {
+						if (res.code === 200) {
+							this.groupList = res.data.rows;
+							this.radiogroupList = res.data.rows;
+							this.$nextTick(() => {
+								// dom元素更新后执行,因此这里能正确打印更改之后的值
+								console.log(that.$refs.refValue.init()) // 改变了的值
+							})
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error'
+							})
+						}
+					})
+					.catch(err => {
+						this.$refs.uToast.show({
+							title: '操作失败!',
+							type: 'error'
+						})
+					});
+			},
+			//更换车牌信息
+			changevehicleNo() {
+				this.ShowchangevehicleNo = true;
+				this.handlegetMycars();
+			},
+			// 添加车辆
+			handleAddCar() {
+				if (!this.$u.test.carNo(this.newPlateNumber)) {
+					this.$refs.uToast.show({
+						title: '请正确填写车牌号',
+						type: 'error',
+					});
+					return
+				}
+				let param = {
+					orderId: this.orderId,
+					vehicleNo: this.newPlateNumber,
+					vehicleColor: this.vehicleColor,
+				};
+				let that = this;
+				this.$u.api.bindVehicleNo(param)
+					.then(res => {
+						if (res.code === 200) {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'success',
+							});
+							that.getOrderDetails(that.orderId);
+							that.ShowchangevehicleNo = false;
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error',
+							});
+						}
+					})
+					.catch(err => {
+						this.$refs.uToast.show({
+							title: '操作失败!',
+							type: 'error',
+						});
+					});
+			},
+			//新增车牌
+			addvehicleNo() {
+				this.ShowaddvehicleNo = true;
+			},
+
+			// 点击输入框
+			messageInputClick() {
+				this.keyboardshow = true;
+			},
+			// 按键被点击(点击退格键不会触发此事件)
+			keyboardChange(val) {
+				// 将每次按键的值拼接到value变量中,注意+=写法
+				this.newPlateNumber += val;
+			},
+			// 退格键被点击
+			backspace() {
+				// 删除value的最后一个字符
+				if (this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber
+					.length - 1);
+			},
+			// 键盘输入完成后确认
+			keyboardConfirm() {
+				this.colorShow = true;
+			},
+			// 确认颜色
+			confirmColor(e) {
+				this.vehicleColor = this.colorList[e].colorCode;
+			},
+			/**
+			 * 反复查询支付状态
+			 * @param { String } orderId
+			 */
+			handlePayStatus(orderId) {
+				this.$u.api.getOrderInfo({
+					orderId
+				}).then(res => {
+					if (res.code === 200) {
+						if (res.data.payStatus === 1 || res.data.payStatus === 3) {
+							this.show = false
+							clearInterval(this.timer1);
+							this.is_pay = false
+							uni.showModal({
+								title: '提示',
+								content: '支付成功,返回首页',
+								showCancel: false,
+								success: function(res) {
+									if (res.confirm) {
+										uni.switchTab({
+											url: '/pages/index/index'
+										})
+									}
+								}
+							});
+						}
+					} else {
+						this.show = false
+						clearInterval(this.timer1);
+						this.$refs.uToast.show({
+							title: res.msg,
+							type: 'error',
+						});
+					}
+				}).catch(() => {
+					this.show = false
+					clearInterval(this.timer1);
+				})
+			},
+			payMoney() {
+				this.payWayPop = true
+			},
+			// 查询订单信息
+			getOrderDetails(spaceId, orderId, payeeId) {
+				this.$u.api.geomaLockDetailsApi({
+					spaceId,
+					orderId,
+					payeeId
+				}).then(res => {
+					if (res.code === 200 && res.data.id) {
+						this.payeeName = res.data.payeeName
+						this.parkingLockStatus = 1
+						// 获取页面完整url
+						const local = window.location.href
+						// 获取url后面的参数
+						const locationLocaturl = window.location.search;
+						// 截取url中的isBack
+						let isBack = getUrlParams(local, "isBack");
+						// 如果没有isBack,则去请求
+						if (!isBack) {
+							this.show = false
+							clearInterval(this.timer1)
+						}
+						this.orderInfo = res.data
+						this.show = false
+						if (res.data.payStatus == 0) {
+							this.is_pay = true
+						} else if (res.data.payStatus == 1){
+							this.is_pay = false
+							uni.showModal({
+								title: '提示',
+								content: '订单已支付,返回首页',
+								showCancel: false,
+								success: function(res) {
+									if (res.confirm) {
+										uni.switchTab({
+											url: '/pages/index/index'
+										})
+									}
+								}
+							});
+						}
+					} else {
+						this.$refs.uToast.show({
+							title: res.msg || '订单无数据',
+							type: 'error',
+						});
+						this.show = false;
+						if (this.timer1) {
+							clearInterval(this.timer1)
+						}
+					}
+				}).catch(() => {
+					this.show = false;
+					if (this.timer1) {
+						clearInterval(this.timer1)
+					}
+				})
+			},
+			// 返回首页
+			cancel() {
+				uni.switchTab({
+					url: '/pages/index/index'
+				})
+			},
+			closePaymentMethod() {
+				this.payWayPop = false
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import './geomagnetismLock.scss';
+</style>

+ 1 - 0
pages/index/index.vue

@@ -351,6 +351,7 @@
 			}
 			}
 		},
 		},
 		onLoad(page) {
 		onLoad(page) {
+			console.log(page)
 			const locationLocaturl = window.location.href
 			const locationLocaturl = window.location.href
 			// 微信聚合支付完成跳转过来重定向到详情页
 			// 微信聚合支付完成跳转过来重定向到详情页
 			const type = getUrlParams(locationLocaturl, 'type')
 			const type = getUrlParams(locationLocaturl, 'type')

+ 8 - 20
pages/parkingLock/parkingLock.vue

@@ -286,7 +286,6 @@
 		},
 		},
 		onShow() {
 		onShow() {
 			if (this.orderId) {
 			if (this.orderId) {
-				this.getOrderDetails(this.orderId)
 				if (this.polyOrderId && this.isBack == 1) {
 				if (this.polyOrderId && this.isBack == 1) {
 					this.timer1 = setInterval(() => {
 					this.timer1 = setInterval(() => {
 						this.show = true
 						this.show = true
@@ -436,11 +435,7 @@
 			},
 			},
 			// 查询订单信息
 			// 查询订单信息
 			getOrderDetails(id) {
 			getOrderDetails(id) {
-				this.$u.api.getOrderDetail({
-					id: id
-				}).then(res => {
-
-					console.log(res)
+				this.$u.api.getOrderDetail({ id }).then(res => {
 					if (res.code === 200 && res.data.id) {
 					if (res.code === 200 && res.data.id) {
 						this.parkingLockStatus = 1
 						this.parkingLockStatus = 1
 						// 获取页面完整url
 						// 获取页面完整url
@@ -457,7 +452,6 @@
 						}
 						}
 						this.orderInfo = res.data
 						this.orderInfo = res.data
 						if (res.data.payStatus === 1) {
 						if (res.data.payStatus === 1) {
-							// uni.hideLoading();
 							this.show = false
 							this.show = false
 							clearInterval(this.timer1)
 							clearInterval(this.timer1)
 							this.checkEqupment()
 							this.checkEqupment()
@@ -487,27 +481,21 @@
 			},
 			},
 			// 查询设备状态
 			// 查询设备状态
 			getEqumentStatus(orderNo) {
 			getEqumentStatus(orderNo) {
-				console.log(orderNo)
-				this.$u.api.getEquomentInfo({
-						orderNo: orderNo
-					})
-					.then(res => {
+				this.$u.api.getEquomentInfo({ orderNo }).then(res => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							console.log(res.data)
-							if (res.data.deviceStatus === 0) {
+							if (res.data.deviceStatus == 0) {
 								this.parkingLockStatus = 4
 								this.parkingLockStatus = 4
 								clearInterval(this.timer)
 								clearInterval(this.timer)
-							} else if (res.data.deviceStatus === 1 || res.data.deviceStatus === 5) {
+							} else if (res.data.deviceStatus == 1 || res.data.deviceStatus == 5) {
 								this.parkingLockStatus = 2
 								this.parkingLockStatus = 2
-							} else if (res.data.deviceStatus === 6) {
+							} else if (res.data.deviceStatus == 6) {
 								this.parkingLockStatus = 3
 								this.parkingLockStatus = 3
 							}
 							}
+						} else {
+							clearInterval(this.timer)
 						}
 						}
 					}).catch(() => {
 					}).catch(() => {
-						// this.$refs.uToast.show({
-						// 	title: '程序错误!订单编号:' + orderNo,
-						// 	type: 'error',
-						// });
+						clearInterval(this.timer)
 					})
 					})
 			},
 			},
 			// 返回首页
 			// 返回首页

+ 16 - 8
pages/paymentMethod/paymentMethod.vue

@@ -60,6 +60,16 @@
 				type: String,
 				type: String,
 				default: null
 				default: null
 			},
 			},
+			// 地磁支付需要字段
+			payeeId: {
+				type: String,
+				default: undefined
+			},
+			// 地磁支付需要字段
+			payeeName: {
+				type: String,
+				default: undefined
+			},
 			// 跳转页面
 			// 跳转页面
 			jumpUrl: {
 			jumpUrl: {
 				type: String,
 				type: String,
@@ -82,7 +92,9 @@
 				const params = {
 				const params = {
 					orderList: this.curOrderList,
 					orderList: this.curOrderList,
 					deviceNo: this.deviceNo,
 					deviceNo: this.deviceNo,
-					jumpUrl: this.jumpUrl
+					jumpUrl: this.jumpUrl,
+					payeeId: this.payeeId,
+					payeeName: this.payeeName
 				};
 				};
 				this.$u.api.payGzbank(params).then(res=>{
 				this.$u.api.payGzbank(params).then(res=>{
 					if (res.data.needPay) {
 					if (res.data.needPay) {
@@ -117,12 +129,6 @@
 				uni.showLoading({
 				uni.showLoading({
 				    title: '加载中'
 				    title: '加载中'
 				});
 				});
-				// const openId = this.$store.state.vuex_wxinfo.openId
-				// if (openId) {
-				// 	this.getWXPay(this.curOrderList, this.deviceNo)
-				// } else {
-				// 	this.getCode()
-				// }
 				this.getWXPayByJava(this.curOrderList, this.deviceNo)
 				this.getWXPayByJava(this.curOrderList, this.deviceNo)
 			},
 			},
 			/**
 			/**
@@ -171,7 +177,9 @@
 					orderList: orderList,
 					orderList: orderList,
 					openid: '',
 					openid: '',
 					jumpUrl: this.jumpUrl,
 					jumpUrl: this.jumpUrl,
-					deviceNo: deviceNo ? deviceNo : null
+					deviceNo: deviceNo ? deviceNo : null,
+					payeeId: this.payeeId,
+					payeeName: this.payeeName
 				};
 				};
 				this.$u.api.ordinaryWxPay(params)
 				this.$u.api.ordinaryWxPay(params)
 					.then(res => {
 					.then(res => {

+ 92 - 0
pages/wechatLogin/wechatLogin.vue

@@ -0,0 +1,92 @@
+<template>
+	<view>
+		<u-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	import getUrlParams from "./../../utils/getUrlParams.js";
+	export default {
+		data() {
+			return {
+				backUrl: '',
+				code: ''
+			}
+		},
+		onLoad(page) {
+			let local = window.location.href;
+			let locationLocaturl = window.location.search;
+			// 微信返回的回调地址
+			let backUrl = local.split('backUrl=')[1]
+			if (backUrl) {
+				this.backUrl = decodeURIComponent(backUrl)
+			}
+			let code = getUrlParams(local, "code")
+			if (code) {
+				this.code = code
+				this.handleGetWXInfo(this.code)
+			} else {
+				window.location.href =
+					`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
+			}
+		},
+		methods: {
+			// 通过code获取 openId等用户信息
+			handleGetWXInfo(code) {
+				uni.showLoading({
+					title: '加载中'
+				})
+				this.$u.api.getWXInfo(code).then((res) => {
+					if (res.code === 200) {
+						this.$u.vuex('vuex_wxinfo', res.data);
+						this.getToken(res.data.openId)
+					} else {
+						this.$refs.uToast.show({
+							title: '获取用户信息失败!',
+							type: 'error'
+						});
+						uni.hideLoading()
+					}
+				}).catch((err) => {
+					this.$refs.uToast.show({
+						title: '获取用户信息失败!',
+						type: 'error'
+					});
+					uni.hideLoading()
+				})
+			},
+			/**
+			 * 通过openId获取token
+			 * @param {Object} openId
+			 */
+			getToken(openId) {
+				this.$u.api.codeV2Api.sendSmsCodeV2api({ openId }).then(res => {
+					if (res.code === 200) {
+						if (res.data.needVerify) {
+							localStorage.setItem('backUrl', this.backUrl)
+							uni.navigateTo({
+							  url: '/pages/center/phoneLogin/phoneLogin'
+							})
+						} else {
+							this.$u.vuex('vuex_user', res.data);
+							this.$u.vuex('vuex_token', res.data.accessToken);
+							this.$u.vuex('vuex_hasLogin', true);
+							location.href = this.backUrl
+						}
+						uni.hideLoading()
+					} else {
+						this.$refs.uToast.show({
+							title: res.msg || '获取用户信息失败!',
+							type: 'error'
+						});
+						uni.hideLoading()
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+
+</style>