zhengkaixin 3 年之前
父節點
當前提交
73ae6b4885

+ 1 - 1
pages/searchPile/apointment/apointmentRecharge.vue

@@ -110,7 +110,7 @@
 					uni.hideLoading()
 					
 					 uni.reLaunch({
-					 	url:"/pages/user/preengaged/preengagedListDetails?id="+res.data+"&isback=1"
+					 	url:"/pages/user/myReservation/reservationListDetails?id="+res.data+"&isback=1"
 					 })
 					
 				}).catch(error => {

+ 1 - 1
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -225,7 +225,7 @@
 					this.role()
 					if(res.data.chargingAppointment){
 						uni.reLaunch({
-							url:"/pages/user/preengaged/preengagedListDetails?id="+res.data.chargingAppointment.id+"&qr=1&stationId="+this.detail.stationId+"&deviceNo="+this.detail.deviceNo+"&gun="+this.gun.channelNo+"&carNumber="+(this.car?this.car.carNum:"")
+							url:"/pages/user/myReservation/reservationListDetails?id="+res.data.chargingAppointment.id+"&qr=1&stationId="+this.detail.stationId+"&deviceNo="+this.detail.deviceNo+"&gun="+this.gun.channelNo+"&carNumber="+(this.car?this.car.carNum:"")
 						})
 					}
 					

+ 161 - 36
pages/user/myReservation/reservationListDetails.vue

@@ -1,17 +1,18 @@
 <template>
 	<view >
-		<u-navbar title="预约单详情">
+		<u-navbar title="预约单详情" :custom-back="customback" >
 		
 		</u-navbar>
 		<view class="iconfont tittle-font">
 			&#xe616;
 		</view>
-		<u-alert-tips type="warning" :title="title" :description="description"></u-alert-tips>
-		<view class="reverse-time">
+		<u-alert-tips type="warning" v-if="detail.status==0"  :description="description"></u-alert-tips>
+		
+ 		<view class="reverse-time">
 			<view class="time">
-				预留30分钟
-				<view class="img-box">
-					<img src="assets/img/finished.png" alt="">
+				预留{{detail.reserveMinutes}}分钟
+				<view class="img-box" v-if="detail.status==1">
+					<img src="@/assets/img/finished.png" alt="">
 				</view>
 			</view>
 			<!-- 已取消/已拒绝 -->
@@ -24,7 +25,7 @@
 						预约单号
 					</view>
 					<view class="item-content">
-						0000111122223333
+						{{detail.flowNo}}
 					</view>
 				</view>
 				<view class="item">
@@ -33,7 +34,7 @@
 					</view>
 					<view class="item-content">
 						
-						2022-05-31 09:30:00
+						{{detail.startTime}}
 						
 					</view>
 				</view>
@@ -42,7 +43,7 @@
 						预计充电时长
 					</view>
 					<view class="item-content">
-						6小时
+						{{detail.estimateMinutes}}分钟
 					</view>
 				</view>
 			</view>
@@ -50,12 +51,13 @@
 		</view>
 		<!-- 充电桩详情 -->
 		<view class="charge-pile">
-		<view class="box">
+		<view class="box" @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=3865b3a3-13fd-461a-8145-ee9711df35a2')">
+		
 			<view class="name ellipsis">
-				荆鹏软件园充电站/1号快充桩
+				{{chargingDevice.stationName}}/{{chargingDevice.name}}
 			</view>
 			<view class="address ellipsis">
-				湖北省荆州市沙市区江津东路附155号
+				{{chargingDevice.address}}
 			</view>
 			<text class="iconfont more">
 				&#xe600;
@@ -66,51 +68,174 @@
 				<view class="item">
 					<view class="item-name">
 						预约单生成时间
-						
+			
 					</view>
 					<view class="item-content">
-						0000111122223333
+						{{detail.createTime}}
+			
 					</view>
 				</view>
 				<view class="item">
 					<view class="item-name">
-					
-						电费单价(kW/h)
-						
+			
+						电费单价
+			
 					</view>
 					<view class="item-content">
-						1.00元
+						{{price.electricityPrice}}元/度
 					</view>
 				</view>
 				<view class="item">
 					<view class="item-name">
-						
-						充电服务费(kW/h)
+			
+						充电服务费 
 					</view>
 					<view class="item-content">
-							1.00元
+						{{price.servicePrice}}元/度
 					</view>
 				</view>
 			</view>
 		</view>
 		<!-- 底部按钮 -->
-		<view class="bottom">
-			<u-button shape='circle' class="refuse-btn">拒绝</u-button>
+		<view class="bottom" v-if="detail.status==0" >
+		<!-- 	<u-button shape='circle' class="refuse-btn">拒绝</u-button>
 			<u-button type="success" shape='circle'>确认</u-button>
-			<!-- 删除订单按钮 -->
-			<!-- <u-button shape='circle' class="cancel-btn">删除订单</u-button> -->
+			 --><!-- 删除订单按钮 -->
+		 <u-button shape='circle' 
+		 @click="regChangeStatus()"
+		 class="cancel-btn">取消预约</u-button>
+		</view>
+		<view class="bottom" v-if="detail.status==1" >
+		<!-- 	<u-button shape='circle' class="refuse-btn">拒绝</u-button>
+			<u-button type="success" shape='circle'>确认</u-button>
+			 --><!-- 删除订单按钮 -->
+		 <u-button shape='circle' type="success" >开始充电</u-button>
 		</view>
 	</view>
 </template>
 
+
 <script>
-		export default {
-			data() {
-				return{
-					description: '等待桩主确认预约单,剩余时间04:59:59'
-				}
+	import * as API from '@/apis/apointment.js'
+	
+	import {
+		hourDistanceArr,
+		currentTimeStamp,
+		parseUnixTime
+	} from '@/utils'
+	export default {
+		data() {
+			return {
+				isback:false,
+				detail:{},
+				price:{},
+				chargingDevice:{},
+				description: '等待桩主确认预约单,剩余时间04:59:59'
 			}
+			
+		},onLoad(op) {
+			//预约充电跳转过来则 返回首页
+			if(op.isback){
+				this.isback=true
+			}
+			if(op.qr){
+				//扫码进入的
+			}
+			this.id= op.id;
+			this.getInfo()
+		},
+		methods:{
+			regChangeStatusSuccess(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})	
+				
+				API.regChangeStatus({
+					id:this.id,			
+					status:3
+				}).then((res) => {
+					uni.hideLoading()
+					this.getInfo();
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
+			regChangeStatus(){
+				
+				uni.showModal({
+					title:"提示",
+					content: "请确认是否取消预约功能",
+				
+					success: (res1) => {
+						if (res1.confirm) {
+								this.regChangeStatusSuccess()
+						} else if (res1.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				})
+				
+				
+			},
+			getInfo(bl){
+				console.log(bl)
+				if(!bl){
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})	
+				}
+				
+				API.myAppointmentDetail({
+					id:this.id,			
+				
+				}).then((res) => {
+					if(!bl){
+						uni.hideLoading()
+					}
+					this.detail= res.data.chargingAppointment;
+					this.chargingDevice=res.data.chargingDevice;
+					this.price=res.data.price;
+					
+					if(this.detail.status=="0"){
+						//this.description= '等待桩主确认预约单,剩余时间'
+						var data=new Date(this.detail.createTime).getTime()
+						var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
+					
+						this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";		
+						
+						
+						setTimeout(()=>{
+							this.getInfo(true);
+						},2000)
+					}
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+				
+			},
+			customback(){
+				if(this.isback){
+					uni.reLaunch({
+						url:"/pages/index/index"
+					})
+				}else{
+					uni.navigateBack({
+						
+					})
+				}
+				
+			},
 		}
+		
+	}
 </script>
 
 <style lang="scss" scoped>
@@ -209,16 +334,16 @@
 				background-color: #DBDBDB;
 			}
 			.u-btn{
-				width: 44%;
+				width: 91.4%;
 				height: 40px;
 				margin: auto;
 				font-size: 18px;
 				
 			}
-			.cancel-btn{
-				width: 91.4%;
-				background-color: #dbdbdb;
-				color: #666666
-			}
+			// .cancel-btn{
+			// 	width: 91.4%;
+			// 	background-color: #dbdbdb;
+			// 	color: #666666
+			// }
 		}
 </style>

+ 56 - 1
pages/user/preengaged/preengagedListDetails.vue

@@ -4,7 +4,7 @@
 
 		</u-navbar>
 		
-		<u-alert-tips type="warning"  :description="description"></u-alert-tips>
+		<u-alert-tips type="warning" v-if="detail.status==0"  :description="description"></u-alert-tips>
 		<view class="reverse-time">
 			<view class="time">
 				预留30分钟
@@ -107,10 +107,20 @@
 </template>
 
 <script>
+	import * as API from '@/apis/apointment.js'
+	
+	import {
+		hourDistanceArr,
+		currentTimeStamp,
+		parseUnixTime
+	} from '@/utils'
 	export default {
 		data() {
 			return {
 				isback:false,
+				detail:{},
+				price:{},
+				chargingDevice:{},
 				description: '等待桩主确认预约单,剩余时间04:59:59'
 			}
 			
@@ -119,8 +129,53 @@
 			if(op.isback){
 				this.isback=true
 			}
+			if(op.qr){
+				//扫码进入的
+			}
+			this.id= op.id;
+			this.getInfo()
 		},
 		methods:{
+			getInfo(bl){
+				console.log(bl)
+				if(!bl){
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})	
+				}
+				
+				API.myAppointmentDetail({
+					id:this.id,			
+				
+				}).then((res) => {
+					if(!bl){
+						uni.hideLoading()
+					}
+					this.detail= res.data.chargingAppointment;
+					this.chargingDevice=res.data.chargingDevice;
+					this.price=res.data.price;
+					
+					if(this.detail.status=="0"){
+						//this.description= '等待桩主确认预约单,剩余时间'
+						var data=new Date(this.detail.createTime).getTime()
+						var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
+					
+						this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";		
+						
+						
+						setTimeout(()=>{
+							this.getInfo(true);
+						},1000)
+					}
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+				
+			},
 			customback(){
 				if(this.isback){
 					uni.reLaunch({