7
0

4 Commity 4c0211a83e ... fb20d35067

Autor SHA1 Správa Dátum
  XWookey fb20d35067 电池包逻辑调整 6 mesiacov pred
  XWookey 35dc6f3a81 叫车业务 6 mesiacov pred
  XWookey 1e2a583875 调度充电车完成 6 mesiacov pred
  XWookey bfe9297d11 充电站详情 6 mesiacov pred

+ 2 - 0
app.js

@@ -1,6 +1,8 @@
 //app.js
 let wechat = require('./utils/wechat.js');
 let log = require('./utils/log.js');
+import EventBus from './utils/EventBus.js'
+wx.$bus = new EventBus()
 App({
   globalData: {
     // postHeadAgreement: 'http://127.0.0.1:10301',

+ 3 - 1
app.json

@@ -1,6 +1,7 @@
 {
   "lazyCodeLoading": "requiredComponents",
   "pages": [
+
     "pages/index/index",
     "pages/routes/routes",
     "pages/charginfo/charginfo",
@@ -56,7 +57,8 @@
     "pages/ucenter/control/carControl",
     "pages/ucenter/control/batteryControl",
     "pages/scan_result/elpackage",
-    "pages/batteryPack/batteryPackWait"
+    "pages/batteryPack/batteryPackWait",
+    "pages/charginfo/eleCarMap"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 80 - 56
components/circle-progress/circle-progress.js

@@ -19,27 +19,27 @@ Component({
           this.updateDisabled(newVal);
         }
       },
-    width: {
-        type: Number,
-        value: 100,
-        observer(newVal) {
-            this.updateWidth(newVal);
-        }
-    },
-    r: {
-        type: Number,
-        value: 90,
-        observer(newVal) {
-            this.updateR(newVal);
-        }
-    },
-    lw: {
-        type: Number,
-        value: 5,
-        observer(newVal) {
-            this.updateLw(newVal);
-        }
-    },
+    // width: {
+    //     type: Number,
+    //     value: 100,
+    //     observer(newVal) {
+    //         this.updateWidth(newVal);
+    //     }
+    // },
+    // r: {
+    //     type: Number,
+    //     value: 90,
+    //     observer(newVal) {
+    //         this.updateR(newVal);
+    //     }
+    // },
+    // lw: {
+    //     type: Number,
+    //     value: 5,
+    //     observer(newVal) {
+    //         this.updateLw(newVal);
+    //     }
+    // },
   },
 
   
@@ -54,9 +54,20 @@ Component({
       r:110,
       lw:7,
     },
-  
+    
     lifetimes: {
       attached() {
+
+        const container = this.selectComponent('#container')
+        // const width = container.offsetWidth;
+        // const height = container.offsetHeight;
+        console.log("xxxxxxxxxxxxxxxxxxxxxxx")
+        console.log(container)
+        // console.log(width)
+        // console.log(height)
+        console.log("xxxxxxxxxxxxxxxxxxxxxxx")
+
+
         // 组件加载后准备绘制
         this.initCanvas();
       },
@@ -70,11 +81,28 @@ Component({
        * 初始化 Canvas 上下文
        */
       initCanvas() {
+          let that = this
         // 获取两个canvas元素的上下文
         this.bgContext = wx.createCanvasContext('canvasProgressbg', this);
         this.progressContext = wx.createCanvasContext('canvasProgress', this);
-        this.drawProgressbg();
-        this.drawCircle(this.data.progress);
+
+
+        const container = this.selectComponent('#container')
+        var query = wx.createSelectorQuery().in(this);
+        query.select('#container').boundingClientRect()
+        query.exec(function (res) {
+            //res就是 所有标签为publicImg的元素的信息 的数组
+            console.log(res);
+            that.data.width = res[0].width / 2
+            that.data.r = that.data.width - 1
+            that.data.lw = 1
+
+            that.drawProgressbg();
+            that.drawCircle(that.data.progress);
+        })
+
+                    
+
       },
   
       /**
@@ -100,10 +128,6 @@ Component({
 
         this.progressContext.setFillStyle('red');
 
-
-    
-
-
       },
 
       /**
@@ -127,39 +151,39 @@ Component({
         })
         //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
         if(this.progressContext){
-            this.drawCircle(this.data.progressPercentage);
+            this.drawCircle(this.data.progress);
         }
       }, 
                   /**
       * 更新并画disabled
       */
-     updateWidth(dis) {
-        this.setData({
-            width:dis
-        })
-        //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
-        if(this.progressContext){
-            this.drawCircle(this.data.progressPercentage);
-        }
-      }, 
-      updateR(dis) {
-        this.setData({
-            r:dis
-        })
-        //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
-        if(this.progressContext){
-            this.drawCircle(this.data.progressPercentage);
-        }
-      },
-      updateLw(dis) {
-        this.setData({
-            r:dis
-        })
-        //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
-        if(this.progressContext){
-            this.drawCircle(this.data.progressPercentage);
-        }
-      },
+    //  updateWidth(dis) {
+    //     this.setData({
+    //         width:dis
+    //     })
+    //     //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
+    //     if(this.progressContext){
+    //         this.drawCircle(this.data.progressPercentage);
+    //     }
+    //   }, 
+    //   updateR(dis) {
+    //     this.setData({
+    //         r:dis
+    //     })
+    //     //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
+    //     if(this.progressContext){
+    //         this.drawCircle(this.data.progressPercentage);
+    //     }
+    //   },
+    //   updateLw(dis) {
+    //     this.setData({
+    //         r:dis
+    //     })
+    //     //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
+    //     if(this.progressContext){
+    //         this.drawCircle(this.data.progressPercentage);
+    //     }
+    //   },
       /**
        * 画progress进度
        */

+ 1 - 1
components/circle-progress/circle-progress.wxml

@@ -1,6 +1,6 @@
 <!--components/circle/circle.wxml-->
 
-<view class='container'>
+<view class='container' id="container">
   <view class='progress_box'>
     <!-- 绘制圆环背景 -->
     <canvas class="progress_bg" canvas-id="canvasProgressbg" />

+ 1 - 1
components/circle-progress/circle-progress.wxss

@@ -51,7 +51,7 @@
   }
    
   .progress_info {
-    font-size: 12rpx;
+    font-size: 16rpx;
     text-align: center;
     /* letter-spacing: 2rpx; */
     color: #21ADFF;

BIN
images/ele_lock.png


BIN
images/ele_unlock.png


BIN
images/park_lock.png


BIN
images/park_unlock.png


BIN
images/power.png


BIN
images/triangle.png


+ 120 - 1
pages/batteryPack/batteryPackWait.js

@@ -5,15 +5,134 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    chargePileId: -9,
+    timer:{},
+    userInfo:{},
+    // count: 0 , // 用于测试
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
+    let that = this
+    let userInfo = wx.getStorageSync('userInfo');
+    let timer  = setInterval(()=>{
+        that.wait(that)
+    }, 2000);
+    that.setData({
+        timer,
+        userInfo
+    })
 
   },
+  wait(that){
+    let userInfo = that.data.userInfo;
+    if(!userInfo){
+       return; 
+    }
+    wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/ivCarRequirement' + 
+        '?userId='+userInfo.userId,
+        data: {
+        },
+        method: 'POST',
+        success(res) {
+            // 0-7 进等待 8进终端详情
+            if(res?.data?.result?.requirementStep>=0 && res?.data?.result?.requirementStep<=7 
+                // || that.data.count < 3
+            ){
+                that.setData({
+                    chargePileId: res?.data?.result?.terminalId,
+                    // chargePileId: res?.data?.result?.terminalId,
+                    // count: that.data.count + 1
+                })
+                // 等待
+                console.log(new Date() + " - requirementStep:" + res?.data?.result?.requirementStep)
+            }else if(res?.data?.result?.requirementStep==8 
+                // || that.data.count>3
+                ){
+                that.setData({
+                    chargePileId: res?.data?.result?.terminalId,
+                    // chargePileId: res?.data?.result?.terminalId,
+                    // count: that.data.count + 1
+                })
+                // 8进终端详情
+                clearInterval(that.data.timer)
+                that.gotoScan_result(that)
+            }else{
+                that.gotoIndex()
+            }
+            
+        },
+        fail(e) {
+            getApp().showNetworkError();
+        }
+    });
+  },
+gotoIndex(){
+    let url = `/pages/index/index`;
+    wx.reLaunch({
+        url
+      });
+},
+gotoScan_result(that){
+    let chargPileId = that.data.chargePileId
+    let userInfo = that.data.userInfo
+    wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
+        // data: charePileId,
+        data:{
+          chargPileId,
+          userId: userInfo.userId
+        },
+        method: 'POST',
+        success(res) {
+          //console.log(res.data);
+          // log.info('[首页]', '[获取微信扫一扫充电桩]', '[响应]', res.data);
+          if (!res.data || res.data.code == 500) {
+            //没有该充电桩信息
+            wx.showModal({
+              showCancel: false,
+              content: res && res.data && res.data.msg ? res.data.msg :'无效的终端编号',
+              confirmColor:'#00AADD',
+            });
+          } else {
+            res.data = res.data.result
+            //充电状态0:离线、1:故障、2:空闲中、3:充电中、4:欠压故障、5:过压故障、6:过电流故障、8:预约、9:在线升级、10:操作中、11:已插枪等
+            if (!res.data.chargstatus || res.data.chargstatus == 0 || res.data.chargstatus == 1 || res.data.chargstatus == 4 || res.data.chargstatus == 5 || res.data.chargstatus == 6 || res.data.chargstatus == 9) {
+              //充电桩故障
+
+              wx.showModal({
+                showCancel: false,
+                content: '终端故障,维修中',
+                confirmColor:'#00AADD',
+              });
+            } else if (res.data.chargstatus == 3 || res.data.chargstatus == 8 || res.data.chargstatus == 10) {
+              wx.showModal({
+                showCancel: false,
+                content: '正在充电中',
+                confirmColor:'#00AADD',
+              });
+            } else if (res.data.chargstatus == 2 || res.data.chargstatus == 11) {
+              wx.setStorage({
+                key: "scan_chargpile",
+                data: res.data
+              });
+            //  log.info('[首页]', '[微信扫一扫充电桩空闲跳转去充电界面]');
+              let url = `/pages/scan_result/scan_result`;
+              wx.reLaunch({
+                url
+              });
+            }
+          }
+        },
+        fail(e) {
+          getApp().showNetworkError();
+        }
+      });
+},
+
 
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 1 - 1
pages/batteryPack/batteryPackWait.wxml

@@ -1,6 +1,6 @@
 <!--pages/batteryPack/batteryPackWait.wxml-->
 <image class="car" src='/images/chargingCarIcon.png'></image>
-<view class="txt">智能充电车调度中, 请等待!!</view>
+<view class="txt">智能充电车调度中, 请等待!</view>
 <view class="loading">
     <view class="loader-circle"></view>
     <view class="loader-circle"></view>

+ 133 - 17
pages/charginfo/charginfo.js

@@ -1,6 +1,3 @@
-import * as echarts from '../../ec-canvas/echarts';
-import * as lf from '../../ec-canvas/echarts-liquidfill';
-
 
 let log = require('../../utils/log.js');
 
@@ -24,12 +21,18 @@ Page({
     slowSum:0,
     pagesize:30,
     pagenum:1,
+    ele_pagenum:1,
     total:-1,
+    ele_total:-1,
     loadTotal: 0,
     dataLoading: false,
+    ele_dataLoading: false,
     finishedLoadTap: 0,
+    ele_finishedLoadTap: 0,
     finishedLoadShowTimes: 0,
+    ele_finishedLoadShowTimes: 0,
     chargList: [],
+    ele_chargList: [],
     seeInfoChargPile:{},
     userInfo:{},
     chargfeatureList:[],
@@ -161,7 +164,8 @@ Page({
       sumprice
     });
  
-    this.getPage();
+    this.ori_getPage();
+    this.ele_getPage();
   },
   previewImage(e){
     var that = this,
@@ -177,14 +181,113 @@ Page({
     })
   },
   getPage(){
+    let that = this;
+    if(that.activeTab=='1'){
+        that.ori_getPage();
+    }else{
+        that.ele_getPage();
+    }
+
+  },
 
+  ori_getPage(){
+    // ivType
+    // 是否为无人车充电站(0否;1是)
+    // 0:桩
+    // 1:电池
     if(this.data.chargList.length == this.data.total){
+        this.setData({
+          finishedLoadTap:this.data.finishedLoadTap+1
+        })
+        if(this.data.finishedLoadTap>0 && this.data.finishedLoadShowTimes==0){
+          this.setData({
+            finishedLoadShowTimes:this.data.finishedLoadShowTimes+1
+          })
+          wx.showToast({
+            title: '全部加载完毕',
+            icon: 'success',
+            duration: 2000
+          })
+        }
+        return
+      }
+  
+      if(this.data.dataLoading){
+        return
+      }
+      this.setData({
+        dataLoading: true
+      })
+      wx.showLoading({
+        title: '数据加载中....',
+      })
+  
+    let that = this;
+      // 充电桩
+      wx.request({
+        url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
+        data: {
+          id: that.data.chargid,
+          pagenum: this.data.pagenum++,
+          ivType: 0,
+          pagesize: 30,
+        },
+        method: 'POST',
+        success(res) {
+          console.log(res);
+          let chargList = res.data.chargList.rows;
+  
+          chargList.forEach(key => {
+            let chargstatusname = '';
+            let chargstatusclass = '';
+            if(key.chargstatus == 2){
+              chargstatusname='空闲中'
+              chargstatusclass = 'chargstatus_kxz'
+            }else if(key.chargstatus == 11){
+              chargstatusname='已插枪'
+              chargstatusclass = 'chargstatus_ycq'
+            }else if(key.chargstatus == 3 || key.chargstatus == 10){
+              chargstatusname='充电中'
+              chargstatusclass = 'chargstatus_cdz'
+            }else if(key.chargstatus == 0){
+              chargstatusname='离线'
+              chargstatusclass = 'chargstatus_lx'
+            }else{
+              chargstatusname='故障'
+              chargstatusclass = 'chargstatus_gz'
+            }
+            key.chargstatusname = chargstatusname;
+            key.chargstatusclass = chargstatusclass;
+        })
+  
+          console.log(chargList);
+          // that.rechargeTimeOrder(chargemoneylogs);
+          wx.hideLoading()
+          that.setData({
+            chargList: that.data.chargList.concat(chargList),
+            total: res.data.chargList.total,
+            dataLoading: false,
+            fastFree : res.data.fastFree,
+            slowFree : res.data.slowFree,
+            fastSum : res.data.fastSum,
+            slowSum : res.data.slowSum
+          });
+        }
+      });
+  },
+
+  ele_getPage(){
+    // ivType
+    // 是否为无人车充电站(0否;1是)
+    // 0:桩
+    // 1:电池
+    if(this.data.ele_chargList.length == this.data.ele_total){
       this.setData({
-        finishedLoadTap:this.data.finishedLoadTap+1
+        ele_finishedLoadTap:this.data.ele_finishedLoadTap+1
       })
-      if(this.data.finishedLoadTap>0 && this.data.finishedLoadShowTimes==0){
+      if(this.data.ele_finishedLoadTap>0 && this.data.ele_finishedLoadShowTimes==0){
         this.setData({
-          finishedLoadShowTimes:this.data.finishedLoadShowTimes+1
+          ele_finishedLoadShowTimes:this.data.ele_finishedLoadShowTimes+1
         })
         wx.showToast({
           title: '全部加载完毕',
@@ -195,22 +298,24 @@ Page({
       return
     }
 
-    if(this.data.dataLoading){
+    if(this.data.ele_dataLoading){
       return
     }
     this.setData({
-      dataLoading: true
+      ele_dataLoading: true
     })
     wx.showLoading({
       title: '数据加载中....',
     })
 
   let that = this;
+    // 充电桩
     wx.request({
       url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
       data: {
         id: that.data.chargid,
-        pagenum: this.data.pagenum++,
+        pagenum: this.data.ele_pagenum++,
+        ivType: 1,
         pagesize: 30,
       },
       method: 'POST',
@@ -245,18 +350,29 @@ Page({
         // that.rechargeTimeOrder(chargemoneylogs);
         wx.hideLoading()
         that.setData({
-          chargList: that.data.chargList.concat(chargList),
-          total: res.data.chargList.total,
-          dataLoading: false,
-          fastFree : res.data.fastFree,
-          slowFree : res.data.slowFree,
-          fastSum : res.data.fastSum,
-          slowSum : res.data.slowSum
+          ele_chargList: that.data.ele_chargList.concat(chargList),
+          ele_total: res.data.chargList.total,
+          ele_dataLoading: false,
+          ele_fastFree : res.data.fastFree,
+          ele_slowFree : res.data.slowFree,
+          ele_fastSum : res.data.fastSum,
+          ele_slowSum : res.data.slowSum
         });
       }
     });
 
   },
+  goEleCarMap(e){
+    console.info("呼叫充电车");
+    let that = this;
+    wx.setStorageSync('eleCarMapPage', {
+    chargid: that.data.chargid
+    })
+    let url = '/pages/charginfo/eleCarMap';
+    wx.navigateTo({
+        url
+    });
+  },
   goScanResult(e){
     // scan_result
 

+ 7 - 4
pages/charginfo/charginfo.wxml

@@ -118,17 +118,20 @@
     <!-- 充电桩 end  -->
 
     <!-- 机器人充电车 start -->
-    <view wx:if="{{activeTab=='1'}}" class="charg"  hover-class='active' wx:key='{{key}}' wx:for="{{chargList}}" data-idx="{{item}}" bindtap="{{userInfo.flag ?'chargingLog':''}}">
+    <!--
+    <view wx:if="{{activeTab=='1'}}" class="charg"  hover-class='active' wx:key='{{key}}' wx:for="{{ele_chargList}}" data-idx="{{item}}" bindtap="{{userInfo.flag ?'chargingLog':''}}">
+    -->
+    <view wx:if="{{activeTab=='1'}}" class="charg"  hover-class='active' wx:key='{{key}}' wx:for="{{ele_chargList}}" data-idx="{{item}}" bindtap="goEleCarMap">
       <view class="runstatus {{item.chargstatusclass}}">
       <view class="runstatus_inner ">{{item.chargstatusname}}</view>
       </view>
       <view class="chargInfo_v">
       <view class="chargInfo_v_name">{{item.chargPileName}}</view>
-      <view class="chargInfo_v_id"><text style="width:300rpx">{{item.chargPileId}}</text><text wx:if="{{!item.openStatus}}" decode="{{true}}" space="nbsp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</text><text wx:if="{{!userInfo.flag && item.openStatus}}" class="seeReservation" bindtap="seeReservation" bindtap="seeReservation"  data-idx="{{item}}">查看预约</text><text class="startpower" wx:if="{{!userInfo.flag && item.chargstatusname=='已插枪'}}"  data-keywords="{{item}}"  bindtap="{{(!userInfo.flag && item.chargstatusname=='已插枪')?'goScanResult':''}}">呼叫充电车 ></text></view>
+      <view class="chargInfo_v_id"><text style="width:300rpx">{{item.chargPileId}}</text><text wx:if="{{!item.openStatus}}" decode="{{true}}" space="nbsp">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</text><text class="startpower" wx:if="{{!userInfo.flag && item.chargstatusname=='已插枪'}}"  data-keywords="{{item}}"  bindtap="{{(!userInfo.flag && item.chargstatusname=='已插枪')?'goEleCarMap':''}}">呼叫充电车 ></text></view>
       </view>
-      <view class="iconCard" >
+      <!-- <view class="iconCard" >
         <view class="icon {{item.pileType=='慢充'?'slowBar':'fastBar'}}">{{item.pileType=='慢充'?'慢':'快'}}</view>
-      </view>
+      </view> -->
     </view>
     <!-- 机器人充电车 end  -->
 

+ 404 - 0
pages/charginfo/eleCarMap.js

@@ -0,0 +1,404 @@
+// pages/charginfo/eleCarMap.js
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    longitude:116.4965075,
+    latitude: 40.006103,
+    speed:0,
+    scale:20,
+    accuracy:0,
+    chargid:0,
+    ele_chargList:[],
+    ele_park:[1,2,3],
+    markers:[],
+    markTemp:{
+        id: 1,
+        latitude: 23.098994,
+        longitude: 113.322520,
+        iconPath: '/images/triangle.png',
+        height: 5,
+        width: 5,
+        customCallout: {
+            anchorX: 0,
+            anchorY: 0,
+            display: "ALWAYS"
+        }
+
+        // anchor:{x: 0.5, y:1 },
+        // callout: {
+        //   content: '文本内容',
+        //   color: '#000000',
+        //   fontSize: 14,
+        //   borderWidth: 2,
+        //   borderRadius: 5,
+        //   borderColor: '#FFFFFF',
+        //   bgColor: '#ffffff',
+        //   padding: 5,
+        //   display: 'ALWAYS',
+        //   textAlign: 'center'   
+        // }
+    },
+    eleActiveIndex: -1,
+    parkActiveIndex: -1,
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    let that = this;
+    let json = wx.getStorageSync("eleCarMapPage")
+    let {chargid} = json;
+    that.setData({chargid})
+    let userInfo = wx.getStorageSync('userInfo');
+    that.setData({
+        userInfo
+    })
+    this.getEleData()
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+
+  addHandler(json){
+    let {
+        chargid
+    } = json
+    this.setData({
+        chargid
+    })
+    this.getEleData()
+  },
+  callouttap(e){
+
+    // eleActiveIndex: -1,
+    // parkActiveIndex: -1,
+    let that = this;
+    let index = e.markerId;
+    console.info(e.markerId)
+    let ele_chargList = this.data.ele_chargList;
+    let mm = ele_chargList[index]
+    if(mm.lock){
+        return
+    }
+
+    if(mm.active){
+        
+        mm.active = false;
+        if(mm.objType == 'ele'){
+            
+            that.setData({
+                eleActiveIndex:-1
+            })
+        }else{
+            
+            that.setData({
+                parkActiveIndex:-1
+            })
+        }
+        this.setData({
+            ele_chargList
+        })
+    
+        return;
+    }
+    mm.active = true;
+    if(mm.objType == 'ele'){
+        if( that.data.eleActiveIndex >=0){
+            ele_chargList[ that.data.eleActiveIndex].active = false
+        }
+       
+        that.setData({
+            eleActiveIndex:index
+        })
+    }else{
+        if( that.data.parkActiveIndex >=0){
+            ele_chargList[ that.data.parkActiveIndex].active = false
+        }
+       
+       
+        that.setData({
+            parkActiveIndex:index
+        })
+    }
+
+
+    // ele_chargList.forEach(key=>{
+
+    // })
+    console.info(this.data.ele_chargList)
+
+    let car_active = false
+    if(this.data.parkActiveIndex >=0 && this.data.eleActiveIndex >=0 ){
+        car_active = true
+    }
+
+    this.setData({
+        ele_chargList,
+        car_active
+    })
+
+  },
+  getEleData(){
+      console.info("查询数据")
+    // 新源恒远210调试站
+    let that = this;
+    // 充电桩
+    wx.request({
+      url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
+      data: {
+        id: that.data.chargid,
+        pagenum: 1,
+        ivType: 1,
+        pagesize: 10000,
+      },
+      method: 'POST',
+      success(res) {
+        console.log(res);
+        let chargList = res.data.chargList.rows;
+        let ele_chargList = []
+        chargList.forEach(key => {
+          let chargstatusname = '';
+          let chargstatusclass = '';
+          if(key.chargstatus == 2){
+            chargstatusname='空闲中'
+            chargstatusclass = 'chargstatus_kxz'
+          }else if(key.chargstatus == 11){
+            chargstatusname='已插枪'
+            chargstatusclass = 'chargstatus_ycq'
+          }else if(key.chargstatus == 3 || key.chargstatus == 10){
+            chargstatusname='充电中'
+            chargstatusclass = 'chargstatus_cdz'
+          }else if(key.chargstatus == 0){
+            chargstatusname='离线'
+            chargstatusclass = 'chargstatus_lx'
+          }else{
+            chargstatusname='故障'
+            chargstatusclass = 'chargstatus_gz'
+          }
+          key.chargstatusname = chargstatusname;
+          key.chargstatusclass = chargstatusclass;
+          let mark = JSON.parse(JSON.stringify(that.data.markTemp));
+          
+          if(key?.currentParkPoint?.latitude && key?.currentParkPoint?.longitude ){
+            mark.id = that.data.ele_chargList.length + ele_chargList.length;
+            mark.latitude = key?.currentParkPoint?.latitude
+            mark.longitude = key?.currentParkPoint?.longitude
+            mark['ele_lock'] = key?.lockStatus == 1
+            mark['ele_unlock'] = key?.lockStatus == 0
+            mark['park_lock'] = false
+            mark['park_unlock'] = false
+            mark['lock'] = mark['ele_lock'] || mark['park_lock']
+            mark['active'] = false
+            mark['title'] = key?.currentSoc? key?.currentSoc + '%' : '-'
+            mark['type'] = mark['ele_lock'] ? '锁定' : '未锁定'
+            mark['objType'] = 'ele'
+            // mark['chargPileId'] = that.data.chargid
+            // mark['chargPileId'] = key?.chargPileId
+            mark['chargPileId'] = key?.id
+
+
+            // mark.callout.content = key?.currentParkPoint?.pointShowName
+            ele_chargList.push(mark)
+            that.setData({
+                longitude:mark.longitude,
+                latitude:mark.latitude,
+            })
+          }
+
+      })
+
+        console.log(ele_chargList);
+        // that.rechargeTimeOrder(chargemoneylogs);
+        wx.hideLoading()
+        that.setData({
+          ele_chargList: that.data.ele_chargList.concat(ele_chargList),
+          markers: that.data.markers.concat(ele_chargList),
+        //   ele_total: res.data.chargList.total,
+        //   ele_dataLoading: false,
+        //   ele_fastFree : res.data.fastFree,
+        //   ele_slowFree : res.data.slowFree,
+        //   ele_fastSum : res.data.fastSum,
+        //   ele_slowSum : res.data.slowSum
+        });
+        console.log(ele_chargList);
+      }
+    });
+
+    // 停靠点
+    wx.request({
+        url: getApp().globalData.postHeadAgreement +'/restapi/wechat/ivparkByStation',
+        data: {
+          id: that.data.chargid,
+          pagenum: 1,
+          ivType: 1,
+          pagesize: 10000,
+        },
+        method: 'POST',
+        success(res) {
+          console.log(res);
+          let chargList = res.data;
+          let ele_chargList = []
+          chargList.forEach(key => {
+            let chargstatusname = '';
+            let chargstatusclass = '';
+            if(key.chargstatus == 2){
+              chargstatusname='空闲中'
+              chargstatusclass = 'chargstatus_kxz'
+            }else if(key.chargstatus == 11){
+              chargstatusname='已插枪'
+              chargstatusclass = 'chargstatus_ycq'
+            }else if(key.chargstatus == 3 || key.chargstatus == 10){
+              chargstatusname='充电中'
+              chargstatusclass = 'chargstatus_cdz'
+            }else if(key.chargstatus == 0){
+              chargstatusname='离线'
+              chargstatusclass = 'chargstatus_lx'
+            }else{
+              chargstatusname='故障'
+              chargstatusclass = 'chargstatus_gz'
+            }
+            key.chargstatusname = chargstatusname;
+            key.chargstatusclass = chargstatusclass;
+
+            let mark = JSON.parse(JSON.stringify(that.data.markTemp));
+          
+
+            mark.id = that.data.ele_chargList.length + ele_chargList.length;
+            mark.latitude = key?.latitude
+            mark.longitude = key?.longitude
+            mark['ele_lock'] = false
+            mark['ele_unlock'] = false
+            mark['park_lock'] = key?.parkStatus == 1
+            mark['park_unlock'] = key?.parkStatus == 0
+            mark['lock'] = mark['ele_lock'] || mark['park_lock']
+            mark['active'] = false
+            mark['title'] = key?.pointShowName? key?.pointShowName : '-'
+            mark['type'] = mark['ele_lock'] ? '占用' : '空闲'
+            mark['objType'] = 'park'
+            mark['ivParkPointId'] = key?.ivParkPointId;
+            // mark.callout.content = key?.currentParkPoint?.pointShowName
+            ele_chargList.push(mark)
+            that.setData({
+                longitude:mark.longitude,
+                latitude:mark.latitude,
+            })
+
+
+        })
+  
+          console.log(ele_chargList);
+          // that.rechargeTimeOrder(chargemoneylogs);
+
+        
+
+          wx.hideLoading()
+          that.setData({
+            ele_chargList: that.data.ele_chargList.concat(ele_chargList),
+            markers: that.data.markers.concat(ele_chargList),
+            // ele_park: that.data.ele_park.concat(chargList),
+          //   ele_total: res.data.chargList.total,
+          //   ele_dataLoading: false,
+          //   ele_fastFree : res.data.fastFree,
+          //   ele_slowFree : res.data.slowFree,
+          //   ele_fastSum : res.data.fastSum,
+          //   ele_slowSum : res.data.slowSum
+          });
+        }
+      });
+
+
+
+  },
+  callCar(){
+    let that = this
+    let car_active = that.data.car_active;
+    if(!car_active){
+        return;
+    }
+
+    let ivParkPointId = that.data.ele_chargList[that.data.parkActiveIndex].ivParkPointId
+    let chargePileId = that.data.ele_chargList[that.data.eleActiveIndex].chargPileId
+    let userId = that.data.userInfo.userId
+
+    wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/callCarRequirement?'
+        + 'ivParkPointId=' + ivParkPointId
+        + '&chargePileId=' + chargePileId
+        + '&userId=' + userId
+        + '&requirementType=0',
+        data: {
+        },
+        method: 'POST',
+        success: function (res) {
+            if( res.data.code ==200){
+                // 走你
+                let url = `/pages/batteryPack/batteryPackWait`;
+                wx.redirectTo({
+                  url
+                });
+            }else{
+                // 给出提示
+                wx.showModal({
+                    showCancel: false,
+                    content: "调度失败" + res.data?.msg,
+                    confirmColor:'#00AADD',
+                  });
+            }
+        },
+        fail(e) {
+          console.log("呼叫充电车失败");
+        }
+    })
+    }
+})

+ 3 - 0
pages/charginfo/eleCarMap.json

@@ -0,0 +1,3 @@
+{
+    "navigationBarTitleText": "详情"
+}

+ 31 - 0
pages/charginfo/eleCarMap.wxml

@@ -0,0 +1,31 @@
+
+<view class='view'>
+  <!-- <map longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" covers="{{covers}}" show-location> -->
+  <view class="mapBox">
+<map longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" scale="{{scale}}" bindcallouttap="callouttap">
+    <cover-view slot="callout">
+        <!--  电池包 -->
+        <block wx:for="{{ele_chargList}}" wx:key="*this">
+            <cover-view  class="cardView {{item.active?'c_active':''}}  {{item.objType}}" marker-id="{{item.id}}" >
+                <cover-image class="imgLeft" src='/images/ele_lock.png' wx:if="{{item.ele_lock}}"></cover-image>
+                <cover-image class="imgLeft" src='/images/ele_unlock.png' wx:if="{{item.ele_unlock}}"></cover-image>
+                <cover-image class="imgLeft" src='/images/park_lock.png' wx:if="{{item.park_lock}}"></cover-image>
+                <cover-image class="imgLeft" src='/images/park_unlock.png' wx:if="{{item.park_unlock}}"></cover-image>
+                <cover-view  class="infoView ">
+                    <cover-view  class="topView">
+                        <cover-view class="title">{{item.title}}</cover-view>
+                        <cover-image class="power" src='/images/power.png' wx:if="{{item.objType=='ele'}}"></cover-image>
+                    </cover-view>
+                    <cover-view  class="typeView">{{item.type}}</cover-view>
+                </cover-view>
+            </cover-view>
+            <cover-view  class="triangle"></cover-view>
+
+        </block>
+      </cover-view>
+  </map>
+</view>
+  <view class="txt">请选择可用车位和电池包</view>
+  <button class="{{car_active?'login_button':'login_button_disable'}}" bindtap="callCar">呼叫充电车</button>
+</view>
+

+ 166 - 0
pages/charginfo/eleCarMap.wxss

@@ -0,0 +1,166 @@
+/**index.wxss**/
+/* 不加page无法全屏 */
+page {
+    height: 100%;
+}
+   
+.view {
+width: 100%;
+height: 100%;
+}
+   
+.mapBox{
+    margin: 0 20rpx;
+    width: calc(100% - 40rpx);
+    height: 80%;
+    overflow: hidden;
+}
+map {
+margin: 0 20rpx;
+width: calc(100% - 40rpx);
+height: calc(100% + 50rpx);
+background-color: #FFF;
+
+}
+
+
+  
+  .login_button {
+    width: calc(100% - 270rpx);
+    font-size: 32rpx;
+    /* margin: 0rpx 32rpx; */
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #fff;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    background-color: #00a8dc;
+    border-radius: 40rpx;
+    height: 80rpx;
+    border: none;
+    margin: 70rpx auto;
+  }
+  
+  .login_button_disable {
+    width: calc(100% - 270rpx);
+    font-size: 32rpx;
+    /* margin: 0rpx 32rpx; */
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #fff;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    background-color: #c9c9c9;
+    border-radius: 40rpx;
+    height: 80rpx;
+    border: none;
+    margin: 70rpx 135rpx 0 135rpx;
+  }
+  
+  .login_button.button-hover {
+    background-color: #36a9a6;
+  }
+
+  .cardView{
+    width: 160rpx;
+    height: 60rpx;
+    opacity:0.9;
+    height: calc(100% - 5rpx);
+    background-color: #FFFFFF; 
+    padding: 5rpx 5rpx;
+    border-radius: 20rpx;
+    display: flex;
+    flex-direction: row;
+    box-shadow: 9px 9px 9px #33333333; 
+    position: relative;
+    margin-left:-5rpx
+  }
+
+  .triangle{
+    width: 0px;
+    height: 0px;
+    border-top: 5px solid #FF0000;
+    border-left: 5px solid transparent;
+    border-right: 5px solid transparent;
+    position: absolute;
+    
+  }
+
+  .cardView .imgLeft{
+    width: 50rpx;
+    height: 50rpx;
+    padding: 5rpx 5rpx;
+  }
+
+  .cardView .infoView{
+    width: calc(100% - 80rpx);
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+  }
+
+  .cardView .infoView .topView{
+    width: 100%;
+    height: calc(100% - 20rpx);
+    display: flex;
+    flex-direction: row;
+  }
+  
+
+  .cardView .infoView .topView .title{
+    width: 80%;
+    height: 100%;
+    font-size: 16rpx;
+    line-height: 25rpx;
+    color:#000000;
+    text-align: center;
+    padding-left: 10rpx;
+  }
+
+  .cardView .topView .power{
+    width: 30rpx;
+    height: 30rpx;
+    padding-left: 20rpx;
+  }
+
+  .txt{
+      text-align: center;
+      color: #9A9A9A;
+      width: 100%;
+      font-size: 25rpx;
+      height: 40rpx;
+      line-height: 40rpx;
+      padding-top: 20rpx;
+  }
+  .cardView .typeView{
+    width: 100%;
+    height: 30rpx;
+    line-height: 25rpx;
+    font-size: 16rpx;
+    text-align: left;
+    padding-left:16rpx;
+    color: #9A9A9A;
+  }
+
+/* .c_active{
+    border:#35B2AB 5 solid
+} */
+
+.cardView.ele.c_active{
+    border:#35B2AB 5rpx solid;
+}
+
+.cardView.park.c_active{
+    border:#21ADFF 5rpx solid;
+}

+ 101 - 6
pages/index/index.js

@@ -89,7 +89,6 @@ Page({
   wxScan(q) {
     //console.log(decodeURIComponent(e.q));
     let charePileId = decodeURIComponent(q).replace("https://cdgl.pjnes.com/", "");
-    //console.log(charePileId);
     log.info('[首页]', '[微信扫一扫]', { 'q': q });
     if(!charePileId){
       charePileId = "0"
@@ -109,6 +108,7 @@ Page({
         });
         return;
       } else {
+
         log.info('[首页]', '[获取用户是否有未完成订单]', '[请求]', { userId: userInfo.userId });
         wx.request({
           url: getApp().globalData.postHeadAgreement + '/restapi/pileLog/wechatchargstatus',
@@ -912,8 +912,15 @@ Page({
       scanResult = "0"
     }
   }
+  // 是否电池包
+  let batteryFlag = false;
+  if (scanResult.startsWith("tkd")){
+    scanResult = scanResult.substring(3);
+    batteryFlag = true
+  }
+
   if (scanResult.startsWith("hlht://") || scanResult.startsWith("HLHT://")){
-    scanResult = scanResult.                                                                                                                                                                                                                substring(7, scanResult.indexOf("."));
+    scanResult = scanResult.substring(7, scanResult.indexOf("."));
   }
   scanResult = scanResult.replace("https://cdgl.pjnes.com/", "");
   scanResult = scanResult.replace("https://cdglyy.pjnes.com/", "");
@@ -921,7 +928,7 @@ Page({
     log.info('[首页]', '[用户完成扫一扫]', scanResult);
     log.info('[首页]', '[获取扫一扫充电桩]', '[请求]', scanResult);
     wx.request({
-      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
+      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/' + (batteryFlag? 'chargBattery' : 'chargPile'),
       // data: scanResult,
       data: {
         chargPileId:scanResult,
@@ -929,6 +936,7 @@ Page({
       },
       method: 'POST',
       success(res) {
+        console.log( res.data);
         log.info('[首页]', '[获取扫一扫充电桩]', '[响应]', res.data);
         if (!res.data || res.data.code == 500) {
           that.data.scanFlag = false;
@@ -941,14 +949,67 @@ Page({
           });
         } else {
           res.data = res.data.result
+          // 拨乱反正, 将电池包的逻辑强行合并
+          if(batteryFlag){
+            //  0空闲
+            let status = res.data.parkStatus
+            if(status == 1){
+                wx.showModal({
+                    showCancel: false,
+                    content: '当前停靠点占用',
+                    confirmColor:'#00AADD',
+                });
+            }else if(status == 0){
+                wx.hideLoading();
+                that.data.scanFlag = false;
+                // 判断电池包
+                if(res?.data?.chargPileList?.length==0 || !res?.data?.chargPileList){
+                    wx.showModal({
+                        showCancel: false,
+                        content: '暂无可用电池包',
+                        confirmColor:'#00AADD',
+                    });
+                    return;
+                }
+
+                wx.setStorage({
+                    key: "elpackage",
+                    data: res.data
+                  });
+
+                let url = `/pages/scan_result/elpackage`;
+
+
+                wx.navigateTo({
+                  url
+                });
+            }else{
+                wx.showModal({
+                    showCancel: false,
+                    content: '未知错误,电池包返回状态码异常:' + res.data.parkStatus,
+                    confirmColor:'#00AADD',
+                });
+            }
+            that.data.scanFlag = false;
+            wx.hideLoading();
+            return;
+          }
+          
+
+            //SZP
+            // park_status
+
+
           //充电状态0:离线、1:故障、2:空闲中、3:充电中、4:欠压故障、5:过压故障、6:过电流故障、8:预约、9:在线升级、10:操作中、11:已插枪等
           if (!res.data.chargstatus || res.data.chargstatus == 0 || res.data.chargstatus == 1 || res.data.chargstatus == 4 || res.data.chargstatus == 5 || res.data.chargstatus == 6 || res.data.chargstatus == 9) {
+
             //充电桩故障    
             wx.showModal({
-              showCancel: false,
-              content: '终端故障,维修中',
-              confirmColor:'#00AADD',
+                showCancel: false,
+                content: '终端故障,维修中',
+                confirmColor:'#00AADD',
             });
+
           } else if (res.data.chargstatus == 3 || res.data.chargstatus == 8 || res.data.chargstatus == 10) {
             wx.showModal({
               showCancel: false,
@@ -1152,6 +1213,9 @@ Page({
         });
         return;
       }
+
+    // 查询订单
+
       log.info('[首页]', '[获取用户是否有未完成订单]', '[请求]', { userId: userInfo.userId });
       wx.request({
         url: getApp().globalData.postHeadAgreement + '/restapi/pileLog/wechatchargstatus',
@@ -1180,6 +1244,37 @@ Page({
           getApp().showNetworkError();
         }
       });
+
+    // 查询呼叫电车
+    console.log("查询呼叫电车")
+    wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/ivCarRequirement' + 
+        '?userId='+userInfo.userId,
+        data: {
+        },
+        method: 'POST',
+        success(res) {
+            console.log(res?.data?.result?.requirementStep)
+            // 0-7 进等待 8进终端详情
+            if(res?.data?.result?.requirementStep>=0 && res?.data?.result?.requirementStep<=7){
+                // 等待
+                let url = `/pages/batteryPack/batteryPackWait`;
+                wx.reLaunch({
+                  url
+                });
+            }else if(res?.data?.result?.requirementStep==8){
+                // 8进终端详情
+                let url = `/pages/batteryPack/batteryPackWait`;
+                // wx.reLaunch({
+                //   url
+                // });
+            }
+        },
+        fail(e) {
+            getApp().showNetworkError();
+        }
+    });
+
     } else {
       //未登录信息
       this.setData({

+ 1 - 0
pages/index/index.wxss

@@ -112,6 +112,7 @@
   height: 38rpx;
   display:block;
   margin: 24rpx;
+ 
 }
 
 .map_location_hover{

+ 87 - 409
pages/scan_result/elpackage.js

@@ -8,18 +8,25 @@ Page({
   data: {
     progressPercentage: 100, // 初始进度值为50%
     // chargPile: null,
-    chargPile: true,
+    chargPile: {
+
+    },
+    parkObj:{},
+    eleList:{},
     orderid: null,
+    userInfo:{},
     userId: null,
     repaidbalance: 0,
     resultTable: [],
+    selectEleIndex : -1,
     // 是否减免停车费
     carParkingRate: false,
     // 停车时间
     parkTime: 0,
     url:'/images/scan_result.png',
     authStatus: 1,
-    defPlateNumber:''
+    defPlateNumber:'',
+    car_active: false
   },
 
   /**
@@ -27,450 +34,121 @@ Page({
    */
   onLoad: function (options) {
     let that = this;
+
+    let userInfo = wx.getStorageSync('userInfo');
+    that.setData({
+        userInfo
+    })
+
+
     wx.getStorage({
-      key: 'scan_chargpile',
+      key: 'elpackage',
       success: function (res) {
         console.log(res);
-        //console.log(res.data);
-        var chargPile = res.data;
-        let authStatus = chargPile.authStatus
-        let resultTable = chargPile.resultList
-        that.resetResultList(resultTable)
-        that.setData({
-          resultTable,
-          authStatus
+        console.log(res.data);
+        let chargPile = res.data.chargStation;
+        let eleList = res.data.chargPileList; 
+        let parkObj = res.data
+
+        eleList.forEach((key)=>{
+            if(!key.currentSoc){
+                key.currentSoc = 0
+            }
+            key['active'] = false
         })
-        chargPile.sharpTotalPrice = parseFloat((chargPile.sharpChargPrice + chargPile.sharpServicePrice).toFixed(6));
-        chargPile.peakTotalPrice = parseFloat((chargPile.peakChargPrice + chargPile.peakServicePrice).toFixed(6));
-        chargPile.flatTotalPrice = parseFloat((chargPile.flatChargPrice + chargPile.flatServicePrice).toFixed(6));
-        chargPile.valleyTotalPrice = parseFloat((chargPile.valleyChargPrice + chargPile.valleyServicePrice).toFixed(6));
-        chargPile.totalprice = parseFloat((chargPile.chargprice + chargPile.serviceprice).toFixed(6));
+
+
         that.setData({
-          chargPile
-        });
-        //console.log(chargPile);
+            chargPile,
+            eleList,
+            parkObj
+        })
 
         // 更新是否减停车费
-        that.execParking(that,chargPile)
+
 
 
         wx.removeStorage({
-          key: 'scan_chargpile',
+          key: 'elpackage',
           success(res) {
             console.log(res);
           }
         });
-        log.info('[扫码]', '[加载完成]', '[参数]', res.data);
-		let userInfo = wx.getStorageSync('userInfo');
-		wx.request({
-		  url: getApp().globalData.postHeadAgreement + '/restapi/wechat/syncUser',
-		  data: {
-			loginName: userInfo.loginName
-		  },
-		  method: 'POST',
-		  success: function (res) {
-			let {
-			  data
-			} = res;
-			log.info('[扫码]', '[同步用户数据]', '[响应]', data);
-			console.info('[扫码]', '[同步用户数据]', '[响应]', data);
-			if (data.code && data.code != 200) {
-			  log.info('[扫码]', '[同步用户数据]', '[失败data null||data.code<>200跳转登陆界面]', data);
-			} else {
-			  that.setData({
-				repaidbalance:data.repaidbalance
-			  });
-			}
-		  },
-		  fail(e) {
-			console.log("用户数据同步失败");
-			log.info('[扫码]', '[同步用户数据]', '[fail]', e);
-		  }
-    });
-    
-
-
 
       }
     });
   },
-  execParking(that,chargPile){
-    let stationId = chargPile.chargStationId;
-    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 reduceTime = res.data?.reduceTime;
-        if(!reduceTime){
-          that.setData({
-            carParkingRate:false
-          })
-          return;
-        }
-        that.setData({
-          carParkingRate:true
-        })
-        try{
-          that.setData({
-            parkTime: parseFloat((reduceTime/ 3600).toFixed(2))
-          })
-        }catch(e){
-          that.setData({
-            carParkingRate:false
-          })
-        }
-
-      },
-      fail(e) {
-      console.log("用户数据同步失败");
-      log.info('[扫码]', '[同步用户数据]', '[fail]', e);
-      }
-    });
 
-  },
+  selectEle(e){
+    let idx = e.currentTarget.dataset.idx;
 
-  beginChargeInner(that,plateNumber){
-    let userInfo = wx.getStorageSync('userInfo');
-    let isLogin = wx.getStorageSync('isLogin');
-    // 扫码启动
-    wx.showLoading({
-      title: '开启充电中...',
-      mask: true
-    });
-    log.info('[扫码]', '[开始充电流程]');
-    //同步用户数据
-    log.info('[扫码]', '[同步用户数据]', '[请求]', {
-      loginName: userInfo.loginName
-    });
-    wx.request({
-      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/syncUser',
-      data: {
-        loginName: userInfo.loginName,
-      },
-      method: 'POST',
-      success: function (res) {
-        wx.hideLoading();
-        let {
-          data
-        } = res;
-
-
-        log.info('[扫码]', '[同步用户数据]', '[响应]', data);
-        console.info('[扫码]', '[同步用户数据]', '[响应]', data);
-        if (data.code && data.code != 200) {
-          wx.removeStorageSync('userInfo');
-          wx.removeStorageSync('isLogin');
-          let url = '/pages/login/phone_login/phone_login';
-          wx.redirectTo({
-            url,
-          });
-          log.info('[扫码]', '[同步用户数据]', '[失败data null||data.code<>200跳转登陆界面]', data);
-        } else {
-          wx.setStorageSync('userInfo', data);
-          wx.setStorageSync('isLogin', true);
-          let repaidbalance = data.repaidbalance;
-          that.setData({
-            repaidbalance
-          });
-          //开始充电
-          if(data.bindingPhone==0){
-            wx.showModal({
-              title: '提示',
-              content: '您未绑定手机号,请重新登录后自动刷新绑定信息',
-              confirmText: '去登录',
-              showCancel:false,
-              confirmColor:'#00AADD',
-              success: function (res1) {
-                if (res1.confirm) {
-                  wx.removeStorageSync('userInfo');
-                  wx.removeStorageSync('isLogin');
-                  let url = '/pages/login/phone_login/phone_login';
-                  wx.redirectTo({
-                    url
-                  })
-                }
-              }
-            });
-            log.info('[扫码]', '[同步用户数据]', '[未绑定手机号]', data);
-          }else if (!data.repaidbalance || data.repaidbalance <= 0) {
-            wx.showModal({
-              showCancel: false,
-              content: '余额不足,请充值!',
-              confirmColor:'#00AADD',
-              success: function (res) {
-                if (res.confirm) {
-                  let url = "/pages/chargemoney/chargemoney";
-                  wx.navigateTo({
-                    url
-                  });
-                }
-              }
-            });
-            log.info('[扫码]', '[同步用户数据]', '[data.repaidbalance null||data.repaidbalance<=0余额不足跳转充值界面]', data);
-          } else if (data.repaidbalance > 0 && data.repaidbalance <= 15) {
-            wx.showModal({
-              title: '余额:' + data.repaidbalance + '元',
-              showCancel: false,
-              confirmText: "去充值",
-              confirmColor:'#00AADD',
-              content: '余额过低,请尽快充值!',
-              success: function (res) {
-                if (res.confirm) {
-                  let url = "/pages/chargemoney/chargemoney";
-                  wx.navigateTo({
-                    url
-                  });
-                }
-              }
-            });
-            log.info('[扫码]', '[同步用户数据]', '[0<data.repaidbalance<=15余额过低]', data);
-
-            // wx.showModal({
-            //   title:'请选择',
-            //   showCancel: true,
-            //   confirmText:"继续充电",
-            //   cancelText:"去充值",
-            //   content: '余额过低,请尽快充值!',
-            //   success: function (res) {
-            //     if (res.confirm) {
-
-            //       that.beginCharge_satrt();
-            //     } else if (res.cancel) {
-            //       let url = "/pages/chargemoney/chargemoney";
-            //       wx.navigateTo({
-            //         url
-            //       });
-            //     }
-            //   }
-            // });
-          } else if (data.repaidbalance > 15) {
-            log.info('[扫码]', '[同步用户数据]', '[余额充足开始充电]', data);
-            that.beginCharge_satrt(plateNumber,1);
-          }
+    let that = this;
+    let eleList = that.data.eleList;
+    let car_active = that.data.car_active;
+    if(eleList[idx].active){
+        eleList[idx].active = false;
+        idx = -1
+    }else{
+        eleList[idx].active = true;
+        if(that.data.selectEleIndex>=0){
+            eleList[that.data.selectEleIndex].active = false;
         }
-      }
-    });
-    // 扫描结束
-  },
-  beginChargeMsg(e){
-    let that = this
-    wx.requestSubscribeMessage({
-      tmplIds: ['3FR5XRyycT81ZWMdVi_ZQYKJcVatZr2Tm7DgcLwCD1I','KWHBIONCrdumgTkE1dpIpAZRgrN5TuhpHuZ0uU-Eud4','XWj70eHMLAjLlufPuhE_NQmdSQzhrOwEXIblWveH0bk'],
-      success (res33333) {
-        that.beginCharge(e)
-      },fail(reee){
-        console.info("ffffffffffffff")
-        console.info(reee)
-      }
+
+    }
+    car_active = (idx>=0)
+    that.setData({
+        selectEleIndex: idx,
+        eleList,
+        car_active
     })
+    
   },
-  beginCharge(e) {
+  callCar(){
     let that = this
-    let userInfo = wx.getStorageSync('userInfo');
-    let isLogin = wx.getStorageSync('isLogin');
+    let car_active = that.data.car_active;
 
-    if(!that.data.carParkingRate){
-      that.beginChargeInner(that,'');
-      return;
+    if(!car_active){
+        return;
     }
-    // 读取默认车牌
+
+    let ivParkPointId = that.data.parkObj.ivParkPointId 
+    let chargePileId = that.data.eleList[that.data.selectEleIndex].id
+    let userId = that.data.userInfo.userId
+
     wx.request({
-      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/carList?loginName=' + userInfo.loginName,
-      // data: {
-      // loginName: userInfo.loginName
-      // },
-      method: 'POST',
-      success: function (res) {
-        let userCarList = res.data;
-        userCarList = userCarList.filter(it=>it.defaultType==1);
-        console.info(userCarList)
-        if(userCarList.length==0 ){
-          wx.showModal({
-            title: '提示',
-            content: '当前充电站可减免停车费,是否绑定车牌信息?',
-            confirmText: '绑定车牌',
-            cancelText: '直接启动',
-            showCancel:true,
-            confirmColor:'#00AADD',
-            cancelColor:'#00AADD',
-            success: function (ress1) {
-              if(ress1.confirm){
-                let url = '/pages/ucenter/car/chooseCar'
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/callCarRequirement?'
+        + 'ivParkPointId=' + ivParkPointId
+        + '&chargePileId=' + chargePileId
+        + '&userId=' + userId
+        + '&requirementType=0',
+        data: {
+        },
+        method: 'POST',
+        success: function (res) {
+            if( res.data.code ==200){
+                // 走你
+                let url = `/pages/batteryPack/batteryPackWait`;
                 wx.navigateTo({
                   url
                 });
-              }else{
-                that.beginChargeInner(that,'')
-              }
-            }
-          });
-        }else{
-          let userCar = userCarList[0]
-          wx.showModal({
-            title: '提示',
-            content: '确定使用' + userCar.plateNumber + '车牌信息减免停车费?',
-            confirmText: '确定',
-            cancelText: '其他车牌',
-            showCancel:true,
-            confirmColor:'#00AADD',
-            cancelColor:'#00AADD',
-            success: function (ress1) {
-                if(ress1.confirm){
-                  that.beginChargeInner(that,userCar.plateNumber)
-                }else{
-                  let url = '/pages/ucenter/car/chooseCar'
-                  wx.navigateTo({
-                    url
+            }else{
+                // 给出提示
+                wx.showModal({
+                    showCancel: false,
+                    content: "调度失败" + res.data?.msg,
+                    confirmColor:'#00AADD',
                   });
-                }
-                return;
-
-            },
-            fail: function(res1){
-              console.info(res1)
             }
-          });
+        },
+        fail(e) {
+          console.log("呼叫充电车失败");
         }
+  });
 
-      },
-      fail(e) {
-      console.log("查询车辆失败");
-      log.info('[查询车辆]','[fail]', e);
-      }
-    });
-  
-  
-  },
-  beginCharge_satrt(plateNumber,runTimes) {
-    wx.showLoading({
-      title: '开启充电中...',
-      mask: true
-    });
 
-    let that = this;
-    let terminalNum = this.data.chargPile.chargPileId;
 
-    let userInfo = wx.getStorageSync('userInfo');
-    let isLogin = wx.getStorageSync('isLogin');
-
-    console.log(terminalNum);
-    let userId = userInfo.userId;
-    let chargstarttime = new Date().getTime();
-    console.log(chargstarttime);
-    log.info('[扫码]', '[开始充电]', '[请求]', {
-      //chargPileId: '201811010000004202',
-      chargPileId: terminalNum,
-      userId: userId,
-      chargstarttime: chargstarttime
-    });
-    wx.request({
-      url: getApp().globalData.postHeadAgreement + '/restapi/pileLog/miniprogramadd',
-      data: {
-        //chargPileId: '201811010000004202',
-        chargPileId: terminalNum,
-        userId: userId,
-        chargstarttime: chargstarttime,
-        userPlateNumber: plateNumber,
-        runTimes:runTimes
-      },
-      method: 'POST',
-      fail(e) {
-
-        wx.hideLoading();
-        //开启充电失败,提示用户
-        wx.showModal({
-          showCancel: false,
-          content: '开启充电失败',
-          confirmColor:'#00AADD',
-        });
-        log.info('[扫码]', '[开始充电]', '[fail]', e);
-      },
-      success(res) {
-        wx.hideLoading();
-        let {
-          data
-        } = res;
-        log.info('[扫码]', '[开始充电]', '[响应]', data);
-        if (data && data.code == 200) {
-          //if (data && data.code == 200 && data.orderid) {
-          //开启充电成功,跳转到正在充电界面
-          let {
-            orderid
-          } = data;
-          log.info('[扫码]', '[开始充电]', '[成功,跳转充电中页面]', data);
-          //console.log(this.data.city);
-          let url = `/pages/charging/charging?orderid=${orderid}&userId=${userId}&chargPileId=${terminalNum}`;
-          wx.redirectTo({
-            url
-          });
-        } else if (data && data.code == 501) {
-          //开启充电失败,提示用户
-          wx.showModal({
-            showCancel: false,
-            content: '余额不足,请充值!',
-            confirmColor:'#00AADD',
-          });
-          log.info('[扫码]', '[开始充电]', '[失败data.code=501余额不足]', data);
-        } else if (data && data.code == 502) {
-          //开启充电失败,提示用户
-          wx.showModal({
-            showCancel: false,
-            content: data.message,
-            confirmColor:'#00AADD',
-          });
-          log.info('[扫码]', '[开始充电]', '[失败data.code=502' + data.message + ']', data);
-        } else if (data && data.code == 503) {
-            //开启充电失败,提示用户
-            let msg = res?.data?.message
-            wx.showModal({
-                title: '提示',
-                showCancel: true,
-                content: msg,
-                cancelText:'其他车辆',
-                confirmText:'继续启动',
-                confirmColor:'#00AADD',
-                cancelColor:'#00AADD',
-                success: function (res) {
-                    if (res.cancel) {
-                       //点击取消,其他车辆
-                    } else {
-                       //点击确定,继续启动
-                       that.beginCharge_satrt(plateNumber,runTimes + 1)
-                    }
-                 },
-                 fail: function (res) { },//接口调用失败的回调函数
-                 complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行)
-              });
-            log.info('[扫码]', '[开始充电]', '[失败data.code=502' + data.message + ']', data);
-        } else {
-          //开启充电失败,提示用户
-          let msg = res?.data?.message
-          msg = msg?msg:'开启充电失败'
-          wx.showModal({
-            showCancel: false,
-            content: msg,
-            confirmColor:'#00AADD',
-          });
-          log.info('[扫码]', '[开始充电]', '[失败]', data);
-        }
-      }
-    });
   },
-  previewImage(e){
-    let cur = e.target.dataset.src;//获取本地一张图片链接
-    console.info(cur)
-    wx.previewImage({
-        current: cur, //字符串,默认显示urls的第一张
-          urls: [cur] // 数组,需要预览的图片链接列表
-    })
-},
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 20 - 17
pages/scan_result/elpackage.wxml

@@ -12,27 +12,30 @@
         <image src='/images/charging2_1.png'></image>
       </view>
       <view class='charging_text_title1'>
-        <text class='bold'>{{chargPile.chargPileName}}</text>  <!-- xxxxx场站 -->
-        <text class="h1">{{chargPile.chargPileId}}</text> <!-- xxx号车位 -->
+        <text class='bold'>{{chargPile.chargStationName}}</text>  <!-- xxxxx场站 -->
+        <!-- <text class="h1">{{chargPile.chargStationId}}号车位</text>  -->
+        <text class="h1">{{parkObj.pointShowName}}</text> <!-- xxx号车位 -->
       </view>
     </view>
     <!-- <text style='margin-bottom:10rpx;'>地址:{{chargPile.address}}</text> -->
-    <rich-text space='nbsp' nodes="地址:{{chargPile.address}}" style='line-height:30rpx;font-size:24rpx;margin-bottom:10rpx;word-wrap: break-word;' ></rich-text>
-    <text style="font-size:28rpx;line-height:28rpx;">请选择电池包</text>
+    <text style='line-height:24rpx;height:24rpx;font-size:24rpx;margin-top: 16rpx;' >地址:{{chargPile.address}}</text>
+    <text style="line-height:24rpx;height:24rpx;font-size:24rpx;margin: 20rpx 0;">请选择电池包</text>
     <view class="cardHub">
-
-        <view class="card">
-            <view class="circleOut"><view class="circleIn">1</view></view>
-            <view class="main">
-                <view style="width:60rpx;height:60rpx;margin: 0 auto;margin-top: 30rpx;">
-                    <circle-progress name="circle-progress" progress="100" disabled="{{false}}" width="{{15}}" r="{{14}}" lw="{{1}}"/>
+        <block wx:for="{{eleList}}" wx:key="*this"  >
+        <view class="card {{item.active?'':'dis'}}" bindtap="selectEle" data-idx="{{index}}">
+                <view class="circleOut">{{index + 1}}</view>
+                <view class="main">
+                    <view style="width:60rpx;height:60rpx;margin: 0 auto;margin-top: 30rpx;">
+                        <circle-progress name="circle-progress" progress="{{item.currentSoc}}" disabled="{{!item.active}}"/>
+                    </view>
+                    <view class="no">编号:{{item.chargPileId}}</view>
+                </view>
+                <view class="foot">电池包可用
                 </view>
-                <view class="no">编号:123456789</view>
-            </view>
-            <view class="foot">电池包可用
             </view>
-        </view>
+        </block>
 
+<!--
         <view class="card dis">
             <view class="circleOut"><view class="circleIn">1</view></view>
             <view class="main">
@@ -41,13 +44,13 @@
                 </view>
                 <view class="no">编号:123456789</view>
             </view>
-            <view class="foot">电池包可用
+            <view class="foot">电池包可用
             </view>
         </view>
-
+-->
     </view>
 
 
 
   </view>
-  <button wx:if="{{chargPile}}" class='charg_button' bindtap="beginChargeMsg" >呼叫充电车</button>
+  <button wx:if="{{chargPile}}" class="{{car_active?'login_button':'login_button_disable'}}" bindtap="callCar" >呼叫充电车</button>

+ 41 - 15
pages/scan_result/elpackage.wxss

@@ -22,7 +22,7 @@ page {
     height: 105rpx;
     width: 100%;
     display: flex;
-    margin-bottom: 20rpx;
+    margin-bottom: 0rpx;
   }
   
   .charging_text_title1 {
@@ -89,10 +89,10 @@ page {
     min-height: 28rpx;
     color: #a3a3a3;
   }
-  .charg_button {
+  .login_button {
+    width: calc(100% - 270rpx);
     font-size: 32rpx;
-    margin: 20rpx 65rpx;
-    height: 90rpx;
+    /* margin: 0rpx 32rpx; */
     font-family: 'Lucida Sans',
                    'Lucida Sans Regular',
                    'Lucida Grande',
@@ -100,16 +100,35 @@ page {
                    Geneva,
                    Verdana,
                    sans-serif;
-    color: #ffffff;
+    color: #fff;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    background-color: #00a8dc;
+    border-radius: 40rpx;
+    height: 80rpx;
+    border: none;
+    margin: 0rpx auto;
+  }
+  
+  .login_button_disable {
+    width: calc(100% - 270rpx);
+    font-size: 32rpx;
+    /* margin: 0rpx 32rpx; */
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #fff;
     text-overflow: ellipsis;
     white-space: nowrap;
-    background-color: #1d9bf7;
-    border-radius: 45rpx;
-    box-shadow: 0rpx 16rpx 0rpx #edf5fd;
+    background-color: #c9c9c9;
+    border-radius: 40rpx;
+    height: 80rpx;
     border: none;
-    position: fixed;
-    bottom: 10rpx;
-    width: 80%;
+    margin: 0rpx 135rpx 0 135rpx;
   }
   
   .charg_button.button-hover {
@@ -206,7 +225,9 @@ page {
   }
 
   .cardHub .card .circleOut{
-    background-color: #21ADFF;
+    background-color: #ebf8ff;
+    border:1rpx solid #21ADFF;
+    color:#21ADFF;
     position: absolute;
     width: 28rpx;
     height: 28rpx;
@@ -214,9 +235,12 @@ page {
     padding: 0;
     top:10rpx;
     left:10rpx;
+    font-size: 18rpx;
+    line-height: 28rpx;
+    text-align: center;
   }
 
-  .cardHub .card .circleOut .circleIn{
+  /* .cardHub .card .circleOut .circleIn{
     background-color: #ebf8ff;
     color:#21ADFF;
     font-size: 18rpx;
@@ -227,7 +251,7 @@ page {
     border-radius: 50%;
     margin: 3rpx;
     padding: 0;
-  }
+  } */
 
   .cardHub .card .main{
     width:100%;
@@ -268,7 +292,9 @@ page {
   }
 
   .cardHub .card.dis .circleOut{
-    background-color: #B6B3B1;
+    border:1rpx solid #B6B3B1;
+    background-color: #EEEEEE;
+    color:#A4A3A3;
   }
 
   .cardHub .card.dis .no{

+ 7 - 0
pages/ucenter/control/batteryControl.js

@@ -182,6 +182,13 @@ Page({
     // }
     that.bettyControl(2);
   },
+  pauseBtn(){
+    let that = this;
+    // if(that.wxTestDebug(that,'d') > 4){
+    //     return ;
+    // }
+    that.bettyControl(3);
+  },
   bettyControl(bettyControl){
     let that = this;
     wx.showLoading({

+ 4 - 3
pages/ucenter/control/batteryControl.wxml

@@ -11,9 +11,10 @@
     </view>
     <rich-text space='nbsp' nodes="地址:{{chargPile.address}}" style='line-height:30rpx;font-size:24rpx;margin-bottom:10rpx;word-wrap: break-word;' ></rich-text>
     <text class="stitle" >电池包举升控制</text>
-    <view class="vbtn v2">
-        <button class='btn b2 active' bindtap="upBtn" >上升</button>
-        <button class='btn b2 active' bindtap="downBtn" >下降</button>
+    <view class="vbtn v3">
+        <button class='btn b3 active' bindtap="upBtn" >上升</button>
+        <button class='btn b3 active' bindtap="downBtn" >下降</button>
+        <button class='btn b3 active' bindtap="pauseBtn" >暂停</button>
     </view>
     <text class="stitle" >选择车辆</text>
     <view class="vbtn v3">

+ 1 - 1
project.private.config.json

@@ -5,5 +5,5 @@
     "compileHotReLoad": true,
     "bigPackageSizeSupport": false
   },
-  "libVersion": "3.3.4"
+  "libVersion": "3.4.1"
 }

+ 39 - 0
utils/EventBus.js

@@ -0,0 +1,39 @@
+class EventBus{
+    constructor(){
+      this.task = {}
+    }
+   
+    on(name, cb){
+      if(!this.task[name]){
+        this.task[name] = []
+      }
+      typeof cb === 'function' && this.task[name].push(cb)
+    }
+   
+    emit(name, ...arg){
+      let taskQueen = this.task[name]
+      if(taskQueen && taskQueen.length > 0){
+        taskQueen.forEach(cb=>{
+          cb(...arg)
+        })
+      }
+    }
+   
+    off(name, cb){
+      let taskQueen = this.task[name]
+      if(taskQueen && taskQueen.length > 0){
+        let index = taskQueen.indexOf(cb)
+        index != -1 && taskQueen.splice(index, 1)
+      }
+    }
+   
+    once(name, cb){
+      function callback(...arg){
+        this.off(name, cb)
+        cb(...arg)
+      }
+      typeof cb === 'function' && this.on(name, callback)
+    }
+  }
+   
+  export default EventBus