Explorar o código

fix:修复问题

needcode %!s(int64=2) %!d(string=hai) anos
pai
achega
f26f3217ce

+ 4 - 1
src/api/user.ts

@@ -1,5 +1,5 @@
 import Http from "../utils/http";
-import { host } from "../utils/constant";
+import { host, isDebug } from "../utils/constant";
 
 const userHttp = new Http(host);
 
@@ -68,6 +68,9 @@ export function updateProfile(data: any) {
 declare const wx: any;
 
 export function insertMoney(amount: number) {
+  if (isDebug) {
+    return Promise.resolve()
+  }
   return userHttp
     .post("/payment/wxPay", {
       data: {

+ 3 - 2
src/pages-charge/appointment/appointment.vue

@@ -125,7 +125,7 @@
         </view>
         <view class="mt-20 block flex-align-center pl-30 pr-30 pt-30 pb-30">
           <view class="flex-column">
-            <view class="fs-28 lh-28 color-000 fw-500">省模式</view>
+            <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
             >
@@ -155,7 +155,7 @@
             </view>
           </template>
           <style-button v-else type="primary" size="small" @click="submit">{{
-            chargeType === 0 ? "提交申请" : "马上充电"
+            chargeType === 0 ? "提交预约" : "马上充电"
           }}</style-button>
         </view>
       </style-bottom-view>
@@ -609,6 +609,7 @@ onLoad((_options: any) => {
         res.equipment.connectorInfos.length
       ) {
         sn = res.equipment.connectorInfos[0].connectorId;
+        _options.sn = res.equipment.connectorInfos[0].connectorId;
       }
       options.value = _options;
       data.value = res;

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

@@ -87,7 +87,7 @@ export default {
         255: "故障",
         0: "离网",
         1: "空闲",
-        2: "未充电",
+        2: "已占用",
         3: "充电中",
         4: "已预约",
       },

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

@@ -70,7 +70,7 @@
         <view class="flex-align-center">
           <view class="width-168 fs-26 color-666">停车费用</view>
           <view class="fs-26 color-000">{{
-            Number(station.parkFee) > 0 ? station.parkFee : "免费"
+            Number(station.parkFee) > 0 ? station.parkFee : "以停车场公示信息为准"
           }}</view>
         </view>
         <view

+ 1 - 1
src/pages-charge/machines/price-desc/price-desc.vue

@@ -37,7 +37,7 @@
             }"
           >
             <view class="td flex-center">
-              <text>{{ item.startTimeFormat }}</text>
+              <text style="width: 158rpx;text-align:center">{{ item.startTimeFormat }}</text>
               <text
                 class="ml-16 width-38 height-38 br-round fs-24 flex-center"
                 v-if="item.iconIndex >= 0"

+ 1 - 1
src/pages-common/activity/activity.vue

@@ -74,7 +74,7 @@ onLoad((options: any) => {
     view {
       background-position: center;
       background-repeat: no-repeat;
-      background-size: cover;
+      background-size: 100% auto;
     }
   }
 }

+ 10 - 4
src/pages-user/wallet-recharge/wallet-recharge.vue

@@ -90,16 +90,22 @@ const confirm = () => {
     });
     return;
   }
+  uni.showLoading({
+    title: "加载中",
+  });
   insertMoney(params)
     .then(() => {
+      return fetchProfile();
+    })
+    .then((res) => {
+      payValue.value = 0;
+      balance.value = res.balance;
+      uni.hideLoading();
       uni.showToast({
         title: "已支付",
         icon: "success",
       });
-      fetchProfile().then((res) => {
-        payValue.value = 0;
-        balance.value = res.balance;
-      });
+      to("/pages-user/wallet/wallet");
     })
     .catch((err) => {
       if (/cancel/.test(err.errMsg)) {

+ 7 - 1
src/pages-user/wallet/wallet.vue

@@ -100,7 +100,7 @@
 
 <script setup lang="ts">
 import { useInfiniteScroll } from "../../utils/infinite-scroll";
-import { onLoad, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
+import { onLoad, onReachBottom, onPullDownRefresh, onShow } from "@dcloudio/uni-app";
 import { fetchWallet } from "../../api/user";
 import { to } from "../../utils/navigate";
 import { ref } from "vue";
@@ -148,6 +148,12 @@ onLoad(() => {
   }
 });
 
+onShow(() => {
+  if (getApp<any>().globalData.user) {
+    user.value = getApp<any>().globalData.user;
+  }
+})
+
 onReachBottom(() => {
   infiniteScroller.next();
 });

+ 8 - 2
src/pages/map/map.vue

@@ -267,6 +267,7 @@ import { fetchLocation } from "@/utils/location";
 import { to } from "@/utils/navigate";
 import { onLoad } from "@dcloudio/uni-app";
 import { ref } from "vue";
+import { WxRequest } from "@/utils/http";
 
 const isIOS = ref(false);
 const token = ref<string>();
@@ -498,7 +499,12 @@ const handleNavReady = (e: any) => {
 };
 
 const toSearch = () => {
-  to("/pages-charge/search/search");
+  if (!ready.value || station.value.length) {
+    return
+  }
+  uni.navigateTo({
+    url: "/pages-charge/search/search",
+  });
 };
 
 const toActivity = (index: number) => {
@@ -779,7 +785,7 @@ page {
       view {
         background-position: center;
         background-repeat: no-repeat;
-        background-size: cover;
+        background-size: 100% auto;
       }
     }
   }

+ 1 - 1
src/pages/user/user.vue

@@ -16,7 +16,7 @@
         <view class="main flex-shrink">
           <view
             class="avatar"
-            @click="toPage(3)"
+            @click="toPage(2)"
             :style="{
               'background-image': `url(${user.avatar})`,
             }"

+ 1 - 4
src/utils/constant.ts

@@ -12,10 +12,7 @@ console.log("env", env);
 isDevelopment = env === "develop" || env === "trial";
 // #endif
 
-// debug
-// isDevelopment = false
-
 export const domain = isDevelopment ? "dev.kuaiyuman.cn" : "www.kuaiyuman.cn";
 export const host = `https://${domain}/api`;
 
-export const isDebug = true
+export const isDebug = false

+ 25 - 3
src/utils/navigate.ts

@@ -1,6 +1,10 @@
-export function to(url: string) {
+export function to(path: string) {
+  if (nextPageIsPrevPage(path)) {
+    uni.navigateBack();
+    return;
+  }
   uni.navigateTo({
-    url,
+    url: path,
   });
 }
 
@@ -16,6 +20,24 @@ export function redirect(url: string) {
 
 export function reLaunch() {
   uni.reLaunch({
-    url: '/pages/map/map',
+    url: "/pages/map/map",
   });
 }
+
+export function nextPageIsPrevPage(path: string): boolean {
+  const isFull = path[0] === "/";
+  const pages = getCurrentPages();
+  const prevPage = pages.length >= 2 ? pages[pages.length - 2] : undefined;
+  const prevPageQuery = prevPage
+    ? Object.keys(prevPage.options)
+        .map((key) => `${key}=${prevPage.options[key]}`)
+        .join("&")
+    : "";
+  if (prevPage) {
+    return (
+      `${prevPage.route}${prevPageQuery ? "?" + prevPageQuery : ""}` ===
+      (isFull ? path.substring(1) : path)
+    );
+  }
+  return false;
+}