空白格 3 жил өмнө
parent
commit
ae18f2fd30

+ 7 - 1
common/apiurl.js

@@ -100,7 +100,13 @@ const apiurl = {
 	//场内车牌查询订单信息
 	getAdvanceInfo: '/client/parking-orderinfo/advance/info-by-vehicle',
 	//出场页面信息
-	getExportInfo: '/client/parking-orderinfo/export/info'
+	getExportInfo: '/client/parking-orderinfo/export/info',
+	// 出场支付状态查询
+	getOrderStateExportUrl: '/client/payment/parking/query',
+	// 出场快捷支付
+	quickPayExportUrl: '/client/payment/parking/gzbank/quick',
+	// 出场聚合支付
+	polyPayExportUrl: '/client/payment/parking/gzbank/poly'
 }
 
 export {

+ 7 - 1
common/http.api.js

@@ -92,6 +92,9 @@ const install = (Vue, vm) => {
 	let entranceByNoVehicleApi = (params = {}) => vm.$u.post(apiurl.entranceByNoVehicle, params);
 	let getAdvanceInfoApi = (params = {}) => vm.$u.post(apiurl.getAdvanceInfo, params);
 	let getExportInfoApi = (params = {}) => vm.$u.post(apiurl.getExportInfo, params);
+	let getOrderStateExportApi = (params = {}) => vm.$u.post(apiurl.getOrderStateExportUrl, params)
+	let quickPayExportApi = (params = {}) => vm.$u.post(apiurl.quickPayExportUrl, params)
+	let polyPayExportApi = (params = {}) => vm.$u.post(apiurl.polyPayExportUrl, params)
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		feedbackAdd,
@@ -139,7 +142,10 @@ const install = (Vue, vm) => {
 		getDetailExportApi,
 		entranceByNoVehicleApi,
 		getAdvanceInfoApi,
-		getExportInfoApi
+		getExportInfoApi,
+		getOrderStateExportApi,
+		quickPayExportApi,
+		polyPayExportApi
 	};
 }
 

+ 1 - 6
common/http.interceptor.js

@@ -3,12 +3,7 @@ import store  from '../store/index.js'
 // vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
 const install = (Vue, vm) => {
 	Vue.prototype.$u.http.setConfig({
-		baseUrl: config.baseUrl,
-		showLoading: true, // 是否显示请求中的loading
-		loadingText: '请求中...', // 请求loading中的文字提示
-		loadingTime: 500, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
-		originalData: false, // 是否在拦截器中返回服务端的原始数据
-		loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
+		baseUrl: config.baseUrl
 	});
 	// 请求拦截,配置Token等参数
 	Vue.prototype.$u.http.interceptor.request = (config) => {

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "智慧停车",
-    "appid" : "__UNI__4F85294",
+    "appid" : "__UNI__BF6D66C",
     "description" : "",
     "versionName" : "1.5.0",
     "versionCode" : "100",

+ 139 - 33
pages/parkexport/parkexport.vue

@@ -2,101 +2,207 @@
 	<!-- 地磁 -->
 	<view class="parking-lock">
 		<!-- 地磁支付 -->
-		<template >
-			<view class="parking-lock-pay" v-if="infoData">
-				<!-- <view class="parking-lock-title">支付停车费</view> -->
-				<!-- <view class="parking-lock-tips">请您确认停车费用,确认后请支付费用,结束停车。谢谢您的使用!</view> -->
+		<template v-if="infoData">
+			<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">{{ infoData.outParkingName}}</view>
+						<view>车牌号</view>
+						<view class="weight">{{ infoData.vehicleNo}}</view>
 					</view>
 					<view class="parking-lock-info-item">
-						<view>出口名称</view>
-						<view>{{infoData.outEntranceName }}</view>
+						<view>停车场名称</view>
+						<view class="weight">{{ infoData.outParkingName}}</view>
 					</view>
 					<view class="parking-lock-info-item">
-						<view>通道名称</view>
-						<view>{{infoData.outRoadwayName}}</view>
+						<view>入场车道</view>
+						<view class="weight">{{infoData.inTime}}</view>
 					</view>
 					<view class="parking-lock-info-item">
 						<view>入场时间</view>
-						<view>{{infoData.inTime}}</view>
+						<view class="weight">{{infoData.inTime}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>出场车道</view>
+						<view class="weight">{{infoData.outEntranceName }}</view>
 					</view>
 					<view class="parking-lock-info-item">
 						<view>出场时间</view>
-						<view>{{infoData.outTime}}</view>
+						<view class="weight">{{infoData.outTime}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>通道名称</view>
+						<view class="weight">{{infoData.outRoadwayName}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>免费时长</view>
+						<view class="weight">{{infoData.freeDuration}}</view>
 					</view>
 					<view class="parking-lock-info-item">
-						<view>停车时长</view>
-						<view>{{infoData.duration}}</view>
+						<view class="weight">计费时长</view>
+						<view class="weight">{{infoData.calcDuration}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>累计停车时长</view>
+						<view class="weight">{{infoData.duration}}</view>
 					</view>
 					<view class="parking-lock-info-item">
 						<view>应收金额</view>
-						<view>{{infoData.totalAmount}}元</view>
+						<view class="weight">{{infoData.totalAmount}}元</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>订单编号</view>
+						<view class="weight">{{infoData.id}}</view>
 					</view>
 				</view>
 				<view class="parking-lock-pay-btn">
-					<button type="default" @click="onEntraceClick">支付出场</button>
+					<button type="default" v-if="isPay" @click="onEntraceClick">支付出场</button>
+					<button type="default" v-else @click="jumpHome('/pages/index/index')">支付成功,返回首页</button>
 				</view>
 			</view>
-			<view v-else>
-				<view class="parking-lock-info">
-					<view class="parking-lock-info-item">
-						<view>入口无车辆</view>
-					</view>
+		</template>
+		<template v-else>
+			<view class="parking-lock-info">
+				<view class="parking-lock-info-item">
+					<view>入口无车辆</view>
 				</view>
 			</view>
 		</template>
+		<!-- 支付方式 -->
+		<PaymentMethod
+			:payWayPop="payWayPop"
+			:curOrderList="orderList"
+			:jumpUrl="jumpUrl"
+			:exportFlag="true"
+			@closePaymentMethod="closePaymentMethod"
+		></PaymentMethod>
+		<u-toast ref="uToast" />
 	</view>
 </template>
 
 <script>
+	import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
 	export default {
 		components: {
+			PaymentMethod
 		},
 		data() {
 			return {
-				intoInfo:{
+				intoInfo: {
 					parkNo: '',
-					roadwayNo:''
+					roadwayNo: '',
+					polyOrderId: '',
+					isBack: 0
 				},
-				infoData:undefined
+				payWayPop: false, // 支付弹框
+				infoData: undefined, // 订单信息
+				orderList: [], // 支付订单列表
+				jumpUrl: location.href + '&isBack=1', // 回调地址
+				timer: null, // 轮询
+				isPay: false, // 支付按钮显示
 			}
 		},
 		onLoad(page) {
 			this.intoInfo.parkNo = page?.parkNo;
 			this.intoInfo.roadwayNo = page?.roadwayNo;
+			this.intoInfo.polyOrderId = page?.polyOrderId
+			this.intoInfo.isBack = page?.isBack
 		},
 		onShow() {
 			this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
+			if (this.intoInfo.polyOrderId && this.intoInfo.isBack == 1) {
+				uni.showLoading({
+					title: '订单状态查询中...'
+				})
+				this.timer = setInterval(() => {
+					this.handlePayStatus(this.intoInfo.polyOrderId)
+				}, 1000)
+			}
 		},
 		onUnload() {
-			
+			clearInterval(this.timer)
 		},
 		methods: {
-			onEntraceClick(){
-				
+			/**
+			 * 立即支付
+			 */
+			onEntraceClick() {
+				this.payWayPop = true
+			},
+			/**
+			 * 反复查询支付状态
+			 * @param { String } orderId
+			 */
+			handlePayStatus(orderId) {
+				this.$u.api.getOrderStateExportApi({
+					orderId
+				}).then(res => {
+					if (res.code === 200) {
+						if (res.data.payStatus === 1 || res.data.payStatus === 3) {
+							clearInterval(this.timer);
+							uni.hideLoading()
+							this.getOrderDetails(this.intoInfo.parkNo, this.intoInfo.roadwayNo);
+						} else if (res.data.payStatus === 2) {
+							this.isPay = true
+							uni.hideLoading()
+						}
+					} else {
+						clearInterval(this.timer);
+						uni.hideLoading()
+						this.$refs.uToast.show({
+							title: res.msg || '支付失败!',
+							type: 'error',
+						});
+					}
+				}).catch(() => {
+					uni.hideLoading()
+					clearInterval(this.timer);
+				})
 			},
 			/**
 			 * 查询订单信息
-			 * @param { String } tqgThree 车位ID
-			 * @param { String } orderId 订单id
-			 * @param { String } payeeId 收费员ID
+			 * @param { String } parkNo 停车场编号
+			 * @param { String } roadwayNo 出口编号
 			 */
 			getOrderDetails(parkNo, roadwayNo) {
-				this.$u.api.getDetailExportApi({parkNo,roadwayNo}).then(res => {
-					if (res.code === 200 ) {
+				uni.showLoading({
+					title: '订单查询中...'
+				})
+				this.$u.api.getDetailExportApi({
+					parkNo,
+					roadwayNo
+				}).then(res => {
+					if (res.code === 200) {
 						this.infoData = res.data
+						this.orderList = [res.data.id]
+						if (res.data.orderStatus == 2 || res.data.orderStatus == 3) {
+							this.isPay = true
+						} else {
+							this.isPay = false
+						}
 					} else {
 						this.$refs.uToast.show({
 							title: res.msg || '订单无数据',
 							type: 'error',
 						});
 					}
+					uni.hideLoading()
+				}).catch(err => {
+					uni.hideLoading()
+				})
+			},
+			/**
+			 * 关闭支付弹框
+			 */
+			closePaymentMethod() {
+				this.payWayPop = false
+			},
+			jumpHome(url) {
+				uni.switchTab({
+					url: url
 				})
 			}
-	
 		}
 	}
 </script>

+ 78 - 38
pages/paymentMethod/paymentMethod.vue

@@ -74,6 +74,11 @@
 			jumpUrl: {
 				type: String,
 				default: null
+			},
+			// 出口扫码   接口不一样
+			exportFlag: {
+				type: Boolean,
+				default: false
 			}
 		},
 		data() {
@@ -96,26 +101,49 @@
 					payeeId: this.payeeId,
 					payeeName: this.payeeName
 				};
-				this.$u.api.payGzbank(params).then(res=>{
-					if (res.data.needPay) {
-						let payUrl = res.data.url;
-						location.href = payUrl;
-					} else {
+				if (this.exportFlag) {
+					this.$u.api.quickPayExportApi(params).then(res=>{
+						if (res.data.needPay) {
+							let payUrl = res.data.url;
+							location.href = payUrl;
+						} else {
+							this.$refs.uToast.show({
+								title: '无需支付',
+								type: 'info',
+							});
+							setTimeout(() => {
+								uni.hideLoading();
+								location.reload()
+							}, 1000)
+						}
+					}).catch(err=>{
 						this.$refs.uToast.show({
-							title: '无需支付',
-							type: 'info',
+							title: err.msg,
+							type: 'error',
 						});
-						setTimeout(() => {
-							uni.hideLoading();
-							location.reload()
-						}, 1000)
-					}
-				}).catch(err=>{
-					this.$refs.uToast.show({
-						title: err.msg,
-						type: 'error',
 					});
-				});
+				} else {
+					this.$u.api.payGzbank(params).then(res=>{
+						if (res.data.needPay) {
+							let payUrl = res.data.url;
+							location.href = payUrl;
+						} else {
+							this.$refs.uToast.show({
+								title: '无需支付',
+								type: 'info',
+							});
+							setTimeout(() => {
+								uni.hideLoading();
+								location.reload()
+							}, 1000)
+						}
+					}).catch(err=>{
+						this.$refs.uToast.show({
+							title: err.msg,
+							type: 'error',
+						});
+					});
+				}
 			},
 			/**
 			 * 微信支付
@@ -181,27 +209,39 @@
 					payeeId: this.payeeId,
 					payeeName: this.payeeName
 				};
-				this.$u.api.ordinaryWxPay(params)
-					.then(res => {
-						if (res.code === 200) {
-							// if (getEnvIsWx()) {
-							// 	location.href = res.data.qrCodeUrl + '&jump_url=' + encodeURIComponent(this.jumpUrl)
-							// } else {
-							// 	location.href = res.data.qrCodeUrl
-							// }
-							localStorage.setItem('jumpUrl', this.jumpUrl)
-							location.href = res.data.qrCodeUrl
-							// this.cookie.set("jumpUrl",this.jumpUrl);
-						} else {
-							uni.hideLoading();
-						}
-					})
-					.catch(err => {
-						this.$refs.uToast.show({
-							title: '无法调起微信支付!',
-							type: 'error',
-						});
-					})
+				if (this.exportFlag) {
+					this.$u.api.polyPayExportApi(params)
+						.then(res => {
+							if (res.code === 200) {
+								localStorage.setItem('jumpUrl', this.jumpUrl)
+								location.href = res.data.qrCodeUrl
+							} else {
+								uni.hideLoading();
+							}
+						})
+						.catch(err => {
+							this.$refs.uToast.show({
+								title: '无法调起微信支付!',
+								type: 'error',
+							});
+						})
+				} else {
+					this.$u.api.ordinaryWxPay(params)
+						.then(res => {
+							if (res.code === 200) {
+								localStorage.setItem('jumpUrl', this.jumpUrl)
+								location.href = res.data.qrCodeUrl
+							} else {
+								uni.hideLoading();
+							}
+						})
+						.catch(err => {
+							this.$refs.uToast.show({
+								title: '无法调起微信支付!',
+								type: 'error',
+							});
+						})
+				}
 			},
 			/**
 			 * 获取code

+ 23 - 26
utils/filter.js

@@ -1,37 +1,37 @@
 import Vue from 'vue'
 
 //保留两位小数
-Vue.filter('keepTwoNum',function(val){
+Vue.filter('keepTwoNum', function(val) {
 	let value = Number(val)
 	return value.toFixed(2)
 });
 
 //格式化数字三位加一逗号
 Vue.filter('NumFormat', function(value) {
-	if(!value) return '';
+	if (!value) return '';
 	/*原来用的是Number(value).toFixed(0),这样取整时有问题,例如0.51取整之后为1 */
 	/*后来改成了 Number(value)|0,但是输入超过十一位就为负数了 */
-	var intPart = Number(value) - Number(value)%1; //获取整数部分
+	var intPart = Number(value) - Number(value) % 1; //获取整数部分
 	var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
 	return intPartFormat;
 
 });
 
 //链接加时间戳
-Vue.filter("timestamp", function(link) {	
+Vue.filter("timestamp", function(link) {
 	return link + '?t=' + new Date().getTime();
 });
 
 //截取第一张照片且判断是否有图片,没有图片输入默认图片
-Vue.filter("firstImg",function(arr,sizeType,imgType){
+Vue.filter("firstImg", function(arr, sizeType, imgType) {
 	//图片类型判断
-	if(arr){
-		if(arr instanceof Array){
+	if (arr) {
+		if (arr instanceof Array) {
 			img = arr[0]
-		}else{
+		} else {
 			img = arr.split(',')[0]
 		}
-	}else if(!arr){
+	} else if (!arr) {
 		//如果没有图片则随机输出一张
 		// if(imgType === 'farmer'){
 		// 	const farmerList = ['carbon2/farmer/1.png','carbon2/farmer/2.png']
@@ -44,29 +44,29 @@ Vue.filter("firstImg",function(arr,sizeType,imgType){
 });
 
 //七牛云压缩图片
-Vue.filter("miniImg",function(img,quality){
-	return img+'?imageMogr2/quality/'+quality
+Vue.filter("miniImg", function(img, quality) {
+	return img + '?imageMogr2/quality/' + quality
 });
 
 //单位米m转换为单位千米km,提醒:传递参数不要带引号,如kmUnit('100')会返回0m。
-Vue.filter("kmUnit",function(m){
+Vue.filter("kmUnit", function(m) {
 	var v;
-	if(typeof m === 'number' && !isNaN(m)){
+	if (typeof m === 'number' && !isNaN(m)) {
 		if (m >= 1000) {
 			v = (m / 1000).toFixed(2) + 'km'
 		} else {
 			v = m + 'm'
 		}
-	}else{
+	} else {
 		v = '0m'
 	}
 	return v;
 });
 
 // 订单状态
-Vue.filter("filterOrderStatus",function(status){
+Vue.filter("filterOrderStatus", function(status) {
 	status = Number(status);
-	switch (status){
+	switch (status) {
 		case 1:
 			return '停放中'
 			break;
@@ -83,13 +83,13 @@ Vue.filter("filterOrderStatus",function(status){
 			return '未知'
 			break;
 	}
-	
+
 });
 
 // 支付状态
-Vue.filter("filterPayStatus",function(status){
+Vue.filter("filterPayStatus", function(status) {
 	status = Number(status);
-	switch (status){
+	switch (status) {
 		case 0:
 			return '未支付'
 			break;
@@ -106,13 +106,13 @@ Vue.filter("filterPayStatus",function(status){
 			return '未知'
 			break;
 	}
-	
+
 });
 
 // 汽车类型
-Vue.filter("energyTpye",function(value){
+Vue.filter("energyTpye", function(value) {
 	status = Number(value);
-	switch (value){
+	switch (value) {
 		case 1:
 			return '汽油车'
 			break;
@@ -123,8 +123,5 @@ Vue.filter("energyTpye",function(value){
 			return '汽油车'
 			break;
 	}
-	
-});
-
-
 
+});

+ 1 - 1
utils/judgEnvironment.js

@@ -3,7 +3,7 @@
  */
 export function getEnvIsWx() {
 	let en = window.navigator.userAgent.toLowerCase()
-	// 匹配en中是否含有MicroMessenger字符串
+	// 匹配en中是否含有MicroMessenger字符串,有则是微信浏览器
 	if (en.match(/MicroMessenger/i) == 'micromessenger') {
 		return true
 	} else {