Selaa lähdekoodia

扫码增加车牌

XWookey 1 vuosi sitten
vanhempi
commit
e29e649b6d

+ 50 - 4
pages/index/index.js

@@ -77,7 +77,8 @@ Page({
       
     }],
     showModal: false,
-    notice: null
+    notice: null,
+    carParkingRate: false
   },
   howtouse(){
     wx.navigateTo({
@@ -384,7 +385,7 @@ Page({
                       /** 停车费 */
                       stopprice: item.stopprice,
                       operationState: item.operationState,
-                      chargStationId: item.chargStationId,
+                      chargStationId: item.id,
                     };
                     markers[index] = marker;
                   });
@@ -451,7 +452,7 @@ Page({
                   valleyChargPrice : item.valleyChargPrice,
                   valleyServicePrice : item.valleyServicePrice,
                   resultList: item.resultList,
-                  chargStationId: item.chargStationId
+                  chargStationId: item.id
                 };
                 markers[index] = marker;
 
@@ -573,6 +574,7 @@ Page({
   },
   //将mark呈现在地图中心点,并弹出详细信息框
   showMarkerInfo(data) {
+    let that = this
     let {
       latitude,
       longitude
@@ -582,6 +584,49 @@ Page({
       latitude: latitude,
       longitude: longitude
     })
+    console.info(data)
+    // 查询是否需要显示
+    that.execParking(that,data.id)
+  },
+  execParking(that,stationId){
+    wx.request({
+      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/carParkingRate?stationId=' + stationId,
+      // data: {
+      // loginName: userInfo.loginName
+      // },
+      method: 'POST',
+      success: function (res) {
+        // 是否减免停车费
+        // carParkingRate: false,
+        // parkTime: 0,
+        console.info(res)
+        let dataSharePlatform = res.data.dataSharePlatform;
+        if(!dataSharePlatform){
+          that.setData({
+            carParkingRate:false
+          })
+          return;
+        }
+        that.setData({
+          carParkingRate:true
+        })
+        try{
+          that.setData({
+            parkTime: parseFloat((dataSharePlatform.chargeUserId/ 3600).toFixed(2))
+          })
+        }catch(e){
+          that.setData({
+            carParkingRate:false
+          })
+        }
+
+      },
+      fail(e) {
+      console.log("用户数据同步失败");
+      log.info('[扫码]', '[同步用户数据]', '[fail]', e);
+      }
+    });
+
   },
   //改变选中mark的颜色
   changeMarkerColor(markerId) {
@@ -636,6 +681,7 @@ Page({
       chargprice,
       serviceprice,
     } = textData;
+
     console.log("222222");
     console.log(markers);
     if (!markers.length) return;
@@ -982,7 +1028,7 @@ Page({
                     valleyChargPrice : item.valleyChargPrice,
                     valleyServicePrice : item.valleyServicePrice,
                     resultList: item.resultList,
-                    chargStationId: item.chargStationId
+                    chargStationId: item.id
                   };
                   markers[index] = marker;
                 });

+ 1 - 1
pages/index/index.wxml

@@ -50,7 +50,7 @@
       </view>
       <view style="width: 100%;height: 40rpx;display: flex;flex-direction: row;">
       <text class='inline border'>服务费:{{textData.serviceprice == null? '暂无服务费' : textData.serviceprice + ' 元/度'}}</text>
-      <view class="parkingfee"><image src="/images/v2_rxmjcu.png" style="height:30rpx;width:30rpx"/><text class='inline'>减免停车费</text></view>
+      <view class="parkingfee" wx:if="{{carParkingRate}}"><image src="/images/v2_rxmjcu.png" style="height:30rpx;width:30rpx"/><text class='inline'>减免停车费</text></view>
     </view>
       <!-- <text class='inline border'>停车费:{{textData.stopprice}}元/小时</text> -->
      

+ 7 - 6
pages/scan_result/scan_result.js

@@ -146,7 +146,7 @@ Page({
 
   },
 
-  beginChargeInner(that){
+  beginChargeInner(that,plateNumber){
     let userInfo = wx.getStorageSync('userInfo');
     let isLogin = wx.getStorageSync('isLogin');
     // 扫码启动
@@ -162,7 +162,7 @@ Page({
     wx.request({
       url: getApp().globalData.postHeadAgreement + '/restapi/wechat/syncUser',
       data: {
-        loginName: userInfo.loginName
+        loginName: userInfo.loginName,
       },
       method: 'POST',
       success: function (res) {
@@ -262,7 +262,7 @@ Page({
             // });
           } else if (data.repaidbalance > 15) {
             log.info('[扫码]', '[同步用户数据]', '[余额充足开始充电]', data);
-            that.beginCharge_satrt();
+            that.beginCharge_satrt(plateNumber);
           }
         }
       }
@@ -317,7 +317,7 @@ Page({
             cancelColor:'#00AADD',
             success: function (ress1) {
                 if(ress1.confirm){
-                  that.beginChargeInner(that)
+                  that.beginChargeInner(that,userCar.plateNumber)
                 }else{
                   let url = '/pages/ucenter/car/car'
                   wx.navigateTo({
@@ -345,7 +345,7 @@ Page({
     });
   
   },
-  beginCharge_satrt() {
+  beginCharge_satrt(plateNumber) {
     wx.showLoading({
       title: '开启充电中...',
       mask: true
@@ -373,7 +373,8 @@ Page({
         //chargPileId: '201811010000004202',
         chargPileId: terminalNum,
         userId: userId,
-        chargstarttime: chargstarttime
+        chargstarttime: chargstarttime,
+        userPlateNumber: plateNumber
       },
       method: 'POST',
       fail(e) {

+ 4 - 4
pages/search_result/search_result.js

@@ -174,7 +174,7 @@ Page({
                   valleyChargPrice : item.valleyChargPrice,
                   valleyServicePrice : item.valleyServicePrice,
                   resultList: item.resultList,
-                  chargStationId: item.chargStationId
+                  chargStationId: item.id
 
 
                 };
@@ -239,7 +239,7 @@ Page({
               valleyChargPrice : item.valleyChargPrice,
               valleyServicePrice : item.valleyServicePrice,
               resultList: item.resultList,
-              chargStationId: item.chargStationId
+              chargStationId: item.id
             };
             markers[index] = marker;
           });
@@ -369,7 +369,7 @@ Page({
                   valleyChargPrice : item.valleyChargPrice,
                   valleyServicePrice : item.valleyServicePrice,
                   resultList: item.resultList,
-                  chargStationId: item.chargStationId
+                  chargStationId: item.id
                 };
                 if (myChargeStationsIds.indexOf(item.id + ',') != -1) {
                   marker.userFlag = true;
@@ -438,7 +438,7 @@ Page({
               valleyChargPrice : item.valleyChargPrice,
               valleyServicePrice : item.valleyServicePrice,
               resultList: item.resultList,
-              chargStationId: item.chargStationId
+              chargStationId: item.id
             };
             markers[index] = marker;
           });