zhengkaixin vor 3 Jahren
Ursprung
Commit
d6edc90189

+ 19 - 0
apis/apointment.js

@@ -1 +1,20 @@
 import request from '@/utils/request'
+
+
+ export function information(data) {
+ 	return request({
+ 		method: 'post',
+ 		data: data,
+ 		url: '/mobile/chargingAppointment/information'
+ 	})
+ }
+ 
+ 
+ 
+ export function submitAppointment(data) {
+ 	return request({
+ 		method: 'get',
+ 		data: data,
+ 		url: '/mobile/chargingAppointment/submitAppointment'
+ 	})
+ }

+ 39 - 56
pages/searchPile/apointment/apointmentRecharge.vue

@@ -3,17 +3,17 @@
 		<u-navbar title="预约充电"></u-navbar>
 		<!-- 站点详情 -->
 		<view class="station-details box">
-			<p class="station-name">荆鹏软件园充电站</p>
+			<p class="station-name">{{detail.stationName}}</p>
 			<view class="details">
 				<view class="details-item">
-					充电桩类型:直流快充
+					充电桩类型:{{detail.gunType=='1'?'直流快充':'交流慢充'}}
 				</view>
 		 
 				<view class="details-item">
-					桩号:80kW快充桩01
+					桩号:{{detail.deviceName}}
 				</view>
 				<view class="details-item">
-					枪号:02号充电枪
+					枪号:{{id}}
 				</view>
 			</view>
 		</view>
@@ -83,7 +83,7 @@
 			return {
 				id:0,
 				detail:{},
-				timeList:[15,30],
+				timeList:[],
 				numList:[60,90,120,0],
 				apointment:"",
 				selectTime:15,
@@ -97,47 +97,27 @@
 		},
 		methods:{
 			submit(){
-				
-				uni.reLaunch({
-					url:"/pages/user/preengaged/preengagedListDetails?&isback=1"
-				})
-				return;
-				
+				 
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
-				})
-				
-				//this.submitForm.deviceNo = this.detail.deviceNo;
-				API.startCarCharging(this.submitForm).then((res) => {
+				})	
+				API.submitAppointment({
+					gunNo:this.id,			
+					waitMinute:this.selectTime,
+					chargingMinute:this.selectNum,
+				}).then((res) => {
+					uni.hideLoading()
+					
 					 uni.reLaunch({
-					 	url:"/pages/user/preengaged/preengagedListDetails?id="+res.data.id+"&isback=1"
+					 	url:"/pages/user/preengaged/preengagedListDetails?id="+res.data+"&isback=1"
 					 })
-				
+					
 				}).catch(error => {
-					uni.hideLoading()
-					if (error == '用户账户余额不足!') {
-						uni.showModal({
-							title: '支付',
-							content: '用户账户余额不足,是否充值?',
-							success: res => {
-								if (res.confirm) {
-									//付钱  改为组件
-									this.gotoUrl("pages/user/finance/recharge");
-				
-								} else if (res.cancel) {
-									console.log('用户点击取消');
-								}
-							}
-						});
-					} else {
-						uni.showToast({
-							title: error
-						})
-					}
-				
+					uni.showToast({
+						title: error
+					})
 				})
-				
 			},
 			getInfo(){
 				newsApi.findConfigureByKey({
@@ -149,19 +129,30 @@
 				}).catch(error => {
 					
 				})
-				return
+				
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
 				})	
-				API.couponList({
-					id:this.id,			
-					selectTime:this.selectTime,
-					selectNum:this.selectNum,
+				API.information({
+					gunNo:this.id,			
+				
 				}).then((res) => {
 					uni.hideLoading()
-					this.detail= res.data.recordsTotal;
-					 
+					
+					this.detail= {
+						stationName:res.data.gun.stationName,
+						deviceName:res.data.gun.deviceName,
+						gunType:res.data.gun.gunType,
+					};
+					if(res.data.gunShare.reserveMinutes){
+						
+						this.timeList=res.data.gunShare.reserveMinutes.split(",")
+						this.selectTime=this.timeList[0]
+						if(this.timeList.indexOf("30")>-1){
+							this.selectTime='30'
+						}
+					}
 					
 				}).catch(error => {
 					uni.showToast({
@@ -170,15 +161,7 @@
 				})
 				
 				
-				newsApi.findConfigureByKey({
-					key:"apointment"
-				}).then((res) => {
-										
-					this.apointment = res.data;
-				
-				}).catch(error => {
-					
-				})
+			
 				
 			},
 			getPercent(estimateMinute) {
@@ -243,7 +226,7 @@
 			justify-content: space-between;
 
 			.details-item {
-				width: 45%;
+				width: 95%;
 				color: rgba(102, 102, 102, 100);
 				line-height: 20px;
 				text-align: left;

+ 8 - 25
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -193,30 +193,7 @@
 				var id = this.id;
 				var info = this.carhelp.getPersonInfo();
 				if (info) {
-					if (false&&this.car == null) {
-						uni.showModal({
-							content: "需要绑定车辆后扫码充电",
-							confirmText: "前往绑定",
-							success: (res) => {
-								uni.hideToast();
-								if (res.confirm) {
-								 
-									this.onShowRole = true
-									uni.navigateTo({
-										url: "/pages/user/car/carDet?jpcode=jp_team51_charge_id:A_" + id
-									})
-								} else if (res.cancel) {
-									console.log('用户点击取消');
-								}
-						
-
-
-							}
-						})
-					} else {
-						uni.hideLoading();
-						this.isReady=true;
-					}
+				
 				} else {
 					
 					uni.showModal({
@@ -245,7 +222,13 @@
 					this.prices = res.data.prices
 					this.gun = res.data.gun
 					this.car = res.data.car
-					this.role()
+					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:"")
+						})
+					}
+					
 					uni.hideLoading()
 
 				}).catch(error => {

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

@@ -331,7 +331,7 @@
 			},
 			book(item){
 				uni.navigateTo({
-					url:'/pages/searchPile/apointment/apointmentRecharge?id='+item.id,
+					url:'/pages/searchPile/apointment/apointmentRecharge?id='+item.gunNo,
 				})
 				//console.log('book'+JSON.stringify(item))
 			},