|
@@ -21,12 +21,12 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card_item" style="color:#8898A9;font-size: 15rpx;">
|
|
|
- {{item.position}}
|
|
|
+ {{item.address}}
|
|
|
</view>
|
|
|
|
|
|
<view class="card_item2" >
|
|
|
<view style="color:#FF6573;font-size:45rpx;margin-right: 10rpx;">
|
|
|
- {{item.price}}
|
|
|
+ {{item.costPrice}}
|
|
|
</view>
|
|
|
<view style="display: flex; justify-content: center;align-items: center">
|
|
|
起 元/度
|
|
@@ -41,11 +41,11 @@
|
|
|
</view>
|
|
|
<view style="display: flex;flex-direction: row;">
|
|
|
<view style="color: #00B962;">
|
|
|
- 空闲{{item.idleNum}}
|
|
|
+ 空闲{{item.availableNum}}
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
- /总数{{item.total}}
|
|
|
+ /总数{{item.totalNum}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -104,10 +104,49 @@
|
|
|
}
|
|
|
},
|
|
|
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){
|
|
|
console.log('item'+JSON.stringify(item))
|
|
|
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(){
|
|
@@ -127,118 +166,7 @@
|
|
|
})
|
|
|
|
|
|
// 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() {
|
|
|
if (this.userId) {
|
|
|
WxJsApi.scanQRCode(1).then(res => {
|
|
@@ -262,21 +190,68 @@
|
|
|
}
|
|
|
},
|
|
|
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) {
|
|
|
_self = this;
|
|
@@ -284,32 +259,10 @@
|
|
|
// console.log('longitude0 ' + _self.longitude);
|
|
|
if (op != 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;
|
|
|
}
|
|
|
if(op.station!=null){
|
|
@@ -341,7 +294,7 @@
|
|
|
})
|
|
|
this.isReady = true;
|
|
|
this.$refs.amap.init();
|
|
|
-
|
|
|
+
|
|
|
//let state = {};
|
|
|
uni.getSystemInfo({
|
|
|
success: (res) => {
|