Pārlūkot izejas kodu

修改页面上的细节问题

zaijin 2 gadi atpakaļ
vecāks
revīzija
af914f8acf

+ 2 - 2
components/ad-banner/ad-banner.vue

@@ -3,14 +3,14 @@
  * @Author: 空白格
  * @Date: 2023-05-24 09:23:58
  * @LastEditors: 空白格
- * @LastEditTime: 2023-05-25 11:25:19
+ * @LastEditTime: 2023-06-01 13:33:53
  * @FilePath: \parking_h5_all\components\ad-banner\ad-banner.vue
  * @Copyright: Copyright (c) 2016~2023 by 空白格, All Rights Reserved. 
 -->
 <template>
   <view class="ad-banner">
     <u-swiper v-if="list.length" :list="list" @click="adBannerClick" height="300" />
-    <u-empty v-else text="暂无广告数据" mode="data" />
+    <!-- <u-empty v-else text="暂无广告数据" mode="data" /> -->
   </view>
 </template>
 

+ 1 - 1
pages.json

@@ -80,7 +80,7 @@
     {
       "path": "pages/parkingInformation/parkingInformation",
       "style": {
-        "navigationBarTitleText": "停车信息",
+        "navigationBarTitleText": "停车信息",
         "enablePullDownRefresh": false,
         "navigationBarBackgroundColor": "#ffffff",
         "navigationBarTextStyle": "black"

+ 48 - 110
pages/index/index.vue

@@ -7,17 +7,17 @@
         <u-icon name="arrow-down" color="#fff" size="32"></u-icon>
       </view>
       <u-search placeholder="搜索停车点" :show-action="false" @search="handleSearch" v-model="keyword"></u-search>
-      <!-- <u-icon class="scan" name="scan" color="#fff" size="48" @click="$refs.uToast.show({title: '建设中'})"></u-icon> -->
     </view>
 
     <!-- ===================================== 轮播图 ===================================== -->
-    <u-swiper :list="bannerList" border-radius="0" mode="none" @click="swiperClick"></u-swiper>
-
+    <view v-if="bannerList.length">
+      <u-swiper :list="bannerList" border-radius="0" mode="none" @click="swiperClick"></u-swiper>
+    </view>
     <!-- ===================================== 城市选择器 ===================================== -->
     <u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode="['52', '5201']"></u-city-select>
 
     <!-- ===================================== 滚动信息栏 ===================================== -->
-    <view class="notice-bar-wrap u-flex" v-if="noticeList.length >= 1" @click="openPage('pages/message/message', true)">
+    <view class="notice-bar-wrap u-flex" v-if="noticeList.length" @click="openPage('pages/message/message', true)">
       <u-icon custom-prefix="custom-icon" size="50" name="xiaoxi" color="#008CFF"></u-icon>
       <u-notice-bar
         class="u-flex-1"
@@ -57,10 +57,6 @@
         >
       </view>
     </u-card>
-    <!-- ===================================== 无停车信息 ===================================== -->
-    <view class="empty-data-box" v-if="!orderList || orderList.length < 1">
-      <u-empty text="暂无停车信息" mode="list"></u-empty>
-    </view>
 
     <!-- ===================================== 停车列表 ===================================== -->
     <view v-for="item in orderList" :key="item.id">
@@ -141,6 +137,11 @@
       </u-card>
     </view>
 
+    <!-- ===================================== 无停车信息 ===================================== -->
+    <view class="empty-data-box" v-if="!orderList.length">
+      <u-empty text="暂无停车信息" mode="list"></u-empty>
+    </view>
+
     <!-- ===================================== 优惠活动 ===================================== -->
     <view class="promotion-box">
       <view class="promotion-title">
@@ -159,7 +160,7 @@
       confirm-text="去绑定"
       content="首次使用请先绑定您的车牌"
       @confirm="$u.route({ url: 'pages/myCars/myCars' })"
-    ></u-modal>
+    />
 
     <!-- ===================================== 停车场信息弹框 ===================================== -->
     <u-popup class="popup-order-details" v-model="showOrderDetails" mode="center" width="90%" border-radius="20">
@@ -185,9 +186,6 @@
       <view class="popup-order-details-footer" @click="closeOrderDetails">知道了</view>
     </u-popup>
 
-    <!-- ===================================== 支付方式弹框 ===================================== -->
-    <!-- <PaymentMethod :payWayPop="payWayPop" :curOrderList="curOrderList" :jumpUrl="jumpUrl" @closePaymentMethod="closePaymentMethod"></PaymentMethod> -->
-
     <!-- ===================================== 0元提示弹出层 ===================================== -->
     <u-modal v-model="jumpMsgModal" :content="jumpMsgContent" :show-title="false" :show-confirm-button="false" />
     <u-toast ref="uToast" />
@@ -211,14 +209,7 @@
     </u-popup>
 
     <u-action-sheet :list="colorList" @click="confirmColor" v-model="colorShow"></u-action-sheet>
-    <u-keyboard
-      ref="uKeyboard"
-      mode="car"
-      @change="keyboardChange"
-      @confirm="keyboardConfirm"
-      @backspace="backspace"
-      v-model="keyboardshow"
-    ></u-keyboard>
+    <u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @confirm="keyboardConfirm" @backspace="backspace" v-model="keyboardshow" />
 
     <!-- ===================================== 更换车牌弹出层 ===================================== -->
     <u-popup class="popup-vehicleNo" v-model="ShowchangevehicleNo" mode="center" border-radius="20" width="710rpx" height="auto">
@@ -293,11 +284,7 @@ export default {
       // 搜索框值
       keyword: '',
       // 轮播图
-      bannerList: [
-        {
-          image: require('@/static/img/index-banner01.png')
-        }
-      ],
+      bannerList: [],
       // 订单列表
       orderList: [],
       // 微信code
@@ -371,17 +358,7 @@ export default {
     };
   },
   onLoad(page) {
-    // 获取参数免费时长
-    this.$u.api
-      .getParamsApi({
-        key: 'park.lock.freetime'
-      })
-      .then((res) => {
-        if (res.code === 200) {
-          this.$u.vuex('free_time', res.msg);
-        }
-      });
-    const locationLocaturl = window.location.href;
+    const locationLocaturl = location.href;
     // 微信聚合支付完成跳转过来重定向到详情页
     const type = getUrlParams(locationLocaturl, 'type');
     if (type && type === 'jumpurl') {
@@ -405,17 +382,23 @@ export default {
         this.jumpMsgModal = false;
       }, 3000);
     }
+    this.getParams();
     this.getLocation();
-  },
-  onShow() {
     this.handleGetIndexData();
-    const locationLocaturl = window.location.search;
-    this.code = getUrlParams(locationLocaturl, 'code');
-    if (this.code && !this.$store.state.vuex_wxinfo.openId) {
-      this.handleGetWXInfo(this.code);
-    }
   },
   methods: {
+    /**
+     * @description: 获取参数免费时长
+     * @return {*}
+     */
+    async getParams() {
+      const { code, msg } = await this.$u.api.getParamsApi({
+        key: 'park.lock.freetime'
+      });
+      if (code === 200) {
+        this.$u.vuex('free_time', msg);
+      }
+    },
     radioGroupChange(e) {
       this.newPlateNumber = e;
     },
@@ -430,11 +413,6 @@ export default {
             // dom元素更新后执行,因此这里能正确打印更改之后的值
             console.log(that.$refs.refValue.init()); // 改变了的值
           });
-        } else {
-          this.$refs.uToast.show({
-            title: res.msg,
-            type: 'error'
-          });
         }
       });
     },
@@ -458,20 +436,14 @@ export default {
         vehicleNo: this.newPlateNumber,
         vehicleColor: this.vehicleColor
       };
-      let that = this;
       this.$u.api.bindVehicleNo(param).then((res) => {
         if (res.code === 200) {
           this.$refs.uToast.show({
             title: res.msg,
             type: 'success'
           });
-          that.handleGetIndexData();
-          that.ShowchangevehicleNo = false;
-        } else {
-          this.$refs.uToast.show({
-            title: res.msg,
-            type: 'error'
-          });
+          this.handleGetIndexData();
+          this.ShowchangevehicleNo = false;
         }
       });
     },
@@ -523,21 +495,6 @@ export default {
             that.getCityNameByLonLat(that.latLongItude);
           },
           function (err) {
-            // 错误处理
-            // switch (err.code) {
-            //   case 1:
-            //     alert('位置服务被拒绝。');
-            //     break;
-            //   case 2:
-            //     alert('暂时获取不到位置信息。');
-            //     break;
-            //   case 3:
-            //     alert('获取信息超时。');
-            //     break;
-            //   default:
-            //     alert('未知错误。');
-            //     break;
-            // }
             uni.getLocation({
               type: 'gcj02',
               success: function (res) {
@@ -601,16 +558,8 @@ export default {
           console.log('res', res);
           if (res?.code == 200) {
             this.handleGetIndexData();
-          } else {
-            // this.$refs.uToast.show({
-            //   title: res?.msg,
-            //   type: 'error'
-            // })
           }
           uni.hideLoading();
-        })
-        .catch((err) => {
-          console.log('orderNavclick err', err);
         });
     },
     /**
@@ -654,20 +603,14 @@ export default {
       this.$u.api.getIndexData().then((res) => {
         if (res.code === 200) {
           // 轮播
-          const bannerList = [];
-          const banner = res.data?.advs;
-          banner.forEach((item) => {
-            const obj = {
+          this.bannerList = (res?.data?.advs ?? []).map((item) => {
+            return {
               image: item.bannerUrl,
               id: item.id,
               name: item.name,
               content: item.content
             };
-            bannerList.push(obj);
           });
-          if (bannerList.length > 0) {
-            this.bannerList = bannerList;
-          }
           // 是否有绑定车牌: 没有则通过弹框去绑定
           const vehicleList = res.data?.vehicleList ?? [];
           if (vehicleList.length === 0) {
@@ -689,14 +632,15 @@ export default {
               enableFeepay.push(0);
             }
           });
+          this.recordList = enableFeepay;
+          if (enableFeepay.length) this.orderNav = enableFeepay[0];
+          if (enableFeepay.length === 3) this.contractStatus = enableFeepay[2];
+          // 统计
           this.totalActualAmount = res.data?.payedInfo?.totalActualAmount;
           this.totalCount = res.data?.payedInfo?.totalCount;
           this.totalPayAmount = res.data?.payingInfo?.totalPayAmount;
           this.totalPayCount = res.data?.payingInfo?.totalCount;
-          this.recordList = enableFeepay;
-          this.orderNav = enableFeepay[0];
-          this.contractStatus = enableFeepay[2];
-          this.orderList = res.data.orderList;
+          this.orderList = orderList;
           // 消息提示
           const newsList = [];
           const news = res.data?.news ?? [];
@@ -704,11 +648,6 @@ export default {
             newsList.push(item.content);
           });
           this.noticeList = newsList;
-        } else {
-          this.$refs.uToast.show({
-            title: res.msg,
-            type: 'error'
-          });
         }
       });
     },
@@ -716,27 +655,26 @@ export default {
     goPay(item) {
       const href = location.origin;
       this.jumpUrl = href + '/pages/center/order/orderDetails/orderDetails?orderId=' + item.id + '&type=open';
-      // this.payWayPop = true;
       this.curOrderList = [];
       this.curOrderList.push(item.id);
       this.$refs['choosePayment'].openPopup({ ...item }, 'single', 'road');
     },
     // 获取路段详情
-    onRoadInfo(item) {
-      this.$u.api
-        .roadInfoById({
-          id: item.roadId
-        })
-        .then((res) => {
-          this.popupOrderDetails = res.data;
+    async onRoadInfo(item) {
+      const { code, data } = await this.$u.api.roadInfoById({
+        id: item.roadId
+      });
+      if (code === 200) {
+        if (data) {
+          this.popupOrderDetails = data;
           this.showOrderDetails = true;
-        })
-        .catch((err) => {
+        } else {
           this.$refs.uToast.show({
-            title: '系统异常',
-            type: 'error'
+            title: '暂无停车点数据!',
+            type: 'warning'
           });
-        });
+        }
+      }
     },
     // 关闭路段详情弹框
     closeOrderDetails() {
@@ -766,7 +704,7 @@ export default {
     },
     // 关闭支付弹框
     closePaymentMethod() {
-      this.payWayPop = false;
+      // this.payWayPop = false;
     }
   }
 };

+ 13 - 8
pages/parkingLists/parkingLists.vue

@@ -350,10 +350,10 @@ export default {
             }
           });
           this.nearParkingList = nearParkingList;
-          if (nearParkingList.length > 0) {
-            this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude;
-            this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude;
-          }
+          // if (nearParkingList.length > 0) {
+          //   this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude;
+          //   this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude;
+          // }
           this.nearParkingFlag = true;
           if (this.searchContent) {
             this.searchParkingList = nearParkingList;
@@ -406,10 +406,10 @@ export default {
             }
           });
           this.nearParkingList = nearParkingList;
-          if (nearParkingList.length > 0) {
-            this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude;
-            this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude;
-          }
+          // if (nearParkingList.length > 0) {
+          //   this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude;
+          //   this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude;
+          // }
           this.nearParkingFlag = true;
           if (this.searchContent) {
             this.searchParkingList = nearParkingList;
@@ -494,6 +494,11 @@ export default {
             latitude: this.currentPosition.latitude
           }
         });
+      } else {
+        this.$refs.uToast.show({
+          title: '该停车点不能包月!',
+          type: 'warning'
+        });
       }
     },
     /**

+ 18 - 21
pages/parkingLock/parkingLock.vue

@@ -115,6 +115,10 @@
     </view>
     <!-- 广告轮播 -->
     <ad-banner/>
+    <!-- 参数丢失弹框 -->
+    <parmas-loss-pop :show="lossPopShow" />
+    <!-- 页面报错弹框 -->
+    <page-error-pop :show="pageErrorShow" :tipText="pageErrorTxt" @pageErrorPopClose="pageErrorPopClose" />
     <u-toast ref="uToast" />
   </view>
 </template>
@@ -123,10 +127,13 @@
 import getUrlParams from '@/utils/getUrlParams.js';
 import ChoosePayment from '@/pages/choosePayment/choosePayment.vue';
 import AdBanner from '@/components/ad-banner/ad-banner.vue';
+import ParmasLossPop from '@/components/params-loss-pop/params-loss-pop.vue';
+import PageErrorPop from '@/components/page-error-pop/page-error-pop.vue';
 export default {
   components: {
     ChoosePayment,
-    AdBanner
+    AdBanner,
+    ParmasLossPop
   },
   data() {
     return {
@@ -155,7 +162,10 @@ export default {
       // 是否为返回标识
       isBack: '',
       // 预支付订单
-      polyOrderId: ''
+      polyOrderId: '',
+      lossPopShow: false,
+      pageErrorShow: false,
+      pageErrorTxt: ''
     };
   },
   onLoad(page) {
@@ -171,18 +181,7 @@ export default {
       this.tipsMsg = page?.msg;
       this.parkingLockStatus = 5;
     } else {
-      uni.showModal({
-        title: '提示',
-        content: '参数丢失, 返回首页',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            uni.switchTab({
-              url: '/pages/index/index'
-            });
-          }
-        }
-      });
+      this.lossPopShow = true;
     }
   },
   onShow() {
@@ -272,13 +271,10 @@ export default {
             this.parkingLockStatus = 1;
             // 获取页面完整url
             const local = window.location.href;
-            // 获取url后面的参数
-            const locationLocaturl = window.location.search;
             // 截取url中的isBack
             let isBack = getUrlParams(local, 'isBack');
             // 如果没有isBack,则去请求
             if (!isBack) {
-              // uni.hideLoading();
               clearInterval(this.timer1);
             }
             this.orderInfo = res.data;
@@ -287,10 +283,8 @@ export default {
               this.checkEqupment();
             }
           } else {
-            this.$refs.uToast.show({
-              title: res.msg || '订单无数据',
-              type: 'error'
-            });
+            this.pageErrorShow = true;
+            this.pageErrorTxt = res.msg || '订单无数据'
             if (this.timer1) {
               clearInterval(this.timer1);
             }
@@ -337,6 +331,9 @@ export default {
       uni.switchTab({
         url: '/pages/index/index'
       });
+    },
+    pageErrorPopClose() {
+      this.pageErrorShow = false;
     }
   }
 };

+ 19 - 20
pages/searchparking/searchparking.vue

@@ -33,8 +33,8 @@
       <view class="parkinglist">
         <view class="parkinglist-item" v-for="(item, index) in parkinglist" :key="index" @click="navigation(item.latitude, item.longitude)">
           <view class="up u-flex u-row-between">
-            <view class="vehicle-no">{{ item.vehicleNo || '-' }}</view>
-            <view class="space-name">{{ item.spaceName || '-' }}</view>
+            <view class="vehicle-no">{{ item.vehicleNo || item.parkingNo || '-' }}</view>
+            <view class="space-name">{{ item.spaceName || item.parkingName || '-' }}</view>
           </view>
           <view class="down u-flex u-row-left">
             <u-icon name="map-fill" color="#008CFF" size="28"></u-icon>
@@ -65,6 +65,10 @@ export default {
       currentPosition: {
         latitude: '',
         longitude: ''
+      },
+      currentPositionHover: {
+        latitude: '',
+        longitude: ''
       }
     };
   },
@@ -115,11 +119,19 @@ export default {
      * 导航
      * */
     navigation(lat, lon) {
-      uni.openLocation({
-        latitude: parseFloat(lat),
-        longitude: parseFloat(lon),
-        scale: 18
-      });
+      // this.currentPositionHover = { longitude: lon, latitude: lat }
+      if (lat && lon) {
+        uni.openLocation({
+          latitude: parseFloat(lat),
+          longitude: parseFloat(lon),
+          scale: 18
+        });
+      } else {
+        this.$refs.uToast.show({
+          title: '该停车点未设置经纬度!',
+          type: 'warning'
+        });
+      }
     },
     // 多地图选择
     /**
@@ -181,13 +193,6 @@ export default {
           if (this.parkinglist.length <= 0) {
             this.listEmpty = true;
           }
-        })
-        .catch((err) => {
-          this.$refs.uToast.show({
-            title: err.msg,
-            type: 'error'
-          });
-          console.log('vehicleList ', err);
         });
     },
     /**
@@ -217,12 +222,6 @@ export default {
             this.listEmpty = true;
           }
         })
-        .catch((err) => {
-          this.$refs.uToast.show({
-            title: err.msg,
-            type: 'error'
-          });
-        });
     }
   }
 };