Browse Source

停车场

zhengkaixin 3 years ago
parent
commit
327e14d9dc

+ 201 - 21
pages/parking/outPayment.vue

@@ -1,18 +1,21 @@
 <template>
 	<view>
-		<u-navbar title="无车辆扫码停车" back-icon-name="close" back-icon-size="30"></u-navbar>
+		<u-navbar title="无车辆扫码停车" :is-back="false"></u-navbar>
 		<view class="main">
 			<view class="park-name">
 				<img src="../../static/img/if-location-pin@2x.png" alt="">
-				<text>玉桥公园停车场</text>
+				<text>{{detail.parkName}}</text>
 			</view>
-			<view class="infos">
+			<view class="infos"  v-if="!detail.id">
+				已抬杆,欢迎下次光临
+			</view>	
+			<view class="infos" v-if="detail.id">
 				<view class="item">
 					<view class="title">
 						车牌号
 					</view>
 					<view class="content">
-						临D101010
+						{{detail.carNum}}
 					</view>
 				</view>
 				<view class="item">
@@ -20,20 +23,20 @@
 						停车费
 					</view>
 					<view class="content">
-						10.00
+						{{detail.price}}
 					</view>
 				</view>
 				
 			</view>
 			
 		</view>
-		<view class="details">
+		<view class="details"  v-if="detail.id">
 			<view class="detail-item">
 				<view class="title">
 					进场时间
 				</view>
 				<view class="content">
-					2022-06-01 12:00:00
+					{{detail.inParkingTime}}
 				</view>
 			</view>
 			<view class="detail-item">
@@ -41,7 +44,7 @@
 					离场时间
 				</view>
 				<view class="content">
-					2022-06-01 17:20:22
+						{{detail.outParkingTime}}
 				</view>
 			</view>
 			<view class="detail-item">
@@ -49,7 +52,7 @@
 					停车时长
 				</view>
 				<view class="content">
-					5小时23分钟
+					{{detail.parkingTimeStr}}
 				</view>
 			</view>
 			<view class="detail-item">
@@ -57,11 +60,11 @@
 					收费标准
 				</view>
 				<view class="content">
-					4.00/小时
+					{{detail.hourCost}}元/小时
 				</view>
 			</view>
 		</view>
-		<view class="payment">
+		<view class="payment" v-if="detail.id">
 			<p>付款方式</p>
 			<view class="methods">
 				<view class="recharge-radio" >
@@ -82,20 +85,61 @@
 			
 		</view>
 		
-		<u-button>缴纳停车费</u-button>
+		<u-button @click='submit()' v-if="detail.id">缴纳停车费</u-button>
 		<view class="box">
 			
 		</view>
-		<view class="service">
+		<!-- // @confirm="confirm" -->
+		<u-modal v-model="showModel"
+				:show-cancel-button="false"
+				
+				confirm-text="确定"
+				title="扫码支付" >
+					<view    style="
+							text-align: center;
+						">
+						<img id="qrcode2" :src="qrCodeImg" >
+					</view>
+					<view    style="
+							text-align: center;
+						">请使用支付宝扫码</view>
+					
+				</u-modal>
+		<img id="qrcode" style="display: none;" >
+			
+			<u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
+					:asyncClose="true" :title="title" :content="content" :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
+				
+		<view class="service"  @click="openModal">
 			联系停车场客服
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as Pay from '@/apis/weixin.js'
+	import QRCode from 'qrcodejs2'
+	import * as newsApi from '@/apis/news.js'
+	
+	import {
+		convertCanvasToImage,
+		} from '@/utils'
+	import {
+		wxPayJs
+	} from '@/utils/wxpay'
+	import {
+		aliPayJs
+	} from '@/utils/alipay'
+	import * as API from '@/apis/parking.js'
 	export default {
 		data() {
 			return {
+					title:"客服电话",
+					confirmText:"拨打电话",
+				content:'',
+				show:false,
+				showModel:false,
+					qrCodeImg:"",
 				list: [{
 						id:'0',
 						name: '微信',
@@ -109,14 +153,148 @@
 						color: '#1677ff',
 					},
 				],
-				value:0
+				value:0,
+				channelId:'',
+				detail:{}
+			}
+		},onLoad(op) {
+			 this.getPhone()
+			if(op.id){
+				this.channelId=op.id
+				this.getInfo()
+			}else{
+				uni.showModal({
+					content:"参数错误"
+				})
 			}
-		},
-		methods: {
 			
+			
+		},	methods: {
+			getPhone(){
+				newsApi.findConfigureByKey({
+					key:'consumerPhone'
+				}).then((res) => {
+									
+					this.content = res.data.value;
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			openModal() {
+				 
+				this.show = true;
+			},
+			confirmPhone(){
+				
+				
+				this.show = false;
+				uni.makePhoneCall({
+					phoneNumber:this.content //仅为示例
+				});
+			},
+			confirm(){
+				uni.redirectTo({
+					url:"/pages/parking/paymentResult"
+				})
+			},
+			submit(){
+				if(this.value=="0"){
+					this.wxpy()
+				}else{
+					this.alpy()
+				}
+				
+			},
+			alpy(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.parkTradePrecreatePay({
+					id: this.detail.id,
+					openId: this.carhelp.getOpenId()
+				}).then((response) => {
+					
+					let qrcode = new QRCode('qrcode', {
+						width: 200,
+						height: 200,
+						text: response.data,
+						correctLevel: QRCode.CorrectLevel.M,
+					
+					})
+				//	this.outOrderNo=response.data.outOrderNo;
+					var canvas = document.getElementsByTagName('canvas')[0];
+					this.qrCodeImg = convertCanvasToImage(canvas);
+					uni.hideLoading()
+					this.showModel=true
+						
+				}).catch(error => {
+						uni.showToast({
+						
+							title: error
+						})
+				})
+			},
+			wxpy(){
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.parkingWxPay({
+					id: this.detail.id,
+					openId: this.carhelp.getOpenId()
+				}).then(data => {
+					
+					//data.data.url = window.location.href.split("#")[0] + "/#/car/payResult";
+							
+					uni.hideLoading()
+					wxPayJs(data.data)
+				}).catch(error => {
+						uni.hideLoading()
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.generateTemporaryCarNum({
+					openId:this.carhelp.getOpenId(),
+					channelId:this.channelId
+				}).then((res) => {
+					
+					uni.hideLoading();
+					
+					this.detail = res.data;
+					
+				}).catch(error => {
+						uni.hideLoading()
+					// uni.showToast({
+					// 	title: error,
+					// 	icon: "none"
+					// })
+					uni.showModal({
+						title:"提示",
+						content:error,
+						showCancel:false,
+					})
+				})
+			}
 		}
 	}
+	
 </script>
+ 
 
 <style lang="scss" scoped>
 	
@@ -221,11 +399,13 @@
   		color: rgba(0, 90, 217, 100);
   		font-size: 16px;
   		text-align: center;
-		padding-bottom: 20px;
-		// position: absolute;
-		// bottom:20px;
-		// left: 0;
-		// right: 0;
+  		position: fixed;
+  		    bottom: 0px;
+  		    left: 0;
+  		    right: 0;
+  		    height: 40px;
+  		    background-color: #fff;
+			    z-index: 999;
 		
   }
 </style>

+ 7 - 5
pages/parking/paymentResult.vue

@@ -8,7 +8,7 @@
 				10.00元
 			</view>
 		</view>
-		<u-button>抬杆离场</u-button>
+		<!-- <u-button>抬杆离场</u-button> -->
 		<view class="service">
 			联系停车场客服
 		</view>
@@ -56,9 +56,11 @@
 	  		color: rgba(0, 90, 217, 100);
 	  		font-size: 16px;
 	  		text-align: center;
-	  		position: absolute;
-	  		bottom:20px;
-	  		left: 0;
-	  		right: 0;
+	  		position: fixed;
+	  		    bottom: 0px;
+	  		    left: 0;
+	  		    right: 0;
+	  		    height: 40px;
+	  		    background-color: #fff;
 	  }
 </style>

+ 108 - 7
pages/parking/registration.vue

@@ -1,33 +1,134 @@
 <template>
 	<view >
-		<u-navbar title="无牌车辆扫码停车" back-icon-name="close" back-icon-size="30" ></u-navbar>
+		<u-navbar title="无牌车辆扫码停车" :is-back="false" ></u-navbar>
 		<view class="main">
 			<view class="park-name">
 				<img src="../../static/img/if-location-pin@2x.png" alt="">
-				<text>玉桥公园停车场</text>
+				<text>{{detail.parkName}}</text>
 			</view>
 			<view class="unlabeled">
 				无牌车
 			</view>
 			<view class="bus-number">
-				临D51108
+				{{detail.carNum}}
 			</view>
 			
 		</view>
-		<u-button >请求进场</u-button>
+		<view v-if="detail.inParkingStatus==1" style="
+				text-align: center;
+				font-size: 30px;
+				font-weight: bold;
+			">
+			车辆已进场
+		</view>
+		<u-button v-if="detail.inParkingStatus==0" @click="submit" >请求进场</u-button>
 		<view class="notice">
 			<view class="title">
 				停车场须知
 			</view>
-			<p>1.停车规则</p>
-			<p>2.收费规则</p>
-			<p>3.联系电话</p>
+			<p v-html="txt"></p>
+			
 			
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as API from '@/apis/parking.js'
+	import * as newsApi from '@/apis/news.js'
+	
+	export default {
+		data() {
+			return {
+				channelId:'',
+				detail:{},
+			 
+				txt:''
+			}
+		},onLoad(op) {
+			this.getNewsInfoDetail()
+			if(op.id){
+				this.channelId=op.id
+				this.getInfo()
+			}else{
+				uni.showModal({
+					content:"参数错误"
+				})
+			}
+			
+		},	methods: {
+			getNewsInfoDetail() {
+				
+				
+				newsApi.findConfigureByKey({
+					key:'parking-registration-txt'
+				}).then((res) => {
+									
+					this.txt = res.data.value;
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			submit(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.temporaryCarNumInPark({
+					id: this.detail.id,
+					openId: this.carhelp.getOpenId(),
+					channelId:this.channelId
+				}).then(data => {
+					var obj=data.data;
+					 
+					this.carhelp.set("parkingregistration_submit",obj)
+					uni.reLaunch({
+						url:'/pages/parking/request'
+					})
+					
+				}).catch(error => {
+						uni.hideLoading()
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+				
+			},
+			getInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.generateTemporaryCarNum({
+					openId:this.carhelp.getOpenId(),
+					channelId:this.channelId
+				}).then((res) => {
+					
+					uni.hideLoading();
+					
+					this.detail = res.data;
+					if(this.detail.status==2){
+						uni.reLaunch({
+							url:'/pages/parking/outPayment?id='+this.channelId
+						})
+					}
+				}).catch(error => {
+						uni.hideLoading()
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
+		}
+	}
+	
 </script>
 
 <style lang="scss" scoped>

+ 58 - 14
pages/parking/request.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<u-navbar title="请求进场"back-icon-name="close" back-icon-size="30" ></u-navbar>
+		<u-navbar title="请求进场"back-icon-name="close" back-icon-size="30" :is-back="false" ></u-navbar>
 		<view class="success">
 			<u-icon name="chenggong" custom-prefix="custom-icon" size="180" color="#00B962"></u-icon>
 			<view class="title" >进场成功</view>
@@ -11,7 +11,7 @@
 					临牌
 				</view>
 				<view class="content">
-					临13123123
+					{{detail.carNum}}
 				</view>
 			</view>
 			<view class="info-item">
@@ -27,7 +27,7 @@
 					入场大门
 				</view>
 				<view class="content">
-					玉桥公园停车场北门入口
+					{{detail.inChannel}}
 				</view>
 			</view>
 			<view class="info-item">
@@ -35,7 +35,7 @@
 					停车场组
 				</view>
 				<view class="content">
-					玉桥公园停车场
+					{{detail.parkName}}
 				</view>
 			</view>
 			<view class="info-item">
@@ -43,7 +43,7 @@
 					入门时间
 				</view>
 				<view class="content">
-					2022-6-22 12:00:00
+					{{detail.inParkingTime}}
 				</view>
 			</view>
 			<view class="info-item">
@@ -56,23 +56,65 @@
 			</view>
 			
 		</view>
-		<view class="service">
+		<view class="service" @click="openModal">
 			联系停车场客服
 		</view>
+		<u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
+				:asyncClose="true" :title="title" :content="content" :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
+		
 	</view>
 </template>
 
+
 <script>
+	import * as API from '@/apis/parking.js'
+	import * as newsApi from '@/apis/news.js'
+	
 	export default {
 		data() {
 			return {
-				
+				id:'',
+				detail:{},
+				content:'',
+					confirmText:"拨打电话",
+				title:"客服电话",
+				show:false,
 			}
-		},
-		methods: {
+		},onLoad(op) {
+			this.detail=this.carhelp.get("parkingregistration_submit")
+			
+			 this.getPhone()
+		},	methods: {
 			
+			getPhone(){
+				newsApi.findConfigureByKey({
+					key:'consumerPhone'
+				}).then((res) => {
+									
+					this.content = res.data.value;
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			openModal() {
+				 
+				this.show = true;
+			},
+			confirmPhone(){
+				
+				
+				this.show = false;
+				uni.makePhoneCall({
+					phoneNumber:this.content //仅为示例
+				});
+			}
 		}
 	}
+	
 </script>
 
 <style lang="scss" scoped>
@@ -120,11 +162,13 @@
   		color: rgba(0, 90, 217, 100);
   		font-size: 16px;
   		text-align: center;
-  		position: absolute;
-  		bottom:20px;
-  		left: 0;
-  		right: 0;
-		
+  		
+  		    bottom: 0px;
+  		    left: 0;
+  		    right: 0;
+  		    height: 40px;
+  		    background-color: #fff;
+		    position: fixed;
 		
   }
 

+ 5 - 3
pages/searchPile/chargeProcess/dcCharging.vue

@@ -207,7 +207,7 @@
 			</view>
 			<view class="bottom2" >
 				<u-button type="primary"  @click="submit"
-				 :style="chargingRecord.status==1?'background-color: #00b962':'background-color: #9be6c2;'"
+				 :style="(chargingRecord.status==1||chargingRecord.status==4)?'background-color: #00b962':'background-color: #9be6c2;'"
 				 shape="circle" >结束充电</u-button>
 			</view>
 
@@ -475,8 +475,10 @@
 				})
 			},
 			submit() {
-				if(this.chargingRecord.status!=1&&this.chargingRecord.status!=3){
-					return
+				if(this.chargingRecord.status==1||this.chargingRecord.status==4){
+					
+				}else{
+					return
 				}
 				uni.showModal({
 					title: '提示',