Explorar el Código

Merge branch 'robot' into V2.0

# Conflicts:
#	pages/charginfo/charginfo.js
#	pages/charginfo/charginfo.wxml
#	pages/charginfo/charginfo.wxss
#	project.private.config.json
XWookey hace 2 meses
padre
commit
a34cd17004
Se han modificado 54 ficheros con 3579 adiciones y 137 borrados
  1. 2 0
      app.js
  2. 7 1
      app.json
  3. BIN
      banner/banner1 - 副本.png
  4. BIN
      banner/banner1.png
  5. BIN
      banner/banner11.png
  6. 208 0
      components/circle-progress/circle-progress.js
  7. 4 0
      components/circle-progress/circle-progress.json
  8. 14 0
      components/circle-progress/circle-progress.wxml
  9. 65 0
      components/circle-progress/circle-progress.wxss
  10. BIN
      images/chargeover_1.png
  11. BIN
      images/chargingCarIcon.png
  12. BIN
      images/ele_lock.png
  13. BIN
      images/ele_unlock.png
  14. BIN
      images/login.png
  15. BIN
      images/login_logo1.png
  16. BIN
      images/mypurse.png
  17. BIN
      images/park_lock.png
  18. BIN
      images/park_unlock.png
  19. BIN
      images/power.png
  20. BIN
      images/register.png
  21. BIN
      images/scan_result.png
  22. BIN
      images/scan_result1.png
  23. BIN
      images/triangle.png
  24. BIN
      images/user.png
  25. BIN
      images/user_backup.png
  26. 185 0
      pages/batteryPack/batteryPackWait.js
  27. 4 0
      pages/batteryPack/batteryPackWait.json
  28. 10 0
      pages/batteryPack/batteryPackWait.wxml
  29. 71 0
      pages/batteryPack/batteryPackWait.wxss
  30. 142 112
      pages/charginfo/charginfo.js
  31. 28 5
      pages/charginfo/charginfo.wxml
  32. 20 10
      pages/charginfo/charginfo.wxss
  33. 404 0
      pages/charginfo/eleCarMap.js
  34. 3 0
      pages/charginfo/eleCarMap.json
  35. 31 0
      pages/charginfo/eleCarMap.wxml
  36. 166 0
      pages/charginfo/eleCarMap.wxss
  37. 101 6
      pages/index/index.js
  38. 1 0
      pages/index/index.wxss
  39. 232 0
      pages/scan_result/elpackage.js
  40. 7 0
      pages/scan_result/elpackage.json
  41. 56 0
      pages/scan_result/elpackage.wxml
  42. 306 0
      pages/scan_result/elpackage.wxss
  43. 581 0
      pages/ucenter/control/batteryControl.js
  44. 6 0
      pages/ucenter/control/batteryControl.json
  45. 62 0
      pages/ucenter/control/batteryControl.wxml
  46. 181 0
      pages/ucenter/control/batteryControl.wxss
  47. 409 0
      pages/ucenter/control/carControl.js
  48. 4 0
      pages/ucenter/control/carControl.json
  49. 42 0
      pages/ucenter/control/carControl.wxml
  50. 145 0
      pages/ucenter/control/carControl.wxss
  51. 17 0
      pages/ucenter/index/index.js
  52. 25 0
      pages/ucenter/index/index.wxml
  53. 1 3
      project.config.json
  54. 39 0
      utils/EventBus.js

+ 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',

+ 7 - 1
app.json

@@ -1,6 +1,7 @@
 {
   "lazyCodeLoading": "requiredComponents",
   "pages": [
+
     "pages/index/index",
     "pages/routes/routes",
     "pages/charginfo/charginfo",
@@ -52,7 +53,12 @@
     "pages/ucenter/yuyt/yuyt",
     "pages/ucenter/car/chooseCar",
     "pages/ucenter/car/chooseAndBindCar",
-    "pages/ucenter/charginglog/opsCharginglog"
+    "pages/ucenter/charginglog/opsCharginglog",
+    "pages/ucenter/control/carControl",
+    "pages/ucenter/control/batteryControl",
+    "pages/scan_result/elpackage",
+    "pages/batteryPack/batteryPackWait",
+    "pages/charginfo/eleCarMap"
   ],
   "window": {
     "backgroundTextStyle": "light",

BIN
banner/banner1 - 副本.png


BIN
banner/banner1.png


BIN
banner/banner11.png


+ 208 - 0
components/circle-progress/circle-progress.js

@@ -0,0 +1,208 @@
+// components/circle/circle.js
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    // 新增一个进度百分比属性,外部可通过此属性传递进度值
+    progress: {
+      type: Number,
+      value: 0,
+      observer(newVal) {
+        this.updateProgress(newVal);
+      }
+    },
+    disabled: {
+        type: Boolean,
+        value: false,
+        observer(newVal) {
+          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);
+    //     }
+    // },
+  },
+
+  
+    /**
+     * 组件的初始数据
+     */
+    data: {
+      progress_txt: '加载中...', // 提示文字
+      progress: 0,
+      disabled: false,
+      width:110,
+      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();
+      },
+    },
+  
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+      /**
+       * 初始化 Canvas 上下文
+       */
+      initCanvas() {
+          let that = this
+        // 获取两个canvas元素的上下文
+        this.bgContext = wx.createCanvasContext('canvasProgressbg', this);
+        this.progressContext = wx.createCanvasContext('canvasProgress', this);
+
+
+        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);
+        })
+
+                    
+
+      },
+  
+      /**
+       * 画progress底部背景
+       */
+      drawProgressbg() {
+        let w = this.data.width;
+        let r = this.data.r;
+        let lw = this.data.lw;
+
+        this.progressContext.setFillStyle('#FFFFFF');
+        this.progressContext.beginPath();
+        this.progressContext.arc(w, w, r, 0, 2 * Math.PI, false);
+        this.progressContext.fill();
+
+        this.bgContext.setLineWidth(lw);
+        this.bgContext.setStrokeStyle('#FFFFFF');
+        this.bgContext.setLineCap('round');
+        this.bgContext.beginPath();
+        this.bgContext.arc(w, w, r, 0, 2 * Math.PI, false);
+        this.bgContext.stroke();
+        this.bgContext.draw(false, () => {}); // 第二个参数用于兼容旧版API,新版不需要传入回调函数
+
+        this.progressContext.setFillStyle('red');
+
+      },
+
+      /**
+      * 更新并画progress进度
+      */
+      updateProgress(progressPercentage) {
+        this.setData({
+            progress:progressPercentage
+        })
+        //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
+        if(this.progressContext){
+            this.drawCircle(this.data.progressPercentage);
+        }
+      },
+            /**
+      * 更新并画disabled
+      */
+     updateDisabled(dis) {
+        this.setData({
+            disabled:dis
+        })
+        //const normalizedProgress = (progressPercentage / 100) * 2; // 转换成弧度,最大值为2(对应100%)
+        if(this.progressContext){
+            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);
+    //     }
+    //   },
+      /**
+       * 画progress进度
+       */
+      drawCircle(step) {
+        step = step * 2 / 100;
+        let w = this.data.width;
+        let r = this.data.r;
+        let lw = this.data.lw;
+        this.progressContext.setLineWidth(lw+1);
+        this.progressContext.setStrokeStyle(this.data.disabled?'#B6B3C1':'#21ADFF');
+        this.progressContext.setLineCap('round');
+        this.progressContext.beginPath();
+        this.progressContext.arc(w, w, r, -Math.PI / 2, step * Math.PI - Math.PI / 2, false);
+        this.progressContext.stroke();
+        this.progressContext.draw(false, () => {}); // 同样添加false参数
+        this.setData({
+            progress_txt:this.data.progress + "%"
+        })
+      },
+  
+    }
+  })

+ 4 - 0
components/circle-progress/circle-progress.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 14 - 0
components/circle-progress/circle-progress.wxml

@@ -0,0 +1,14 @@
+<!--components/circle/circle.wxml-->
+
+<view class='container' id="container">
+  <view class='progress_box'>
+    <!-- 绘制圆环背景 -->
+    <canvas class="progress_bg" canvas-id="canvasProgressbg" />
+    <!-- 绘制加载中圆弧 -->
+    <canvas class="progress_canvas" canvas-id="canvasProgress" /> 
+    <!-- 绘制圆弧中心提示文字 -->
+    <view class="progress_text">
+      <text class="progress_info {{disabled?'dis':''}}"> {{progress_txt}}</text>
+    </view>
+  </view>
+</view>

+ 65 - 0
components/circle-progress/circle-progress.wxss

@@ -0,0 +1,65 @@
+/* components/circle/circle.wxss */
+
+.container {
+    position: relative;
+    width: 100%;
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    margin:0;
+    padding:0;
+    /* background-color: #34343d; */
+  }
+   
+  .progress_box {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    background-color: transparent;
+    margin:0;
+    padding:0;
+  }
+   
+  .progress_bg {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    margin:0;
+    padding:0;
+  }
+   
+  .progress_canvas {
+    width: 100%;
+    height: 100%;
+    margin:0;
+    padding:0;
+  }
+   
+  .progress_text {
+    position: absolute;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    width:100%;
+    margin:0;
+    padding:0;
+  }
+   
+  .progress_info {
+    font-size: 16rpx;
+    text-align: center;
+    /* letter-spacing: 2rpx; */
+    color: #21ADFF;
+    margin:0;
+    padding:0;
+  }
+  .progress_info.dis {
+    color: #B6B3C1;
+    margin:0;
+    padding:0;
+  }

BIN
images/chargeover_1.png


BIN
images/chargingCarIcon.png


BIN
images/ele_lock.png


BIN
images/ele_unlock.png


BIN
images/login.png


BIN
images/login_logo1.png


BIN
images/mypurse.png


BIN
images/park_lock.png


BIN
images/park_unlock.png


BIN
images/power.png


BIN
images/register.png


BIN
images/scan_result.png


BIN
images/scan_result1.png


BIN
images/triangle.png


BIN
images/user.png


BIN
images/user_backup.png


+ 185 - 0
pages/batteryPack/batteryPackWait.js

@@ -0,0 +1,185 @@
+// pages/batteryPack/batteryPackWait.js
+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();
+        }
+      });
+},
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 4 - 0
pages/batteryPack/batteryPackWait.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": ""
+}

+ 10 - 0
pages/batteryPack/batteryPackWait.wxml

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

+ 71 - 0
pages/batteryPack/batteryPackWait.wxss

@@ -0,0 +1,71 @@
+/* pages/batteryPack/batteryPackWait.wxss */
+page{
+    display: flex;
+    flex-direction: column;
+}
+.car{
+    margin-top:5%;
+    width:100%;
+    padding: 0;
+}
+.txt{
+    /* color: rgba(33, 173, 255, 1); */
+    font-size: 40rpx;
+    text-align: center;
+}
+.loading{
+    margin-top:10%;
+    height:40rpx;
+    display: flex;
+    justify-content: space-between;
+    width: 30%;
+    margin-left: 35%;
+}
+
+
+.loading .loader-circle {
+    width: 20rpx;
+    height: 20rpx;
+    border-radius: 50%;
+    background-color: #93dffb; /*淡蓝*/
+    animation-duration: 2s;
+    animation-name: loadingCircle;
+    animation-iteration-count: infinite;
+    animation-timing-function: ease-in-out;
+    opacity: 0;
+}
+
+@keyframes loadingCircle {
+    0%, 100% {
+        transform: scale(1);
+        opacity: 0.5;
+    }
+    16.67% { /* 每个元素动画开始的时间点 */
+        opacity: 0.5;
+    }
+    33.33% {
+        transform: scale(1.3);
+        background-color: #27bef7; /*深蓝*/
+    }
+    50% {
+        transform: scale(1.6);
+        opacity: 0.9;
+    }
+}
+
+/* 确保每个圆按照顺序开始动画 */
+.loading .loader-circle:nth-child(1) {
+    animation-delay: 0s;
+}
+.loading .loader-circle:nth-child(2) {
+    animation-delay: 0.2s;
+}
+.loading .loader-circle:nth-child(3) {
+    animation-delay: 0.4s;
+}
+.loading .loader-circle:nth-child(4) {
+    animation-delay: 0.6s;
+}
+.loading .loader-circle:nth-child(5) {
+    animation-delay: 0.8s;
+}

+ 142 - 112
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');
 
@@ -22,14 +19,20 @@ Page({
     slowFree:0,
     fastSum:0,
     slowSum:0,
-    pagesize:10,
+    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:[],
@@ -39,7 +42,7 @@ Page({
     carParkingRate: false,
     // 停车时间
     parkTime: 0,
-    scrollTop:0
+    activeTab: '0',
   },
   execParking(that,stationId){
     wx.request({
@@ -160,26 +163,9 @@ Page({
       chargid,
       sumprice
     });
-    this.fastAndSlow()
-    this.getPage();
-  },
-  fastAndSlow(e){
-    let that = this;
-    wx.request({
-      url: getApp().globalData.postHeadAgreement +'/restapi/wechat/fastAndSlow',
-      data: {
-        id: that.data.chargid,
-      },
-      method: 'POST',
-      success(res) {
-        that.setData({
-          fastFree : res.data.fastFree,
-          slowFree : res.data.slowFree,
-          fastSum : res.data.fastSum,
-          slowSum : res.data.slowSum
-        });
-      }
-    });
+ 
+    this.ori_getPage();
+    this.ele_getPage();
   },
   previewImage(e){
     var that = this,
@@ -195,13 +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({
-        finishedLoadTap:this.data.finishedLoadTap+1
+        dataLoading: true
       })
-      if(this.data.finishedLoadTap>0 && this.data.finishedLoadShowTimes==0){
+      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({
+        ele_finishedLoadTap:this.data.ele_finishedLoadTap+1
+      })
+      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: '全部加载完毕',
@@ -212,27 +298,29 @@ 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++,
-        pagesize: 10,
+        pagenum: this.data.ele_pagenum++,
+        ivType: 1,
+        pagesize: 30,
       },
       method: 'POST',
       success(res) {
         console.log(res);
-        console.log(that.data.pagenum+":num");
         let chargList = res.data.chargList.rows;
 
         chargList.forEach(key => {
@@ -262,91 +350,27 @@ Page({
         // that.rechargeTimeOrder(chargemoneylogs);
         wx.hideLoading()
         that.setData({
-          chargList: that.data.chargList.concat(chargList),
-          total: res.data.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
         });
       }
     });
 
   },
-  refreshPage: function(e) {
-    wx.showLoading({
-      title: '数据加载中....',
-    })
+  goEleCarMap(e){
+    console.info("呼叫充电车");
     let that = this;
-    that.setData({
-      pagenum:1
-    });
-    wx.request({
-      url: getApp().globalData.postHeadAgreement +'/restapi/wechat/chargInfo',
-      data: {
-        id: that.data.chargid,
-        pagenum: this.data.pagenum++,
-        pagesize: 10,
-      },
-      method: 'POST',
-      success(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: chargList,
-          total: res.data.total,
-          dataLoading: false,
-          fastFree : res.data.fastFree,
-          slowFree : res.data.slowFree,
-          fastSum : res.data.fastSum,
-          slowSum : res.data.slowSum
-        });
-      }
-    });
-    wx.request({
-      url: getApp().globalData.postHeadAgreement +'/restapi/wechat/fastAndSlow',
-      data: {
-        id: that.data.chargid,
-      },
-      method: 'POST',
-      success(res) {
-        that.setData({
-          fastFree : res.data.fastFree,
-          slowFree : res.data.slowFree,
-          fastSum : res.data.fastSum,
-          slowSum : res.data.slowSum
-        });
-      }
-    });
-    this.setData({
-      scrollTop: 0
+    wx.setStorageSync('eleCarMapPage', {
+    chargid: that.data.chargid
+    })
+    let url = '/pages/charginfo/eleCarMap';
+    wx.navigateTo({
+        url
     });
   },
   goScanResult(e){
@@ -601,6 +625,12 @@ Page({
       })
   
   },
+  toggleTabs(e){
+    let idx = e.currentTarget.dataset.idx;
+    this.setData({
+        activeTab: idx
+    })
+  },
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 28 - 5
pages/charginfo/charginfo.wxml

@@ -96,11 +96,14 @@
   </view>
 
   <view class="title_list">终端列表</view>
-  <view  bindtap="refreshPage">
-    <image class= "refreshPage" src="/images/refresh.png"></image>
+  <view class="tabList">
+    <view data-idx="0" class="tab {{activeTab=='0'?'active':''}}" bindtap="toggleTabs">充电桩</view>
+    <view data-idx="1" class="tab {{activeTab=='1'?'active':''}}" bindtap="toggleTabs">机器人充电车</view>
   </view>
-  <scroll-view class='context' scroll-y='true' bindscrolltolower="bindScrollTolowerEvent"  id="scrollview" scrollTop="{{scrollTop}}" >
-    <view class="charg"  hover-class='active' wx:key='{{key}}' wx:for="{{chargList}}" data-idx="{{item}}" bindtap="{{userInfo.flag ?'chargingLog':''}}">
+
+  <scroll-view class='context' scroll-y='true' bindscrolltolower="bindScrollTolowerEvent" >
+    <!-- 充电桩 start -->
+    <view wx:if="{{activeTab=='0'}}" class="charg"  hover-class='active' wx:key='{{key}}' wx:for="{{chargList}}" data-idx="{{item}}" bindtap="{{userInfo.flag ?'chargingLog':''}}">
       <view class="runstatus {{item.chargstatusclass}}">
       <view class="runstatus_inner ">{{item.chargstatusname}}</view>
       </view>
@@ -111,8 +114,28 @@
       <view class="iconCard" >
         <view class="icon {{item.pileType=='慢充'?'slowBar':'fastBar'}}">{{item.pileType=='慢充'?'慢':'快'}}</view>
       </view>
-      
     </view>
+    <!-- 充电桩 end  -->
+
+    <!-- 机器人充电车 start -->
+    <!--
+    <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 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="icon {{item.pileType=='慢充'?'slowBar':'fastBar'}}">{{item.pileType=='慢充'?'慢':'快'}}</view>
+      </view> -->
+    </view>
+    <!-- 机器人充电车 end  -->
+
+
     <view class = "bottomm"></view>
   </scroll-view>
 

+ 20 - 10
pages/charginfo/charginfo.wxss

@@ -185,9 +185,9 @@ text.price {
 .charg{
   position: relative;
   height: 150rpx;
-  width: calc(100% - 12rpx);
+  width: calc(100% - 30rpx);
   border-radius: 20rpx;
-  margin: 12rpx 8rpx;
+  margin: 12rpx 15rpx;
   background: #FFFFFF;
   flex-direction: row;
   display: flex;
@@ -382,12 +382,22 @@ text.price {
     color: #9d9d9d;
     margin: 0;
 }
-.refreshPage{
-  width: 70rpx;
-  height: 70rpx;
-  /* float: right; */
-  z-index: 999;
-  position: absolute;
-  right: 5px;
-  bottom: 25px;
+
+.tabList{
+    height: 100rpx;
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    color:#848484;
+}
+
+.tabList .tab{
+    height: 100rpx;
+    width: 50%;
+    line-height: 100rpx;
+    text-align: center;
+}
+
+.tabList .tab.active{
+    color: #21ADFF;
 }

+ 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{

+ 232 - 0
pages/scan_result/elpackage.js

@@ -0,0 +1,232 @@
+// pages/scan_result/elpackage.js
+let log = require('../../utils/log.js');
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    progressPercentage: 100, // 初始进度值为50%
+    // chargPile: null,
+    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:'',
+    car_active: false,
+    hid:false
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    let that = this;
+
+    let userInfo = wx.getStorageSync('userInfo');
+    that.setData({
+        userInfo
+    })
+
+
+    wx.getStorage({
+      key: 'elpackage',
+      success: function (res) {
+        console.log(res);
+        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'] = true
+        })
+
+
+        that.setData({
+            chargPile,
+            eleList,
+            parkObj
+        })
+
+        // 真机诡异的BUG(微信小程序真机)
+        // 直接设置为false 会 导致界面上的电池量不显示(这是因为真机会在css之前加上两个横线--,但是直接在css中写这两个横线会导致编译报错)
+        // 这里折中先设置为true,然后在定时器中设置为false 刷新一下
+        setTimeout(()=>{
+            eleList.forEach((key)=>{
+                key['active'] = false
+            })
+            that.setData({
+                eleList
+            })
+        }, 250)
+
+        setTimeout(()=>{
+            that.setData({
+                hid:true
+            })
+        }, 300)
+
+        // 更新是否减停车费
+
+
+
+        wx.removeStorage({
+          key: 'elpackage',
+          success(res) {
+            console.log(res);
+          }
+        });
+
+      }
+    });
+  },
+
+  selectEle(e){
+    let idx = e.currentTarget.dataset.idx;
+
+    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;
+        }
+
+    }
+    car_active = (idx>=0)
+    that.setData({
+        selectEleIndex: idx,
+        eleList,
+        car_active
+    })
+    
+  },
+  callCar(){
+    let that = this
+    let car_active = that.data.car_active;
+
+    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/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{
+                // 给出提示
+                wx.showModal({
+                    showCancel: false,
+                    content: "调度失败" + res.data?.msg,
+                    confirmColor:'#00AADD',
+                  });
+            }
+        },
+        fail(e) {
+          console.log("呼叫充电车失败");
+        }
+  });
+
+
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    let car = wx.getStorageSync('chooseCar_plateNumber')
+    let plateNumber = ''
+    if(car){
+        plateNumber = car.plateNumber;
+        wx.removeStorageSync('chooseCar_plateNumber')
+    }
+    this.setData({
+        plateNumber
+    })
+    console.info('将会自动跳过弹窗,默认车牌号:' + plateNumber)
+
+    if(car){
+        this.beginChargeInner(this,plateNumber)
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 7 - 0
pages/scan_result/elpackage.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "circle-progress": "/components/circle-progress/circle-progress"
+  },
+  "navigationBarTitleText": "终端详情",
+  "backgroundColor": "#FFFFFF"
+}

+ 56 - 0
pages/scan_result/elpackage.wxml

@@ -0,0 +1,56 @@
+<!-- pages/index.wxml -->
+<!-- <import src="/components/circle-progress/circle-progress.wxml"/> -->
+<!-- <view style="width:400rpx;height:400rpx;background-color: green;">
+    <circle-progress name="circle-progress" progress="{{progressPercentage}}" disabled="{{false}}"/>
+</view> -->
+
+<!--pages/scan_result/scan_result.wxml-->
+<view wx:if="{{chargPile}}"  class="map_text" hover-class='active' >
+
+    <view class='charging_text_title'>
+      <view class='charging'>
+        <image src='/images/charging2_1.png'></image>
+      </view>
+      <view class='charging_text_title1'>
+        <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> -->
+    <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 {{!hid?'hid':''}}" >
+        <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>
+        </block>
+
+<!--
+        <view class="card dis">
+            <view class="circleOut"><view class="circleIn">1</view></view>
+            <view class="main">
+                <view style="width:60rpx;height:60rpx;margin: 0 auto;margin-top: 40rpx;">
+                    <circle-progress name="circle-progress" progress="100" disabled="{{true}}" width="{{15}}" r="{{14}}" lw="{{1}}"/>
+                </view>
+                <view class="no">编号:123456789</view>
+            </view>
+            <view class="foot">电池包不可用
+            </view>
+        </view>
+-->
+    </view>
+
+
+
+  </view>
+  <button wx:if="{{chargPile}}" class="{{car_active?'login_button':'login_button_disable'}}" bindtap="callCar" >呼叫充电车</button>

+ 306 - 0
pages/scan_result/elpackage.wxss

@@ -0,0 +1,306 @@
+/* pages/scan_result/scan_result.wxss */
+page {
+    height: 100%;
+  }
+  
+  view.inline {
+    display: inline-block;
+    vertical-align: middle;
+    line-height: 28rpx;
+    height: 28rpx;
+    min-height: 28rpx;
+  }
+  
+  .map_text {
+    position: relative;
+    height: calc(100% - 160rpx);
+    padding: 20rpx 30rpx 0 30rpx;
+    box-shadow: 0rpx 6rpx 6rpx  #f5f5f5 inset;
+    width: calc(100% - 60rpx);
+  }
+  .charging_text_title {
+    height: 105rpx;
+    width: 100%;
+    display: flex;
+    margin-bottom: 0rpx;
+  }
+  
+  .charging_text_title1 {
+    width: 100%;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+  }
+  .charging {
+    width: 62rpx;
+    height: 62rpx;
+    margin: 30rpx 30rpx 30rpx 0;
+    flex-shrink: 0;
+    overflow: hidden;
+  }
+  .charging image {
+    width: 62rpx;
+    height: 62rpx;
+  }
+  
+  text {
+    margin: 0 0 18rpx 0;
+    display: block;
+    font-size: 26rpx;
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #231400;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+    line-height: 30rpx;
+    height: 30rpx;
+    min-height: 30rpx;
+  }
+  
+  text.bold {
+    font-weight: bold;
+    line-height: 34rpx;
+    height: 34rpx;
+    min-height: 34rpx;
+    margin-top: 28rpx;
+    margin-bottom: 8rpx;
+    display: block;  
+    font-size: 30rpx;
+  }
+  
+  text.inline {
+    display: inline-block;
+    color: #575757;
+    margin-top:18rpx;
+    margin-bottom: 0;
+  }
+  
+  .h1 {
+    margin: 0rpx 0rpx 24rpx 0rpx;
+    font-size: 24rpx;
+    line-height: 28rpx;
+    height: 28rpx;
+    min-height: 28rpx;
+    color: #a3a3a3;
+  }
+  .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: 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: #c9c9c9;
+    border-radius: 40rpx;
+    height: 80rpx;
+    border: none;
+    margin: 0rpx 135rpx 0 135rpx;
+  }
+  
+  .charg_button.button-hover {
+    background-color: #1d9cf7b9;
+    color: #ffffff;
+  }
+  
+  .rtable{
+    width: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+  }
+  
+  .rtable .rtr{
+    width: 100%;
+    height: 40rpx;
+    display: flex;
+    flex-direction: row;
+  }
+  
+  .rtable .rtr{
+    font-size: 26rpx;
+  }
+  .rtable .rtr.active{
+    color:#f06c6c;
+    font-weight: bold;
+    font-size: 28rpx;
+    font-style: italic;
+  }
+  
+  .rtable .rtr .rtd{
+    font-size: 26rpx;
+  }
+  
+  .rtable .rtr .rtd.t1{
+    width: 210rpx
+  }
+  
+  .rtable .rtr .rtd.t2{
+    width: 180rpx
+  }
+  
+  .context{
+    height: 1400rpx;
+    width: 100%;
+  }
+  .richHourNum{
+    display: inline;
+    color: red;
+    padding-left: 10rpx;
+    padding-right: 20rpx;
+  }
+  
+  .scan_img{
+      width:400rpx;
+      height:400rpx;
+      padding: 0 calc((100% - 400rpx) / 2);
+  }
+  
+  .scan_text{
+      word-wrap: break-word;
+      word-break: break-all;
+      white-space: pre-line;
+      text-align: center;
+      padding:0 calc((100% - 500rpx) / 2);
+      padding-bottom: 200rpx;
+  }
+
+
+  .cardHub{
+    height:calc(100% - 230rpx);
+    width:100%;
+    background-color: #FFF;
+  }
+
+
+  .cardHub .card{
+    float:left;
+    margin-bottom: 20rpx;
+    width:330rpx;
+    height:200rpx;
+    background-color: #FFFFFF;
+    display:flex;
+    flex-direction: column;
+    position: relative;
+    overflow: hidden;
+    box-shadow:0px 0px 5px 1px #DEDEDEFF;
+    border-radius: 15rpx;
+  }
+
+  .cardHub .card:nth-child(odd){
+    margin-right: 20rpx;
+  }
+
+  .cardHub .card .circleOut{
+    background-color: #ebf8ff;
+    border:1rpx solid #21ADFF;
+    color:#21ADFF;
+    position: absolute;
+    width: 28rpx;
+    height: 28rpx;
+    border-radius: 50%;
+    padding: 0;
+    top:10rpx;
+    left:10rpx;
+    font-size: 18rpx;
+    line-height: 28rpx;
+    text-align: center;
+  }
+
+  /* .cardHub .card .circleOut .circleIn{
+    background-color: #ebf8ff;
+    color:#21ADFF;
+    font-size: 18rpx;
+    width: 24rpx;
+    height: 24rpx;
+    line-height: 22rpx;
+    text-align: center;
+    border-radius: 50%;
+    margin: 3rpx;
+    padding: 0;
+  } */
+
+  .cardHub .card .main{
+    width:100%;
+    height:calc(100% - 34rpx);
+    background:#ebf8ff;
+  }
+  
+  .cardHub .card .main .no{
+    width:100%;
+    height:32rpx;
+    font-size: 24rpx;
+    text-align: center;
+    color: #21ADFF;
+    line-height: 80rpx;
+  }
+  
+  .cardHub .card .foot{
+    width:100%;
+    height:34rpx;
+    background-color:#21ADFF;
+    font-size: 24rpx;
+    color:#FFF;
+    text-align: center;
+  }
+  
+  .cardHub .card.dis .main{
+    background-color: #EEEEEE;
+    color:#A4A3A3;
+  }
+
+  .cardHub .card.dis .foot{
+    background-color: #B6B3B1;
+  }
+
+  .cardHub .card.dis .circleOut .circleIn{
+    background-color: #EEEEEE;
+    color:#A4A3A3;
+  }
+
+  .cardHub .card.dis .circleOut{
+    border:1rpx solid #B6B3B1;
+    background-color: #EEEEEE;
+    color:#A4A3A3;
+  }
+
+  .cardHub .card.dis .no{
+    color:#A4A3A3;
+  }
+
+  .hid{
+      margin: 999999rpx;
+  }

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

@@ -0,0 +1,581 @@
+// pages/ucenter/control/batteryControl.js
+
+
+var selectPopup1;
+var selectPopup2;
+
+Page({
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    code: '202007221111110201',
+    s1_index: -1,
+    select1_text: '点击选择',
+    select2_text: '点击选择',
+    select1_arr:[],
+    select2_arr:[],
+    select1_index:-1,
+    select2_index:-1,
+    batteryByStation: {},
+    chargPile:{
+        // chargPileName:'测试电池包',
+        // chargPileId:'202007221111110201',
+        // address:'雁塔区小寨西路',
+        // wxTest:'wxTest',
+        chargPileName:'',
+        chargPileId:'',
+        address:'',
+        wxTest:'wxTest',
+    },
+    cars:[],
+    carIndex: -1,
+    locations:[],
+    locationIndex: -1,
+    wxTest:{
+        msg:'uuddudududud',
+        index:0,
+        t: new Date().valueOf(),
+        tnum: 0,
+    },
+    tractorTaskTypeIndex: -1,
+    tractorTaskTypeList:[
+      {
+          "txt": "装载电池包",
+          "val": 2
+      },
+      {
+          "txt": "卸载电池包",
+          "val": 3
+      },
+      {
+          "txt": "离开电池包",
+          "val": 4
+      }
+    ]
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    let that = this
+    // let {code} = options
+    // this.setData({
+    //     code
+    // })
+
+
+
+    wx.request({
+        url: getApp().globalData.postHeadAgreement +'/restapi/wechat/ivCar',
+        data: {
+        },
+        method: 'POST',
+        success(res) {
+            let cars = res?.data?.result?res?.data?.result:[]
+            that.setData({
+                cars
+            })
+        }
+    })
+
+    wx.request({
+        url: getApp().globalData.postHeadAgreement +'/restapi/wechat/ivParkPoint',
+        data: {
+        },
+        method: 'POST',
+        success(res) {
+            console.info(res);
+            let locations = res?.data?.result?res?.data?.result:[]
+            that.setData({
+                locations
+            })
+        }
+    })
+
+        let userInfo = wx.getStorageSync('userInfo');
+      // 加载下拉框
+      wx.request({
+          url: getApp().globalData.postHeadAgreement + '/restapi/wechat/batteryByStation',
+          // data: charePileId,
+          data:{
+            chargPileId: '1771052602050748417',
+            userId: userInfo.userId
+          },
+          method: 'POST',
+          success(res) {
+            res = res.data
+            let batteryByStation = res.result
+            let select1_arr = Object.keys(batteryByStation).sort().map(it=>{
+                let regex = /chargStationName=(.*?)(,|")/;
+                let match = it.match(regex);
+                return match && match[1]?match[1]:it
+            })
+            let ee = {
+                "detail":{
+                    "value":0
+                }
+            }
+            that.setData({
+                batteryByStation,
+                select1_arr,
+            })
+
+          },
+          fail(e) {
+            getApp().showNetworkError();
+          }
+        });
+       
+
+
+    // wx.showToast({
+    //     title: that.data.code,
+    //     icon: 'success',
+    //     duration: 2000
+    //   })
+  },
+  loadSelect2(){
+    let that = this;
+    let index1 = that.data.select1_index
+    let batteryByStation = that.data.batteryByStation;
+    let key = Object.keys(batteryByStation).sort()[index1]
+    let select2_arr = batteryByStation[key].map(it=>it.chargPileName)
+    that.setData({
+        select2_arr,
+    })
+
+  },
+  bindPickerChange1(e){
+    let index = e.detail.value
+    let text = this.data.select1_arr[index]
+    this.setData({
+        select1_index: index,
+        select1_text: text,
+        select2_index: -1,
+        select2_text: '点击选择',
+        chargPile:{}
+    })
+    this.loadSelect2()
+  },
+  bindPickerChange2(e){
+    let that = this;
+    let index = e.detail.value
+    let text = this.data.select2_arr[index]
+
+    let index1 = that.data.select1_index
+    let batteryByStation = that.data.batteryByStation;
+    let key = Object.keys(batteryByStation).sort()[index1]
+    console.info(index1)
+    console.info(index)
+    console.info(key)
+    console.info(batteryByStation[key])
+    let code = batteryByStation[key].map(it=>it.chargPileId)[index]
+    this.setData({
+        select2_index: index,
+        select2_text: text,
+        code
+    })
+    that.loadCode()
+  },
+  loadCode(){
+    let that = this
+
+
+    let index1 = that.data.select1_index
+    let batteryByStation = that.data.batteryByStation;
+    let key = Object.keys(batteryByStation).sort()[index1]
+    let chargPile = batteryByStation[key][that.data.select2_index]
+    // let userInfo = wx.getStorageSync('userInfo');
+    // wx.request({
+    //     url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
+    //     data: {
+    //       chargPileId:that.data.code,
+    //       userId: userInfo.userId
+    //     },
+    //     method: 'POST',
+    //     success(res) {
+    //     //   log.info('[首页]', '[获取扫一扫充电桩]', '[响应]', res.data);
+    //     console.info(res)
+    //     if (!res.data || res.data.code == 500) {
+    //         wx.showModal({
+    //           showCancel: false,
+    //           content: res && res.data && res.data.msg ? res.data.msg :'无效的终端编号',
+    //           confirmColor:'#00AADD',
+    //         });
+    //     }else{
+    //         let chargPile = res.data.result;
+            that.setData({
+                chargPile
+            })
+    //     }
+
+    //     },
+    //     fail(e) {
+    //       getApp().showNetworkError();
+    //     }
+    //   });
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+    selectPopup1 = this.selectComponent("#selectpopup1");
+    selectPopup2 = this.selectComponent("#selectpopup2");
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+  upBtn(){
+    let that = this;
+    // if(that.wxTestDebug(that,'u') > 4){
+    //     return ;
+    // }
+    that.bettyControl(1)
+  },
+  downBtn(){
+    let that = this;
+    // if(that.wxTestDebug(that,'d') > 4){
+    //     return ;
+    // }
+    that.bettyControl(2);
+  },
+  pauseBtn(){
+    let that = this;
+    // if(that.wxTestDebug(that,'d') > 4){
+    //     return ;
+    // }
+    that.bettyControl(3);
+  },
+  bettyControl(bettyControl){
+    let that = this;
+    wx.showLoading({
+      title: '控制电池中。。。',
+      mask: true
+    })
+    wx.request({
+        url: getApp().globalData.postHeadAgreement +'/restapi/pileLog/bettyControl',
+        data: {
+            bettyControl,
+            chargPileId: that.data.chargPile.chargPileId
+        },
+        method: 'POST',
+        success(res) {
+            console.info(res)
+            wx.hideLoading()
+            wx.showToast({
+                icon: 'none',
+                title: res.data.msg,
+                duration: 1000
+              })
+        }
+     })
+  },
+  wxTestDebugClick(){
+    let that = this
+    if(new Date().valueOf() - that.data.wxTest.t <= 1000){
+        that.data.wxTest.tnum = that.data.wxTest.tnum + 1
+    }else{
+        that.data.wxTest.tnum = 0
+    }
+    that.data.wxTest.t = new Date().valueOf()
+    if(that.data.wxTest.tnum > 10){
+        wx.request({
+            url: getApp().globalData.postHeadAgreement +'/restapi/wechat/wxTest/switch',
+            data: {
+            },
+            method: 'GET',
+            success(res) {
+                that.data.wxTest.tnum = 0
+                wx.showToast({
+                    title: "调试模式: " + res.data.msg,
+                    duration: 1000
+                  })
+            }
+         })
+    }
+
+  },
+  wxTestDebug(that,s){
+    // let that = this;
+
+    if(that.data.wxTest.msg.length == that.data.wxTest.index + 1){
+        wx.request({
+            url: getApp().globalData.postHeadAgreement +'/restapi/wechat/wxTest/switch',
+            data: {
+            },
+            method: 'GET',
+            success(res) {
+                wx.showToast({
+                    title: "调试模式: " + res.data.msg,
+                    duration: 1000
+                  })
+            }
+         })
+         idx = 0;
+         that.setData({
+             wxTest:{
+                 msg:that.data.wxTest.msg,
+                 index: idx,
+             }
+         })
+         return;
+    }
+    let idx = 0
+    if(that.data.wxTest.msg.substr(that.data.wxTest.index,1) == s){
+        idx = that.data.wxTest.index + 1
+        that.setData({
+            wxTest:{
+                msg:that.data.wxTest.msg,
+                index: idx,
+            }
+        })
+    }else{
+        idx = 0;
+        that.setData({
+            wxTest:{
+                msg:that.data.wxTest.msg,
+                index: idx,
+            }
+        })
+    }
+    return idx;
+  },
+  carTap(e){
+    let  carIndex =  e.currentTarget.dataset.idx;
+    this.setData({
+        carIndex
+    })
+  },
+  locationTap(e){
+    let  locationIndex =  e.currentTarget.dataset.idx;
+    this.setData({
+        locationIndex
+    })
+
+  },
+  tractorTaskTypeTap(e){
+    let  tractorTaskTypeIndex =  e.currentTarget.dataset.idx;
+    this.setData({
+        tractorTaskTypeIndex
+    })
+},
+  submit(){
+     let that = this;
+
+
+     if(this.data.carIndex==-1){
+        wx.showToast({
+          icon: 'none',
+          title: '请选择车辆',
+          duration: 1000
+        })
+        return ;
+     }
+     if(this.data.locationIndex==-1){
+        wx.showToast({
+          icon: 'none',
+          title: '请选择点位',
+          duration: 1000
+        })
+        return ;
+     }
+     if(this.data.tractorTaskTypeIndex==-1){
+        wx.showToast({
+          icon: 'none',
+          title: '请选择任务类型',
+          duration: 1000
+        })
+        return ;
+     }
+      let car = this.data.cars[this.data.carIndex];
+      let location = this.data.locations[this.data.locationIndex]
+      wx.showModal({
+        title: '提示',
+        content: '是否调度当前车辆?' + car.carName + "|" + location.pointShowName,
+        complete: (res) => {
+          if (res.cancel) {
+            
+          }
+      
+          if (res.confirm) {
+            wx.showLoading({
+                title: '调度车辆中。。。',
+                mask: true
+            })
+            let userInfo = wx.getStorageSync('userInfo');
+            // userId: 
+            wx.request({
+                url: getApp().globalData.postHeadAgreement +'/restapi/wechat/createIvCarRequirement?' 
+                + 'finalTargetParkPointId=' + location.id
+                + '&carId=' + car.id
+                // + '&chargePileId=' + that.data.chargPile.id
+                + '&chargePileId=12'
+                + '&userId=' + userInfo.userId
+                // + '&requirementType=' + that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                + '&requirementType=0',
+                data:{
+                    // "finalTargetParkPointId":location.id,
+                    // "carId":car.id,
+                    // "chargePileId":that.data.chargPile.chargPileId,
+                    // "userId":userInfo.userId,
+                    // "requirementType":that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                },
+                method: 'POST',
+                success(ress) {
+                    if(ress && ress.statusCode==200){
+                        let iid = ress.data.result.id;
+                        console.info(iid);
+                        console.info("11111111111111111");
+                        wx.request({
+                            url: getApp().globalData.postHeadAgreement +'/restapi/wechat/xingshen',
+                            data: {
+                                // capacityResourceId: car.id,
+                                // targetParkPointId: location.id,
+                                // tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+            
+                                // ivCarId:car.id,
+                                // targetParkPointId: 1,
+                                // capacityResourceId: location.id,
+                                // tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+            
+                                carId:car.id,
+                                parkPointId: location.id,
+                                carRequirementId: iid,
+                                tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                            },
+                            method: 'POST',
+                            success(res) {
+                                wx.hideLoading();
+                                if(res.statusCode==200){
+                                    if(res.data.code==200){
+                                        wx.showToast({
+                                            icon: 'success',
+                                            title: res.data.msg,
+                                            duration: 1000
+                                        })
+                                    }else{
+                                        wx.showToast({
+                                            icon: 'none',
+                                            title: '调度失败:' + res.data.msg,
+                                            duration: 1000
+                                        })
+                                    }
+                                }else{
+                                    wx.showToast({
+                                        icon: 'none',
+                                        title: '调度失败',
+                                        duration: 1000
+                                    })
+                                }
+                            }
+                         })
+                    }
+                },
+
+            })
+
+          }
+        }
+      })
+  },
+  goToScanResult(){
+    let userInfo = wx.getStorageSync('userInfo');
+    let that = this;
+    wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
+        // data: charePileId,
+        data:{
+          chargPileId: that.data.chargPile.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.navigateTo({
+                url
+              });
+            }
+          }
+        },
+        fail(e) {
+          getApp().showNetworkError();
+        }
+      });
+},
+
+
+
+})

+ 6 - 0
pages/ucenter/control/batteryControl.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "电池包控制",
+  "usingComponents": {
+    "selectpopup": "/components/selectpopup/selectpopup"
+  }
+}

+ 62 - 0
pages/ucenter/control/batteryControl.wxml

@@ -0,0 +1,62 @@
+
+<view class="pg">
+
+    <view class="selectBox">
+    <view class="selectCard">
+        <text>请选择充电站</text>
+        <picker bindchange="bindPickerChange1" value="{{index}}" range="{{select1_arr}}">
+            <view class="picker">{{select1_text}}</view>
+        </picker>
+    </view>
+    <view class="selectCard">
+        <text>请选择充电桩</text>
+        <picker bindchange="bindPickerChange2" value="{{index}}" range="{{select2_arr}}">
+            <view class="picker">{{select2_text}}</view>
+        </picker>
+    </view>
+    </view>
+
+
+    <view class='charging_text_title'>
+      <view class='charging'>
+        <image src='/images/charging2_1.png' bindtap="wxTestDebugClick"></image>
+      </view>
+      <view class='charging_text_title1'>
+        <text class='bold'>{{chargPile.chargPileName}}</text>
+        <text class="h1">终端编号:{{chargPile.chargPileId}}</text>
+      </view>
+    </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 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">
+        <block wx:for="{{cars}}" wx:key="id">
+            <button class="btn b3 {{carIndex==index?'active':''}}" bindtap="carTap" data-idx="{{index}}">{{item.carName}}</button>
+        </block>
+    </view>
+    <text class="stitle" >选择点位</text>
+    <view class="vbtn v3">
+        <block wx:for="{{locations}}" wx:key="id">
+            <button class="btn b3 {{locationIndex==index?'active':''}}" bindtap="locationTap" data-idx="{{index}}" >{{item.pointShowName}}</button>
+        </block>
+    </view>    <text class="stitle" >选择任务类型</text>
+    <view class="vbtn v3">
+        <block wx:for="{{tractorTaskTypeList}}" wx:key="id">
+            <button class="btn b3 {{tractorTaskTypeIndex==index?'active':''}} char4" bindtap="tractorTaskTypeTap" data-idx="{{index}}" >{{item.txt}}</button>
+        </block>
+    </view>
+    <view class="vbtn v1">
+        <button class='btn b1 active' bindtap="submit" >调度车辆</button>
+    </view>
+    <text class="stitle" >启动充电</text>
+    <view class="vbtn v1" style="margin-top: 20rpx;">
+        <button class='btn b1 active' bindtap="goToScanResult" >启动充电</button>
+    </view>
+    <view class="vbtn v1"></view>
+    
+</view>

+ 181 - 0
pages/ucenter/control/batteryControl.wxss

@@ -0,0 +1,181 @@
+.pg {
+    position: relative;
+    /* height: calc(100% - 640rpx); */
+    background: #fff;
+    padding: 20rpx 30rpx 0 30rpx;
+    box-shadow: 0rpx 6rpx 6rpx  #f5f5f5 inset;
+    width: calc(100% - 60rpx);
+  }
+  .charging_text_title {
+    height: 105rpx;
+    width: 100%;
+    display: flex;
+    margin-bottom: 20rpx;
+  }
+  
+  .charging_text_title1 {
+    width: 100%;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+  }
+  .charging {
+    width: 62rpx;
+    height: 62rpx;
+    margin: 30rpx 30rpx 30rpx 0;
+    flex-shrink: 0;
+    overflow: hidden;
+  }
+  .charging image {
+    width: 62rpx;
+    height: 62rpx;
+  }
+  
+  text {
+    margin: 0 0 18rpx 0;
+    display: block;
+    font-size: 26rpx;
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #231400;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+    line-height: 30rpx;
+    min-height: 30rpx;
+  }
+
+
+  text.bold {
+    font-weight: bold;
+    line-height: 34rpx;
+    height: 34rpx;
+    min-height: 34rpx;
+    margin-top: 28rpx;
+    margin-bottom: 8rpx;
+    display: block;  
+    font-size: 30rpx;
+  }
+  
+  text.inline {
+    display: inline-block;
+    color: #575757;
+    margin-top:18rpx;
+    margin-bottom: 0;
+  }
+  
+  .h1 {
+    margin: 0rpx 0rpx 24rpx 0rpx;
+    font-size: 24rpx;
+    line-height: 28rpx;
+    height: 28rpx;
+    min-height: 28rpx;
+    color: #a3a3a3;
+  }
+
+  .btn {
+    width: 80%;
+    font-size: 32rpx;
+    /* margin: 0rpx 32rpx; */
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    border: #bbbbbb 1rpx solid;
+    background-color: #FFF;
+    color: #00a8dc;
+    border-radius: 40rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+  }
+  .stitle{
+    line-height:40rpx;font-size:28rpx;margin:20rpx 0;word-wrap: break-word;
+  }
+
+  .btn.active{
+    background-color: #00a8dc;
+    color: #fff;
+  }
+
+  .btn.b1{
+    /* width: 80%; */
+}
+  .btn.b2{
+      /* width: 40%; */
+  }
+
+  .btn.b3{
+    /* width: 30%; */
+}
+  
+  .vbtn{
+    width: 100%;
+    display: grid;
+    margin:50rpx 0;
+  }
+  .vbtn.v1{
+    margin:0;
+    margin-top:60rpx;
+    grid-template-columns: auto;
+  }
+  .vbtn.v2{
+    margin:30rpx 0;
+    grid-template-columns: auto auto;
+    
+  }
+  .vbtn.v3{
+    margin:30rpx 0;
+    grid-template-columns: auto auto auto;
+    grid-row-gap: 30rpx;
+  }
+  .char4{
+    font-size: 24rpx;
+  }
+
+  .selectBox{
+    margin-top: 10rpx;
+    font-size: 28rpx;
+    line-height: 28rpx;
+    height: 110rpx;
+    width: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content:space-between;
+  }
+  .selectCard{
+    width: 100%;
+    height:50rpx;
+    display: flex;
+    flex-direction: row;
+    justify-content:space-between;
+}
+
+ .selectCard text{
+    font-size: 28rpx;
+    line-height: 50rpx;
+    height:50rpx;
+    width: 180rpx;
+}
+.selectCard picker{
+    width: calc(100% - 200rpx);
+    height: 50rpx;
+    padding-left: 20rpx;
+    background: #EFEFEF;
+    color:#575757;
+    border-radius: 10rpx;
+    font-size: 28rpx;
+    line-height: 50rpx;
+}
+
+

+ 409 - 0
pages/ucenter/control/carControl.js

@@ -0,0 +1,409 @@
+// pages/ucenter/control/batteryControl.js
+
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+      code: '202007221111110201',
+      chargPile:{
+        //   chargPileName:'测试电池包',
+        //   chargPileId:'202007221111110201',
+        //   address:'雁塔区小寨西路',
+        //   wxTest:'wxTest',
+            chargPileName:'',
+            chargPileId:'',
+            address:'',
+            wxTest:'wxTest',
+      },
+      cars:[],
+      carIndex: -1,
+      locations:[],
+      locationIndex: -1,
+      wxTest:{
+          msg:'uuddudududud',
+          index:0,
+          t: new Date().valueOf(),
+          tnum: 0,
+      },
+      tractorTaskTypeIndex: -1,
+      tractorTaskTypeList:[
+        {
+            "txt": "装载电池包",
+            "val": 2
+        },
+        {
+            "txt": "卸载电池包",
+            "val": 3
+        },
+        {
+            "txt": "离开电池包",
+            "val": 4
+        }
+      ]
+    },
+  
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+      let that = this
+    //   let {code} = options
+    //   this.setData({
+    //       code
+    //   })
+  
+  
+  
+      wx.request({
+          url: getApp().globalData.postHeadAgreement +'/restapi/wechat/ivCar',
+          data: {
+          },
+          method: 'POST',
+          success(res) {
+              console.info(res);
+              let cars = res?.data?.result?res?.data?.result:[]
+              that.setData({
+                  cars
+              })
+          }
+      })
+  
+      wx.request({
+          url: getApp().globalData.postHeadAgreement +'/restapi/wechat/ivParkPoint',
+          data: {
+          },
+          method: 'POST',
+          success(res) {
+              console.info(res);
+              let locations = res?.data?.result?res?.data?.result:[]
+              that.setData({
+                  locations
+              })
+          }
+      })
+      let userInfo = wx.getStorageSync('userInfo');
+      wx.request({
+          url: getApp().globalData.postHeadAgreement + '/restapi/wechat/chargPile',
+          data: {
+            chargPileId:that.data.code,
+            userId: userInfo.userId
+          },
+          method: 'POST',
+          success(res) {
+          //   log.info('[首页]', '[获取扫一扫充电桩]', '[响应]', res.data);
+          console.info(res)
+          if (!res.data || res.data.code == 500) {
+              wx.showModal({
+                showCancel: false,
+                content: res && res.data && res.data.msg ? res.data.msg :'无效的终端编号',
+                confirmColor:'#00AADD',
+              });
+          }else{
+              let chargPile = res.data.result;
+              that.setData({
+                  chargPile
+              })
+          }
+  
+          },
+          fail(e) {
+            getApp().showNetworkError();
+          }
+        });
+    },
+  
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+  
+    },
+  
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+  
+    },
+  
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+  
+    },
+  
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+  
+    },
+  
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+  
+    },
+  
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+  
+    },
+  
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+  
+    },
+    upBtn(){
+      let that = this;
+      // if(that.wxTestDebug(that,'u') > 4){
+      //     return ;
+      // }
+      that.bettyControl(1)
+    },
+    downBtn(){
+      let that = this;
+      // if(that.wxTestDebug(that,'d') > 4){
+      //     return ;
+      // }
+      that.bettyControl(2);
+    },
+    bettyControl(bettyControl){
+      let that = this;
+      wx.showLoading({
+        title: '控制电池中。。。',
+        mask: true
+      })
+      wx.request({
+          url: getApp().globalData.postHeadAgreement +'/restapi/pileLog/bettyControl',
+          data: {
+              bettyControl,
+              chargPileId: that.data.chargPile.chargPileId
+          },
+          method: 'POST',
+          success(res) {
+              console.info(res)
+              wx.hideLoading()
+              wx.showToast({
+                  icon: 'none',
+                  title: res.data.msg,
+                  duration: 1000
+                })
+          }
+       })
+    },
+    wxTestDebugClick(){
+      let that = this
+      if(new Date().valueOf() - that.data.wxTest.t <= 1000){
+          that.data.wxTest.tnum = that.data.wxTest.tnum + 1
+      }else{
+          that.data.wxTest.tnum = 0
+      }
+      that.data.wxTest.t = new Date().valueOf()
+      if(that.data.wxTest.tnum > 10){
+          wx.request({
+              url: getApp().globalData.postHeadAgreement +'/restapi/wechat/wxTest/switch',
+              data: {
+              },
+              method: 'GET',
+              success(res) {
+                  that.data.wxTest.tnum = 0
+                  wx.showToast({
+                      title: "调试模式: " + res.data.msg,
+                      duration: 1000
+                    })
+              }
+           })
+      }
+  
+    },
+    wxTestDebug(that,s){
+      // let that = this;
+  
+      if(that.data.wxTest.msg.length == that.data.wxTest.index + 1){
+          wx.request({
+              url: getApp().globalData.postHeadAgreement +'/restapi/wechat/wxTest/switch',
+              data: {
+              },
+              method: 'GET',
+              success(res) {
+                  wx.showToast({
+                      title: "调试模式: " + res.data.msg,
+                      duration: 1000
+                    })
+              }
+           })
+           idx = 0;
+           that.setData({
+               wxTest:{
+                   msg:that.data.wxTest.msg,
+                   index: idx,
+               }
+           })
+           return;
+      }
+      let idx = 0
+      if(that.data.wxTest.msg.substr(that.data.wxTest.index,1) == s){
+          idx = that.data.wxTest.index + 1
+          that.setData({
+              wxTest:{
+                  msg:that.data.wxTest.msg,
+                  index: idx,
+              }
+          })
+      }else{
+          idx = 0;
+          that.setData({
+              wxTest:{
+                  msg:that.data.wxTest.msg,
+                  index: idx,
+              }
+          })
+      }
+      return idx;
+    },
+    carTap(e){
+      let  carIndex =  e.currentTarget.dataset.idx;
+      this.setData({
+          carIndex
+      })
+    },
+    locationTap(e){
+      let  locationIndex =  e.currentTarget.dataset.idx;
+      this.setData({
+          locationIndex
+      })
+  
+    },
+    tractorTaskTypeTap(e){
+        let  tractorTaskTypeIndex =  e.currentTarget.dataset.idx;
+        this.setData({
+            tractorTaskTypeIndex
+        })
+    },
+    submit(){
+       let that = this;
+       if(this.data.carIndex==-1){
+          wx.showToast({
+            icon: 'none',
+            title: '请选择车辆',
+            duration: 1000
+          })
+          return ;
+       }
+       if(this.data.locationIndex==-1){
+          wx.showToast({
+            icon: 'none',
+            title: '请选择点位',
+            duration: 1000
+          })
+          return ;
+       }
+       if(this.data.tractorTaskTypeIndex==-1){
+        wx.showToast({
+          icon: 'none',
+          title: '请选择任务类型',
+          duration: 1000
+        })
+        return ;
+     }
+        let car = this.data.cars[this.data.carIndex];
+        let location = this.data.locations[this.data.locationIndex]
+        wx.showModal({
+          title: '提示',
+          content: '是否调度当前车辆?' + car.carName + "|" + location.pointShowName,
+          complete: (res) => {
+            if (res.cancel) {
+              
+            }
+            if (res.confirm) {
+              wx.showLoading({
+                  title: '调度车辆中。。。',
+                  mask: true
+              })
+  
+              let userInfo = wx.getStorageSync('userInfo');
+            // userId: 
+            wx.request({
+                url: getApp().globalData.postHeadAgreement +'/restapi/wechat/createIvCarRequirement?' 
+                + 'finalTargetParkPointId=' + location.id
+                + '&carId=' + car.id
+                // + '&chargePileId=' + that.data.chargPile.id
+                + '&chargePileId=12'
+                + '&userId=' + userInfo.userId
+                // + '&requirementType=' + that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                + '&requirementType=0',
+                data:{
+                    // "finalTargetParkPointId":location.id,
+                    // "carId":car.id,
+                    // "chargePileId":that.data.chargPile.chargPileId,
+                    // "userId":userInfo.userId,
+                    // "requirementType":that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                },
+                method: 'POST',
+                success(ress) {
+                    if(ress && ress.statusCode==200){
+                        let iid = ress.data.result.id;
+                        console.info(iid);
+                        console.info("11111111111111111");
+                        wx.request({
+                            url: getApp().globalData.postHeadAgreement +'/restapi/wechat/xingshen',
+                            data: {
+                                // capacityResourceId: car.id,
+                                // targetParkPointId: location.id,
+                                // tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+            
+                                // ivCarId:car.id,
+                                // targetParkPointId: 1,
+                                // capacityResourceId: location.id,
+                                // tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+            
+                                carId:car.id,
+                                parkPointId: location.id,
+                                carRequirementId: iid,
+                                tractorTaskType: that.data.tractorTaskTypeList[that.data.tractorTaskTypeIndex]['val'],
+                            },
+                            method: 'POST',
+                            success(res) {
+                                wx.hideLoading();
+                                if(res.statusCode==200){
+                                    if(res.data.code==200){
+                                        wx.showToast({
+                                            icon: 'success',
+                                            title: res.data.msg,
+                                            duration: 1000
+                                        })
+                                    }else{
+                                        wx.showToast({
+                                            icon: 'none',
+                                            title: '调度失败:' + res.data.msg,
+                                            duration: 1000
+                                        })
+                                    }
+                                }else{
+                                    wx.showToast({
+                                        icon: 'none',
+                                        title: '调度失败',
+                                        duration: 1000
+                                    })
+                                }
+                            }
+                         })
+                    }
+                },
+
+            })
+            }
+          }
+        })
+    },
+
+  })

+ 4 - 0
pages/ucenter/control/carControl.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "车辆控制"
+}

+ 42 - 0
pages/ucenter/control/carControl.wxml

@@ -0,0 +1,42 @@
+
+<view class="pg">
+    <!-- <view class='charging_text_title'>
+      <view class='charging'>
+        <image src='/images/charging2_1.png' bindtap="wxTestDebugClick"></image>
+      </view>
+      <view class='charging_text_title1'>
+        <text class='bold'>{{chargPile.chargPileName}}</text>
+        <text class="h1">终端编号:{{chargPile.chargPileId}}</text>
+      </view>
+    </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> -->
+    <text class="stitle" >选择车辆</text>
+    <view class="vbtn v3">
+        <block wx:for="{{cars}}" wx:key="id">
+            <button class="btn b3 {{carIndex==index?'active':''}}" bindtap="carTap" data-idx="{{index}}">{{item.carName}}</button>
+        </block>
+    </view>
+    <text class="stitle" >选择点位</text>
+    <view class="vbtn v3">
+        <block wx:for="{{locations}}" wx:key="id">
+            <button class="btn b3 {{locationIndex==index?'active':''}}" bindtap="locationTap" data-idx="{{index}}" >{{item.pointShowName}}</button>
+        </block>
+    </view>
+    <text class="stitle" >选择任务类型</text>
+    <view class="vbtn v3">
+        <block wx:for="{{tractorTaskTypeList}}" wx:key="id">
+            <button class="btn b3 {{tractorTaskTypeIndex==index?'active':''}} char4" bindtap="tractorTaskTypeTap" data-idx="{{index}}" >{{item.txt}}</button>
+        </block>
+    </view>
+
+    <view class="vbtn v1">
+        <button class='btn b1 active' bindtap="submit" >调度车辆</button>
+    </view>
+
+
+</view>

+ 145 - 0
pages/ucenter/control/carControl.wxss

@@ -0,0 +1,145 @@
+.pg {
+    position: relative;
+    /* height: calc(100% - 640rpx); */
+    background: #fff;
+    padding: 20rpx 30rpx 0 30rpx;
+    box-shadow: 0rpx 6rpx 6rpx  #f5f5f5 inset;
+    width: calc(100% - 60rpx);
+  }
+  .charging_text_title {
+    height: 105rpx;
+    width: 100%;
+    display: flex;
+    margin-bottom: 20rpx;
+  }
+  
+  .charging_text_title1 {
+    width: 100%;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+  }
+  .charging {
+    width: 62rpx;
+    height: 62rpx;
+    margin: 30rpx 30rpx 30rpx 0;
+    flex-shrink: 0;
+    overflow: hidden;
+  }
+  .charging image {
+    width: 62rpx;
+    height: 62rpx;
+  }
+  
+  text {
+    margin: 0 0 18rpx 0;
+    display: block;
+    font-size: 26rpx;
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    color: #231400;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    overflow: hidden;
+    line-height: 30rpx;
+    min-height: 30rpx;
+  }
+
+
+  text.bold {
+    font-weight: bold;
+    line-height: 34rpx;
+    height: 34rpx;
+    min-height: 34rpx;
+    margin-top: 28rpx;
+    margin-bottom: 8rpx;
+    display: block;  
+    font-size: 30rpx;
+  }
+  
+  text.inline {
+    display: inline-block;
+    color: #575757;
+    margin-top:18rpx;
+    margin-bottom: 0;
+  }
+  
+  .h1 {
+    margin: 0rpx 0rpx 24rpx 0rpx;
+    font-size: 24rpx;
+    line-height: 28rpx;
+    height: 28rpx;
+    min-height: 28rpx;
+    color: #a3a3a3;
+  }
+
+  .btn {
+    width: 80%;
+    font-size: 32rpx;
+    /* margin: 0rpx 32rpx; */
+    font-family: 'Lucida Sans',
+                   'Lucida Sans Regular',
+                   'Lucida Grande',
+                   'Lucida Sans Unicode',
+                   Geneva,
+                   Verdana,
+                   sans-serif;
+    
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    border: #bbbbbb 1rpx solid;
+    background-color: #FFF;
+    color: #00a8dc;
+    border-radius: 40rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+  }
+  .stitle{
+    line-height:40rpx;font-size:28rpx;margin:20rpx 0;word-wrap: break-word;
+  }
+
+  .btn.active{
+    background-color: #00a8dc;
+    color: #fff;
+  }
+
+  .btn.b1{
+    /* width: 80%; */
+}
+  .btn.b2{
+      /* width: 40%; */
+  }
+
+  .btn.b3{
+    /* width: 30%; */
+}
+  
+  .vbtn{
+    width: 100%;
+    display: grid;
+    margin:50rpx 0;
+  }
+  .vbtn.v1{
+    margin:0;
+    margin-top:60rpx;
+    grid-template-columns: auto;
+  }
+  .vbtn.v2{
+    margin:30rpx 0;
+    grid-template-columns: auto auto;
+    
+  }
+  .vbtn.v3{
+    margin:30rpx 0;
+    grid-template-columns: auto auto auto;
+    grid-row-gap: 30rpx;
+  }
+  .char4{
+    font-size: 24rpx;
+  }
+  

+ 17 - 0
pages/ucenter/index/index.js

@@ -282,6 +282,23 @@ Page({
     // });
     wx.navigateBack();
   },
+  goCarControl(){
+    wx.navigateTo({
+        url: '/pages/ucenter/control/carControl',
+      })
+  },
+  goBatteryControl(){
+    // wx.scanCode({
+    //     success (res) {
+    //       wx.navigateTo({
+    //         url: '/pages/ucenter/control/batteryControl?code=' +  res.result,
+    //       })
+    //     }
+    //   })
+      wx.navigateTo({
+        url: '/pages/ucenter/control/batteryControl',
+      })
+  }
   /*,
   goLogin: function() {
     wx.navigateTo({

+ 25 - 0
pages/ucenter/index/index.wxml

@@ -168,6 +168,31 @@
           <image src='/images/enter.png'></image>
         </view>
       </view>
+
+      <view class="zan-cell"  wx:if='{{userInfo.flag==null?1:!userInfo.flag}}' hover-class="active" bindtap="goBatteryControl">
+        <view class="zan-icon">
+          <image src='/images/column.png'></image>
+        </view>
+        <view class="zan-text">
+          <text>电池包控制</text>
+        </view>
+        <view class="zan-ft">
+          <image src='/images/enter.png'></image>
+        </view>
+      </view>
+      <view class="zan-cell"  wx:if='{{userInfo.flag==null?1:!userInfo.flag}}' hover-class="active" bindtap="goCarControl">
+        <view class="zan-icon">
+          <image src='/images/column.png'></image>
+        </view>
+        <view class="zan-text">
+          <text>车辆控制</text>
+        </view>
+        <view class="zan-ft">
+          <image src='/images/enter.png'></image>
+        </view>
+      </view>
+
+
       <view class="zan-cell" hover-class="active" bindtap="goAgreement">
         <view class="zan-icon">
           <!-- <image src='/images/help.png'></image> -->

+ 1 - 3
project.config.json

@@ -135,11 +135,9 @@
     "tabIndent": "insertSpaces",
     "tabSize": 2
   },
-  "libVersion": "2.25.1",
   "packOptions": {
     "ignore": [],
     "include": []
   },
-  "appid": "wx6e03e5ada030b1aa",
-  "projectname": "%E5%85%85%E7%94%B5%E6%A1%A9"
+  "appid": "wx6e03e5ada030b1aa"
 }

+ 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