瀏覽代碼

chore: 死代码大扫除——移除废弃页面/死函数/未用导入,清理全部 console.log 调试日志并在生产构建剔除

skyline 3 周之前
父節點
當前提交
57d7cf14d8

+ 0 - 50
charge-front/src/api/auth.ts

@@ -22,7 +22,6 @@ const _resolveTokenQueue = function (res: any) {
   _tokenQueue.pending = false;
   uni.hideLoading();
   if (res.errMsg) {
-    console.log(res);
     uni.showModal({
       title: "登录失败",
       content: `${res.errMsg}`,
@@ -107,55 +106,6 @@ export function login(e: any): Promise<string> {
   });
 }
 
-export function refresh(): Promise<string> {
-  return new Promise((resolve, reject) => {
-    _tokenStorage.get("token").then((token) => {
-      if (!token) {
-        clearToken();
-        reject({
-          errMsg: "请登录",
-        });
-        uni.reLaunch({
-          url: "/pages/map/map",
-        });
-      } else {
-        getApp<any>().globalData.token = "";
-        _tokenStorage.clear("token");
-        uni.request({
-          url: `${host}/user/refresh`,
-          method: "GET",
-          dataType: "json",
-          header: {
-            Authorization: token,
-          },
-          success: (res: any) => {
-            console.log("refresh返回", res);
-            const { statusCode, data } = res;
-            if (
-              statusCode === 200 &&
-              data &&
-              data.msg === "OK" &&
-              data.code === 200
-            ) {
-              resolve(data.data.access_token);
-            } else {
-              if (data.code === 21005) {
-                uni.reLaunch({
-                  url: "/pages/map/map",
-                });
-              }
-              reject({
-                errMsg: `${JSON.stringify(res)}`,
-              });
-            }
-          },
-          fail: reject,
-        });
-      }
-    });
-  });
-}
-
 export function onLogin(cb: (token: string) => void) {
   _onTokenListener.push({
     cb,

+ 0 - 4
charge-front/src/api/index.ts

@@ -36,10 +36,6 @@ export function fetchInvoiceList() {
   return indexHttp.get("/invoice/list?status=1");
 }
 
-export function cancelApplyInvoice() {
-  return indexHttp.get("/invoice/cancelApplyInvoice");
-}
-
 export function fetchInvoicePDF(invoiceId: string) {
   return indexHttp.get(`/invoice/downloadInvoice/${invoiceId}`);
 }

+ 0 - 1
charge-front/src/components/style-checkbox/style-checkbox.vue

@@ -36,7 +36,6 @@ export default {
   },
   methods:{
     handleClick(){
-      console.log(!this.checked)
       this.$emit('on-checkChange',!this.checked);
     }
   }

+ 0 - 861
charge-front/src/pages-charge/appointment/appointment-backup.vue

@@ -1,861 +0,0 @@
-<template>
-  <view :class="['page']">
-    <view v-if="data && priceInfo">
-      <view class="block">
-        <view class="station">
-          <ChargeMachine
-              :title="'NO.' + data.equipment.shortId"
-              :list="data.equipment.connectorInfos"
-              :time="priceInfo.useTime"
-              :parkingNo="data.equipment.parkingNo"
-          ></ChargeMachine>
-        </view>
-        <view class="pt-20 pb-20 pl-30 pr-30 flex-align-center">
-          <image
-              src="../static/machines-banner-address.png"
-              mode="widthFix"
-              class="flex-shrink mr-12 width-40"
-          />
-          <view class="fs-26 color-666">{{ data.station.address }}</view>
-        </view>
-      </view>
-      <!--      <view class="mt-40 ml-30 color-999 fs-32 fw-500">费用说明</view>-->
-      <view
-          class="mt-20 block height-96 flex-align-center pl-30 pr-30"
-          @click="openPriceDesc"
-      >
-        <view class="fs-28 color-000">充电费用</view>
-        <view class="ml-64 fs-26 color-333"
-        >{{ priceInfo.minPrice }}~{{ priceInfo.maxPrice }}元/度
-        </view
-        >
-        <view class="ml-auto">
-          <uni-icons type="right" size="16" color="rgba(0,0,0,0.4)"></uni-icons>
-        </view>
-      </view>
-      <template v-if="appointmentData">
-        <view class="mt-40 color-999 fs-32 fw-500">已预约充电</view>
-        <view class="mt-20 block flex-align-center" style="height: 180rpx">
-          <image
-              class="width-56 ml-30"
-              src="../static/icon-alarm.png"
-              mode="widthFix"
-          ></image>
-          <view class="ml-24">
-            <view class="flex" v-if="appointmentCountDown">
-              <view class="fs-28 color-000">将在</view>
-              <view class="fs-44 lh-36 color-primary ml-8 mr-8">{{
-                  appointmentCountDown
-                }}
-              </view>
-              <view class="fs-28 color-000">后开始充电</view>
-            </view>
-            <view class="fs-24 color-999 mt-8"
-            >请在{{ appointmentData.startTime }}前到达充电桩并开始充电
-            </view
-            >
-          </view>
-        </view>
-        <view class="mt-40 flex-center">
-          <view
-              class="flex-center height-68 br-68 fs-26 color-666"
-              style="width: 184rpx; border: 1px solid rgba(0, 0, 0, 0.3)"
-              @click="cancelAppointment"
-          >取消预约
-          </view
-          >
-        </view>
-      </template>
-      <template v-else>
-        <!--        <view class="mt-40 ml-30 color-999 fs-32 fw-500">选择充电方式</view>-->
-        <view class="mt-20 block pl-30 pr-30">
-          <view
-              v-for="(type, index) in chargeTypes"
-              :key="index"
-              :class="['pt-40', 'pb-40', 'flex-align-center']"
-              :style="{
-              borderTop: index === 0 ? '' : '1rpx solid rgba(0, 0, 0, 0.10)',
-            }"
-              @click="changeType(index)"
-          >
-            <view>
-              <view class="fs-28 lh-28 color-000 fw-500">{{ type.title }}</view>
-              <view
-                  class="fs-24 lh-24 mt-16"
-                  style="color: #f8386a"
-                  v-if="chargeType === index"
-              >{{ type.checkTip }}
-              </view
-              >
-              <view class="fs-24 color-999 lh-24 mt-16" v-else>{{
-                  type.tip
-                }}
-              </view>
-            </view>
-            <view class="ml-auto">
-              <style-checkbox :checked="chargeType === index"></style-checkbox>
-            </view>
-          </view>
-        </view>
-        <view class="mt-20 block pl-30 pr-30" v-if="chargeType === 0">
-          <view
-              class="pt-40 pb-40 flex-between"
-              style="border-bottom: 1rpx solid rgba(0, 0, 0, 0.1)"
-              @click="selectTime"
-          >
-            <view class="fs-28 color-000 fw-500">充电时间</view>
-            <view class="flex-align-center lh-28">
-              <block v-if="chargeTime.isPowerSaving">
-                <view class="fs-28 color-333 fw-500 mr-16">00:00 - 08:00</view>
-              </block>
-              <block v-else>
-                <view
-                    v-if="chargeTime.format"
-                    class="fs-28 color-333 fw-500 mr-16"
-                >{{ chargeTime.format }}
-                </view
-                >
-                <view v-else class="fs-26 mr-16" style="color: #cacaca"
-                >请选择
-                </view
-                >
-                <uni-icons type="right" size="16" color="#CACACA"></uni-icons>
-              </block>
-            </view>
-          </view>
-          <view class="pt-40 pb-40 flex-between">
-            <view class="fs-28 color-000 fw-500">预计费用</view>
-            <view class="flex-align-center lh-28">
-              <block v-if="chargeTime.isPowerSaving">
-                <view class="fs-28 color-333 fw-500"
-                >低至{{ priceInfo.minPrice }}元/kwh
-                </view
-                >
-              </block>
-              <block v-else>
-                <view
-                    v-if="chargeTime.formatPrice"
-                    class="fs-28 color-333 fw-500"
-                >{{ chargeTime.formatPrice }}
-                </view
-                >
-                <view v-else class="fs-26 mr-16" style="color: #cacaca"
-                >选择时间后显示
-                </view
-                >
-              </block>
-            </view>
-          </view>
-        </view>
-
-        <view
-            class="mt-20 block flex-align-center pl-30 pr-30 pt-30 pb-30"
-            @click="
-            to(
-              `/pages-charge/discount/discountV2?rightsId=${userRechargeRightsId}&couponId=${userCouponId}&stationId=${stationId}`
-            )
-          "
-        >
-          <view class="fs-28 lh-28 color-000 fw-500">优惠</view>
-          <block v-if="discountList.length > 0">
-            <view class="fs-28 lh-28 ml-auto" style="color: #f43636"
-            >{{ discountList[discountIndex].discountFormat.toFixed(1) }}折
-            </view
-            >
-            <uni-icons type="right" size="16" color="#CACACA"></uni-icons>
-          </block>
-          <block v-else-if="activity">
-            <view class="fs-28 lh-28 ml-auto" style="color: #f43636"
-            >{{ activity.minDiscount }}折
-            </view
-            >
-            <view class="fs-28 lh-28 color-666 ml-8">权益待领取</view>
-            <uni-icons type="right" size="16" color="#CACACA"></uni-icons>
-          </block>
-          <view v-else class="fs-28 lh-28 color-666 ml-auto">无</view>
-        </view>
-
-        <view
-            class="mt-20 block flex-align-center pl-30 pr-30 pt-30 pb-30"
-            v-if="chargeType === 0"
-        >
-          <view class="flex-column">
-            <view class="fs-28 lh-28 color-000 fw-500">省钱模式</view>
-            <view class="fs-24 lh-30 color-999 mt-8"
-            >处于00:00-08:00时,电费低至{{ priceInfo.minPrice }}元/kwh
-            </view
-            >
-          </view>
-          <view class="ml-auto">
-            <switch
-                :checked="chargeTime.isPowerSaving"
-                color="#2d9e95"
-                @change="changePowerSaving"
-            />
-          </view>
-        </view>
-      </template>
-      <view class="pt-60 pb-80"></view>
-      <style-bottom-view>
-        <view class="pt-20 pl-40 pr-40 pb-20 bg-fff flex">
-          <template v-if="appointmentData">
-            <view class="mr-10" style="width: 50%">
-              <style-button size="small" @click="selectTime"
-              >修改时间
-              </style-button
-              >
-            </view
-            >
-            <view class="ml-10" style="width: 50%">
-              <style-button type="primary" size="small" @click="submitNow"
-              >立即开始
-              </style-button
-              >
-            </view>
-          </template>
-          <style-button v-else type="primary" size="small" @click="submit">{{
-              chargeType === 0 ? "提交预约" : "马上充电"
-            }}
-          </style-button>
-        </view>
-      </style-bottom-view>
-    </view>
-    <style-dialog
-        v-if="chargeTimeDialog"
-        @close="closeTime"
-        :title="
-        '请选择' + (chargeTime.isPowerSaving ? '省电模式' : '') + '充电时间'
-      "
-    >
-      <view class="flex" style="border-top: 1rpx solid rgba(0, 0, 0, 0.1)">
-        <view
-            class="flex-shrink"
-            style="height: 840rpx; width: 256rpx; background-color: #f0f0f0"
-        >
-          <view
-              class="flex-align-center pl-32 height-90"
-              v-for="(day, index) in timesInfo.day"
-              :key="index"
-              :style="{
-              backgroundColor:
-                day.format === chargeTime.day ? '#fff' : 'transparent',
-            }"
-              @click="changeDay(index)"
-          >
-            <view
-                :class="[
-                'fs-32',
-                'fw-500',
-                day.format === chargeTime.day ? 'color-primary' : 'color-000',
-              ]"
-            >{{ day.format }}
-            </view
-            >
-            <view
-                class="fs-24 color-666 ml-12 br-8 width-60 height-40 flex-center"
-                style="background-color: rgba(0, 0, 0, 0.07)"
-                v-if="day.year && day.format !== chargeTime.day"
-            >{{ day.year }}年
-            </view
-            >
-          </view>
-        </view>
-        <scroll-view
-            scroll-y
-            class="flex-grow"
-            style="height: 840rpx"
-            :scroll-into-view="chargeTime.scrollId"
-        >
-          <view
-              :id="`hour-${hour.format}`"
-              class="flex-align-center pl-40 height-90 fs-32"
-              v-for="(hour, index) in timesInfo.hour"
-              :key="index"
-              :style="{
-              color: hour.disabled
-                ? '#999'
-                : hour.format === chargeTime.hour
-                ? 'var(--color-primary)'
-                : '#000',
-            }"
-              @click="changeHour(index)"
-          >
-            {{ hour.format }}
-          </view>
-          <view class="hour-placeholder"></view>
-        </scroll-view>
-      </view>
-    </style-dialog>
-    <PriceDesc
-        v-if="priceDescVisible"
-        :desc="priceInfo.policyInfos || []"
-        @close="closePriceDesc"
-    ></PriceDesc>
-  </view>
-</template>
-
-<script setup lang="ts">
-import {cancelAppointmentCharge, changeAppointmentTime, fetchChargeStatus, fetchStationByConnectorIdOrShortId, fetchStationPriceDesc, startAppointmentCharge, startCharge,} from "@/api/charge";
-import {fetchProfile} from "@/api/user";
-import {onLoad, onShow} from "@dcloudio/uni-app";
-import {ref} from "vue";
-import ChargeMachine from "../machines/charge-machine/charge-machine.vue";
-import PriceDesc from "../machines/price-desc/price-desc.vue";
-import {format} from "../utils/date";
-import {redirect, to} from "../../utils/navigate";
-
-const DAY = 24 * 60 * 60 * 1000;
-const options = ref<any>();
-const data = ref<any>();
-const priceInfo = ref();
-const priceDescVisible = ref(false);
-const timesInfo = ref<any>({
-  day: [],
-  time: [],
-});
-
-const chargeType = ref(1);
-const chargeTypes = ref([
-  {
-    title: "预约充电",
-    tip: "预约特定时间点开始充电",
-    checkTip: "部分车辆可能进入休眠状态无法唤醒,将导致充电失败",
-  },
-  {
-    title: "立即充电",
-  },
-]);
-const chargeTimeDialog = ref(false);
-const chargeTime = ref({
-  time: 0, // 时间戳
-  day: "",
-  hour: "",
-  format: "",
-  formatPrice: "",
-  scrollId: "",
-  isPowerSaving: false, // 省电模式
-});
-const appointmentData = ref();
-const appointmentCountDown = ref();
-
-const discountIndex = ref(-1);
-const discountList = ref<any[]>([]);
-const activity = ref();
-
-const userRechargeRightsId = ref();
-const userCouponId = ref();
-const stationId = ref();
-
-
-const changeType = (index: number) => {
-  chargeType.value = index;
-};
-
-const isPassTime = (hour: string, day: number) => {
-  const now = new Date();
-  const time = new Date(format("y/M/d", day) + " " + hour + ":00");
-  return now > time;
-};
-
-const getHourPrice = (hour: string) => {
-  let price = "";
-  priceInfo.value.policyInfos.forEach((item: any) => {
-    if (Number(hour) >= Number(item.startTime.substring(0, 2))) {
-      price = item.totalPrice;
-    }
-  });
-  return price;
-};
-
-const rebuildHours = (day: Date) => {
-  timesInfo.value.hour = [];
-  const nowHour = format("h");
-  const isTaday = format("d") === format("d", day.getTime());
-  // 当前时间的24小时内
-  let startHour = isTaday ? Number(nowHour) : 0;
-  let endHour = isTaday ? 24 : Number(nowHour) + 1;
-  if (chargeTime.value.isPowerSaving) {
-    startHour = 0;
-    endHour = 8;
-  }
-  for (let index = startHour; index < endHour; index++) {
-    timesInfo.value.hour = [...timesInfo.value.hour, ...buildHours(index, day)];
-  }
-};
-
-const buildHours = (hour: number, day: Date) => {
-  let res: any[] = [];
-  let hourTemp = hour >= 10 ? `${hour}` : `0${hour}`;
-  let priceTemp = getHourPrice(hourTemp);
-  for (let index = 0; index < 12; index++) {
-    res.push({
-      format: `${hourTemp}:${index * 5 >= 10 ? index * 5 : `0${index * 5}`}`,
-      formatPrice: priceTemp,
-      disabled: isPassTime(
-          `${hourTemp}:${index * 5 >= 10 ? index * 5 : `0${index * 5}`}`,
-          chargeTime.value.time ? chargeTime.value.time : day.getTime()
-      ),
-    });
-  }
-  return res;
-};
-
-const selectTime = () => {
-  if (chargeTime.value.isPowerSaving) {
-    uni.showToast({
-      title: "省电模式将在00:00-08:00进行充电",
-      icon: "none",
-    });
-    return;
-  }
-  if (!appointmentData.value && chargeType.value === 1) {
-    uni.showToast({
-      title: "请选择预约模式",
-      icon: "none",
-    });
-    return;
-  }
-  const now = appointmentData.value
-      ? new Date(appointmentData.value.startTime.replace(/-/g, "/"))
-      : new Date();
-  const year = format("y", now.getTime());
-  const nextyear = format("y", now.getTime() + DAY);
-
-  // 天
-  timesInfo.value.day = [
-    {
-      time: now.getTime(),
-      format: format("M月d日", now.getTime()),
-      year: "",
-    },
-    {
-      time: now.getTime() + DAY,
-      format: format("M月d日", now.getTime() + DAY),
-      year: year === nextyear ? "" : nextyear.slice(2),
-    },
-  ];
-  rebuildHours(now);
-
-  // 预约时间
-  if (!appointmentData.value) {
-    if (!chargeTime.value.day) {
-      chargeTime.value.time = timesInfo.value.day[0].time;
-      chargeTime.value.day = timesInfo.value.day[0].format;
-    }
-    // 滚动到特定位置
-    if (chargeTime.value.hour) {
-      chargeTime.value.scrollId = `hour-${chargeTime.value.hour}`;
-    } else {
-      let hourNow = now.getHours();
-      chargeTime.value.scrollId = `hour-${hourNow}:00`;
-    }
-  }
-  // 修改时间
-  if (appointmentData.value) {
-    chargeTime.value.time = timesInfo.value.day[0].time;
-    chargeTime.value.day = timesInfo.value.day[0].format;
-    const findIndex = timesInfo.value.hour.findIndex(
-        (item: any) => item.format === format("h:m:s", now.getTime())
-    );
-    if (findIndex >= 0) {
-      chargeTime.value.hour = timesInfo.value.hour[findIndex].format;
-      chargeTime.value.formatPrice =
-          timesInfo.value.hour[findIndex].formatPrice;
-    }
-  }
-  chargeTimeDialog.value = true;
-};
-
-const changeDay = (index: number) => {
-  chargeTime.value.time = timesInfo.value.day[index].time;
-  chargeTime.value.day = timesInfo.value.day[index].format;
-  if (chargeTime.value.hour) {
-    chargeTime.value.hour = "";
-    chargeTime.value.formatPrice = "";
-  }
-  const now = new Date(chargeTime.value.time);
-  rebuildHours(now);
-  setTimeout(() => {
-    chargeTime.value.scrollId = `hour-${timesInfo.value.hour[0].format}`;
-  }, 0);
-};
-
-const changeHour = (index: number) => {
-  if (timesInfo.value.hour[index].disabled) {
-    uni.showToast({
-      title: "无法选择过去的时间",
-      icon: "none",
-    });
-    return;
-  }
-  if (appointmentData.value) {
-    // 修改时间
-    uni.showModal({
-      title: "温馨提示",
-      content: `确认修改为${timesInfo.value.hour[index].format}吗?`,
-      confirmText: "确定",
-      confirmColor: "#2d9e95",
-      success(modal) {
-        if (modal.confirm) {
-          uni.showLoading({
-            title: "提交中",
-            mask: true,
-          });
-          changeAppointmentTime(
-              appointmentData.value.startChargeSeq,
-              `${format("y-M-d", chargeTime.value.time)} ${
-                  timesInfo.value.hour[index].format
-              }:00`
-          )
-              .then(() => {
-                return fetchChargeStatus();
-              })
-              .then((res) => {
-                uni.hideLoading();
-                if (res && res.isAppointment) {
-                  uni.showToast({
-                    icon: "success",
-                    title: "修改成功",
-                  });
-                  closeTime();
-                  appointmentData.value = res;
-                  startAppointmentCountDown();
-                }
-              });
-        }
-      },
-    });
-    return;
-  }
-  chargeTime.value.hour = timesInfo.value.hour[index].format;
-  chargeTime.value.format = `${format("y年M月d日", chargeTime.value.time)} ${
-      chargeTime.value.hour
-  }`;
-  chargeTime.value.formatPrice = timesInfo.value.hour[index].formatPrice;
-  closeTime();
-};
-
-const changePowerSaving = (e: any) => {
-  chargeTime.value = {
-    time: 0, // 时间戳
-    day: "",
-    hour: "",
-    isPowerSaving: e.detail.value,
-    format: "",
-    formatPrice: "",
-    scrollId: "",
-  };
-};
-
-const closeTime = () => {
-  chargeTimeDialog.value = false;
-  if (appointmentData.value) {
-    return;
-  }
-  if (!chargeTime.value.hour) {
-    chargeTime.value = {
-      time: 0, // 时间戳
-      day: "",
-      hour: "",
-      isPowerSaving: chargeTime.value.isPowerSaving, // 省电模式
-      format: "",
-      formatPrice: "",
-      scrollId: "",
-    };
-  }
-};
-
-const openPriceDesc = () => {
-  priceDescVisible.value = true;
-};
-
-const closePriceDesc = () => {
-  priceDescVisible.value = false;
-};
-
-const cancelAppointment = () => {
-  uni.showModal({
-    title: "取消预约",
-    content: "确定取消预约吗?",
-    cancelText: "取消预约",
-    cancelColor: "#999999",
-    confirmText: "点错了",
-    confirmColor: "#2d9e95",
-    success: (res) => {
-      if (res.cancel) {
-        uni.showLoading({
-          title: "提交中",
-          mask: true,
-        });
-        cancelAppointmentCharge()
-            .then(() => {
-              uni.hideLoading();
-              uni.showToast({
-                icon: "success",
-                title: "已取消",
-              });
-              appointmentData.value = undefined;
-              startAppointmentCountDown();
-            })
-            .catch((err) => {
-              uni.hideLoading();
-            });
-      }
-    },
-  });
-};
-
-let appointmentCountDownTimer = 0;
-
-const startAppointmentCountDown = () => {
-  appointmentCountDownTimer && clearTimeout(appointmentCountDownTimer);
-  if (!appointmentData.value) {
-    appointmentCountDown.value = "";
-    return;
-  }
-  appointmentCountDown.value = formatAppointmentCountDown(
-      appointmentData.value.startTime
-  );
-  if (appointmentCountDown.value) {
-    appointmentCountDownTimer = setTimeout(() => {
-      startAppointmentCountDown();
-    }, 1000);
-  } else {
-    uni.showModal({
-      content: "当前预约时间已到,将开始进行充电",
-      showCancel: false,
-      success() {
-        uni.switchTab({
-          url: "/pages/map/map",
-        });
-      },
-    });
-  }
-};
-
-const formatAppointmentCountDown = (time: string) => {
-  const now = new Date();
-  const date = new Date(time.replace(/-/g, "/"));
-  let secondTime = parseInt(`${(date.getTime() - now.getTime()) / 1000}`);
-  if (secondTime <= 0) {
-    return "";
-  }
-  let hourTime = 0;
-  let minuteTime = 0; // 分
-  if (secondTime >= 60) {
-    minuteTime = parseInt(`${secondTime / 60}`);
-    secondTime = parseInt(`${secondTime % 60}`);
-    if (minuteTime >= 60) {
-      hourTime = parseInt(`${minuteTime / 60}`);
-      minuteTime = parseInt(`${minuteTime % 60}`);
-    }
-  }
-  return `${hourTime < 10 ? "0" + hourTime : hourTime}:${
-      minuteTime < 10 ? "0" + minuteTime : minuteTime
-  }:${secondTime < 10 ? "0" + secondTime : secondTime}`;
-};
-
-const submit = () => {
-  if (
-      chargeType.value === 0 &&
-      !chargeTime.value.isPowerSaving &&
-      !chargeTime.value.hour
-  ) {
-    uni.showToast({
-      title: "请选择充电时间",
-      icon: "none",
-    });
-    return;
-  }
-  const now = new Date();
-  let startTime = chargeTime.value.time;
-  if (chargeTime.value.isPowerSaving) {
-    startTime = now.getTime();
-    // 省电模式
-    if (
-        now.getHours() >= 8 &&
-        now.getDate() === Number(format("d", chargeTime.value.time))
-    ) {
-      startTime += DAY;
-    }
-  }
-  let query = "";
-  if (chargeType.value === 0) {
-    query += "isBooking=true";
-    query += `&startTime=${format("y-M-d", startTime)} ${
-        chargeTime.value.isPowerSaving
-            ? "00:00:00"
-            : `${chargeTime.value.hour}:00`
-    }`;
-    if (chargeTime.value.isPowerSaving) {
-      query += `&endTime=${format("y-M-d", startTime)} 08:00:00`;
-    }
-  }
-  if (chargeType.value === 1) {
-    query += "isBooking=false";
-  }
-  if (discountIndex.value >= 0) {
-    query += `&rechargeRightsId=${discountList.value[discountIndex.value].id}`;
-  }
-  console.log(query)
-  uni.showLoading({
-    title: "提交中",
-    mask: true,
-  });
-  startCharge(options.value.sn, query)
-      .then(() => {
-        if (chargeType.value === 0) {
-          fetchChargeStatus()
-              .then((res) => {
-                if (res && res.isAppointment) {
-                  uni.hideLoading();
-                  uni.showToast({
-                    icon: "success",
-                    title: "预约成功",
-                  });
-                  appointmentData.value = res;
-                  startAppointmentCountDown();
-                }
-              })
-              .catch(() => {
-                uni.navigateBack();
-              });
-        }
-        if (chargeType.value === 1) {
-          redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
-        }
-      })
-      .catch((err) => {
-        uni.hideLoading();
-        uni.showModal({
-          content: `${err.errMsg}`,
-          showCancel: false,
-        });
-      });
-};
-
-const submitNow = () => {
-  uni.showLoading({
-    title: "提交中",
-    mask: true,
-  });
-  startAppointmentCharge(options.value.sn)
-      .then(() => {
-        _checkStartCharge();
-      })
-      .catch((err) => {
-        uni.hideLoading();
-        uni.showModal({
-          content: `${err.errMsg}`,
-          showCancel: false,
-        });
-      });
-};
-
-const _checkStartCharge = () => {
-  fetchChargeStatus().then((res) => {
-    if (res && [2].includes(res.chargeStatus)) {
-      uni.hideLoading();
-      redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
-    } else {
-      _checkStartCharge();
-    }
-  });
-};
-
-onLoad((_options: any) => {
-  // sn=SN100523042860091 测试环境
-  console.log("options", _options);
-  let sn = _options.sn;
-  uni.showLoading({
-    title: "加载中",
-  });
-  fetchStationByConnectorIdOrShortId(sn)
-      .then((res) => {
-        console.log(res);
-        let {station, equipment} = res;
-        if (station) {
-          stationId.value = station.StationID;
-        }
-        if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
-          sn = equipment.connectorInfos[0].connectorId;
-          _options.sn = equipment.connectorInfos[0].connectorId;
-        }
-        options.value = _options;
-        data.value = res;
-        return fetchStationPriceDesc(sn);
-      })
-      .then((res) => {
-        // console.log(res);
-        uni.hideLoading();
-        priceInfo.value = res;
-        return fetchChargeStatus(false, true);
-      })
-      .then((res) => {
-        if (res && res.isAppointment) {
-          appointmentData.value = res;
-          startAppointmentCountDown();
-        }
-      })
-      .catch((err) => {
-        console.log(err);
-        uni.hideLoading();
-      });
-
-
-  fetchProfile().then((res) => {
-    if (res.userRechargeRightsList.length) {
-      res.userRechargeRightsList.forEach((item: any) => {
-        item.discountFormat = Number((Number(item.discount) / 10).toFixed(2));
-      });
-      discountList.value = res.userRechargeRightsList;
-      discountIndex.value = 0;
-    }
-
-    if (res.activityList && res.activityList.length) {
-      res.activityList[0].rechargeRightsList.sort((a: any, b: any) => {
-        return a.discount - b.discount;
-      });
-      activity.value = res.activityList[0];
-      activity.value.minDiscount = Number(
-          (
-              Number(res.activityList[0].rechargeRightsList[0].discount) / 10
-          ).toFixed(1)
-      );
-    }
-  });
-
-});
-
-onShow(() => {
-  if (getApp<any>().globalData.lastData.discount) {
-    discountIndex.value = getApp<any>().globalData.lastData.discount.index;
-    getApp<any>().globalData.lastData.discount = undefined;
-  }
-});
-</script>
-
-<style lang="scss" scoped>
-.page {
-  min-height: 100vh;
-  width: 100%;
-  padding: 20rpx;
-  background-color: #f6f7fa;
-}
-
-.block {
-  border-radius: 20rpx;
-  background: #fff;
-}
-
-.station {
-  height: 148rpx;
-  border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
-}
-
-.hour-placeholder {
-  box-sizing: content-box;
-  padding-bottom: constant(safe-area-inset-bottom);
-  padding-bottom: env(safe-area-inset-bottom);
-}
-</style>

+ 1 - 62
charge-front/src/pages-charge/camera/camera.vue

@@ -85,8 +85,7 @@ import { deCode } from "../../utils/code";
 import { requireAuth } from "@/utils/auth";
 import { back, redirect } from "../../utils/navigate";
 import { onLoad, onReady } from "@dcloudio/uni-app";
-import { fetchChargeStatus, searchQRCode } from "../../api/charge";
-import { upload } from "../utils/uploader";
+import { fetchChargeStatus } from "../../api/charge";
 
 const cameraHeight = ref(0);
 const cameraFlash = ref("off");
@@ -165,7 +164,6 @@ const chooseImage = () => {
     onlyFromCamera:false,
     scanType:['qrcode','barcode'],
     success: (res1) => {
-      console.log("scanCode",res1);
       deCode(res1.result);
     },
     fail: (err) => {
@@ -178,65 +176,6 @@ const chooseImage = () => {
   })
   // #endif
 }
-
-const chooseImage1 = () => {
-  uni.chooseImage({
-    count: 1,
-    sizeType: ["compressed"],
-    sourceType: ["album"],
-    success: (res) => {
-      uni.showLoading({
-        title: "正在识别",
-      });
-      upload(res.tempFilePaths[0], {
-        onSuccess: (res) => {
-          searchQRCode(res.url)
-            .then((res) => {
-              if (
-                res.errmsg === "ok" &&
-                res.errcode === 0 &&
-                res.code_results &&
-                res.code_results.length
-              ) {
-                const fi = res.code_results.findIndex(
-                  (item: any) => item.type_name === "QR_CODE"
-                );
-                if (fi >= 0) {
-                  deCode(res.code_results[fi].data);
-                  return;
-                }
-              }
-              console.log(res);
-              return Promise.reject({
-                errMsg: "微信识别出错,请重试",
-              });
-            })
-            .catch((err) => {
-              uni.hideLoading();
-              uni.showModal({
-                content: err.errMsg || "出现错误,请重试",
-              });
-            });
-        },
-        onFail: (err) => {
-          uni.hideLoading();
-          uni.showModal({
-            content: err.errMsg || "出现错误,请重试",
-          });
-        },
-      });
-    },
-    fail: (err) => {
-      console.log(err);
-      if (/cancel/.test(err.errMsg)) {
-        return;
-      }
-      uni.showModal({
-        content: err.errMsg || "出现错误,请重试",
-      });
-    },
-  });
-};
 </script>
 
 <style lang="scss">

+ 1 - 6
charge-front/src/pages-charge/codeing/codeing.vue

@@ -29,11 +29,7 @@
 </template>
 
 <script setup lang="ts">
-import {
-  fetchStationByConnectorIdOrShortId,
-  fetchStationDetailByConnectorId,
-  fetchStationDetailByShortId
-} from "@/api/charge";
+import { fetchStationDetailByShortId } from "@/api/charge";
 import { ref } from "vue";
 import { scanCode } from "../../utils/code";
 import { to } from "../../utils/navigate";
@@ -59,7 +55,6 @@ const submit = () => {
     })
     .catch((err) => {
       value.value = ''
-      console.log(err);
       uni.hideLoading();
       uni.showModal({
         title: "温馨提示",

+ 0 - 4
charge-front/src/pages-charge/machines/machines.vue

@@ -250,7 +250,6 @@ onLoad((options: any) => {
   });
   fetchStationDetail(options.id)
       .then((res) => {
-        console.log("station detail>>>",res);
         let ConnectorID = "";
         if (res.connectInfoList && res.connectInfoList.length) {
           res.connectInfoList.forEach((con: any) => {
@@ -293,8 +292,6 @@ onLoad((options: any) => {
         desc.value = res.policyInfos || [];
       })
       .catch((err) => {
-        // eslint-disable-next-line no-console
-        console.log(err);
         uni.hideLoading();
         uni.showToast({
           title: "加载失败,请重试",
@@ -364,7 +361,6 @@ const previewImage = (url: string) => {
 };
 
 const showStationCoupon = () => {
-  // console.log(station.value)
   station_coupon_ref.value?.open(station.value.StationID);
 }
 </script>

+ 0 - 2
charge-front/src/pages-charge/machines/price-desc/price-desc.vue

@@ -81,7 +81,6 @@ export default defineComponent({
     };
   },
   mounted() {
-    // console.log(this.desc);
     let currentHour = new Date().getHours()
     if (this.desc && this.desc.length) {
       this._desc = this.desc.map((item) => {
@@ -103,7 +102,6 @@ export default defineComponent({
         };
       });
 
-      // console.log(this._desc)
     }
   },
   methods: {

+ 2 - 21
charge-front/src/pages-charge/orders/orders.vue

@@ -129,15 +129,14 @@ import {
   onShow,
 } from "@dcloudio/uni-app";
 import { fetchOrders } from "../../api/user";
-import { fetchInvoiceList } from "../../api/index";
 import { useInfiniteScroll } from "../../utils/infinite-scroll";
 import { ref } from "vue";
 import { to } from "@/utils/navigate";
 import { requireAuth } from "@/utils/auth";
+import { fenToYuan } from "@/utils/money";
 
 const isInvoice = ref(false);
 const isInvoiceing = ref(false);
-const isInvoiceHistory = ref(false);
 const isInvoiceTitles = ref(["未开票", "已开票", "已作废", "开票中"]);
 const checkAll = ref(false);
 const checkedPrice = ref(0);
@@ -148,12 +147,11 @@ const infiniteScroller = useInfiniteScroll(20, (page) => {
   return fetchOrders(page, 20).then((res: any) => {
     if (res && res.list && res.list.length) {
       res.list.forEach((item: any) => {
-        item.payAmount = (Number(item.payAmount) / 100).toFixed(2);
+        item.payAmount = fenToYuan(item.payAmount);
         item.checked = false;
         item.hidden = item.chargeStatus === 4 && !item.endTime;
       });
     }
-    console.log(res.list)
     return res.list;
   });
 });
@@ -207,23 +205,6 @@ const cancelInvoice = () => {
   });
   setCheckData();
 };
-// 获取发票历史
-const openInvoiceHistory = () => {
-  uni.showLoading({
-    title: "请求中",
-  });
-  fetchInvoiceList().then((res) => {
-    uni.hideLoading();
-    if (res.length <= 0) {
-      uni.showToast({
-        title: "无开票历史",
-        icon: "none",
-      });
-      return;
-    }
-    isInvoiceHistory.value = true;
-  });
-};
 const nextInvoice = () => {
   if (!infiniteScroller.list) return;
   const checkedSeqs = infiniteScroller.list

+ 0 - 1
charge-front/src/pages-charge/search/search.vue

@@ -117,7 +117,6 @@ const search = function () {
   });
   searchStation(keyword.value)
       .then((res) => {
-        console.log("search result", res)
         uni.hideLoading();
         if (res && res.length > 0) {
           let {latitude, longitude} = getApp<any>().globalData.fetchLocation

+ 0 - 1
charge-front/src/pages-user/profile-edit/profile-edit.vue

@@ -64,7 +64,6 @@ const save = () => {
   uni.navigateBack();
 };
 onLoad((options: any) => {
-  // console.log(options)
   let value = "";
   if (options.value) {
     value = decodeURIComponent(options.value);

+ 0 - 34
charge-front/src/pages/index/index.vue

@@ -1,34 +0,0 @@
-<template>
-  <view>
-    <map
-      :style="{
-        width: '100%',
-        height: '100vh',
-      }"
-      :latitude="23.098994"
-      :longitude="113.32252"
-      min-scale="1"
-      :scale="12"
-    ></map>
-  </view>
-</template>
-
-<script setup lang="ts">
-import { isDebug } from "@/utils/constant";
-import { onLoad } from "@dcloudio/uni-app";
-onLoad(() => {
-  if (isDebug) {
-    return;
-  }
-  uni.switchTab({
-    url: "/pages/map/map",
-  });
-});
-</script>
-
-<style lang="scss" scoped>
-.index-page {
-  width: 100%;
-  height: 100vh;
-}
-</style>

+ 0 - 74
charge-front/src/pages/list/list.vue

@@ -1,74 +0,0 @@
-<template>
-  <view class="list">
-    <navigation-bar title="充电站列表"></navigation-bar>
-    <view class="pl-20 pr-20" v-if="infiniteScroller.list">
-      <view
-        class="mt-20"
-        v-for="(item, index) in infiniteScroller.list"
-        :key="index"
-      >
-        <charge-station
-          :title="item.stationName"
-          :tag="item.construction"
-          :price="item.totalFee"
-          :fast="item.fastEquipmentInfos"
-          :slow="item.slowEquipmentInfos"
-          :sId="item.StationID"
-          :distance="item.distance"
-          :address="item.address"
-          :latitude="item.location.stationLat"
-          :longitude="item.location.stationLng"
-        ></charge-station>
-      </view>
-    </view>
-    <view
-      class="flex-center flex-column pt-79"
-      v-if="infiniteScroller.list && infiniteScroller.list.length <= 0"
-    >
-      <image class="empty" src="/static/images/map-empty.png" mode="widthFix" />
-      <view class="fs-22 mt-14" style="color: #8c9997"
-        >暂无充电站信息</view
-      >
-    </view>
-    <view class="flex-center flex-column pt-30" v-if="!infiniteScroller.list">
-      <view class="fs-28 mt-14" style="color: #8c9997">加载中</view>
-    </view>
-  </view>
-</template>
-
-<script setup lang="ts">
-// 废弃页面
-import { fetchStations } from "../../api/charge";
-import { fetchCollectList } from "../../api/user";
-import { useInfiniteScroll } from "../../utils/infinite-scroll";
-import { isAuthenticated } from "@/utils/auth";
-import { onLoad, onReachBottom } from "@dcloudio/uni-app";
-const infiniteScroller = useInfiniteScroll(6, (page) => {
-  let {latitude, longitude} = getApp<any>().globalData.fetchLocation
-  return fetchStations(page, 6,latitude, longitude);
-});
-onLoad(() => {
-  if (isAuthenticated()) {
-    fetchCollectList().then(() => {
-      infiniteScroller.refresh();
-    });
-  } else {
-    infiniteScroller.refresh();
-  }
-});
-onReachBottom(() => {
-  infiniteScroller.next();
-});
-</script>
-
-<style>
-.list {
-  width: 100%;
-  min-height: 100vh;
-  background-color: var(--bg-page);
-}
-
-.empty {
-  width: 80px;
-}
-</style>

+ 1 - 12
charge-front/src/pages/map/map.vue

@@ -240,7 +240,7 @@
 </template>
 
 <script setup lang="ts">
-import {debounce, throttle} from "@/utils/util";
+import {throttle} from "@/utils/util";
 
 const defaulDistance = 3;
 const defaultScale = 12;
@@ -399,7 +399,6 @@ const refresh = () => {
   if (loading.value) {
     return;
   }
-  console.log("刷新电站");
   uni.showLoading({
     title: "加载中",
   });
@@ -422,7 +421,6 @@ const refresh = () => {
       ready.value = true;
     })
     .catch((err) => {
-      console.log(err);
       uni.hideLoading();
       loading.value = false;
       if (!token.value) {
@@ -436,7 +434,6 @@ const refresh = () => {
 };
 
 const handleNavReady = (e: any) => {
-  console.log(e);
   styleData.value.dialog = `padding-top:${e.detail.statusBarHeight - 6}px;`;
   const searchHeight = rpxToPx(88);
   const filterHeight = 0; // rpxToPx(72);
@@ -459,10 +456,8 @@ const toSearch = () => {
 
 onLoad((query: any) => {
   // 只为了打包进tab-bar使用
-  console.log(fetchToken, onLogin);
   // 扫普通码
   if (query.q) {
-    console.log("扫普通码", decodeURIComponent(query.q));
     getApp<any>().globalData.normalCode = decodeURIComponent(query.q); // 获取到二维码原始链接内容
   }
 
@@ -578,7 +573,6 @@ const resetLocation = () => {
 };
 
 const mapUpdated = (e: any) => {
-  // console.log('map updated', isIgnoreChangeLocation)
   setTimeout(() => {
     isIgnoreChangeLocation = false;
   }, 500);
@@ -589,14 +583,10 @@ const mapChange = (e: any) => {
   }
   if (e.type === "end" && markers.value.length) {
     //TODO 防抖500ms触发一次
-    console.log("throttle")
     currentLocation.value = e.target.centerLocation
     // throttle(()=>{
     //
     // },500)
-    // console.log("map change end", {
-    //   ...e.detail.centerLocation,
-    // });
     debounceRefreshStation()
   }
 };
@@ -604,7 +594,6 @@ const mapChange = (e: any) => {
 
 const debounceRefreshStation = throttle(() => {
   const { latitude, longitude } = currentLocation.value;
-  console.log("debounceRefreshStation run...")
   refreshStation({
     latitude,
     longitude,

+ 1 - 1
charge-front/src/uni.scss

@@ -41,7 +41,7 @@ $uni-border-color: #dfe7e5;
 /* 文字尺寸 */
 $uni-font-size-sm: 12px;
 $uni-font-size-base: 14px;
-$uni-font-size-lg: 16;
+$uni-font-size-lg: 16px;
 
 /* 图片尺寸 */
 $uni-img-size-sm: 20px;

+ 0 - 1
charge-front/src/utils/code.ts

@@ -2,7 +2,6 @@ export function scanCode() {
   uni.scanCode({
     scanType: ["qrCode"],
     success: (res) => {
-      console.log(res);
       if (res.scanType === "QR_CODE" && res.result) {
         deCode(res.result);
       }

+ 0 - 1
charge-front/src/utils/constant.ts

@@ -8,7 +8,6 @@ const env =
   typeof __wxConfig !== "undefined"
     ? __wxConfig.envVersion || "release"
     : "release";
-console.log("env", env);
 isDevelopment = env === "develop" || env === "trial";
 // #endif
 

+ 0 - 7
charge-front/src/utils/device.ts

@@ -5,13 +5,6 @@ export function rpxToPx(rpx: number): number {
   return rpx;
 }
 
-export function pxToRpx(px: number): number {
-  if (getApp<any>().globalData.device) {
-    return (750 * px) / getApp<any>().globalData.device.windowWidth;
-  }
-  return px;
-}
-
 export const isDevTool =
   getApp<any>().globalData.device &&
   getApp<any>().globalData.device.platform === "devtools";

+ 0 - 1
charge-front/src/utils/location.ts

@@ -18,7 +18,6 @@ export function fetchLocation() {
         resolve(cacheLocation)
       },
       fail: err => {
-        // console.log(err)
         if (/auth/.test(err.errMsg)) {
           resolve({
             latitude: 23.098994,

+ 0 - 1
charge-front/src/utils/navigate.ts

@@ -1,5 +1,4 @@
 export function to(path: string) {
-  console.log(path)
   if (nextPageIsPrevPage(path)) {
     uni.navigateBack();
     return;

+ 0 - 2
charge-front/src/utils/storage.ts

@@ -44,8 +44,6 @@ class Storage {
                 return
               }
             } catch (error) {
-              // eslint-disable-next-line no-console
-              console.log(error)
             }
           }
           uni.removeStorage({

+ 0 - 4
charge-front/src/utils/util.ts

@@ -6,11 +6,9 @@ export function debounce(fn, wait) {
         let args = arguments;
         if (timer) {
             clearTimeout(timer)
-            console.log('debounce')
         }
         let callNow = !timer
         timer = setTimeout(() => {
-            console.log('debounce send')
             timer = null
         }, delay)
         if (callNow) fn.apply(this, args)
@@ -23,11 +21,9 @@ export function throttle(fn, wait) {
     let timer = null
     return function() {
         if (timer) {
-            console.log('throttle');
             return
         }
         timer = setTimeout(() => {
-            console.log('throttle send');
             fn.apply(this, arguments)
             timer = null
         }, delay)

+ 4 - 0
charge-front/vite.config.ts

@@ -11,4 +11,8 @@ export default defineConfig({
       },
     },
   },
+  esbuild: {
+    // 生产构建移除调试日志,保留 error/warn 便于线上排障
+    pure: ["console.log", "console.debug"],
+  },
 });