Bläddra i källkod

fix:不存在电桩提示

needcode 2 år sedan
förälder
incheckning
5e039e38e6
2 ändrade filer med 26 tillägg och 11 borttagningar
  1. 4 8
      src/pages-charge/appointment/appointment.vue
  2. 22 3
      src/pages-charge/codeing/codeing.vue

+ 4 - 8
src/pages-charge/appointment/appointment.vue

@@ -293,7 +293,7 @@ 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 { to } from "../../utils/navigate";
+import { to,redirect } from "../../utils/navigate";
 
 const DAY = 24 * 60 * 60 * 1000;
 const options = ref<any>();
@@ -491,7 +491,7 @@ const changeHour = (index: number) => {
             appointmentData.value.startChargeSeq,
             `${format("y-M-d", chargeTime.value.time)} ${
               timesInfo.value.hour[index].format
-            }`
+            }:00`
           )
             .then(() => {
               return fetchChargeStatus();
@@ -700,9 +700,7 @@ const submit = () => {
           });
       }
       if (chargeType.value === 1) {
-        uni.navigateTo({
-          url: `/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`,
-        });
+        redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
       }
     })
     .catch((err) => {
@@ -736,9 +734,7 @@ const _checkStartCharge = () => {
   fetchChargeStatus().then((res) => {
     if (res && [2].includes(res.chargeStatus)) {
       uni.hideLoading();
-      uni.navigateTo({
-        url: `/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`,
-      });
+      redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
     } else {
       _checkStartCharge();
     }

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

@@ -2,7 +2,7 @@
   <view class="pt-10 pr-60 pl-60">
     <view class="lh-0">
       <!-- #ifdef MP-WEIXIN -->
-		  <!-- #endif -->
+      <!-- #endif -->
       <image
         src="/pages-charge/static/charge-input-head.png"
         mode="widthFix"
@@ -29,8 +29,10 @@
 </template>
 
 <script setup lang="ts">
+import { fetchStationByConnectorIdOrShortId } from "@/api/charge";
 import { ref } from "vue";
 import { scanCode } from "../../utils/code";
+import { to } from "../../utils/navigate";
 
 const value = ref("");
 const focus = ref(true);
@@ -43,9 +45,26 @@ const submit = () => {
     });
     return;
   }
-  uni.navigateTo({
-    url: `/pages-charge/appointment/appointment?sn=${value.value}`,
+  uni.showLoading({
+    title: "加载中",
   });
+  fetchStationByConnectorIdOrShortId(value.value)
+    .then(() => {
+      uni.hideLoading();
+      to(`/pages-charge/appointment/appointment?sn=${value.value}`);
+    })
+    .catch((err) => {
+      value.value = ''
+      console.log(err);
+      uni.hideLoading();
+      uni.showModal({
+        title: "温馨提示",
+        content: `充电桩编号不存在,请检查后重新输入`,
+        confirmText: "确定",
+        confirmColor: "#347DFF",
+        showCancel: false,
+      });
+    });
 };
 const input = (e: any) => {
   value.value = e.value;