Quellcode durchsuchen

Merge branch 'V2.0' into occupy

jiuling vor 1 Monat
Ursprung
Commit
db2f24fdf4

+ 2 - 2
pages/charginfo/charginfo.js

@@ -132,7 +132,7 @@ Page({
         seeInfoChargPile.peakTotalPrice = parseFloat((seeInfoChargPile.peakChargPrice==null || seeInfoChargPile.peakServicePrice==null || seeInfoChargPile.peakChargPrice=='暂无费用' || seeInfoChargPile.peakServicePrice=='暂无费用' )? null:(seeInfoChargPile.peakChargPrice + seeInfoChargPile.peakServicePrice).toFixed(6));
         seeInfoChargPile.flatTotalPrice = parseFloat((seeInfoChargPile.flatChargPrice==null || seeInfoChargPile.flatServicePrice==null || seeInfoChargPile.flatChargPrice=='暂无费用' || seeInfoChargPile.flatServicePrice=='暂无费用' )? null:(seeInfoChargPile.flatChargPrice + seeInfoChargPile.flatServicePrice).toFixed(6));
         seeInfoChargPile.valleyTotalPrice = parseFloat((seeInfoChargPile.valleyChargPrice==null || seeInfoChargPile.valleyServicePrice==null || seeInfoChargPile.valleyChargPrice=='暂无费用' || seeInfoChargPile.valleyServicePrice=='暂无费用' )? null:(seeInfoChargPile.valleyChargPrice + seeInfoChargPile.valleyServicePrice).toFixed(6));
-        seeInfoChargPile.totalprice =  parseFloat((seeInfoChargPile.chargprice==null || seeInfoChargPile.serviceprice==null || seeInfoChargPile.chargprice=='暂无费用' || seeInfoChargPile.serviceprice=='暂无费用')? null:(seeInfoChargPile.chargprice + seeInfoChargPile.serviceprice).toFixed(6));
+        seeInfoChargPile.totalprice =  (seeInfoChargPile.chargprice==null || seeInfoChargPile.serviceprice==null || seeInfoChargPile.chargprice=='暂无费用' || seeInfoChargPile.serviceprice=='暂无费用')? null:parseFloat((seeInfoChargPile.chargprice + seeInfoChargPile.serviceprice)).toFixed(8);
 
         that.setData({
           seeInfoChargPile,
@@ -153,7 +153,7 @@ Page({
     let { name, address, chargprice, serviceprice, chargid,brandName } = e;
 
     name =  name=='null'?null:name;
-    brandName =  brandName=='null' || 'undefined' ?null:brandName;
+    brandName = (brandName == 'null' || brandName == 'undefined') ? null : brandName;
     address =  address=='null'?null:address;
     // stationTagList = !stationTagList?null:stationTagList;
     chargprice =  chargprice=='null'?null:chargprice;

+ 1 - 1
pages/charginfo/charginfo.wxss

@@ -309,7 +309,7 @@ text.price {
 .rtable .rtr.active{
   color:#f06c6c;
   font-weight: bold;
-  font-size: 28rpx;
+  font-size: 22rpx;
   font-style: italic;
 }
 

+ 46 - 1
pages/index/index.js

@@ -211,7 +211,12 @@ Page({
     }
     for(let i=0;i<resultList.length;i++){
       if(resultList[i].currentTime){
-        data.chargprice = resultList[i].elecPrice
+        if(resultList[i].elecPrice == '暂无费用'){
+          data.chargprice = '暂无费用'
+        }else{
+          const elecPrice = parseFloat(resultList[i].elecPrice); // 将字符串转换为数字
+          data.chargprice = elecPrice.toFixed(8).replace(/\.?0+$/, ""); // 格式化为8位小数
+        }
         data.serviceprice = resultList[i].servicePrice
       }
     }
@@ -769,6 +774,12 @@ Page({
     // 终点
     markers.forEach((item, index) => {
       if (markerId && markerId == item.id) {
+        let that = this
+        item.resultList.forEach(item=>{
+          item["sumPrice"] = that.resetResultListSumPrice(item)
+          item.elecPrice = item.elecPrice.toFixed(8).replace(/\.?0+$/, "")
+          item.servicePrice = item.servicePrice.toFixed(8).replace(/\.?0+$/, "")
+        })
         let {
           name: latitude2,
           longitude: longitude2
@@ -786,6 +797,18 @@ Page({
     });
 
   },
+  resetResultListSumPrice(item){
+ 
+    if(!item.elecPrice && item.elecPrice!=0){
+      return '暂无费用'
+    }
+    if(!item.servicePrice && item.servicePrice!=0){
+      return '暂无费用'
+    }
+    return (Number(item.elecPrice || 0) + Number(item.servicePrice || 0))
+    .toFixed(8)
+    .replace(/\.?0+$/, "");
+  },
   //导航
   getRoute(e) {
     //console.log(e);
@@ -1291,6 +1314,28 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    // 处理页面跳转回来导致费率字段类型为字符串,处理为数值类型避免报错
+    let that = this;
+    for (let i = 0; i < that.data.markers.length; i++) {
+        let marker = that.data.markers[i];  // 直接获取 marker,减少 that.data 访问
+        let resultList = marker.resultList;
+
+        if (!resultList) continue; 
+        for (let j = 0; j < resultList.length; j++) {
+            let item = resultList[j]; 
+            if (item.elecPrice === '暂无费用') {
+                item.chargprice = '暂无费用';
+            } else {
+                item.elecPrice = parseFloat(parseFloat(item.elecPrice).toFixed(8).replace(/\.?0+$/, ""));
+            }
+            if (item.servicePrice === '暂无费用') {
+                item.servicePrice = '暂无费用';
+            } else {
+                item.servicePrice = parseFloat(parseFloat(item.servicePrice).toFixed(8).replace(/\.?0+$/, ""));
+            }
+        }
+        marker.resultList = resultList; // 直接赋值给 marker
+    }
     this.data.scanFlag = false;
     let userInfo = wx.getStorageSync('userInfo');
     let isLogin = wx.getStorageSync('isLogin');

+ 3 - 0
pages/reservation/reservationEdit.js

@@ -91,6 +91,9 @@ Page({
       } = options;
   
       console.info(options);
+      if(options.brandName == 'null' || options.brandName == ''){
+        brandName = null
+      }
       let curTime = new Date();
       let sstime = new Date(curTime.setMinutes(curTime.getMinutes() + parseInt(earliestReservTime)));
       let curTime2 = new Date();

+ 3 - 1
pages/scan_result/scan_result.js

@@ -25,6 +25,8 @@ Page({
     let that = this
     resultList.forEach(item=>{
       item["sumPrice"] = that.resetResultListSumPrice(item)
+      item.elecPrice = item.elecPrice.toFixed(8).replace(/\.?0+$/, "");  
+      item.servicePrice = item.servicePrice.toFixed(8).replace(/\.?0+$/, "");
     })
   },
   resetResultListSumPrice(item){
@@ -35,7 +37,7 @@ Page({
     if(!item.servicePrice && item.servicePrice!=0){
       return '暂无费用'
     }
-    return parseFloat((item.elecPrice + item.servicePrice).toFixed(6))
+    return parseFloat((item.elecPrice + item.servicePrice).toFixed(8))
   },
 
   /**

+ 1 - 1
pages/scan_result/scan_result.wxss

@@ -158,7 +158,7 @@ text.inline {
 }
 
 .rtable .rtr .rtd{
-  font-size: 26rpx;
+  font-size: 25rpx;
 }
 
 .rtable .rtr .rtd.t1{

+ 2 - 3
pages/search_result/search_result.js

@@ -170,7 +170,7 @@ Page({
                   slowfreenum: item.slowfreenum,
                   breaknum: item.breaknum,
                   /** 电费 */
-                  chargprice: item.chargprice,
+                  chargprice: item.chargprice.toFixed(8).replace(/\.?0+$/, ""),
                   /** 服务费 */
                   serviceprice: item.serviceprice,
                   /** 停车费 */
@@ -237,7 +237,7 @@ Page({
               slowfreenum: item.slowfreenum,
               breaknum: item.breaknum,
               /** 电费 */
-              chargprice: item.chargprice,
+              chargprice: item.chargprice.toFixed(8).replace(/\.?0+$/, ""),
               /** 服务费 */
               serviceprice: item.serviceprice,
               /** 停车费 */
@@ -512,7 +512,6 @@ Page({
     let markers =  this.data.markers; //首页
     this.data.markers.forEach((item, index) => {
       if (markerId && markerId == item.id) {
-
         wx.navigateBack({
           delta: pages.length
         });

+ 1 - 1
pages/ucenter/charginglog/charginglog.wxml

@@ -12,7 +12,7 @@
         <image src='/images/charging2_1.png'></image>
       </view>
       <view class='charging_text_title1'>
-        <text class='bold'>{{charginglog.chargStation.brandName != '' ? charginglog.chargStation.brandName : '' }}{{charginglog.chargStation.chargStationName}}</text>
+        <text class='bold'>{{charginglog.chargStation.brandName || '' }}{{charginglog.chargStation.chargStationName}}</text>
         <text class="h1">{{charginglog.chargStation.address}}</text>
       </view>
     </view>

+ 1 - 1
pages/ucenter/yuyt/yuyt.wxml

@@ -24,7 +24,7 @@
           <image src='/images/charging2_1.png'></image>
         </view>
         <view class='charging_text_title1'>
-          <text class='bold'>{{item.reservStation.brandName != '' ? item.reservStation.brandName : '' }}{{item.reservStation.chargStationName}}</text>
+          <text class='bold'>{{item.reservStation.brandName || '' }}{{item.reservStation.chargStationName}}</text>
           <text class="h1">{{item.reservPile.chargPileId}}</text>
         </view>
       </view>