فهرست منبع

站点详情传递参数,重新获取数据更新

zhupeng 3 سال پیش
والد
کامیت
368ed45026

+ 68 - 16
components/Chargermap.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-	<view>
+	<view >
 		<view id="container" :style="myStyle"></view>
 		<view id="container" :style="myStyle"></view>
 	
 	
 			<u-icon name="map-fill" v-if="false" class="input-card"  style="width: 24rem;top: 130px;width: 20px;height: 20px;" color="#999" size="40"></u-icon>
 			<u-icon name="map-fill" v-if="false" class="input-card"  style="width: 24rem;top: 130px;width: 20px;height: 20px;" color="#999" size="40"></u-icon>
@@ -159,6 +159,48 @@
 					console.log(error)
 					console.log(error)
 				})
 				})
 			},
 			},
+			calculateDistance(startLngLat,endLngLat){
+				
+				var _this = this;
+				//var endLngLat = [item.longitude,item.latitude];
+				return new Promise((resolve, reject) => {
+					AMap.plugin('AMap.Driving', function() {
+					  var driving = new AMap.Driving({
+						// 驾车路线规划策略,AMap.DrivingPolicy.LEAST_TIME是最快捷模式
+						policy: AMap.DrivingPolicy.LEAST_TIME
+					  })
+					  
+					 //var startLngLat = [116.379028, 39.865042]
+					 //var endLngLat = [116.427281, 39.903719]
+					 
+					  driving.search(startLngLat, endLngLat, function (status, result) {
+							//console.log(result)
+							//console.log(result.routes[0].time)//秒
+							//console.log(result.routes[0].distance)//米
+							//item.distance = result.routes[0].distance/1000;
+							//item.time = result.routes[0].time/60;
+							/*uni.showToast({
+								title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+							})*/
+							resolve(result.routes[0])
+					  })
+					  /*
+					  var startLngLat2 = [_this.longitude, _this.latitude]
+					  var endLngLat2 = [_this.longitude2, _this.latitude2]
+					
+					  
+					  driving.search(startLngLat2, endLngLat2, function (status, result) {
+												console.log(result)
+												console.log(result.routes[0].time)//秒
+												console.log(result.routes[0].distance)//米
+												uni.showToast({
+													title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+												})
+					  })*/
+					})
+				})
+			 
+			},
 			searchBtn(startLngLat,endLst){
 			searchBtn(startLngLat,endLst){
 				var _this = this;
 				var _this = this;
 				
 				
@@ -204,9 +246,8 @@
 				 
 				 
 				}) 
 				}) 
 			},
 			},
-			updateCharger(pos){
-//				console.log('更新充电桩'+JSON.stringify(this.chargerList.length) ) 
-//				console.log('更新充电桩1'+JSON.stringify(pos) ) 
+			updateCharger(pos){ 
+				console.log('更新充电桩1'+JSON.stringify(pos) ) 
 //				let index = this.chargerList.findIndex(item => item.info.latitude === pos.latitude && item.info.longitude === pos.longitude);
 //				let index = this.chargerList.findIndex(item => item.info.latitude === pos.latitude && item.info.longitude === pos.longitude);
 				//let index = this.chargerList.findIndex(item => (Math.abs(item.info.longitude-pos.longitude)<0.000001 && Math.abs(item.info.longitude - pos.latitude)<0.000001));
 				//let index = this.chargerList.findIndex(item => (Math.abs(item.info.longitude-pos.longitude)<0.000001 && Math.abs(item.info.longitude - pos.latitude)<0.000001));
 				let index = this.chargerList.findIndex(item => item.info.id === pos.id);
 				let index = this.chargerList.findIndex(item => item.info.id === pos.id);
@@ -217,8 +258,8 @@
 				}else if(this.chargerList[index].info.type =='慢充'){
 				}else if(this.chargerList[index].info.type =='慢充'){
 					colorBg = '#9d9fff'
 					colorBg = '#9d9fff'
 				} 
 				} 
-				console.log('colorBg'+colorBg)
-				console.log('更新充电桩2'+JSON.stringify(this.chargerList[index].info)) 
+//				console.log('colorBg'+colorBg)
+//				console.log('更新充电桩2'+JSON.stringify(this.chargerList[index].info)) 
 				
 				
 				if(index>=0){
 				if(index>=0){
 					let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: " + colorBg +";text-align: center;display: flex;";
 					let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: " + colorBg +";text-align: center;display: flex;";
@@ -229,10 +270,17 @@
 					content+="<div style='color: #ffffff;line-height: 14px;padding: 4px;'>";
 					content+="<div style='color: #ffffff;line-height: 14px;padding: 4px;'>";
 					content+="<div style='"+corner2+"'></div>";
 					content+="<div style='"+corner2+"'></div>";
 					content+="<div class=''>";
 					content+="<div class=''>";
-					content+= "¥" + pos.price.toString();
+					if(pos.price != null)
+						content+= "¥" + pos.price.toString();
+					if(pos.costPrice != null)
+						content+= "¥" + pos.costPrice.toString();
+						
 					content+="</div>";
 					content+="</div>";
 					content+="<div class=''>";
 					content+="<div class=''>";
-					content+="空闲" + pos.idleNum.toString();
+					if(pos.idleNum != null)
+						content+="空闲" + pos.idleNum.toString();
+					if(pos.availableNum != null)
+						content+="空闲" + pos.availableNum.toString();
 					content+="</div>"
 					content+="</div>"
 					content+="</div>";
 					content+="</div>";
 					content+="</div>";
 					content+="</div>";
@@ -288,6 +336,7 @@
 				this.myEmit("charger",marker,pos)
 				this.myEmit("charger",marker,pos)
 				this.chargerList.push({marker:marker,info:pos});
 				this.chargerList.push({marker:marker,info:pos});
 			},
 			},
+			/*
 			addPerson(pos) {
 			addPerson(pos) {
 				console.log('addPerson'+JSON.stringify(pos))
 				console.log('addPerson'+JSON.stringify(pos))
 				let marker = new AMap.Marker({
 				let marker = new AMap.Marker({
@@ -301,7 +350,7 @@
 				marker.setMap(this.mapcharger);
 				marker.setMap(this.mapcharger);
 				this.myEmit("person",marker,pos)
 				this.myEmit("person",marker,pos)
 				//this.chargerList.push(marker)
 				//this.chargerList.push(marker)
-			},
+			},*/
 			/*
 			/*
 			addPosition() {
 			addPosition() {
 				console.log('addPosition'+JSON.stringify(pos))
 				console.log('addPosition'+JSON.stringify(pos))
@@ -317,8 +366,7 @@
 				//this.myEmit("person",marker,pos)
 				//this.myEmit("person",marker,pos)
 				//this.chargerList.push(marker)
 				//this.chargerList.push(marker)
 			},*/
 			},*/
-			setChargerList(sz){
-					
+			setChargerList(sz){ 
 					if(this.AMap==null){
 					if(this.AMap==null){
 						return
 						return
 					}
 					}
@@ -371,16 +419,18 @@
 			setMyStyle(s){
 			setMyStyle(s){
 				this.myStyle=s;
 				this.myStyle=s;
 			},			 
 			},			 
-			setCenter(item){
+			setCenter(item){ 
+				console.log('setCenter'+JSON.stringify(item))
 				if(this.mapcharger){
 				if(this.mapcharger){
 					this.mapcharger.setCenter([item.longitude,item.latitude]);
 					this.mapcharger.setCenter([item.longitude,item.latitude]);
 					return true
 					return true
 				}else{
 				}else{
 					return false
 					return false
 				}
 				}
-			},			
+			},		
+			/*
 			setPerson(ob,bl){
 			setPerson(ob,bl){
-//				console.log('setPerson1'+JSON.stringify(ob))
+				console.log('setPerson1'+JSON.stringify(ob))
 				if(this.AMap==null){
 				if(this.AMap==null){
 					return
 					return
 				}
 				}
@@ -411,10 +461,10 @@
 					}
 					}
 				
 				
 				
 				
-			},
+			},*/
 			logMapInfo() {
 			logMapInfo() {
 			  var posCenter = this.mapcharger.getCenter();
 			  var posCenter = this.mapcharger.getCenter();
-			  //console.log('center'+JSON.stringify(posCenter));
+			  console.log('center'+JSON.stringify(posCenter));
 			  var limitBounds = this.mapcharger.getBounds();
 			  var limitBounds = this.mapcharger.getBounds();
  			  let pos = {center:posCenter,bounds:limitBounds};
  			  let pos = {center:posCenter,bounds:limitBounds};
 			  return pos;
 			  return pos;
@@ -499,6 +549,7 @@
 						_this.$emit('onClicked',e);
 						_this.$emit('onClicked',e);
 						console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
 						console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
 					};
 					};
+					
 					_this.mapcharger.on('click', clickHandler); 
 					_this.mapcharger.on('click', clickHandler); 
 					_this.$emit('onload')
 					_this.$emit('onload')
 					//_this.addPosition();
 					//_this.addPosition();
@@ -519,6 +570,7 @@
 				}
 				}
 				var mapMoveend = function(){
 				var mapMoveend = function(){
 					let pos = _this.logMapInfo();
 					let pos = _this.logMapInfo();
+					 
 					_this.$emit('onMoveEnd',pos);
 					_this.$emit('onMoveEnd',pos);
 //						console.log('mapMoveend')
 //						console.log('mapMoveend')
 				}
 				}

+ 32 - 11
pages/searchPile/searchPile.vue

@@ -170,7 +170,7 @@
 				
 				
 				
 				
 			</view>
 			</view>
-			<view v-show="viewMode" >					
+			<view v-show="viewMode">					
 				<view>
 				<view>
 					<Chargermap @onMoveStart="moveStart"   @onMoveEnd="moveEnd" ref="amap" @onClicked="onClicked" @onload="mapdown" @clickMap="clickMap"></Chargermap>
 					<Chargermap @onMoveStart="moveStart"   @onMoveEnd="moveEnd" ref="amap" @onClicked="onClicked" @onload="mapdown" @clickMap="clickMap"></Chargermap>
 					<!--@location="location"-->
 					<!--@location="location"-->
@@ -223,7 +223,7 @@
 									</view>
 									</view>
 								</view>
 								</view>
 								<view class="card_item" style="padding-bottom: 20rpx;">
 								<view class="card_item" style="padding-bottom: 20rpx;">
-									<u-button shape='circle' style="color: #00B962;" @click="getScanCode">
+									<u-button shape='circle' style="color: #00B962;" @click="getScanCode" >
 										<u-icon name="scan" size="26" color="#00B962" style="margin-right: 20rpx;"></u-icon>
 										<u-icon name="scan" size="26" color="#00B962" style="margin-right: 20rpx;"></u-icon>
 										<label>扫码充电</label></u-button>
 										<label>扫码充电</label></u-button>
 									<view class="round" > 
 									<view class="round" > 
@@ -457,6 +457,8 @@ export default {
 //			console.log('setCenter')
 //			console.log('setCenter')
 		},
 		},
 		getScanCode() {
 		getScanCode() {
+			if(!this.isEnabled())
+				return;
 			if (this.userId) {
 			if (this.userId) {
 				WxJsApi.scanQRCode(1).then(res => {
 				WxJsApi.scanQRCode(1).then(res => {
 					if(res) {
 					if(res) {
@@ -506,7 +508,7 @@ export default {
 									longitude: longitude,
 									longitude: longitude,
 									latitude: latitude
 									latitude: latitude
 								};
 								};
-					this.$refs.amap.setPerson(obj);	
+					this.$refs.amap.setCenter(obj);	
 					//let data = {latitude:latitude,longtitude:longitude};
 					//let data = {latitude:latitude,longtitude:longitude};
 					//this.getChargingStationData(data);
 					//this.getChargingStationData(data);
 					this.getNearbyStationInfo();
 					this.getNearbyStationInfo();
@@ -545,10 +547,26 @@ export default {
 		  // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
 		  // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
 		  console.log(this.timer);
 		  console.log(this.timer);
 		},
 		},
+		isEnabled(){
+			if(this.viewMode)
+			{
+				if(this.show)
+					return false;
+			}
+			return true;
+		},
 		stationDetail(item){
 		stationDetail(item){
+			if(!this.isEnabled())
+				return;
+			console.log('stationDetail'+JSON.stringify(item))
+			uni.navigateTo({
+				url:'stationAndPile/stationDetails?id='+item.id
+			})
+				/*
 			uni.navigateTo({
 			uni.navigateTo({
 				url:'stationAndPile/stationDetails?station='+encodeURIComponent(JSON.stringify(item))
 				url:'stationAndPile/stationDetails?station='+encodeURIComponent(JSON.stringify(item))
 			})
 			})
+			*/
 //			console.log('stationDetail'+JSON.stringify(item))
 //			console.log('stationDetail'+JSON.stringify(item))
 		},
 		},
 		location(e){
 		location(e){
@@ -608,7 +626,7 @@ export default {
 
 
 				if(data1.findType == "0")
 				if(data1.findType == "0")
 				{					
 				{					
-					console.log('getChargingStationData res1'+JSON.stringify(res));
+//					console.log('getChargingStationData res1'+JSON.stringify(res));
 					_self.stationsmap = [];
 					_self.stationsmap = [];
 					for(let i = 0;i<items.length;i++)
 					for(let i = 0;i<items.length;i++)
 					{
 					{
@@ -678,7 +696,7 @@ export default {
 				}else if(data1.findType == "1")
 				}else if(data1.findType == "1")
 				{
 				{
 					_self.stationslist = [];
 					_self.stationslist = [];
-					console.log('getChargingStationData res2'+JSON.stringify(res));
+//					console.log('getChargingStationData res2'+JSON.stringify(res));
 					for(let i = 0;i<items.length;i++)
 					for(let i = 0;i<items.length;i++)
 					{
 					{
 						
 						
@@ -760,9 +778,10 @@ export default {
 			 })
 			 })
 			
 			
 		},	*/	
 		},	*/	
-		moveEnd(e){
+		moveEnd(e){ 
 			this.close_all();
 			this.close_all();
-//			console.log('moveEnd'+JSON.stringify(e))			
+			let posCenter = this.$refs.amap.logMapInfo();
+			//console.log('posCenter'+JSON.stringify(posCenter))			
 			let data = {latitude:e.center.lat,longtitude:e.center.lng};
 			let data = {latitude:e.center.lat,longtitude:e.center.lng};
 			this.getChargingStationData(data);
 			this.getChargingStationData(data);
 		},
 		},
@@ -903,7 +922,7 @@ export default {
 				);
 				);
 			}
 			}
 		},
 		},
-		mapdown() {
+		mapdown() { 
 			//console.log('this'+JSON.stringify(this))
 			//console.log('this'+JSON.stringify(this))
 //			console.log('longitude1  ' + this.longitude);
 //			console.log('longitude1  ' + this.longitude);
 //			console.log('latitude1  ' + this.latitude);
 //			console.log('latitude1  ' + this.latitude);
@@ -925,13 +944,15 @@ export default {
 					console.log('window width'+state.status_width);*/
 					console.log('window width'+state.status_width);*/
 					
 					
 					let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
 					let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
-	//				console.log('布局结果'+ JSON.stringify(res));
-	//				console.log('scrollH'+scrollH)
+					let scrollW = res.windowWidth;
+ 	//				console.log('布局结果'+ JSON.stringify(res));
+					console.log('scrollW'+scrollW)
 					//#ifdef MP-WEIXIN
 					//#ifdef MP-WEIXIN
 					const {
 					const {
 						statusBarHeight,
 						statusBarHeight,
 						windowWidth,
 						windowWidth,
 					} = uni.getSystemInfoSync();
 					} = uni.getSystemInfoSync();
+					scrollW = windowWidth;
 	//				console.log('height ' + statusBarHeight);
 	//				console.log('height ' + statusBarHeight);
 					//this.status_height = uni.getStatusbarHeight();
 					//this.status_height = uni.getStatusbarHeight();
 					let res1 =  uni.getMenuButtonBoundingClientRect()
 					let res1 =  uni.getMenuButtonBoundingClientRect()
@@ -939,7 +960,7 @@ export default {
 					//state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
 					//state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
 					//#endif
 					//#endif
 					//console.log('status height'+state.status_height)
 					//console.log('status height'+state.status_height)
-					_self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:100%;");
+					_self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:"+scrollW+"px;");
 				}
 				}
 			})
 			})
 			
 			

+ 104 - 2
pages/searchPile/stationAndPile/stationDetails.vue

@@ -193,6 +193,33 @@
 			_self.processStationsInfo();
 			_self.processStationsInfo();
 				 
 				 
 			if(op!=null){
 			if(op!=null){
+				if(op.id != null){
+					let data = {stationId:op.id};
+						//if(station.distance != null)
+						//	_self.stationDetail.station.distance = station.distance;
+						//console.log('station'+JSON.stringify(station))
+						//_self.station = station; 
+						api.getChargingStationDetail(data).then(function(res){
+//							console.log('站点详情'+JSON.stringify(res))
+							//this.info.st
+							if(res && res.result)
+							{
+								if(res.data){
+									let data = res.data;
+									//data.station.distance = station.distance;
+									
+									_self.stationDetail = data;
+									_self.processStationsInfo();							
+									if(_self.stationDetail.station.distance == null){
+										_self.getPoint();
+									}
+	//								console.log('data'+JSON.stringify(data)); 
+								}
+								
+							}
+							
+						})
+				}
 				if(op.station != null){
 				if(op.station != null){
 					let station = JSON.parse(decodeURIComponent(op.station))
 					let station = JSON.parse(decodeURIComponent(op.station))
 					let data = {stationId:station.id};
 					let data = {stationId:station.id};
@@ -244,7 +271,6 @@
 					console.log('stationDetail onLoad'+JSON.stringify(station))					
 					console.log('stationDetail onLoad'+JSON.stringify(station))					
 				} 
 				} 
 			}
 			}
-			_self = this;
 		},
 		},
 		onReady(){
 		onReady(){
 			if (this.carhelp.getPersonInfo()) {
 			if (this.carhelp.getPersonInfo()) {
@@ -259,6 +285,82 @@
 			 
 			 
 		},
 		},
 		methods:{
 		methods:{
+			getPoint() {
+				 
+	//			console.log('getPoint')
+				WxJsApi.getLocation().then((res) => {
+					
+					var latitude = parseFloat(res.latitude);
+					var longitude = parseFloat(res.longitude);
+					var startLngLat = [longitude,latitude];
+					var endLngLat = [_self.stationDetail.station.longitude,_self.stationDetail.station.latitude];
+					_self.calculateDistance(startLngLat,endLngLat);
+					
+					
+					console.log('当前位置' +JSON.stringify(data))
+					
+					//this.latitude2 = latitude;
+					//this.longitude2 = longitude;
+					/*uni.showToast({
+						title:JSON.stringify(res)
+					})*/
+					//this.message=JSON.stringify(res)
+				}).catch(error => {
+					uni.showToast({
+						title:JSON.stringify(error)
+					})					
+				})
+			},
+			calculateDistance(startLngLat,endLngLat){
+				var _this = this;
+				MapLoader().then(AMap1 => {
+					
+					this.AMap=AMap;
+				
+					var map=new AMap.Map("container", {
+						center: [116.397559, 39.89621],
+						zoom: 14
+					});  
+					AMap.plugin('AMap.Driving', function() {
+					  var driving = new AMap.Driving({
+					    // 驾车路线规划策略,AMap.DrivingPolicy.LEAST_TIME是最快捷模式
+					    policy: AMap.DrivingPolicy.LEAST_TIME
+					  })
+					  
+					 //var startLngLat = [116.379028, 39.865042]
+					 //var endLngLat = [116.427281, 39.903719]
+					 
+					  driving.search(startLngLat, endLngLat, function (status, result) {
+							console.log(result)
+							console.log(result.routes[0].time)//秒
+							console.log(result.routes[0].distance)//米
+							_self.stationDetail.station.distance = result.routes[0].distance/1000;
+							_self.stationDetail.station.time = result.routes[0].time/60;
+							/*uni.showToast({
+								title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+							})*/
+					  })
+					  /*
+					  var startLngLat2 = [_this.longitude, _this.latitude]
+					  var endLngLat2 = [_this.longitude2, _this.latitude2]
+					
+					  
+					  driving.search(startLngLat2, endLngLat2, function (status, result) {
+					  							console.log(result)
+					  							console.log(result.routes[0].time)//秒
+					  							console.log(result.routes[0].distance)//米
+					  							uni.showToast({
+					  								title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+					  							})
+					  })*/
+					})
+					
+				
+				}, e => {
+					//_this.mui.toast('地图加载失败');
+					console.log('地图加载失败', e)
+				})
+			},
 			getScanCode() {
 			getScanCode() {
 				if (this.userId) {
 				if (this.userId) {
 					WxJsApi.scanQRCode(1).then(res => {
 					WxJsApi.scanQRCode(1).then(res => {
@@ -334,7 +436,7 @@
 			map(){
 			map(){
 				console.log('map'+JSON.stringify(_self.station))
 				console.log('map'+JSON.stringify(_self.station))
 				_self.station.address = 'xxxxxxxxxxxxx'
 				_self.station.address = 'xxxxxxxxxxxxx'
-				this.carhelp.set(_self.stationDetail.station.id,_self.station);
+				//this.carhelp.set(_self.stationDetail.station.id,_self.station);
 				uni.navigateTo({
 				uni.navigateTo({
 					url:'stationDetailsMap?stationId='+_self.stationDetail.station.id
 					url:'stationDetailsMap?stationId='+_self.stationDetail.station.id
 					//url:'stationDetailsMap?station='+encodeURIComponent(JSON.stringify(_self.station))
 					//url:'stationDetailsMap?station='+encodeURIComponent(JSON.stringify(_self.station))

+ 111 - 158
pages/searchPile/stationAndPile/stationDetailsMap.vue

@@ -21,12 +21,12 @@
 					</view>
 					</view>
 				</view>		
 				</view>		
 				<view class="card_item" style="color:#8898A9;font-size: 15rpx;">
 				<view class="card_item" style="color:#8898A9;font-size: 15rpx;">
-					{{item.position}}
+					{{item.address}}
 				</view>
 				</view>
 				
 				
 				<view class="card_item2" >
 				<view class="card_item2" >
 					<view style="color:#FF6573;font-size:45rpx;margin-right: 10rpx;">
 					<view style="color:#FF6573;font-size:45rpx;margin-right: 10rpx;">
-						{{item.price}}
+						{{item.costPrice}}
 					</view>
 					</view>
 					<view style="display: flex; justify-content: center;align-items: center">
 					<view style="display: flex; justify-content: center;align-items: center">
 					起 元/度										
 					起 元/度										
@@ -41,11 +41,11 @@
 					</view>
 					</view>
 					<view style="display: flex;flex-direction: row;">
 					<view style="display: flex;flex-direction: row;">
 						<view style="color: #00B962;">
 						<view style="color: #00B962;">
-							空闲{{item.idleNum}}
+							空闲{{item.availableNum}}
 						</view>
 						</view>
 						
 						
 				 			<view>
 				 			<view>
-				 				/总数{{item.total}}
+				 				/总数{{item.totalNum}}
 				 			</view>
 				 			</view>
 				 		</view>
 				 		</view>
 				 	</view>
 				 	</view>
@@ -104,10 +104,49 @@
 			}
 			}
 		},
 		},
 		methods:{
 		methods:{
+			getPoint() {
+				 
+				console.log('getPoint')
+				WxJsApi.getLocation().then((res) => {
+					
+					_self.latitude = parseFloat(res.latitude);
+					_self.longitude  = parseFloat(res.longitude);
+					var startLngLat = [_self.longitude ,_self.latitude ];
+					var endLngLat = [_self.item.longitude,_self.item.latitude];
+					//_self.calculateDistance(startLngLat,endLngLat);
+					//let posCenter= {longitude: _self.longitude,latitude: _self.latitude};
+					
+					_self.$refs.amap.calculateDistance(startLngLat,endLngLat).then(function(res){
+						
+						_self.item.distance = res.distance/1000;
+						_self.item.time = res.time/60;
+						//console.log(result)
+						//console.log(result.routes[0].time)//秒
+						//console.log(result.routes[0].distance)//米
+						
+						console.log('距离'+JSON.stringify(res))
+					})
+					
+					console.log('当前位置' +JSON.stringify(data))
+					
+					//this.latitude2 = latitude;
+					//this.longitude2 = longitude;
+					/*uni.showToast({
+						title:JSON.stringify(res)
+					})*/
+					//this.message=JSON.stringify(res)
+				}).catch(error => {
+					uni.showToast({
+						title:JSON.stringify(error)
+					})					
+				})
+			},
+			
 			stationDetail(item){
 			stationDetail(item){
 				console.log('item'+JSON.stringify(item))
 				console.log('item'+JSON.stringify(item))
 				uni.navigateTo({
 				uni.navigateTo({
-					url:'stationDetails?station='+encodeURIComponent(JSON.stringify(this.item))
+					url:'stationDetails?id='+this.item.id
+					//url:'stationDetails?station='+encodeURIComponent(JSON.stringify(this.item))
 				})
 				})
 			},
 			},
 			setCenter(){
 			setCenter(){
@@ -127,118 +166,7 @@
 				})
 				})
 				
 				
 	//			console.log('setCenter')
 	//			console.log('setCenter')
-			},
-			getChargingStationData(pos){
-						//return;
-				if(pos == null)
-					return ;		 
-				let data1 = { pageIndex:0,pageSize:20};
-				if(pos.longtitude != null)
-					data1.longitude = pos.longtitude.toString();
-				if(pos.latitude != null)
-					data1.latitude = pos.latitude.toString(); 
-				//data1.findType = "0";
-				//data1.type = "1";
-				data1.online = "0";
-/*				if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('直流快充')>=0)
-					data1.type = "1";
-				else if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('交流慢充')>=0)
-					data1.type = "2";
-				
-				if(this.info.miles_type[this.preference.miles_index].distance!=null)
-					data1.radius = this.info.miles_type[this.preference.miles_index].distance.toString();
-				data1.online = "0";//在线	
-				if(pos.findType != null)
-					data1.findType = pos.findType;
-				else
-					data1.findType = "0";
-				
-				if(this.preference.obc_power.minValue!=null)
-					data1.powerStart = this.preference.obc_power.minValue.toString();
-				if(this.preference.obc_power.maxValue!=null)
-					data1.powerEnd = this.preference.obc_power.maxValue.toString();
-				*/
-				console.log('data1'+JSON.stringify(data1))
-				api.searchStationData(data1).then(function(res){
-					
-					console.log('getChargingStationData'+JSON.stringify(res))
-					if(!res.result || !res.data || !res.data.data)
-					{
-						console.log('getChargingStationData res nulll')
-						return;					
-					}
-					let items = res.data.data;
-					 
-					_self.stations_filter = [];
-					for(let i = 0;i<items.length;i++)
-					{
-						let obj = {
-									name:'',
-									position:'',
-									price:1.2,
-									idleNum:10,
-									total:10,									
-									type: data1.type == "2" ? '慢充':'快充',
-									id: i,									
-									distance:0.9,
-									time:9,
-									park: '以实际费用为准',
-//									longitude: 112.28541 + i * 0.001,
-//									latitude: 30.308354 + i * 0.01
-									};
-						if(items[i].id != null)
-							obj.id = items[i].id;
-						else
-							continue;
-						if(items[i].name!=null)
-							obj.name = items[i].name;
-						if(items[i].address!=null)
-							obj.position = items[i].address;
-						if(items[i].coostPrice!=null)
-							obj.price = items[i].coostPrice;
-						if(items[i].availableNum!=null)
-							obj.idleNum = items[i].availableNum;
-						if(items[i].totalNum!=null)
-							obj.total = items[i].totalNum;
-						if(items[i].longitude!=null)
-							obj.longitude = items[i].longitude;
-						if(items[i].latitude!=null)
-							obj.latitude = items[i].latitude;
-						if(items[i].distance!=null)
-							obj.distance = items[i].distance;
-						if(items[i].time != null){
-							obj.time = items[i].time;
-						}
-						if(items[i].park != null)
-							obj.park = items[i].park;
-						/*
-						let obj = {name:items[i].name,
-									position:items[i].address,
-									price:items[i].coostPrice,									
-									idleNum:items[i].availableNum,
-									total:items[i].totalNum,
-									distance:0.1,
-									time:1,
-									type:'慢充',
-									id: items[i].id,
-									park: i%2 == 0? '以实际费用为准':'2小时免费停车',
-									longitude: items[i].longitude,
-									latitude: items[i].latitude
-									};*/
-						_self.stations.push(obj);						
-					}
-					_self.stations_filter = _self.stations;
-					//_self.$refs.amap.searchBtn([_self.longitude, _self.latitude],_self.stationsmap)
-					//_self.$refs.amap.setChargerList(_self.stationsmap);
-					//if(_self.stationsmap.length>0)
-					//	_self.$refs.amap.updateCharger(_self.stationsmap[0]);
-					 
-				},function(err){
-					console.log('getChargingStationData err'+JSON.stringify(err))
-				}
-				)
-				console.log('getChargingStationData end')
-			},	
+			},			 
 			getScanCode() {
 			getScanCode() {
 				if (this.userId) {
 				if (this.userId) {
 					WxJsApi.scanQRCode(1).then(res => {
 					WxJsApi.scanQRCode(1).then(res => {
@@ -262,21 +190,68 @@
 				}
 				}
 			},
 			},
 			mapdown() { 
 			mapdown() { 
-						var obj = {
-							longitude: _self.longitude,
-							latitude: _self.latitude
-						}; 
-						this.$refs.amap.setCenter(obj) 
-						this.stations = [];
-						  
-					   this.stations.push(this.item);
-//					   console.log('stations1'+JSON.stringify(this.stations[0]))
-//					   console.log('stations2'+JSON.stringify(this.item))
-						this.$refs.amap.setChargerList(this.stations);
-						console.log('item'+JSON.stringify(this.item))
-						this.$refs.amap.updateCharger(this.stations[0]) 
+				let data = {stationId:this.id};
+				  
+				api.getChargingStationDetail(data).then(function(res){
+//					console.log('站点详情'+JSON.stringify(res))
+					//this.info.st
+					if(res && res.result)
+					{
+						if(res.data){
+							let data = res.data;
+							data.station.time = 0;
+							_self.item = data.station;
+							if(_self.item.park == null)
+								_self.item.park = '以实际费用为准'
+							if(_self.item.type == '2')
+								_self.item.type = '慢充'
+							else if(_self.item.type == '1')
+								_self.item.type = '快充'
+							else {
+								_self.item.type = '快/慢'
+							}
+							if(_self.item.costPrice == null){
+								if(data.fastPrice != null){
+									_self.item.costPrice = data.fastPrice.costPrice;
+									if(data.slowPrice != null){
+										if(_self.item.costPrice> data.slowPrice.costPrice){
+											_self.item.costPrice = data.slowPrice.costPrice;
+										}
+									}
+								}else if(data.slowPrice != null){ 
+									_self.item.costPrice = data.slowPrice.costPrice; 
+								}
+							}
+							
+							
+							if(_self.item.distance == null){
+								_self.getPoint();
+							} 
+							 
+							var obj = {
+								longitude: _self.item.longitude,
+								latitude: _self.item.latitude
+							}; 
+							
+							
+							_self.$refs.amap.setCenter(obj) 
+ 							_self.stations = [];
+							  
+						   _self.stations.push(_self.item);
+	//					   console.log('stations1'+JSON.stringify(this.stations[0]))
+	//					   console.log('stations2'+JSON.stringify(this.item))
+							_self.$refs.amap.setChargerList(_self.stations);
+							console.log('item'+JSON.stringify(_self.item))
+							_self.$refs.amap.updateCharger(_self.stations[0]) 
+							//_self.stationDetail = data;
+							//_self.processStationsInfo();							
+								console.log('data'+JSON.stringify(_self.item )); 
+						}
 						
 						
-					},
+					}
+					
+				})
+			}
 		},
 		},
 		onLoad(op) {
 		onLoad(op) {
 				_self = this;
 				_self = this;
@@ -284,32 +259,10 @@
 //				console.log('longitude0  ' + _self.longitude);
 //				console.log('longitude0  ' + _self.longitude);
 				if (op != null) {
 				if (op != null) {
 					if(op.stationId != null){
 					if(op.stationId != null){
-						    _self.item =  this.carhelp.get(op.stationId);
-							return;
-							/*let data = {stationId:op.stationId};
-//							if(station.distance != null)
-//								_self.stationDetail.station.distance = station.distance;
-							//console.log('station'+JSON.stringify(station))
-							//_self.station = station; 
-							console.log('stationId'+JSON.stringify(data));
-							api.getChargingStationDetail(data).then(function(res){
-								console.log('站点详情'+JSON.stringify(res))
-								//this.info.st
-								if(res && res.result)
-								{
-									if(res.data){
-										let data = res.data;
-										data.station.time = 0;
-										_self.item = data.station;
-										//data.station.distance = station.distance;
-										//_self.stationDetail = data;
-										//_self.processStationsInfo();							
-											console.log('data'+JSON.stringify(_self.item )); 
-									}
-									
-								}
-								
-							})*/
+						    //_self.item =  this.carhelp.get(op.stationId);
+							//return;
+							this.id = op.stationId;							
+							
 							return;
 							return;
 					}
 					}
 					if(op.station!=null){
 					if(op.station!=null){
@@ -341,7 +294,7 @@
 				})
 				})
 				this.isReady = true;
 				this.isReady = true;
 				this.$refs.amap.init();
 				this.$refs.amap.init();
-				 
+				
 				//let state = {};
 				//let state = {};
 				uni.getSystemInfo({
 				uni.getSystemInfo({
 					success: (res) => {
 					success: (res) => {

+ 1 - 0
pages/user/finance/refundDet.vue

@@ -46,6 +46,7 @@
 			_self = this;
 			_self = this;
 			if(op.id){
 			if(op.id){
 				let data ={id:op.id};
 				let data ={id:op.id};
+				console.log('data'+JSON.stringify(data))
 					api.personAccountRefundDetail(data).then(function(res){
 					api.personAccountRefundDetail(data).then(function(res){
 						console.log('res'+JSON.stringify(res));
 						console.log('res'+JSON.stringify(res));
 						if(res.result){
 						if(res.result){

+ 4 - 4
pages/user/finance/refundList.vue

@@ -81,7 +81,7 @@
 		onReady(){
 		onReady(){
 			if (this.carhelp.getPersonInfo()) {
 			if (this.carhelp.getPersonInfo()) {
 				this.userId = this.carhelp.getPersonInfo().id;
 				this.userId = this.carhelp.getPersonInfo().id;
-						
+				console.log('userId'+this.userId)
 			}
 			}
  
  
 			api.personAccount().then(function(res){
 			api.personAccount().then(function(res){
@@ -90,14 +90,14 @@
 					_self.account = res.data;
 					_self.account = res.data;
 					
 					
 				}
 				}
-//				console.log('个人余额信息'+JSON.stringify(res));
+				console.log('个人余额信息'+JSON.stringify(res));
 			},function(err){
 			},function(err){
 				console.log('个人信息余额错误'+JSON.stringify(err));
 				console.log('个人信息余额错误'+JSON.stringify(err));
 			});
 			});
 			let data = {pageIndex:1,pageSize:10};
 			let data = {pageIndex:1,pageSize:10};
 			api.personAccountRefundList(data).then(function(res){
 			api.personAccountRefundList(data).then(function(res){
 				if(res.result){
 				if(res.result){
-//					console.log('res'+JSON.stringify(res));
+					console.log('res'+JSON.stringify(res));
 					_self.items = res.data.data;
 					_self.items = res.data.data;
 					for(let i = 0;i< _self.items.length;i++){
 					for(let i = 0;i< _self.items.length;i++){
 						if(_self.items[i].refundChannel == 'wechat')
 						if(_self.items[i].refundChannel == 'wechat')
@@ -127,7 +127,7 @@
 				
 				
 			},
 			},
 			confirm(){
 			confirm(){
-				let data = {amount:_self.account.availableAmount,refundChannel:'wechat'}
+				let data = {amount:_self.account.totalAmount,refundChannel:'wechat'}
 				api.personAccountRefundApplication(data).then(function(res){
 				api.personAccountRefundApplication(data).then(function(res){
 					if(res.result){
 					if(res.result){