gcz преди 4 години
родител
ревизия
eb0144a7f9
променени са 5 файла, в които са добавени 131 реда и са изтрити 44 реда
  1. 3 0
      common/apiurl.js
  2. 5 2
      common/http.api.js
  3. 18 23
      pages/getout/getout.vue
  4. 104 18
      pages/getout/getoutpage/getoutpage.vue
  5. 1 1
      pages/parking/parking.vue

+ 3 - 0
common/apiurl.js

@@ -12,6 +12,9 @@ const apiurl = {
 	
 	//车辆出场
 	baiduOcrUrl:'/file/baidu/ocr',
+	
+	//车辆出场详情
+	entranceOutDetailUrl:'/orderinfo/entranceOutDetail/',
 
 }
 

+ 5 - 2
common/http.api.js

@@ -15,7 +15,9 @@ const install = (Vue, vm) => {
 	
 	let getIndex = (params = {}) => vm.$u.post(apiurl.getIndexUrl, params);	
 	
-	let baiduOcr = (params = {}) => vm.$u.post(apiurl.baiduOcrUrl, params);	
+	let baiduOcr = (params = {}) => vm.$u.post(apiurl.baiduOcrUrl, params);
+	
+	let entranceOutDetail = (params = {}) => vm.$u.get(apiurl.entranceOutDetailUrl+params.spaceId);	
 	
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
@@ -24,7 +26,8 @@ const install = (Vue, vm) => {
 		entrance,
 		getOut,
 		getIndex,
-		baiduOcr
+		baiduOcr,
+		entranceOutDetail
 	};
 }
 

+ 18 - 23
pages/getout/getout.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-empty class="u-m-t-80" text="暂无停车" mode="data" v-if="roadspaceList.length == 0"></u-empty>
 		<view class="roadspace-list wrap">
-			<view class="roadspace-list-item" :class="{used:item.placeStatus==1}" @click="roadspaceClick(item)" v-for="item in roadspaceList">
+			<view class="roadspace-list-item" :class="{used:item.placeStatus==1}" @click="roadspaceClick(item)" v-for="item in roadspaceList" :key="item.id">
 				<view class="block">
 					<view class="block-top">
 						<u-icon name="car-fill" size="40" color="#fff"></u-icon>
@@ -31,11 +31,11 @@
 			return {
 				roadNo:null,//路段编码 ,示例值(RN000000004)
 				actionList:[
-					{text: '出场',},
-					{text: '查看'}
+					{text: '出场'},
 				],
 				actionShow:false,
 				roadspaceList:[],
+				orderInfo:null,
 				spaceId:null,
 				currentTime: new Date(), // 获取当前时间
 				
@@ -75,33 +75,28 @@
 					console.log('handleGetRoadspace ',err)
 				});
 			},
-			roadspaceClick(roadspace){
+			roadspaceClick(orderInfo){
 				this.actionShow = true;
-				this.spaceId = roadspace.id;
-				console.log('roadspace',roadspace);
+				this.orderInfo = orderInfo;
+				this.spaceId = orderInfo.id;
+				console.log('orderInfo',orderInfo);
 			},
 			actionClick(e){
 				console.log('actionClick',e);
 				switch (e){
 					case 0:
-						this.$u.api.getOut({spaceId:this.spaceId})
-						.then(res=>{
-							this.$refs.uToast.show({
-								title: res.msg,
-								type: 'success',
-							});
-							this.handleGetRoadspace(this.roadNo);
-							console.log('handleGetRoadspace',res)
-						}).catch(err=>{
-							this.$refs.uToast.show({
-								title: err.msg,
-								type: 'error',
-							});
-							console.log('handleGetRoadspace ',err)
+						const d = new Date();
+						this.$u.route({
+							url: 'pages/getout/getoutpage/getoutpage',
+							params: {
+								orderID:this.orderInfo.id,
+								orderInTime:this.orderInfo.inTime,
+								orderOutTime:`${d.getFullYear()}-${((d.getMonth()+1)>=10?+(d.getMonth()+1):"0"+(d.getMonth()+1))}-${((d.getDate())>=10?d.getDate():'0'+d.getDate())} ${d.getHours()>=10?d.getHours():'0'+d.getHours()}:${d.getMinutes()>=10?d.getMinutes():'0'+d.getMinutes()}:${d.getSeconds()>=10?d.getSeconds():'0'+d.getSeconds()}`,
+								orderSpaceName:this.orderInfo.spaceName,
+								orderVehicleNo:this.orderInfo.vehicleNo
+							}
 						});
 						break;
-					case 1:
-						break;
 					default:
 						break;
 				}
@@ -109,7 +104,7 @@
 			
 			
 		},
-		filters:{			
+		filters:{
 			timeago(inTime,currentTime){
 				var time_start = new Date(inTime.replace(/-/g,'/'));
 				var clock_start = time_start.getTime();

+ 104 - 18
pages/getout/getoutpage/getoutpage.vue

@@ -6,8 +6,8 @@
 			</view>
 			<view class="car-info-text u-flex-1">
 				<view class="text-item">
-					<view class="car">豫U88888</view>
-					<view class="position">车位:P-03</view>
+					<view class="car">{{ orderVehicleNo }}</view>
+					<view class="position">车位:{{orderSpaceName}}</view>
 				</view>
 				<view class="text-item" style="color: #3192FB;">临时卡</view>
 				<view class="text-item u-flex u-flex u-row-between">
@@ -18,12 +18,12 @@
 			</view>
 		</view>
 		<view class="parking-info">
-			<view class="parking-info-item">进场时间:2021-04-08 17:14:31</view>
-			<view class="parking-info-item">出场时间:2021-04-08 18:40:24</view>
-			<view class="parking-info-item">停车时长:01:50:32</view>
+			<view class="parking-info-item">进场时间:{{orderInTime}}</view>
+			<view class="parking-info-item">出场时间:{{orderOutTime}}</view>
+			<view class="parking-info-item">停车时长:{{frontDuration}}</view>
 			<view class="parking-info-item">进场押金:0.0元</view>
 		</view>
-		<view class="bottom-btn-wrap">
+		<view class="bottom-btn-wrap" v-if="payStatus==0">
 			<view class="bottom-btn-box u-flex">
 				<view class="bottom-btn bg-blue" @click="handleOut">出场</view>
 				<view class="bottom-btn bg-gray">取消</view>
@@ -36,6 +36,7 @@
 		 cancel-text="取消" 
 		 confirm-text="确认" 
 		 :show-cancel-button="true"
+		 @confirm="confirmOut"
 		 :title-style="{color: '#404040',fontSize: '46rpx',borderBottom:'1px solid #D5D5D5',margin:'0 30rpx 30rpx',paddingBottom:'30rpx'}">
 			<view class="slot-content">
 				<rich-text class="orderDetails" :nodes="content"></rich-text>
@@ -46,16 +47,30 @@
 </template>
 
 <script>
+	import getUrlParams from "../../../utils/getUrlParams.js";
 	export default {
 		data() {
 			return {
 				showOrderDetails:false,//是否线上订单细节
 				content:'',
+				orderID:'',
+				orderInTime:'',
+				orderOutTime:'',
+				orderSpaceName:'',
+				orderVehicleNo:'',
+				payStatus:null,
 				
 			}
 		},
-		onLoad() {
+		onShow() {
+			let locationLocaturl = window.location.hash;
+			this.orderID = getUrlParams(locationLocaturl,"orderID");
+			this.orderInTime = getUrlParams(locationLocaturl,"orderInTime");
+			this.orderOutTime = getUrlParams(locationLocaturl,"orderOutTime");
+			this.orderSpaceName = getUrlParams(locationLocaturl,"orderSpaceName");
+			this.orderVehicleNo = getUrlParams(locationLocaturl,"orderVehicleNo");
 			
+			this.handleEntranceOutDetail();
 			
 		},
 		methods:{
@@ -65,24 +80,95 @@
 					url: path
 				})
 			},
+			handleEntranceOutDetail(){
+				this.$u.api.entranceOutDetail({spaceId:this.orderID})
+				.then(res=>{
+					// this.$refs.uToast.show({
+					// 	title: res.msg,
+					// 	type: 'success',
+					// });
+					this.payAmount = res.data.payAmount;
+					this.payStatus = res.data.payStatus;
+					this.content = `
+					   <dl><dt>停车时长:</dt> <dd>` + this.frontDuration + `</dd></dl>`
+					+ `<dl><dt>账户类型:</dt><dd>` + '暂无' + `</dd></dl>`
+					+ `<dl><dt>账户余额:</dt><dd>` + '暂无' + `</dd></dl>`
+					+ `<dl><dt>车辆类型:</dt><dd>` + '暂无' + `</dd></dl>`
+					+ `<dl><dt>押金:</dt><dd>` + '暂无' + `</dd></dl>`
+					+ `<dl><dt>应收:</dt><dd>` + res.data.payAmount + `</dd></dl>`
+					+ `<dl><dt>补交:</dt><dd><span class="u-type-warning">` + '暂无' + `<span></dd></dl>`
+					+ `<div class="tip">你是否将该车辆出场,如果是请点击确认,否则点击取消!</div>`;
+					
+					console.log('entranceOutDetail',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('entranceOutDetail ',err)
+				});
+				
+			},
 			handleOut(res){
 				this.showOrderDetails = true;
+			},
+			confirmOut(){
+				this.$u.api.getOut({spaceId:this.orderID})
+				.then(res=>{
+					this.$refs.uToast.show({
+						title: res.msg,
+						type: 'success',
+						url:'pages/getout/getout'
+					});
+					console.log('getOut',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('getOut ',err)
+				});
+			},
+			timeago(inTime,outTime){
+				var time_start = new Date(inTime.replace(/-/g,'/'));
+				var time_end = new Date(outTime.replace(/-/g,'/'));
+				var clock_start = time_start.getTime();
+				var clock_end = time_end.getTime();
+				// console.log('currentTime',this.currentTime)
 				
-				this.content = `
-				   <dl><dt>停车时长:</dt> <dd>` + res?.data?.roadName + `</dd></dl>`
-				+ `<dl><dt>账户类型:</dt><dd>` + res?.data?.roadNo + `</dd></dl>`
-				+ `<dl><dt>账户余额:</dt><dd>` + res?.data?.manager + `</dd></dl>`
-				+ `<dl><dt>车辆类型:</dt><dd>` + res?.data?.telephone + `</dd></dl>`
-				+ `<dl><dt>押金:</dt><dd>` + res?.data?.manager + `</dd></dl>`
-				+ `<dl><dt>应收:</dt><dd>` + res?.data?.manager + `</dd></dl>`
-				+ `<dl><dt>补交:</dt><dd><span class="u-type-warning">` + res?.data?.manager + `<span></dd></dl>`
-				+ `<div class="tip">你是否将该车辆出场,如果是请点击确认,否则点击取消!</div>`;
+				const formatNumber = (num) => {
+					num = num.toString()
+					return num[1] ? num : '0' + num
+				};
 				
+				var i_total_secs = Math.round(clock_end - clock_start);
+				//计算出相差天数
+				var days = Math.floor(i_total_secs / (24 * 3600 * 1000))
+					 
+				//计算出小时数
+				var leave1 = i_total_secs % (24 * 3600 * 1000)    //计算天数后剩余的毫秒数
+				var hours = Math.floor(leave1 / (3600 * 1000))
+				
+				//计算相差分钟数
+				var leave2 = leave1 % (3600 * 1000)        //计算小时数后剩余的毫秒数
+				var minutes = Math.floor(leave2 / (60 * 1000))
+				//计算相差秒数
+				var leave3 = leave2 % (60 * 1000)      //计算分钟数后剩余的毫秒数
+				var seconds = Math.round(leave3 / 1000)
+				
+				hours = formatNumber(hours);
+				minutes = formatNumber(minutes);
+				seconds = formatNumber(seconds);
+				// console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');
+				// this.frontDuration = hours + ':' + minutes + ':' + seconds;
+				return hours + ':' + minutes + ':' + seconds
 			}
 			
 		},
-		filters:{
-			
+		computed:{
+			frontDuration:function(){
+				return this.timeago(this.orderInTime,this.orderOutTime)
+			}
 		}
 		
 	}

+ 1 - 1
pages/parking/parking.vue

@@ -25,7 +25,7 @@
 				roadNo:null,//路段编码 ,示例值(RN000000004)
 				actionList:[
 					{text: '停车',},
-					{text: '查看'}
+					// {text: '查看'}
 				],
 				actionShow:false,
 				roadspaceList:[],