|
|
@@ -47,8 +47,8 @@ export function fetchStationPriceDesc(ConnectorID: string, StationID?: string) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- res.CurrentPrice = currentPrice;
|
|
|
- res.CurrentTime = currentTime;
|
|
|
+ res.currentPrice = currentPrice;
|
|
|
+ res.currentTime = currentTime;
|
|
|
if (StationID) {
|
|
|
res.StationID = StationID;
|
|
|
}
|
|
|
@@ -89,21 +89,21 @@ export function fetchStations(
|
|
|
const end = start + pageSize;
|
|
|
if (latitude && longitude) {
|
|
|
list.forEach((item: any) => {
|
|
|
- item.StationLatDistance = _getDistance(
|
|
|
+ item.stationLatDistance = _getDistance(
|
|
|
latitude,
|
|
|
longitude,
|
|
|
- item.StationLat,
|
|
|
- item.StationLng
|
|
|
+ item.location.stationLat,
|
|
|
+ item.location.stationLng
|
|
|
);
|
|
|
});
|
|
|
list.sort((item1: any, item2: any) => {
|
|
|
- return item1.StationLatDistance - item2.StationLatDistance;
|
|
|
+ return item1.stationLatDistance - item2.stationLatDistance;
|
|
|
});
|
|
|
}
|
|
|
if (options) {
|
|
|
if (options.distance) {
|
|
|
list = list.filter(
|
|
|
- (item: any) => item.StationLatDistance <= (options.distance || 20)
|
|
|
+ (item: any) => item.stationLatDistance <= (options.distance || 20)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -114,11 +114,11 @@ export function fetchStations(
|
|
|
});
|
|
|
if (baseLatitude && baseLongitude) {
|
|
|
data.forEach((item: any) => {
|
|
|
- item.StationLatDistance = _getDistance(
|
|
|
+ item.stationLatDistance = _getDistance(
|
|
|
baseLatitude,
|
|
|
baseLongitude,
|
|
|
- item.StationLat,
|
|
|
- item.StationLng
|
|
|
+ item.location.stationLat,
|
|
|
+ item.location.stationLng
|
|
|
);
|
|
|
});
|
|
|
}
|
|
|
@@ -129,21 +129,21 @@ export function fetchStations(
|
|
|
let res = false;
|
|
|
list = list.filter((item: any) => {
|
|
|
res = false;
|
|
|
- item.EquipmentInfos.forEach((eqInfo: any) => {
|
|
|
- eqInfo.ConnectorInfos.forEach((coInfo: any) => {
|
|
|
+ item.equipmentInfos.forEach((eqInfo: any) => {
|
|
|
+ eqInfo.connectorInfos.forEach((coInfo: any) => {
|
|
|
if (
|
|
|
!res &&
|
|
|
options.status === 1 &&
|
|
|
- coInfo.ConnectorStatusInfo &&
|
|
|
- coInfo.ConnectorStatusInfo.Status === 1
|
|
|
+ coInfo.connectorStatusInfo &&
|
|
|
+ coInfo.connectorStatusInfo.status === 1
|
|
|
) {
|
|
|
res = true;
|
|
|
}
|
|
|
if (
|
|
|
!res &&
|
|
|
options.status === 2 &&
|
|
|
- coInfo.ConnectorStatusInfo &&
|
|
|
- coInfo.ConnectorStatusInfo.Status !== 1
|
|
|
+ coInfo.connectorStatusInfo &&
|
|
|
+ coInfo.connectorStatusInfo.status !== 1
|
|
|
) {
|
|
|
res = true;
|
|
|
}
|
|
|
@@ -190,8 +190,8 @@ export function searchStation(keyword: string) {
|
|
|
}
|
|
|
|
|
|
export function fetchAllStations(): Promise<any[]> {
|
|
|
- if (getApp().globalData.stations.length > 0) {
|
|
|
- return Promise.resolve(getApp().globalData.stations);
|
|
|
+ if (getApp<any>().globalData.stations.length > 0) {
|
|
|
+ return Promise.resolve(getApp<any>().globalData.stations);
|
|
|
}
|
|
|
const page = 1;
|
|
|
const page_size = 99;
|
|
|
@@ -208,7 +208,8 @@ export function fetchAllStations(): Promise<any[]> {
|
|
|
// StationID: '0000'
|
|
|
// })
|
|
|
// }
|
|
|
- getApp().globalData.stations = list;
|
|
|
+ console.log("所有电站数据", list);
|
|
|
+ getApp<any>().globalData.stations = list;
|
|
|
resolve(list);
|
|
|
})
|
|
|
.catch(reject);
|
|
|
@@ -233,24 +234,22 @@ function _fetchAllStations(
|
|
|
|
|
|
function _fetchStations(page: number, pageSize: number) {
|
|
|
return cHttp
|
|
|
- .get<{
|
|
|
- StationInfos: any[];
|
|
|
- }>(`/charge/stationList?page_no=${page}&page_size=${pageSize}`)
|
|
|
+ .get(`/charge/listStation?pageNum=${page}&pageSize=${pageSize}`)
|
|
|
.then((res) => {
|
|
|
- res.StationInfos &&
|
|
|
- res.StationInfos.forEach((item) => {
|
|
|
- item.fastEquipmentInfos = [];
|
|
|
- item.slowEquipmentInfos = [];
|
|
|
- item.TotalFee = Number(
|
|
|
- Number(
|
|
|
- Number(item.ElectricityFee) +
|
|
|
- Number(item.ParkFee) +
|
|
|
- Number(item.ServiceFee)
|
|
|
- ).toFixed(2)
|
|
|
- );
|
|
|
- });
|
|
|
-
|
|
|
- return (res.StationInfos || []).filter((item: any) => {
|
|
|
+ const data = res || [];
|
|
|
+ data.forEach((item: any) => {
|
|
|
+ item.StationID = item.stationId;
|
|
|
+ item.fastEquipmentInfos = [];
|
|
|
+ item.slowEquipmentInfos = [];
|
|
|
+ item.totalFee = Number(
|
|
|
+ Number(
|
|
|
+ Number(item.electricityFee) +
|
|
|
+ Number(item.parkFee) +
|
|
|
+ Number(item.serviceFee)
|
|
|
+ ).toFixed(2)
|
|
|
+ );
|
|
|
+ });
|
|
|
+ return data.filter((item: any) => {
|
|
|
return !["1657"].includes(item.StationID);
|
|
|
});
|
|
|
});
|
|
|
@@ -281,38 +280,38 @@ function _fetchStationStatus(list: any[]) {
|
|
|
let _list: any[] = [];
|
|
|
return cHttp
|
|
|
.get(
|
|
|
- `/charge/stationStatus?station_ids=${list
|
|
|
+ `/charge/stationStatus?stationIds=${list
|
|
|
.filter((item) => item.StationID !== "0000")
|
|
|
.map((item) => item.StationID)
|
|
|
.join(",")}`
|
|
|
)
|
|
|
.then((res) => {
|
|
|
- const StationStatusInfos = res.StationStatusInfos || [];
|
|
|
+ const StationStatusInfos = res || [];
|
|
|
const ConnectorIDs: string[] = [];
|
|
|
const StationIDs: string[] = [];
|
|
|
list.forEach((item: any) => {
|
|
|
item.fastEquipmentInfos = [];
|
|
|
item.slowEquipmentInfos = [];
|
|
|
const StationStatusInfo = StationStatusInfos.find(
|
|
|
- (status: any) => status.StationID === Number(item.StationID)
|
|
|
+ (status: any) => Number(status.stationId) === Number(item.StationID)
|
|
|
);
|
|
|
let ConnectorID = "";
|
|
|
- item.EquipmentInfos.forEach((eqInfo: any) => {
|
|
|
- eqInfo.ConnectorInfos.forEach((coInfo: any) => {
|
|
|
+ item.equipmentInfos.forEach((eqInfo: any) => {
|
|
|
+ eqInfo.connectorInfos.forEach((coInfo: any) => {
|
|
|
if (StationStatusInfo) {
|
|
|
- const ConnectorStatusInfo =
|
|
|
- StationStatusInfo.ConnectorStatusInfos.find(
|
|
|
- (costatus: any) => costatus.ConnectorID === coInfo.ConnectorID
|
|
|
+ const connectorStatusInfo =
|
|
|
+ StationStatusInfo.connectorStatusInfos.find(
|
|
|
+ (costatus: any) => costatus.connectorId === coInfo.connectorId
|
|
|
);
|
|
|
- if (ConnectorStatusInfo) {
|
|
|
- coInfo.ConnectorStatusInfo = ConnectorStatusInfo;
|
|
|
+ if (connectorStatusInfo) {
|
|
|
+ coInfo.connectorStatusInfo = connectorStatusInfo;
|
|
|
}
|
|
|
}
|
|
|
if (!ConnectorID) {
|
|
|
- ConnectorID = coInfo.ConnectorID;
|
|
|
+ ConnectorID = coInfo.connectorId;
|
|
|
}
|
|
|
});
|
|
|
- if ([1].includes(Number(eqInfo.EquipmentType))) {
|
|
|
+ if ([1].includes(Number(eqInfo.equipmentType))) {
|
|
|
item.fastEquipmentInfos.push(eqInfo);
|
|
|
} else {
|
|
|
item.slowEquipmentInfos.push(eqInfo);
|
|
|
@@ -331,12 +330,11 @@ function _fetchStationStatus(list: any[]) {
|
|
|
);
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- // console.log('我要看的数据', res)
|
|
|
if (res && res.length) {
|
|
|
_list.forEach((item) => {
|
|
|
const i = res.findIndex((r) => r.StationID === item.StationID);
|
|
|
if (i >= 0) {
|
|
|
- item.TotalFee = res[i].CurrentPrice;
|
|
|
+ item.totalFee = res[i].currentPrice;
|
|
|
}
|
|
|
});
|
|
|
}
|