|
@@ -56,10 +56,10 @@
|
|
|
<view class="round">
|
|
|
<text class="iconfont distance-font"></text>
|
|
|
<view style="margin-right: 10rpx;">
|
|
|
- {{item.distance.toFixed(2)}}公里
|
|
|
+ {{item.distance!=null?item.distance.toFixed(2):''}}公里
|
|
|
</view>
|
|
|
<view style="margin-right: 10rpx;">
|
|
|
- {{item.time.toFixed(0)}}分钟
|
|
|
+ {{item.time!=null?item.time.toFixed(0):''}}分钟
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -72,6 +72,7 @@
|
|
|
|
|
|
<script>
|
|
|
let _self;
|
|
|
+ import * as api from '@/apis/site.js';
|
|
|
import * as indexAPI from '@/apis/index.js'
|
|
|
import Chargermap from '@/components/Chargermap.vue';
|
|
|
import * as WxJsApi from '@/utils/wxJsApi.js'
|
|
@@ -127,6 +128,117 @@
|
|
|
|
|
|
// 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 => {
|
|
@@ -158,17 +270,48 @@
|
|
|
this.stations = [];
|
|
|
|
|
|
this.stations.push(this.item);
|
|
|
- console.log('stations1'+JSON.stringify(this.stations[0]))
|
|
|
- console.log('stations2'+JSON.stringify(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])
|
|
|
|
|
|
},
|
|
|
},
|
|
|
onLoad(op) {
|
|
|
_self = this;
|
|
|
+
|
|
|
// 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 ));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ })*/
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(op.station!=null){
|
|
|
console.log('op.station ' + op.station);
|
|
|
this.item = JSON.parse(decodeURIComponent(op.station));
|