Browse Source

充电联调

zhengkaixin 3 years ago
parent
commit
00e9a538ce
4 changed files with 78 additions and 43 deletions
  1. 3 3
      apis/index.js
  2. 1 1
      pages.json
  3. 1 1
      pages/index/index.vue
  4. 73 38
      pages/searchPile/chargeProcess/dcCharging.vue

+ 3 - 3
apis/index.js

@@ -73,9 +73,9 @@ export function marketingData(data) {
 }
 export function findChargeData(data) {
 	return request({
-		method: 'get',
+		method: 'post',
 		data: data,
-		url: '/mobile/regUser/findChargeData'
+		url: '/mobile/chargingCar/findChargeData'
 	})
 }
 
@@ -130,7 +130,7 @@ export function chargingRecordData(data) {
 	return request({
 		method: 'post',
 		data: data,
-		url: '/mobile/chargingRecord/chargingRecordData'
+		url: '/mobile/chargingCar/chargingRecordData'
 	})
 }
 export function chargingDetail(id) {

+ 1 - 1
pages.json

@@ -355,7 +355,7 @@
     ],
 	"globalStyle": {
 		"navigationStyle": "custom", // 隐藏系统导航栏
-		//"navigationBarTitleText": "智能充电系统",
+		"navigationBarTitleText": "加载中...",
 		"enablePullDownRefresh": false
 
 	}

+ 1 - 1
pages/index/index.vue

@@ -112,7 +112,7 @@
 				前方等待2位
 			</view>
 			<view v-if="item.status == '1'" class="text-2">
-				已充{{item.actualFee != null ? item.actualFee : '0.00'}}元
+				已充{{item.dueFee != null ? item.dueFee : '0.00'}}元
 			</view>
 			<view v-if="item.status == '2'" class="text-2" style="color: red;">
 				超出时间将收取占位费

+ 73 - 38
pages/searchPile/chargeProcess/dcCharging.vue

@@ -4,11 +4,11 @@
 			<u-navbar title="充电结束">
 			</u-navbar>
 			<view class="progress-bar2">
-				<u-circle-progress width="400" active-color="green" :percent="100" border-width="20">
+				<u-circle-progress width="400" active-color="green" duration='20'  :percent="100" border-width="20">
 					<view class="u-progress-content">
 						<!-- <view class="u-progress-dot"></view> -->
 						<text class='u-progress-info' v-if="chargingGun.gunType==1">
-							{{chargingRecord.endSoc}}
+							{{chargingRecord.endSoc}}%
 							<p class="progress-text">当前电量</p>
 						</text>
 						
@@ -40,6 +40,14 @@
 						充电金额
 					</view>
 				</view>
+			</view>
+			<view 
+			 v-if="chargingRecord.remark"
+			style="
+				margin-top: 20px;
+				text-align: center;
+			">
+				结束原因:{{chargingRecord.remark}}
 			</view>
 			<view class="bottom">
 				<u-button size="default" shape="circle" @click="gotoMain(0)"  >返回首页</u-button>
@@ -57,25 +65,28 @@
 			<view class="progress-bar">
 				<u-circle-progress width="440" active-color="green" :percent="percent?percent:percentValue" border-width="50">
 
-					<view class="u-progress-content" v-if="chargingGun.gunType==1">
-						<view class="u-progress-dot"></view>
-						<text class='u-progress-info'>{{percent.toFixed(2)}}%</text>
-					</view>
-					<view class="u-progress-content" v-if="chargingGun.gunType==2">
-						<text class='u-progress-info'>前方等待10位</text>
+					
+					<view class="u-progress-content" v-if="chargingRecord.status==4">
+						<text class='u-progress-info'>前方等待{{waitNum}}位</text>
+					</view>
+					<view class="u-progress-content" v-else-if="chargingGun.gunType==1">
+						<view class="u-progress-dot"></view>
+						<text class='u-progress-info'>{{percent}}%</text>
+					</view>
+					<view class="u-progress-content" v-else-if="chargingGun.gunType==2">
+						<view class="u-progress-dot"></view>
+						<text class='u-progress-info'>{{chargingRecord.statusText}}...</text>
 					</view>
 					<view class="bot"></view>
 				</u-circle-progress>
 			</view>
-			<view class="starting">
-				{{chargingRecord.statusN}}...
-				
-
+			<view class="starting"  v-if="chargingGun.gunType==1">
+				{{chargingRecord.statusText}}...
 			</view>
 
 
 			<view class="timer">
-				{{getPercent()}}
+				{{timer}}
 			</view>
 			<view class="charged">
 				已充电{{chargingGun.kwh}}度
@@ -83,7 +94,7 @@
 			<view class="cost">
 				<view class="">
 					<view class="cost-top">
-						{{chargingRecord.dueFee}}元
+						{{chargingRecord.dueFee?chargingRecord.dueFee:0}}元
 					</view>
 					<view class="cost-bottom">
 						实时费用
@@ -103,7 +114,7 @@
 			<view class="power">
 				<view>
 					<view class="power-num">
-						{{chargingRecord.chargeVoltage}}v
+						{{chargingRecord.chargeVoltage?chargingRecord.chargeVoltage:0}}v
 					</view>
 					<view class="power-text">
 						电压
@@ -112,7 +123,7 @@
 				<view class="line"></view>
 				<view>
 					<view class="power-num">
-						{{chargingGun.power}}kW
+						{{chargingGun.power?chargingGun.power:0}}kW
 					</view>
 					<view class="power-text">
 						功率
@@ -121,7 +132,7 @@
 				<view class="line"></view>
 				<view>
 					<view class="power-num">
-						{{chargingRecord.chargeAmpere}}A
+						{{chargingRecord.chargeAmpere?chargingRecord.chargeAmpere:0}}A
 					</view>
 					<view class="power-text">
 						电流
@@ -154,7 +165,7 @@
 			</view>
 			<view class="bottom2">
 				<u-button type="primary"  @click="submit"
-				 :style="chargingRecord.status==1?'':'background-color: #9be6c2;'"
+				 :style="chargingRecord.status==1?'background-color: #00b962':'background-color: #9be6c2;'"
 				 shape="circle" >结束充电</u-button>
 			</view>
 
@@ -175,7 +186,8 @@
 	} from '@/utils'
 	export default {
 		data() {
-			return {
+			return {
+				timer:'',
 				title: '联系客服',
 				content: '0716-8123456',
 				confirmText: '拨打电话',
@@ -186,7 +198,9 @@
 				id: "",
 				chargingGun: {},
 				chargingRecord: {},
-				show: false,
+				show: false,
+				isReady:true,
+				waitNum:'',
 			}
 		},
 		onLoad(op) {
@@ -201,6 +215,9 @@
 				this.consumerPhone = consumerPhone
 			}
 
+		},
+		onUnload() {
+			this.isReady=false;
 		},
 		onReady() {
 			this.addpercent()
@@ -219,8 +236,8 @@
 				}
 			},
 			addpercent(){
-				
-				if(this.percent==0){
+				this.timer=this.getPercent()
+				if(this.isReady){
 					setTimeout(()=>{	
 						this.percentValue++;
 						if(this.percentValue>=100){
@@ -243,13 +260,20 @@
 				return obj;
 			},
 			getPercent() {
-				var ms=this.chargingGun.chargeTimeSec;
+				var Hour=0;
+				var Fen=0;
+				var S=0;
+				if (this.chargingRecord.status == 1) {
+					var second = secondsDistance(this.chargingRecord.startTime);
 				
-				var Hour = parseInt(Math.floor(ms / (60 * 60)));
-				var Fen = parseInt(Math.floor(ms % (60 * 60) / 60));
-				var S = parseInt(Math.floor(ms % (60) ));
+				var ms=second;
 				
-				var obj = (Hour > 9 ? "" : "0") + Hour + ":" + (Fen > 9 ? "" : "0") + Fen+ ":" + (S > 9 ? "" : "0") + S
+				 Hour = parseInt(Math.floor(ms / (60 * 60)));
+				 Fen = parseInt(Math.floor(ms % (60 * 60) / 60));
+				 S = parseInt(Math.floor(ms % (60) ));
+				
+				 }
+				 var obj = (Hour > 9 ? "" : "0") + Hour + ":" + (Fen > 9 ? "" : "0") + Fen+ ":" + (S > 9 ? "" : "0") + S
 				 
 			
 				return obj;
@@ -274,36 +298,47 @@
 				});
 			},
 			getInfo() {
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
+				// uni.showLoading({
+				// 	title: "加载中",
+				// 	mask: true,
+				// })
 				API.chargingDetail({
 					id: this.id
 				}).then((res) => {
 					this.chargingRecord = res.data.chargingRecord
 
 					this.chargingGun = res.data.chargingGun
-
+					this.waitNum=res.data.waitNum;
 					this.isReady = true;
 					//直流
 					if(this.chargingGun.gunType==1){
 						
 						if (this.chargingRecord.status == 1) {
+							this.percent=this.chargingGun.soc
 							// var second = secondsDistance(this.chargingRecord.startTime);
 							// var percent = (second / 60) / this.chargingRecord.estimateMinute * 100;
 							// console.log(this.percent)
-							var sum=this.chargingGun.chargeTimeSec/60+this.chargingGun.remainMin;
-							if(sum){
-								this.percent=this.chargingGun.chargeTimeSec/60/sum*100	
-							}
+							// var sum=this.chargingGun.chargeTimeSec/60+this.chargingGun.remainMin;
+							// if(sum){
+							// 	this.percent=this.chargingGun.chargeTimeSec/60/sum*100	
+							// }
 							
 						}
 					}else if(this.chargingGun.gunType==2){
 						//交流
 					}
-					
-					uni.hideLoading()
+					if(this.isReady&&this.chargingRecord.status!=2){
+						var time=500;
+						if(this.chargingRecord.status==0){
+							
+						}else{
+							time=3000;
+						}
+						setTimeout(()=>{
+							this.getInfo();
+						},time)
+					}
+					//uni.hideLoading()
 
 				}).catch(error => {
 					uni.showToast({