Browse Source

道闸系统

空白格 3 years ago
parent
commit
abd2e384ce

+ 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) => {

+ 10 - 1
pages.json

@@ -257,11 +257,20 @@
 				"navigationBarTextStyle": "white"
 			}
 
+		}, {
+			"path": "pages/roadGateSystem/roadGateSystem",
+			"style": {
+				"navigationBarTitleText": "道闸系统",
+				"enablePullDownRefresh": false,
+				"navigationBarBackgroundColor": "#008CFF",
+				"navigationBarTextStyle": "white"
+			}
+
 		}
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uView",
+		"navigationBarTitleText": "普定智慧停车",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"backgroundColor": "#F8F8F8",
 		"backgroundColorTop": "#FFFFFF"

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

@@ -126,7 +126,7 @@
 					mobile: this.tel
 				};
 				this.$u.api.codeV2Api.verifyCodeV2Api(params).then(res => {
-					if (res.code == '200') {
+					if (res.code == 200) {
 						this.$u.vuex('vuex_token', this.accessToken);
 						this.$u.vuex('vuex_user', res.data);
 						this.$u.vuex('vuex_hasLogin', true);
@@ -153,7 +153,7 @@
 					const pagesIndex = ret.indexOf('pages')
 					if (pagesIndex > (-1)) {
 						const pageUrl = ret.slice(pagesIndex)
-						const tabbarUrl = ['pages/center/index', 'pages/parkingLists/parkingLists']
+						const tabbarUrl = ['pages/index/index', 'pages/center/index', 'pages/parkingLists/parkingLists']
 						if (tabbarUrl.indexOf(pageUrl) > (-1)) {
 							setTimeout(() => {
 								uni.switchTab({
@@ -162,7 +162,7 @@
 							}, 100)
 						} else {
 							setTimeout(() => {
-								uni.navigateTo({
+								uni.redirectTo({
 									url: '/' + pageUrl
 								})
 							}, 100)

+ 1 - 5
pages/index/index.vue

@@ -379,11 +379,6 @@
 		onShow() {
 			this.handleGetIndexData()
 			this.getLocation()
-			const locationLocaturl = window.location.search
-			this.code = getUrlParams(locationLocaturl, 'code')
-			if (this.code && !this.$store.state.vuex_wxinfo.openId) {
-				this.handleGetWXInfo(this.code)
-			};
 		},
 		methods: {
 			radioGroupChange(e){
@@ -671,6 +666,7 @@
 							})
 						}
 					})
+					.catch(err => {})
 			},
 			// 去支付,选择支付方式
 			goPay(orderId) {

+ 18 - 35
pages/message/message.vue

@@ -1,24 +1,13 @@
 <template>
 	<view>
-		<u-navbar
-			title-color="#fff"
-			:custom-back="customBack"
-			:border-bottom="false"
-			back-icon-color="#CCE8FF"
-			:background="{background: '#008CFF' }"
-			title="消息中心"
-		/>
-		<mescroll-body
-			ref="mescrollRef"
-			@init="mescrollInit"
-			@down="downCallback"
-			@up="upCallback">
+		<u-navbar title-color="#fff" :custom-back="customBack" :border-bottom="false" back-icon-color="#CCE8FF"
+			:background="{background: '#008CFF' }" title="消息中心" />
+		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
 			<scroll-view scroll-y style="height: 100%; width: 100%;" v-for="(messageItem, index) in  messageList"
 				:key="messageItem.id">
 				<view class="time">{{messageItem.createTime}}</view>
 				<view class="page-box">
-					<view class="message"
-						@click="goDetails(messageItem)">
+					<view class="message" @click="goDetails(messageItem)">
 						<view class="message-top u-flex">
 							<view class="message-top-left u-flex-1">
 								<view class="car">{{messageItem.title}}</view>
@@ -54,13 +43,18 @@
 			// 返回上一页
 			customBack() {
 				uni.getStorage({
-				    key: 'messageBack',
-				    success: (res) => {
-							this.$u.route({
-								type: 'switchTab',
-								url: res.data
-							})
-				    }
+					key: 'messageBack',
+					success: (res) => {
+						this.$u.route({
+							type: 'switchTab',
+							url: res.data
+						})
+					},
+					fail: (err) => {
+						uni.switchTab({
+							url: '/pages/index/index'
+						})
+					}
 				})
 			},
 			/*下拉刷新的回调*/
@@ -79,7 +73,7 @@
 					.then(res => {
 						if (res.code == 200) {
 							// 接口返回的当前页数据列表 (数组)
-							let curPageData = res.data?.rows??[];
+							let curPageData = res.data?.rows ?? [];
 							// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
 							let curPageLen = curPageData.length;
 							// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
@@ -100,12 +94,7 @@
 						} else {
 							this.mescroll.endErr()
 						}
-					}).catch(err => {
-						this.$refs.uToast.show({
-							title: err.msg,
-							type: 'error',
-						});
-					});
+					})
 			},
 			// 跳转消息详情
 			goDetails(item) {
@@ -128,12 +117,6 @@
 								})
 							}
 						})
-						.catch(err => {
-							this.$refs.uToast.show({
-								title: '操作失败',
-								type: 'error'
-							})
-						})
 				} else {
 					this.$u.route({
 						url: 'pages/message/messageInfo',

+ 301 - 0
pages/roadGateSystem/roadGateSystem.scss

@@ -0,0 +1,301 @@
+
+.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;
+}

+ 264 - 0
pages/roadGateSystem/roadGateSystem.vue

@@ -0,0 +1,264 @@
+<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>{{'入口1'}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>入场时间</view>
+						<view>{{orderInfo.inTime}}</view>
+					</view>
+					<view class="parking-lock-info-item">
+						<view>出场车道</view>
+						<view>{{'出口1'}}</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-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-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-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	import getUrlParams from "../../utils/getUrlParams.js";
+	import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
+	export default {
+		components: {
+			PaymentMethod
+		},
+		data() {
+			return {
+				// 车位锁状态 1:需支付 2:查询失败返回提醒
+				parkingLockStatus: 0,
+				// 支付方式选择弹框
+				payWayPop: false,
+				// 订单编号
+				orderList: [],
+				// 提示信息
+				tipsMsg: null,
+				// 轮询
+				timer: 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 = 2
+				uni.showModal({
+					title: '提示',
+					content: (page.msg || '参数丢失') + ',返回首页',
+					showCancel: false,
+					success: (res) => {
+						if (res.confirm) {
+							uni.switchTab({
+								url: '/pages/index/index'
+							})
+						}
+					}
+				});
+			}
+		},
+		onShow() {
+			if (this.orderId) {
+				this.getOrderDetails(this.spaceId, this.orderId, this.payeeId)
+				if (this.polyOrderId && this.isBack == 1) {
+					this.timer = setInterval(() => {
+						this.show = true
+						this.handlePayStatus(this.polyOrderId)
+					}, 1000)
+				}
+			} else {
+				this.show = false
+			}
+		},
+		onUnload() {
+			if (this.timer) {
+				clearInterval(this.timer)
+			}
+		},
+		methods: {
+			/**
+			 * 反复查询支付状态
+			 * @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.timer);
+							this.is_pay = false
+							uni.showModal({
+								title: '提示',
+								content: '支付成功,返回首页',
+								showCancel: false,
+								success: (res) => {
+									if (res.confirm) {
+										uni.switchTab({
+											url: '/pages/index/index'
+										})
+									}
+								}
+							});
+						} else if (res.data.payStatus === 2) {
+							this.is_pay = true
+						}
+					} else {
+						this.show = false
+						clearInterval(this.timer);
+						this.$refs.uToast.show({
+							title: res.msg,
+							type: 'error',
+						});
+					}
+				}).catch(() => {
+					this.show = false
+					clearInterval(this.timer);
+				})
+			},
+			/**
+			 * 立即支付
+			 */
+			payMoney() {
+				this.payWayPop = true
+			},
+			/**
+			 * 查询订单信息
+			 * @param { String } spaceId 车位ID
+			 * @param { String } orderId 订单id
+			 * @param { String } payeeId 收费员ID
+			 */
+			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
+						this.orderInfo = res.data
+						this.show = false
+						if (res.data.payStatus == 0 || res.data.payStatus == 2) {
+							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',
+						});
+					}
+				}).catch(err => {
+					this.show = false
+				})
+			},
+			/**
+			 * 关闭支付弹框
+			 */
+			closePaymentMethod() {
+				this.payWayPop = false
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import './roadGateSystem.scss';
+</style>