Browse Source

增加jsonp请求和停车锁

zaijin 3 years ago
parent
commit
681eadbf16

+ 5 - 1
common/apiurl.js

@@ -62,7 +62,11 @@ const apiurl = {
 	payGzbankUrl: '/pay/gzbank/quick',
 	
 	// 贵州银行支付
-	gzbankurl:'http://wx.hw.hongweisoft.com/pay/client/gzbank/paygate'
+	gzbankurl:'http://wx.hw.hongweisoft.com/pay/client/gzbank/paygate',
+	// 订单查询
+	getOrderInfoApi:'/pay/query/',
+	// 查询设备状态
+	getEqupmentStatusApi: '/hardware/deviceInfo/'
 }
 
 export {

+ 4 - 4
common/config.js

@@ -1,8 +1,8 @@
 const config = {
 	wxAppid:'wxbe90cc7c5233dd84',// 测试wxAppid 
 	// wxAppid: 'wx45c3cf2b632f5fd5', // 正式公众号
-	baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//64
-	// baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//殷登顺
+	// baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//64
+	baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//殷登顺
 	// 正式接口访问地址
 	// baseUrl:'http://parking.pdzhtc.com/client',
 	
@@ -15,11 +15,11 @@ const config = {
 	// 登录重定向首页地址
 	// jumpHomeUrl: 'http://h5.pdzhtc.com/#/', // 正式服务器地址
 	// jumpHomeUrl: 'http://wx.hw.hongweisoft.com/wxpaydemoh5/#/', // 64服务器地址
-	jumpHomeUrl: 'http://172.16.90.127:8080/#/', // 本地测试地址
+	jumpHomeUrl: 'http://localhost:8080/#/', // 本地测试地址
 	// 重定位登录页
 	// jumpLoginUrl: 'http://h5.pdzhtc.com/#/pages/center/phoneLogin/phoneLogin', // 正式环境地址
 	// jumpLoginUrl: 'http://wx.hw.hongweisoft.com/wxpaydemoh5/#/pages/center/phoneLogin/phoneLogin', // 64环境地址
-	jumpLoginUrl: 'http://172.16.90.127:8080/#/pages/center/phoneLogin/phoneLogin', // 本地环境地址
+	jumpLoginUrl: 'http://localhost:8080/#/pages/center/phoneLogin/phoneLogin', // 本地环境地址
 	
 }
 export {

+ 7 - 2
common/http.api.js

@@ -52,7 +52,10 @@ const install = (Vue, vm) => {
 	
 	//贵州银行支付
 	let gzbank = (params = {}) => vm.$u.post(apiurl.gzbankurl, params);
-	
+	// 订单查询
+	let getOrderInfo = (params = {}) => vm.$u.get(apiurl.getOrderInfoApi + params.orderId);
+	// 设备状态查询
+	let getEquomentInfo = (params = {}) => vm.$u.get(apiurl.getEqupmentStatusApi + params.orderNo);
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		feedbackAdd,
@@ -84,7 +87,9 @@ const install = (Vue, vm) => {
 		getMonthList,
 		cancelMonth,
 		messageRead,
-		feePay
+		feePay,
+		getOrderInfo,
+		getEquomentInfo
 	};
 }
 

+ 8 - 7
common/http.interceptor.js

@@ -1,4 +1,5 @@
 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) => {
@@ -50,13 +51,13 @@ const install = (Vue, vm) => {
 		} else if(res.msg == "令牌不能为空"||res.code == 401){
 			console.log('location',location)
 			console.log('location',location.href);
-			let storage = window.sessionStorage; 
-			storage.setItem('backUrl',location.href);
-			alert('还未登录,即将跳转登录');		
-			setTimeout(()=>{location.href = config.jumpLoginUrl});//本地
-			// setTimeout(()=>{location.href = 'http://h5.pdzhtc.com/#/pages/center/phoneLogin/phoneLogin';});//正式
-			// setTimeout(()=>{location.href = 'http://wx.hw.hongweisoft.com/wxpaydemoh5/#/pages/center/phoneLogin/phoneLogin';});//64
-			setTimeout(()=>{location.href = 'http://172.16.90.127:8080/#/pages/center/phoneLogin/phoneLogin';});//本地
+			// storage.setItem('backUrl', location.href);
+			localStorage.setItem('backUrl', location.href)
+			alert('还未登录,即将跳转登录');
+			uni.navigateTo({
+				url: "/pages/center/phoneLogin/phoneLogin"
+			})
+			// setTimeout(()=>{location.href = config.jumpLoginUrl});
 			
 		}else return res;
 	}

+ 4 - 0
main.js

@@ -27,6 +27,10 @@ Vue.prototype.$wxApi = $wxApi;
 import $pay from "./pay.js";
 Vue.prototype.$pay = $pay
 
+// jsonp
+import { VueJsonp } from 'vue-jsonp'
+Vue.use(VueJsonp);
+
 const app = new Vue({
 	store,
     ...App

+ 3 - 1
manifest.json

@@ -35,7 +35,9 @@
                     "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+					"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
+					"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>"
                 ]
             },
             /* ios打包配置 */

+ 11 - 0
package-lock.json

@@ -0,0 +1,11 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "vue-jsonp": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
+      "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
+    }
+  }
+}

+ 10 - 0
pages.json

@@ -192,6 +192,16 @@
             }
             
         }
+        ,{
+            "path" : "pages/parkingLists/map_web_view/map_web_view",
+            "style" :                                                                                    
+            {
+                "navigationStyle": "custom",
+				"navigationBarTitleText": "导航",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 11 - 9
pages/center/index.vue

@@ -103,6 +103,7 @@
 
 <script>
 	import getUrlParams from "../../utils/getUrlParams.js";
+	import {config} from "./../../common/config"
 	export default {
 		data() {
 			return {
@@ -160,17 +161,18 @@
 				});
 			},
 			loginOut() {
-				this.$store.state.vuex_hasLogin = false
-				this.$store.state.vuex_token = ''
-				this.$store.state.vuex_user = null
-				this.userInfo = []
-				this.code = ''
-				localStorage.clear()
 				setTimeout(() => {
+					this.$store.state.vuex_hasLogin = false
+					this.$store.state.vuex_token = ''
+					this.$store.state.vuex_user = null
+					this.userInfo = []
+					this.code = ''
+					localStorage.clear()
 					this.logoutPop = false
-					this.$u.route({
-						url: 'pages/center/phoneLogin/phoneLogin'
-					});
+					// location.href = config.jumpLoginUrl
+					uni.navigateTo({
+						url: '/pages/center/phoneLogin/phoneLogin'
+					})
 				}, 500)
 			},
 			clickHead() {

+ 3 - 4
pages/center/phoneLogin/phoneLogin.vue

@@ -177,10 +177,9 @@ export default {
 		},
 		// 微信已登录则跳转到首页
 		jumpIndex() {
-			let storage = window.sessionStorage;
-			let backUrl = storage.getItem('backUrl');
-			if (backUrl) {
-				location.href = backUrl;
+			let ret = localStorage.getItem('backUrl')
+			if (ret) {
+				location.href = ret;
 			} else {
 				location.href = config.jumpHomeUrl
 			}

+ 44 - 15
pages/index/index.vue

@@ -76,6 +76,14 @@
 								<span class="pending-order-body-left-label">入场时间:</span>
 								<span>{{item.inTime}}</span>
 							</view>
+							<view class="item-cell">
+								<span class="pending-order-body-left-label">出场时间:</span>
+								<span>{{item.outTime}}</span>
+							</view>
+							<view class="item-cell">
+								<span class="pending-order-body-left-label">预计金额:</span>
+								<span>{{item.payAmount}}</span>
+							</view>
 							<!-- <view class="item-cell">
 								<span class="pending-order-body-left-label">出场时间:</span>
 								<span>{{item.outTime||'停放中'}}</span>
@@ -236,30 +244,51 @@
 				// 支付方式
 				payWayPop: false,
 				// 订单号
-				curOrderList: []
+				curOrderList: [],
+				latLongItude:{}
 			}
 		},
 		onShow() {
 			this.handleGetIndexData();
-			// this.getLocation();
+			this.getLocation();
 			let locationLocaturl = window.location.search;
 			this.code = getUrlParams(locationLocaturl,"code");
 			if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
 		},
 		methods: {
-			// getLocation(){
-			// 	console.log("请求定位")
-			// 	uni.getLocation({
-			// 		type:"gcj02",
-			// 		success : function (res) {
-			// 			console.log("定位返回信息:", res)
-			// 			alert(res.longitude + "," + res.latitude )
-			// 		},
-			// 		fail: function(res){
-			// 			console.log("请求错误:", res)
-			// 		}
-			// 	})
-			// },
+			getLocation(){
+				const that = this
+				uni.getLocation({
+					type: 'wgs84',
+					geocode: true,
+					success: (res) => {
+						that.latLongItude = {latitude: res.latitude,longitude:res.longitude};
+						that.latitude = res.latitude;
+						that.longitude = res.longitude;
+						that.loAcquire(that.latLongItude)
+					},
+					fail: () => {
+						console.log("获取经纬度失败");
+					}
+				})
+			},
+			loAcquire({longitude,latitude} = {}){
+				let that = this;
+				uni.showLoading({
+				    title: '加载中',
+					mask:true
+				});
+				let str =  `output=jsonp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL&location=${latitude},${longitude}`
+				this.$jsonp('https://apis.map.qq.com/ws/geocoder/v1/?'+ str, {}).then(res=>{
+				  uni.hideLoading();
+				  if(res.status == 0){
+					  console.log(res.result.ad_info)
+					  if (res.result.ad_info) {
+						  that.city = res.result.ad_info.district
+					  }
+				  }
+				})
+			},
 			orderNavclick(){
 				this.feePay()
 			},

+ 24 - 0
pages/parkingLists/map_web_view/map_web_view.vue

@@ -0,0 +1,24 @@
+<template>
+	<!-- webview用来装地图容器 -->
+	 <web-view :src="url"></web-view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				url: ''
+			}
+		},
+		onLoad(e) {
+		  this.url = e.url;
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 8 - 4
pages/parkingLists/parkingLists.vue

@@ -184,10 +184,14 @@
 			  * 导航 
 			  * */
 			navigation (lat, lon) {
-				uni.openLocation({
-					latitude: parseFloat(lat),
-					longitude: parseFloat(lon),
-					scale: 18
+				// uni.openLocation({
+				// 	latitude: parseFloat(lat),
+				// 	longitude: parseFloat(lon),
+				// 	scale: 18
+				// })
+				// 腾讯地图用webview
+				uni.navigateTo({
+				  url: '/pages/parkingLists/map_web_view/map_web_view?url=https://3gimg.qq.com/lightmap/v1/marker/?marker=coord:'+lat+','+lon+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
 				})
 			},
 			clearSearchInput () {

+ 170 - 0
pages/parkingLock/parkingLock.scss

@@ -1,6 +1,7 @@
 .parking-lock {
 	height: calc(100vh - 88rpx);
 	background-color: #F6F6FF;
+	padding-top: 133rpx;
 	.parking-lock-title {
 		font-size: 46rpx;
 		color: #292929;
@@ -24,5 +25,174 @@
 		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;
+				}
+				&:last-child {
+					color: #6E6E6E;
+				}
+			}
+			.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);
+  }
 }

+ 257 - 33
pages/parkingLock/parkingLock.vue

@@ -1,57 +1,281 @@
 <template>
 	<!-- 车位锁 -->
 	<view class="parking-lock">
-		<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>名称1</view>
+		<!-- 车位锁支付 -->
+		<view class="parking-lock-pay" v-if="parkingLockStatus === 1">
+			<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>{{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.duration}}</view>
+				</view>
+				<view class="parking-lock-info-item">
+					<view>合计金额</view>
+					<view>{{orderInfo.totalAmount}} 元</view>
+				</view>
+				<view class="parking-lock-info-item">
+					<view>优惠金额</view>
+					<view>{{orderInfo.preferentialAmount}} 元</view>
+				</view>
+				<view class="parking-lock-info-item">
+					<view>应缴金额</view>
+					<view class="really-money">{{orderInfo.payAmount}} 元</view>
+				</view>
 			</view>
-			<view class="parking-lock-info-item">
-				<view>停车泊位</view>
-				<view>泊位1</view>
+			<view class="parking-lock-pay-btn">
+				<button type="default" @click="payMoney">立即支付</button>
 			</view>
-			<view class="parking-lock-info-item">
-				<view>入场时间</view>
-				<view>2021-01-01 00:00:00</view>
-			</view>
-			<view class="parking-lock-info-item">
-				<view>出场时间</view>
-				<view>2021-01-01 00:00:00</view>
-			</view>
-			<view class="parking-lock-info-item">
-				<view>停车时长</view>
-				<view>2021-01-01 00:00:00</view>
+		</view>
+		<!-- 车位锁开始状态 -->
+		<view class="parking-lock-begin" v-else-if="parkingLockStatus === 2">
+			<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-info-item">
-				<view>合计金额</view>
-				<view>2021-01-01 00:00:00</view>
+			<view class="parking-lock-begin-info">车位锁正在动作,还未到位</view>
+		</view>
+		<!-- 车位锁正在状态 -->
+		<view class="parking-lock-loading" v-else-if="parkingLockStatus === 3">
+			<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-info-item">
-				<view>优惠金额</view>
-				<view>2021-01-01 00:00:00</view>
+			<view class="parking-lock-loading-info">开锁中,请等待!</view>
+		</view>
+		<!-- 开锁完成 -->
+		<view class="parking-lock-success" v-else-if="parkingLockStatus === 4">
+			<view class="parking-lock-success-box">
+				<image src="../../static/img/parking-lock-achieve.png" mode=""></image>
 			</view>
-			<view class="parking-lock-info-item">
-				<view>应缴金额</view>
-				<view>2021-01-01 00:00:00</view>
+			<view class="parking-lock-success-info">开锁已完成</view>
+			<view class="parking-lock-success-button">
+				<button @click="cancel">返回</button>
 			</view>
 		</view>
-		<view class="parking-lock-pay-btn">
-			<button type="default">立即支付</button>
+		<view class="parking-lock-pay" v-else-if="parkingLockStatus === 5">
+			<view class="parking-lock-tips">{{tipsMsg}}</view>
 		</view>
+		<!-- 缴费方式-->
+		<u-modal
+		v-model="payWayPop"
+		:title-style="{color: '#404040'}"
+		title="缴费方式"
+		:show-confirm-button="false"
+		:show-cancel-button="false">
+			<view class="slot-content">
+				<view class="pay-way">
+					<view class="pay-way-item" @click="gyBankPay">
+						<image src="../../static/img/gy-bank-pay-icon.png" mode=""></image>
+						<view>贵州银行</view>
+					</view>
+					<view class="pay-way-item" @click="wechatPay">
+						<image src="../../static/img/wechat-pay-icon.png" mode=""></image>
+						<view>微信支付</view>
+					</view>
+				</view>
+				<button class="pay-way-close-btn" @click="payWayPop = false">关闭</button>
+			</view>
+		</u-modal>
+		<u-toast ref="uToast" />
 	</view>
 </template>
 
 <script>
+	import { config } from './../../common/config'
+	import getUrlParams from "../../utils/getUrlParams.js";
 	export default {
 		data() {
 			return {
-				
+				// 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
+				parkingLockStatus: 1,
+				// 支付方式选择弹框
+				payWayPop: false,
+				// 订单编号
+				orderList: [],
+				// 提示信息
+				tipsMsg: null,
+				// 设备编号
+				deviceNo: null,
+				// 轮询
+				timer: null,
+				// 订单信息
+				orderInfo: {},
+				// 订单id
+				orderId: null
+			}
+		},
+		onLoad(page) {
+			console.log(page)
+			if (page.orderId) {
+				this.getOrderDetails(page.orderId)
+				this.orderList = []
+				this.orderId = page.orderId
+				this.orderList.push(page.orderId)
+				this.deviceNo = page.deviceNo
+			} else {
+				this.tipsMsg = page.msg
+				this.parkingLockStatus = 5
 			}
 		},
 		methods: {
-			
+			payMoney() {
+				this.payWayPop = true
+			},
+			// 查询订单状态
+			// getOrderStatus(orderId) {
+			// 	this.$u.api.getOrderInfo({orderId: orderId})
+			// 		.then(res => {
+			// 			if (res.code === 200) {
+			// 				if (res.data.payStatus === 0 || res.data.payStatus === 3) {
+			// 					this.getOrderDetails(orderId)
+			// 				} else {
+			// 					this.parkingLockStatus = 2
+			// 					setTimeout(() => {
+			// 						this.parkingLockStatus = 3
+			// 					}, 300)
+			// 					this.checkEqupment()
+			// 				}
+			// 			}
+			// 		})
+			// },
+			// 查询订单信息
+			getOrderDetails(id) {
+				this.$u.api.getOrderDetail({id: id})
+					.then(res => {
+						console.log(res)
+						if (res.code === 200) {
+							this.orderInfo = res.data
+							if (res.data.payStatus === 1) {
+								this.checkEqupment()
+							}
+						}
+					})
+			},
+			// 检测设备
+			checkEqupment() {
+				this.timer = setInterval(() => {
+					this.getEqumentStatus(this.deviceNo)
+				}, 1000)
+			},
+			// 查询设备状态
+			getEqumentStatus(orderNo) {
+				console.log(orderNo)
+				this.$u.api.getEquomentInfo({orderNo: orderNo})
+					.then(res => {
+						if (res.code === 200) {
+							console.log(res.data)
+							if (res.data.deviceStatus === 0) {
+								this.parkingLockStatus = 4
+								clearInterval(this.timer)
+							} else if (res.data.deviceStatus === 1 || res.data.deviceStatus === 5) {
+								this.parkingLockStatus = 2
+							} else if (res.data.deviceStatus === 6) {
+								this.parkingLockStatus = 3
+							}
+						}
+					})
+			},
+			// 返回首页
+			cancel() {
+				window.location.href = config.jumpHomeUrl
+			},
+			// 贵阳银行支付
+			gyBankPay() {
+				this.$u.api.payGzbank({orderList: this.orderList, deviceNo: this.deviceNo}).then(res=>{
+					let payUrl = res.data.url;
+					this.currentPayUrl=encodeURIComponent(res.data.url);
+					this.$u.route({
+						url: 'pages/payLists/pay',
+						params: {
+							currentPayUrl: this.currentPayUrl
+						}
+					});
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+				});
+			},
+			// 微信支付
+			wechatPay() {
+				const openId = this.$store.state.vuex_wxinfo.openId
+				if (openId) {
+					this.getWXPay(this.orderList)
+				} else {
+					this.getCode()
+				}
+			},
+			async getWXPay(list){
+				let params = {
+					orderList: list,
+					deviceNo: this.deviceNo,
+					openid: this.$store.state.vuex_wxinfo.openId
+				};
+				await this.$wxApi.config();
+				this.$pay.wechatPay(params).then(res =>{
+					if(res.code == 0){
+						// 成功
+						this.$u.route({
+							url:'/',
+						});
+					}else if(res.code == 1){
+						// 取消
+						// uni.redirectTo({
+						// 	url: '/pages/userCenter/myOrder/myOrder'
+						// })
+					}else if(res.code == 2){
+						this.$refs.uToast.show({
+							title: '支付失败,请检查!',
+							type: 'error',
+							// url: '/pages/user/index'
+						});
+					}
+				});
+			},
+			getCode () {
+				var local = window.location.href // 获取页面url
+				let locationLocaturl = window.location.search;
+				this.code = getUrlParams(locationLocaturl, "code"); // 截取code
+				if (this.code == null || this.code === '') { // 如果没有code,则去请求
+					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`
+				} else {
+					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+				}
+			},
+			handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
+				this.$u.api.getWXInfo(code).then((res) => {
+					if (res.code === 200 ) {
+						this.$u.vuex('vuex_wxinfo', res.data);
+						// 继续支付
+						this.getWXPay(this.orderList)
+					}
+				}).catch((err) => {
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+				})
+			}
 		}
 	}
 </script>

+ 5 - 0
pages/payLists/payLists.vue

@@ -304,6 +304,11 @@
 						this.$u.vuex('vuex_wxinfo', res.data);
 						// 继续支付
 						this.getWXPay(this.currentItem)
+					} else {
+						this.$refs.uToast.show({
+							title: res.msg,
+							type: 'error',
+						});
 					}
 				}).catch((err) => {
 					this.$refs.uToast.show({

+ 16 - 3
pay.js

@@ -37,9 +37,22 @@ export default {
 		return new Promise(r => {
 			$http.post("/pay/wechat",obj)
 				.then(res=>{
-					//#ifdef H5
-					$wxApi.JSAPI(res.data.wx).then(r);
-					//#endif
+					if (res.needPay) {
+						//#ifdef H5
+						$wxApi.JSAPI(res.data.wx).then(r);
+						//#endif
+					} else {
+						uni.showToast({
+							title: "无需支付",
+							icon: "none",
+							duration: 2000
+						});
+						setTimeout(() =>{
+							//#ifdef H5
+							window.location.reload();
+							//#endif
+						}, 1500)
+					}
 					this.payError(res);
 				}).catch(err =>{
 					// alert(err.msg);

BIN
static/img/parking-lock-achieve.png


BIN
static/img/parking-lock-bg.png


+ 1 - 0
store/index.js

@@ -37,6 +37,7 @@ const store = new Vuex.Store({
 		vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
 		// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
 		vuex_version: '1.0.1',
+		back_url: ''
 	},
 	mutations: {
 		$uStore(state, payload) {

+ 1 - 1
utils/filter.js

@@ -71,7 +71,7 @@ Vue.filter("filterOrderStatus",function(status){
 			return '停放中'
 			break;
 		case 2:
-			return '出场中'
+			return '已出场,未缴费'
 			break;
 		case 3:
 			return '欠费'