zhupeng 3 anni fa
parent
commit
119ecedffe

+ 20 - 1
apis/site.js

@@ -1,6 +1,25 @@
 import request from '../utils/request.js';
 import request from '../utils/request.js';
 import Qs from 'qs';
 import Qs from 'qs';
-export function geChargingStationData(data){
+
+
+export function getChargingStationDetail(data){
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/chargingStation/chargingStationDetail'
+	})
+}
+
+export function getChargingStationPrice(data){
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/chargingStation/chargingStationPrice'
+	})
+}
+
+
+export function getChargingStationData(data){
 	return request({
 	return request({
 		method: 'post',
 		method: 'post',
 		data: data,
 		data: data,

+ 6 - 6
components/Chargermap.vue

@@ -148,13 +148,13 @@
 				 {
 				 {
 					 let item = endLst[i];
 					 let item = endLst[i];
 					 let endLngLat = [item.longitude,item.latitude]
 					 let endLngLat = [item.longitude,item.latitude]
-					 console.log('search start['+JSON.stringify(startLngLat))					 
-					 console.log('search end]'+JSON.stringify(endLngLat))
+//					 console.log('search start['+JSON.stringify(startLngLat))					 
+//					 console.log('search end]'+JSON.stringify(endLngLat))
 					 
 					 
 					  driving.search(startLngLat, endLngLat, function (status, result) {
 					  driving.search(startLngLat, endLngLat, function (status, result) {
-							console.log(result)
-							console.log('秒'+result.routes[0].time)//秒
-							console.log('距离'+result.routes[0].distance)//米
+//							console.log(result)
+//							console.log('秒'+result.routes[0].time)//秒
+//							console.log('距离'+result.routes[0].distance)//米
 							//uni.showToast({
 							//uni.showToast({
 							//	title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
 							//	title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
 							//})
 							//})
@@ -184,7 +184,7 @@
 //				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);
-					console.log('更新充电桩['+ index + ']'+JSON.stringify(pos)) 
+//					console.log('更新充电桩['+ index + ']'+JSON.stringify(pos)) 
 				if(index>=0){
 				if(index>=0){
 					let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: rgba(0, 185, 98, 100);text-align: center;display: flex;";
 					let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: rgba(0, 185, 98, 100);text-align: center;display: flex;";
 					let corner2=" width: 0;height: 0;position: absolute;top: 36px;left: 0;right: 0;margin: auto;border-bottom: 6px solid transparent;border-left: 6px solid transparent;border-right: 6px solid transparent;border-top: 8px solid #00b962 ;";
 					let corner2=" width: 0;height: 0;position: absolute;top: 36px;left: 0;right: 0;margin: auto;border-bottom: 6px solid transparent;border-left: 6px solid transparent;border-right: 6px solid transparent;border-top: 8px solid #00b962 ;";

+ 24 - 5
pages/search/search.vue

@@ -2,10 +2,10 @@
 <template>
 <template>
 	<view>
 	<view>
 		<u-navbar title="">
 		<u-navbar title="">
-			<u-search class="search" placeholder="搜索站点名称" v-model="keyword" color="#c8c8c8" @search="search" @click="search" @clickicon='back' @custom='search'></u-search>
+			<u-search class="search" placeholder="搜索站点名称" @change="search" v-model="keyword" color="#c8c8c8" @search="search" @click="search" @clickicon='back' @custom='search'></u-search>
 		</u-navbar>
 		</u-navbar>
 		<view class="recommend">推荐充电站</view>
 		<view class="recommend">推荐充电站</view>
-		<view class="charing-slow" v-for="(item,index) in stations" :key="item.id">
+		<view class="charing-slow" v-for="(item,index) in stations_filter" :key="item.id">
 			<text :class="item.type == '慢充'? 'trickle-charge':'fast-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
 			<text :class="item.type == '慢充'? 'trickle-charge':'fast-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
 			<view class="address">
 			<view class="address">
 				{{item.position}}
 				{{item.position}}
@@ -39,17 +39,25 @@
 			
 			
 			return {
 			return {
 				keyword:'',
 				keyword:'',
+			  stations_filter:[],
 			  stations:[
 			  stations:[
-					{name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idleNum:10,total:10,distance:0.1,time:1,type:'慢充',park:'2小时免费停车'},
+/*					{name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idleNum:10,total:10,distance:0.1,time:1,type:'慢充',park:'2小时免费停车'},
 					{name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idleNum:10,total:10,distance:0.15,time:12,type:'快充',park:'3小时免费停车'},
 					{name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idleNum:10,total:10,distance:0.15,time:12,type:'快充',park:'3小时免费停车'},
 					{name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idleNum:10,total:10,distance:0.2,time:13,type:'慢充',park:'4小时免费停车'},
 					{name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idleNum:10,total:10,distance:0.2,time:13,type:'慢充',park:'4小时免费停车'},
 					{name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idleNum:10,total:10,distance:0.3,time:14,type:'快充',park:'5小时免费停车'},
 					{name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idleNum:10,total:10,distance:0.3,time:14,type:'快充',park:'5小时免费停车'},
-				
+	*/			
 				],
 				],
 			}
 			}
+		},
+		onLoad(op){
+			if(op!= null && op.stationlist != null){
+				this.stations = decodeURIComponent(op.stationlist)
+				console.log('stations'+JSON.stringify(this.stations))
+			}
+			console.log('op'+JSON.stringify(op))
 		},
 		},
 		 // conponents:{charingSlows},
 		 // conponents:{charingSlows},
-		methods: {
+		methods: { 
 			back(){
 			back(){
 				console.log('back');
 				console.log('back');
 				uni.navigateBack({
 				uni.navigateBack({
@@ -57,6 +65,17 @@
 				})
 				})
 			},
 			},
 			search(){
 			search(){
+				console.log('search')
+				this.stations_filter = []
+				if(this.keyword.length<=0){
+					this.stations_filter = this.stations
+				}
+				for(let i = 0;i< this.stations.length;i++){
+					if(this.stations[i].name.indexOf(this.keyword)>=0){
+						this.stations_filter.push(this.stations[i]);
+					}
+				}
+				
 				console.log('search ' + this.keyword);
 				console.log('search ' + this.keyword);
 			}
 			}
 		}
 		}

+ 19 - 4
pages/searchPile/searchPile.vue

@@ -132,7 +132,7 @@
 			</view>
 			</view>
 			<view v-show="!viewMode" >
 			<view v-show="!viewMode" >
 				 
 				 
-				<view v-for="(item,index) in stationslist" :key="item.id" class="charing-slow" >
+				<view v-for="(item,index) in stationslist" :key="item.id" class="charing-slow"   @click="stationDetail(item)">
 					<text :class="item.type == '快充' ? 'fast-charge':'trickle-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
 					<text :class="item.type == '快充' ? 'fast-charge':'trickle-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
 					<view class="address">
 					<view class="address">
 						{{item.position}}
 						{{item.position}}
@@ -171,7 +171,7 @@
 					<swiper :current="currentIndex" @change="swiperChange" @transition="swiperTransition" style="height: 100%;">
 					<swiper :current="currentIndex" @change="swiperChange" @transition="swiperTransition" style="height: 100%;">
 					 	<swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">							 
 					 	<swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">							 
 							
 							
-							<view class="swiper-item" style="height: 100%; background-color: #ffffff;">
+							<view class="swiper-item" style="height: 100%; background-color: #ffffff;" @click="stationDetail(item)">
 								<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;">
 								<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;">
 									<view style="display: flex;flex-direction: row;">
 									<view style="display: flex;flex-direction: row;">
 										<view :class="item.type == '快充'? 'fast-charge':'trickle-charge'" >
 										<view :class="item.type == '快充'? 'fast-charge':'trickle-charge'" >
@@ -358,7 +358,8 @@ export default {
 		navigate(){
 		navigate(){
 			console.log('naviage to ')
 			console.log('naviage to ')
 			uni.navigateTo({
 			uni.navigateTo({
-				url:'/pages/search/search'
+				url:'/pages/search/search?stationlist='+encodeURIComponent(JSON.stringify(_self.stationsmap))
+					 
 			})
 			})
 		},
 		},
 		getPoint() {
 		getPoint() {
@@ -411,6 +412,12 @@ export default {
 		  // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
 		  // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
 		  console.log(this.timer);
 		  console.log(this.timer);
 		},
 		},
+		stationDetail(item){
+			uni.navigateTo({
+				url:'stationAndPile/stationDetails?station='+encodeURIComponent(JSON.stringify(item))
+			})
+//			console.log('stationDetail'+JSON.stringify(item))
+		},
 		location(e){
 		location(e){
 			if(e.position){
 			if(e.position){
 				if(e.position.latitude && e.position.longitude)
 				if(e.position.latitude && e.position.longitude)
@@ -455,7 +462,7 @@ export default {
 				data1.powerEnd = this.preference.obc_power.maxValue.toString();
 				data1.powerEnd = this.preference.obc_power.maxValue.toString();
 			
 			
 			console.log('data1'+JSON.stringify(data1))
 			console.log('data1'+JSON.stringify(data1))
-			api.geChargingStationData(data1).then(function(res){
+			api.getChargingStationData(data1).then(function(res){
 				
 				
 				if(!res.result || !res.data || !res.data.data)
 				if(!res.result || !res.data || !res.data.data)
 				{
 				{
@@ -485,6 +492,10 @@ export default {
 //									longitude: 112.28541 + i * 0.001,
 //									longitude: 112.28541 + i * 0.001,
 //									latitude: 30.308354 + i * 0.01
 //									latitude: 30.308354 + i * 0.01
 									};
 									};
+						if(items[i].id != null)
+							obj.id = items[i].id;
+						else
+							continue;
 						if(items[i].name!=null)
 						if(items[i].name!=null)
 							obj.name = items[i].name;
 							obj.name = items[i].name;
 						if(items[i].address!=null)
 						if(items[i].address!=null)
@@ -545,6 +556,10 @@ export default {
 	//									longitude: 112.28541 + i * 0.001,
 	//									longitude: 112.28541 + i * 0.001,
 	//									latitude: 30.308354 + i * 0.01
 	//									latitude: 30.308354 + i * 0.01
 								};
 								};
+							if(items[i].id != null)
+								obj.id = items[i].id;
+							else
+								continue;
 							if(items[i].name!=null)
 							if(items[i].name!=null)
 								obj.name = items[i].name;
 								obj.name = items[i].name;
 							if(items[i].address!=null)
 							if(items[i].address!=null)

File diff suppressed because it is too large
+ 44 - 21
pages/searchPile/stationAndPile/stationDetails.vue


+ 7 - 2
pages/searchPile/stationAndPile/stationDetailsMap.vue

@@ -7,8 +7,8 @@
 				<Chargermap   ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
 				<Chargermap   ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
 			</view>
 			</view>
 			 
 			 
-			 <view class="chargerCard" >
-				<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;">
+			 <view class="chargerCard" @click="stationDetail(item)">
+				<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;" >
 					<view style="display: flex;flex-direction: row;">
 					<view style="display: flex;flex-direction: row;">
 						<view class="round2" style="margin-right: 5rpx;">
 						<view class="round2" style="margin-right: 5rpx;">
 							{{item.type}}
 							{{item.type}}
@@ -97,6 +97,11 @@
 			}
 			}
 		},
 		},
 		methods:{
 		methods:{
+			stationDetail(item){
+				uni.navigateTo({
+					url:'stationDetails?station='+encodeURIComponent(item)
+				})
+			},
 			charge(){
 			charge(){
 				 console.log('扫码充电')
 				 console.log('扫码充电')
 				//#ifdef MP-WEIXIN
 				//#ifdef MP-WEIXIN

Some files were not shown because too many files changed in this diff