Преглед на файлове

首页、搜索、详情、扫码、收藏页面修改

zuypeng преди 11 месеца
родител
ревизия
95c95a7b77

+ 71 - 18
src/api/charge.ts

@@ -3,14 +3,14 @@ import {host, isDebug} from "../utils/constant";
 
 const cHttp = new Http(host);
 
-export function startCharge(sn: string, query?: string) {
+export function startCharge(connectorId: string, query?: string) {
     return cHttp.get<{
         ConnectorID: string;
         FailReason: number;
         StartChargeSeq: string;
         StartChargeSeqStat: number;
         SuccStat: number;
-    }>(`/charge/startCharge/${sn}?${query}`, {
+    }>(`/charge/startCharge/${connectorId}?${query}`, {
         statusCodeHandle: false,
     });
 }
@@ -97,8 +97,8 @@ export function fetchStationPriceDesc(ConnectorID: string, StationID?: string) {
     });
 }
 
-export function cancelCharge(sn: string) {
-    return cHttp.get(`/charge/stopCharge/${sn}`, {
+export function cancelCharge(connectorId: string) {
+    return cHttp.get(`/charge/stopCharge/${connectorId}`, {
         statusCodeHandle: false,
     });
 }
@@ -128,7 +128,7 @@ export function fetchChargeStatus(
                     success(modal) {
                         if (modal.confirm) {
                             uni.redirectTo({
-                                url: `/pages-charge/appointment/appointment?sn=${res.connectorId}`,
+                                url: `/pages-charge/appointment/appointment?connectorId=${res.connectorId}`,
                             });
                         }
                     },
@@ -145,7 +145,7 @@ export function fetchChargeStatus(
                     success(modal) {
                         if (modal.confirm) {
                             uni.redirectTo({
-                                url: `/pages-charge/ordering/ordering?sn=${res.connectorId}&start=1`,
+                                url: `/pages-charge/ordering/ordering?connectorId=${res.connectorId}&start=1`,
                             });
                         }
                     },
@@ -167,7 +167,7 @@ export function fetchStations(
         status?: number;
     }
 ): Promise<any[]> {
-    return fetchAllStations(latitude,longitude)
+    return fetchAllStations(latitude, longitude)
         .then((res) => {
             // console.log(latitude, longitude);
             // let list = JSON.parse(JSON.stringify(res));
@@ -285,6 +285,51 @@ export function fetchStationDetail(stationId: string) {
         });
 }
 
+
+/**
+ * 根据shortId或connectorId或equipmentId 查询站点信息(因前期为查询全部站点后前端过滤,特此进行性能优化)
+ * @param shortId
+ * @param connectorId
+ * @param equipmentId
+ */
+export function fetchStationDetailByShortIdOrConnectorIdOrEquipmentId(shortId?: string, connectorId?: string, equipmentId?: string) {
+    if (shortId) {
+        return fetchStationDetailByShortId(shortId);
+    } else if (connectorId) {
+        return fetchStationDetailByConnectorId(connectorId)
+    } else if (equipmentId) {
+        return fetchStationDetailByByEquipmentId(equipmentId)
+    }
+}
+
+export function fetchStationDetailByShortId(shortId: string) {
+    return cHttp
+        .get(`/charge/stationInfoByShortId/${shortId}`)
+        .then((res) => {
+            return res;
+        });
+}
+
+export function fetchStationDetailByConnectorId(connectorId: string) {
+    return cHttp
+        .get(`/charge/stationInfoByConnectorId/${connectorId}`)
+        .then((res) => {
+            return res;
+        });
+}
+
+/**
+ * equipmentId  可能不唯一,慎重使用
+ * @param equipmentId
+ */
+export function fetchStationDetailByByEquipmentId(equipmentId: string) {
+    return cHttp
+        .get(`/charge/stationInfoByEquipmentId/${equipmentId}`)
+        .then((res) => {
+            return res;
+        });
+}
+
 export function fetchStationByIds(ids: number[]) {
     return fetchAllStations().then((res) => {
         const list = res.filter((item) => ids.includes(Number(item.StationID)));
@@ -346,22 +391,29 @@ export function fetchStationByConnectorIdOrShortId(sn: string) {
 
 export function searchStation(keyword: string) {
     return fetchAllStations().then((res) => {
-        const reg = new RegExp(keyword, "ig");
-        const list = res.filter(
-            (item) => reg.test(item.stationName) || reg.test(item.address)
-        );
-        return _fetchStationStatus(list);
+        // const reg = new RegExp(keyword.trim(), "ig");
+        // console.log(res)
+        const stationIdList = res.filter(
+            (item) => item.stationName.includes(keyword) || item.address.includes(keyword)
+        ).map(k => k.stationId+"");
+        // console.log("serach>>>>>",list)
+        if (stationIdList) {
+            return _fetchStations(1, 100, 0, 0,  stationIdList)
+        } else {
+            return Promise.reject([])
+        }
+
     });
 }
 
-export function fetchAllStations(latitude?:number,longitude?:number): Promise<any[]> {
+export function fetchAllStations(latitude?: number, longitude?: number): Promise<any[]> {
     if (getApp<any>().globalData.stations.length > 0) {
         return Promise.resolve(getApp<any>().globalData.stations);
     }
     const page = 1;
     const page_size = 99;
     return new Promise((resolve, reject) => {
-        _fetchAllStations(page, page_size, [],latitude,longitude)
+        _fetchAllStations(page, page_size, [], latitude, longitude)
             .then((list) => {
                 // if (!isProduction) {
                 //   list.push({
@@ -399,11 +451,12 @@ function _fetchAllStations(
     });
 }
 
-function _fetchStations(page: number, pageSize: number, latitude?: number, longitude?: number) {
+export function _fetchStations(page: number, pageSize: number,
+                        latitude?: number, longitude?: number, stationIdList?: Array<string>) {
     return cHttp
-        .get(`/charge/listStation?pageNum=${page}&pageSize=${pageSize}&latitude=${latitude}&longitude=${longitude}`)
+        .get(`/charge/listStation?pageNum=${page}&pageSize=${pageSize}&latitude=${latitude||22.696779}&longitude=${longitude||114.044805}&stationIdList=${stationIdList||[]}`)
         .then((res) => {
-            console.log("xxxxx", res)
+            // console.log("xxxxx", res)
             const data = res.list || [];
             data.forEach((item: any) => {
                 item.StationID = item.stationId;
@@ -423,7 +476,7 @@ function _fetchStations(page: number, pageSize: number, latitude?: number, longi
         });
 }
 
-function _getDistance(lat1: number, lng1: number, lat2: number, lng2: number) {
+export function _getDistance(lat1: number, lng1: number, lat2: number, lng2: number) {
     var radLat1 = (lat1 * Math.PI) / 180.0;
     var radLat2 = (lat2 * Math.PI) / 180.0;
     var a = radLat1 - radLat2;

+ 5 - 5
src/components/charge-station/charge-station.vue

@@ -49,16 +49,16 @@
           <text class="fs-22 ml-6 color-666">元/度</text>
         </view>
         <view class="flex-align-center lh-0 mt-auto" v-if="!fromMap">
-          <charge-icon type="fast"></charge-icon>
+<!--          <charge-icon type="fast"></charge-icon>
           <view class="fs-22 ml-8 color-666" v-if="fast"
           >空闲:{{ freeLength(fast) }}|共:{{ fast.length }}
           </view
-          >
-          <view class="ml-60">
+          >-->
+          <view class="ml-2">
             <charge-icon type="slow"></charge-icon>
           </view>
-          <view class="fs-22 ml-8 color-666" v-if="slow"
-          >空闲:{{ freeLength(slow) }}|共:{{ slow.length }}
+          <view class="fs-22 ml-8 color-666"
+          >空闲:{{ availableParkingNum }}|共:{{ parkingNum }}
           </view
           >
         </view>

+ 71 - 28
src/pages-charge/appointment/appointment.vue

@@ -1,13 +1,13 @@
 <template>
   <view :class="['page']">
-    <view v-if="data && priceInfo">
+    <view v-if="station && priceInfo">
       <view class="block">
         <view class="station">
           <ChargeMachine
-              :title="'NO.' + data.equipment.shortId"
-              :list="data.equipment.connectorInfos"
+              :title="'NO.' + equipment.shortId"
+              :list="station.connectInfoList"
               :time="priceInfo.useTime"
-              :parkingNo="data.equipment.parkingNo"
+              :parkingNo="equipment.parkingNo"
           ></ChargeMachine>
         </view>
         <view class="pt-20 pb-20 pl-30 pr-30 flex-align-center">
@@ -16,7 +16,7 @@
               mode="widthFix"
               class="flex-shrink mr-12 width-40"
           />
-          <view class="fs-26 color-666">{{ data.station.address }}</view>
+          <view class="fs-26 color-666">{{ station.address }}</view>
         </view>
       </view>
       <!--      <view class="mt-40 ml-30 color-999 fs-32 fw-500">费用说明</view>-->
@@ -306,7 +306,17 @@
 </template>
 
 <script setup lang="ts">
-import {cancelAppointmentCharge, changeAppointmentTime, fetchChargeStatus, fetchStationByConnectorIdOrShortId, fetchStationPriceDesc, startAppointmentCharge, startCharge,} from "@/api/charge";
+import {
+  cancelAppointmentCharge,
+  changeAppointmentTime,
+  fetchChargeStatus,
+  fetchStationByConnectorIdOrShortId,
+  fetchStationDetail, fetchStationDetailByShortId, fetchStationDetailByShortIdOrConnectorIdOrEquipmentId,
+  fetchStationPriceDesc,
+  startAppointmentCharge,
+  startCharge,
+} from "@/api/charge";
+
 import {fetchProfile, listStationAvailableRightsAndCoupons} from "@/api/user";
 import {onLoad, onShow} from "@dcloudio/uni-app";
 import {ref} from "vue";
@@ -320,6 +330,9 @@ import {redirect, to} from "../../utils/navigate";
 const DAY = 24 * 60 * 60 * 1000;
 const options = ref<any>();
 const data = ref<any>();
+const equipment = ref<any>(null);
+const station = ref<any>();
+const stationId = ref<any>();
 const priceInfo = ref();
 const priceDescVisible = ref(false);
 const timesInfo = ref<any>({
@@ -368,7 +381,6 @@ const discountIndex = ref(-1);
 const discountList = ref<any[]>([]);
 const activity = ref();
 
-const stationId = ref();
 const balance = ref(0);
 
 
@@ -748,7 +760,7 @@ const submit = () => {
     title: "提交中",
     mask: true,
   });
-  startCharge(options.value.sn, query)
+  startCharge(equipment.value.connectorId, query)
       .then(() => {
         if (chargeType.value === 0) {
           fetchChargeStatus()
@@ -768,7 +780,7 @@ const submit = () => {
               });
         }
         if (chargeType.value === 1) {
-          redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
+          redirect(`/pages-charge/ordering/ordering?connectorId=${options.value.connectorId}&start=1`)
         }
       })
       .catch((err) => {
@@ -785,7 +797,7 @@ const submitNow = () => {
     title: "提交中",
     mask: true,
   });
-  startAppointmentCharge(options.value.sn)
+  startAppointmentCharge(options.value.connectorId)
       .then(() => {
         _checkStartCharge();
       })
@@ -802,7 +814,7 @@ const _checkStartCharge = () => {
   fetchChargeStatus().then((res) => {
     if (res && [2].includes(res.chargeStatus)) {
       uni.hideLoading();
-      redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
+      redirect(`/pages-charge/ordering/ordering?connectorId=${options.value.connectorId}&start=1`)
     } else {
       _checkStartCharge();
     }
@@ -834,37 +846,68 @@ const fetchUserStationDefaultRightsAndCoupon = () => {
 onLoad((_options: any) => {
   // sn=SN100523042860091 测试环境
   console.log("options", _options);
-  let sn = _options.sn;
-  let stationId = _options.stationId;
-  if(stationId){
-    stationId.value =stationId;
+  let {sn, connectorId, equipmentId} = _options
+  let _sn = _options.sn;
+  let _stationId = _options.stationId;
+  if (_stationId) {
+    stationId.value = _stationId;
   }
+  options.value = {..._options}
   uni.showLoading({
     title: "加载中",
   });
-  fetchStationByConnectorIdOrShortId(sn)
+  fetchStationDetailByShortIdOrConnectorIdOrEquipmentId(sn, connectorId, equipmentId)
       .then((res) => {
-        console.log(res);
-        let {station, equipment} = res;
-        if (station) {
-          stationId.value = station.StationID;
-          fetchUserStationDefaultRightsAndCoupon();
+        console.log("1111111111", res);
+        stationId.value = res.stationId;
+        fetchUserStationDefaultRightsAndCoupon();
+        if (sn) {
+          let cns = res.connectInfoList?.filter(k => k.shortId === sn)
+          if (cns && cns.length > 0) {
+            equipment.value = cns[0]
+          }
+        }
+
+        if (connectorId) {
+          let cns = res.connectInfoList?.filter(k => k.connectorId === connectorId)
+          if (cns && cns.length > 0) {
+            equipment.value = cns[0]
+          }
         }
-        if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
-          sn = equipment.connectorInfos[0].connectorId;
-          _options.sn = equipment.connectorInfos[0].connectorId;
+
+        if (equipmentId) {
+          let cns = res.connectInfoList?.filter(k => k.equipmentId === equipmentId)
+          if (cns && cns.length > 0) {
+            equipment.value = cns[0]
+          }
+        }
+
+
+        // if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
+        //   sn = equipment.connectorInfos[0].connectorId;
+        //   _options.sn = equipment.connectorInfos[0].connectorId;
+        // }
+        // options.value = _options;
+        // data.value = res;
+        station.value = res;
+        if(!equipment.value){
+          uni.showToast({
+            titile:'none',
+            content:"服务异常,请稍后再试。"
+          })
+          // return Promise.resolve({});
+          throw Error;
         }
-        options.value = _options;
-        data.value = res;
-        return fetchStationPriceDesc(sn);
+        return fetchStationPriceDesc(equipment.value.connectorId, res.stationId)
       })
       .then((res) => {
-        // console.log(res);
+        console.log("xxxx price", res);
         uni.hideLoading();
         priceInfo.value = res;
         return fetchChargeStatus(false, true);
       })
       .then((res) => {
+        console.log("charge status", res)
         if (res && res.isAppointment) {
           appointmentData.value = res;
           startAppointmentCountDown();

+ 3 - 3
src/pages-charge/codeing/codeing.vue

@@ -29,7 +29,7 @@
 </template>
 
 <script setup lang="ts">
-import { fetchStationByConnectorIdOrShortId } from "@/api/charge";
+import {fetchStationByConnectorIdOrShortId, fetchStationDetailByConnectorId} from "@/api/charge";
 import { ref } from "vue";
 import { scanCode } from "../../utils/code";
 import { to } from "../../utils/navigate";
@@ -48,10 +48,10 @@ const submit = () => {
   uni.showLoading({
     title: "加载中",
   });
-  fetchStationByConnectorIdOrShortId(value.value)
+  fetchStationDetailByConnectorId(value.value)
     .then(() => {
       uni.hideLoading();
-      to(`/pages-charge/appointment/appointment?sn=${value.value}`);
+      to(`/pages-charge/appointment/appointment?connectorId=${value.value}`);
     })
     .catch((err) => {
       value.value = ''

+ 2 - 2
src/pages-charge/machines/charge-machine/charge-machine.vue

@@ -50,7 +50,7 @@
         <text class="fs-32">{{ price }}</text>
         <text class="fs-22 ml-4" style="vertical-align: text-top">元</text>
       </view>
-      <view class="fs-24 lh-24 color-999 mt-10">预计费用</view>
+      <view class="fs-24 lh-24 color-999 mt-10">当前时段</view>
     </view>
     <view class="ml-auto height-60 flex-align-end" v-if="time">
       <view class="fs-24 lh-24 color-999">{{ time }}</view>
@@ -94,7 +94,7 @@ export default {
           success: (res) => {
             if (res.tapIndex === 0) {
               uni.navigateTo({
-                url: `/pages-charge/appointment/appointment?sn=${list[index].connectorId}&stationId=${list[index].stationId}`,
+                url: `/pages-charge/appointment/appointment?connectorId=${list[index].connectorId}&sn=${list[index].shortId}&stationId=${list[index].stationId}`,
               });
             }
           },

+ 3 - 1
src/pages-charge/machines/machines.vue

@@ -137,7 +137,7 @@
       >
         <ChargeMachine
             :title="'NO.' + item.shortId"
-            :price="station.totalFee"
+            :price="currentPrice"
             :list="[item]"
             :parkingNo="item.parkingNo"
         ></ChargeMachine>
@@ -209,6 +209,7 @@ const statusList = ref([
 
 const totalCount = ref(0);
 const canUseCount = ref(0);
+const currentPrice = ref(0);
 const canUseTime = ref("");
 const canUsePrice = ref("");
 const title = ref("");
@@ -283,6 +284,7 @@ onLoad((options: any) => {
       })
       .then((res) => {
         uni.hideLoading();
+        currentPrice.value = res.currentPrice;
         currentTime.value = res.currentTime;
         canUseTime.value = res.useTime;
         canUsePrice.value = `${res.minPrice}~${res.maxPrice}`;

+ 5 - 5
src/pages-charge/ordering/ordering.vue

@@ -136,7 +136,7 @@ const startStatusTimer = () => {
 const start = () => {
   step.value = 1;
   startStartTimer();
-  startCharge(options.value && options.value.sn ? options.value.sn : "")
+  startCharge(options.value && options.value.connectorId ? options.value.connectorId : "")
     .then(() => {
       fetchStatus();
     })
@@ -175,7 +175,7 @@ const cancel = () => {
               title: "正在取消",
             });
             cancelCharge(
-              options.value && options.value.sn ? options.value.sn : ""
+              options.value && options.value.connectorId ? options.value.connectorId : ""
             )
               .then(() => {
                 // console.log(res)
@@ -260,7 +260,7 @@ const finish = () => {
           });
         }
         chargeInfo.value = _chargeInfo;
-        cancelCharge(options.value && options.value.sn ? options.value.sn : "")
+        cancelCharge(options.value && options.value.connectorId ? options.value.connectorId : "")
           .then(() => {
             if (res.failReason) {
               uni.hideLoading();
@@ -374,11 +374,11 @@ const onImgLoad = () => {
   fetchChargeStatus()
     .then((res) => {
       if (res && res.isAppointment) {
-        to(`/pages-charge/appointment/appointment?sn=${options.value.sn}`);
+        to(`/pages-charge/appointment/appointment?connectorId=${options.value.connectorId}`);
         return;
       }
       if (res && res.isStarted) {
-        if (options.value && options.value.sn === res.connectorId) {
+        if (options.value && options.value.connectorId === res.connectorId) {
           fetchStatus(res);
           return;
         }

+ 64 - 44
src/pages-charge/search/search.vue

@@ -4,36 +4,36 @@
   </view>
 
   <image
-    src="/static/images/back.png"
-    mode="widthFix"
-    class="back"
-    @click="back"
-    :style="backStyle"
+      src="/static/images/back.png"
+      mode="widthFix"
+      class="back"
+      @click="back"
+      :style="backStyle"
   ></image>
 
   <view
-    class="search flex-align-center"
-    v-if="searchStyle"
-    :style="searchStyle"
+      class="search flex-align-center"
+      v-if="searchStyle"
+      :style="searchStyle"
   >
     <view class="search_icon flex-center flex-shrink">
       <icon type="search" size="18" color="rgba(0,0,0,0.3)"></icon>
     </view>
     <input
-      class="search_input flex-grow"
-      :value="keyword"
-      type="text"
-      :focus="true"
-      placeholder="搜索附近充电站"
-      placeholder-class="input-placeholder"
-      @input="input"
-      @confirm="search"
-      confirm-type="search"
+        class="search_input flex-grow"
+        :value="keyword"
+        type="text"
+        :focus="true"
+        placeholder="搜索附近充电站"
+        placeholder-class="input-placeholder"
+        @input="input"
+        @confirm="search"
+        confirm-type="search"
     />
     <view
-      class="search_close flex-align-center flex-shrink"
-      @click.stop="clear"
-      v-if="keyword"
+        class="search_close flex-align-center flex-shrink"
+        @click.stop="clear"
+        v-if="keyword"
     >
       <image class="icon" src="/static/images/search-close.png"></image>
     </view>
@@ -43,24 +43,27 @@
     <view class="pl-20 pr-20" v-if="list.length">
       <view class="mt-20" v-for="(item, index) in list" :key="index">
         <charge-station
-          :title="item.stationName"
-          :tag="item.construction"
-          :price="item.totalFee"
-          :fast="item.fastEquipmentInfos"
-          :slow="item.slowEquipmentInfos"
-          :sId="item.StationID"
-          :address="item.address"
-          :latitude="item.location.stationLat"
-          :longitude="item.location.stationLng"
-          :border="true"
+            :title="item.stationName"
+            :tag="item.construction"
+            :price="item.totalFee"
+            :fast="item.fastEquipmentInfos"
+            :slow="item.slowEquipmentInfos"
+            :sId="item.StationID"
+            :address="item.address"
+            :latitude="item.location.stationLat"
+            :longitude="item.location.stationLng"
+            :distance="item.stationLatDistance"
+            :availableParkingNum="item.availableParkingNum"
+            :parkingNum="item.parkingNum"
+            :border="true"
         ></charge-station>
       </view>
     </view>
     <view class="empty flex-center flex-column" v-else>
       <image
-        class="image"
-        src="/static/images/search-empty.png"
-        mode="widthFix"
+          class="image"
+          src="/static/images/search-empty.png"
+          mode="widthFix"
       ></image>
       <view class="tip">无搜索结果...</view>
     </view>
@@ -68,9 +71,10 @@
 </template>
 
 <script setup lang="ts">
-import { searchStation } from "@/api/charge";
-import { onLoad } from "@dcloudio/uni-app";
-import { ref } from "vue";
+import {_getDistance, searchStation} from "@/api/charge";
+import {onLoad} from "@dcloudio/uni-app";
+import {ref} from "vue";
+
 const searchStyle = ref<any>();
 const backStyle = ref<any>();
 const keyword = ref("");
@@ -112,14 +116,27 @@ const search = function () {
     title: "搜索中",
   });
   searchStation(keyword.value)
-    .then((res) => {
-      uni.hideLoading();
-      list.value = res;
-    })
-    .catch(() => {
-      uni.hideLoading();
-      list.value = [];
-    });
+      .then((res) => {
+        console.log("search result", res)
+        uni.hideLoading();
+        if (res && res.length > 0) {
+          let {latitude, longitude} = getApp<any>().globalData.fetchLocation
+          res.forEach(item => {
+            item.stationLatDistance = _getDistance(
+                latitude||22.696779,
+                longitude||114.044805,
+                item.location.stationLat,
+                item.location.stationLng
+            );
+            item.totalFee = (Number(item.serviceFee)+Number(item.electricityFee)).toFixed(2)
+          })
+        }
+        list.value = res;
+      })
+      .catch(() => {
+        uni.hideLoading();
+        list.value = [];
+      });
 };
 </script>
 
@@ -153,6 +170,7 @@ const search = function () {
 
   &_close {
     width: 50rpx;
+
     .icon {
       height: 30rpx;
       width: 30rpx;
@@ -162,9 +180,11 @@ const search = function () {
 
 .empty {
   margin-top: 240rpx;
+
   .image {
     width: 368rpx;
   }
+
   .tip {
     font-size: 24rpx;
     color: rgba(0, 0, 0, 0.4);

+ 28 - 5
src/pages-user/collect/collect.vue

@@ -11,6 +11,9 @@
         :address="item.address"
         :latitude="item.location.stationLat"
         :longitude="item.location.stationLng"
+        :distance="item.stationLatDistance"
+        :availableParkingNum="item.availableParkingNum"
+        :parkingNum="item.parkingNum"
       ></charge-station>
     </view>
   </view>
@@ -28,16 +31,36 @@
 </template>
 
 <script setup lang="ts">
-import { fetchStationByIds } from "../../api/charge";
+import {_fetchStations, _getDistance, fetchStationByIds} from "../../api/charge";
 import { fetchCollectList } from "../../api/user";
 import { onLoad } from "@dcloudio/uni-app";
 import { ref } from "vue";
 const list = ref<any[]>();
 onLoad(() => {
-  fetchCollectList().then((collectIds) => {
-    fetchStationByIds(collectIds || []).then((res: any) => {
-      list.value = res;
-    });
+  fetchCollectList().then((stationIdList) => {
+    if (stationIdList) {
+      return _fetchStations(1, 100, 0, 0,  stationIdList)
+    } else {
+      return Promise.reject([])
+    }
+
+    // fetchStationByIds(collectIds || []).then((res: any) => {
+    //   list.value = res;
+    // });
+  }).then(res=>{
+    if (res && res.length > 0) {
+      let {latitude, longitude} = getApp<any>().globalData.fetchLocation
+      res.forEach(item => {
+        item.stationLatDistance = _getDistance(
+            latitude||22.696779,
+            longitude||114.044805,
+            item.location.stationLat,
+            item.location.stationLng
+        );
+        item.totalFee = (Number(item.serviceFee)+Number(item.electricityFee)).toFixed(2)
+      })
+    }
+    list.value = res;
   });
 });
 </script>

+ 3 - 3
src/pages/map/map.vue

@@ -698,7 +698,7 @@ const mapChange = (e: any) => {
 };
 
 
-const debounceRefreshStation = debounce(() => {
+const debounceRefreshStation = throttle(() => {
   const { latitude, longitude } = currentLocation.value;
   stationPage.value.page = 1;
   console.log("debounceRefreshStation run...")
@@ -783,8 +783,8 @@ const touchCardMove = (e: any) => {
 const toCharging = () => {
   to(
     charging.value.chargeStatus === 0
-      ? `/pages-charge/appointment/appointment?sn=${charging.value.connectorId}`
-      : `/pages-charge/ordering/ordering?sn=${charging.value.connectorId}&start=1`
+      ? `/pages-charge/appointment/appointment?connectorId=${charging.value.connectorId}`
+      : `/pages-charge/ordering/ordering?sn=${charging.value.connectorId}&start=1&connectorId=${charging.value.connectorId}`
   );
 };
 </script>

+ 1 - 0
src/utils/location.ts

@@ -14,6 +14,7 @@ export function fetchLocation() {
           latitude,
           longitude
         }
+        getApp<any>().globalData.fetchLocation = cacheLocation
         resolve(cacheLocation)
       },
       fail: err => {