XWookey 1 rok pred
rodič
commit
f7e38afa7c

+ 4 - 4
pages/chargemoney/chargemoney.js

@@ -117,10 +117,10 @@ Page({
                         } = res3;
                         log.info('[充值]', '[微信支付回调]', '[响应]', data);
                         if (data && data.code == 200) {
-                          // wx.showModal({
-                          //   showCancel: false,
-                          //   content: '充值成功'
-                          // });
+                          wx.showModal({
+                            showCancel: false,
+                            content: '微信扣款成功,平台入账稍有延迟,请您确认余额更新后再启动充电。'
+                          });
                           let url = `/pages/chargemoneyresult/chargemoneyresult?timeStamp=${res1.data.timeStamp}&money=${that.data.chargemoney_select}`;
                           wx.redirectTo({
                             url

+ 2 - 2
pages/scan_result/scan_result.wxml

@@ -64,10 +64,10 @@
     </view> -->
   </view>
   <view  style='margin-top:24rpx;'>
-    <rich-text style='line-height:48rpx;color:red;font-size:32rpx;word-break:break-all;'>您当前余额为:{{repaidbalance}}元。建议参考充电总费用(元/度电)与您爱车的电池容量(度),避免因费用不足导致充电量不足的情况发生。</rich-text>
+    <rich-text style='line-height:48rpx;color:red;font-size:32rpx;word-break:break-all;'>您当前余额为:{{repaidbalance}}元。</rich-text><rich-text style='line-height:48rpx;color:black;font-size:32rpx;word-break:break-all;'>建议参考充电总费用(元/度电)与您爱车的电池容量(度),避免因费用不足导致充电量不足的情况发生。</rich-text>
   </view>
   <view wx:if="{{chargPile.showinfo}}" style='margin-top:24rpx;'>
-    <rich-text style='line-height:48rpx;color:red;font-size:32rpx;word-break:break-all;'>{{chargPile.showinfo}}</rich-text>
+    <rich-text style='line-height:48rpx;color:black;font-size:32rpx;word-break:break-all;'>{{chargPile.showinfo}}</rich-text>
   </view>
   <button wx:if="{{chargPile}}" class='charg_button' bindtap="beginCharge" >开始充电</button>
 

+ 45 - 48
pages/worksheetinfo/addworksheetinfo.js

@@ -37,6 +37,7 @@ Page({
       text: '完成确认'
     }],
     workstatusindex: 0,
+    
     workBigclass: [{
       value: 1,
       text: '售后服务'
@@ -86,15 +87,12 @@ Page({
     }],
     breakdownTypeindex: null,
     exceptdate: null,
-    excepttime: null,
+    excepttime: '00:00',
     finishdate: null,
-    finishtime: null,
+    finishtime: '00:00',
     accendantids: [],
     userNames:[],
-
-    school_name:'',
-    school_id:'',
-    schoolValidate:'',
+    chargStationName:'',
 
   },
   bindChargstationsChange: function(e) {
@@ -151,13 +149,18 @@ Page({
       worksheetinfo
     });
   },
+  chargStationNameSelect:function(e){
+    let url = `/pages/worksheetinfo/findstation`;
+    console.info(url)
+    wx.navigateTo({
+      url
+    });
+  },
+
   bindAccendantChange: function(e) {
-    console.info(this.data.chargstations)
-    console.info(this.data.chargstationsindex)
-    console.info(this.data.chargstationsindex)
-    let chargstationid = this.data.chargstations[this.data.chargstationsindex].id;
     let accendant = this.data.worksheetinfo.accendant;
-    let url = `/pages/worksheetinfo/accendant?chargstationid=${chargstationid}&accendant=${accendant}`;
+    let chargStationId = this.data.worksheetinfo.chargStationId;
+    let url = `/pages/worksheetinfo/accendant?chargstationid=${chargStationId}&accendant=${accendant}`;
     wx.navigateTo({
       url
     });
@@ -203,10 +206,12 @@ Page({
     worksheetinfo.operatorName = this.data.userNames.length>0?this.data.userNames[0]:"";
     worksheetinfo.pams = this.data.accendantids;
     worksheetinfo.accendant = null;
-    if (this.data.exceptdate && this.data.excepttime) {
+    if (this.data.exceptdate ) {
+    // if (this.data.exceptdate && this.data.excepttime) {
       worksheetinfo.exceptTime = this.data.exceptdate + " " + this.data.excepttime + ":00";
     }
-    if (this.data.finishdate && this.data.finishtime){
+    if (this.data.finishdate){
+    // if (this.data.finishdate && this.data.finishtime){
       worksheetinfo.finishTime = this.data.finishdate + " " + this.data.finishtime + ":00";
     }
     let images = this.data.images;
@@ -261,9 +266,7 @@ Page({
             //worksheetinfo.pciture = ((worksheetinfo.pciture.split(",")).concat(signString)).join(",");
             console.log(worksheetinfo.pciture);
           }
-          console.info("===============================")
-          console.info(worksheetinfo)
-          console.info("===============================")
+
           wx.request({
             url: getApp().globalData.postHeadAgreement + '/restapi/wechat/saveWorkSheet',
             data: worksheetinfo,
@@ -304,9 +307,6 @@ Page({
                         //worksheetinfo.pciture = ((worksheetinfo.pciture.split(",")).concat(signString)).join(",");
                         worksheetinfo.pciture = (pciString.concat(imgString).concat(signString)).join(",");
                         //var images = this.data.images.concat(res.tempFilePaths);
-                        console.info("===============================")
-                        console.info(worksheetinfo)
-                        console.info("===============================")
                         wx.request({
                           url: getApp().globalData.postHeadAgreement + '/restapi/wechat/saveWorkSheet',
                           data: worksheetinfo,
@@ -476,40 +476,37 @@ Page({
 
 
     if (userInfo && isLogin) {
-      wx.getLocation({
-        success: function(res) {
+
+      wx.request({
+        url: getApp().globalData.postHeadAgreement + '/restapi/wechat/userChargStationsWeb',
+        data: {
+          userId: userInfo.userId,
+          pagenum: 1,
+          pagesize: 1,
+        },
+        method: 'POST',
+        success(res) {
           //console.log(res);
           let {
-            latitude,
-            longitude,
-          } = res;
-          wx.request({
-            url: getApp().globalData.postHeadAgreement + '/restapi/wechat/userChargStationsWeb',
-            data: {
-              userId: userInfo.userId,
-              lat: latitude,
-              lon: longitude
-            },
-            method: 'POST',
-            success(res) {
-              //console.log(res);
-              let {
-                data: chargstations
-              } = res;
-              chargstations.forEach((item, index) => {
-                if (item.chargStationName && worksheetinfo && worksheetinfo.chargStationName && item.chargStationName == worksheetinfo.chargStationName) {
-                  that.setData({
-                    chargstationsindex: index
-                  });
-                }
-              });
-              that.setData({
-                chargstations
-              });
-            }
+            rows: chargstations
+          } = res.data;
+          let chargStationName='';
+          let chargStationId=0;
+          chargstations.forEach((item, index) => {
+            chargStationName = item.chargStationName
+            chargStationId = item.id
+          });
+          let worksheetinfo = that.data.worksheetinfo;
+          worksheetinfo.chargStationId = chargStationId;
+          that.setData({
+            chargStationName,
+            worksheetinfo 
           });
         }
       });
+
+
+
     }
     // wx.request({
     //   url: getApp().globalData.postHeadAgreement + '/restapi/wechat/getuserworksheet',

+ 3 - 2
pages/worksheetinfo/addworksheetinfo.wxml

@@ -6,9 +6,10 @@
 <scroll-view scroll-y='true'>
   <view class="context">
     <text>场站</text>
-    <picker class="picker" disabled="{{worksheetinfo.workStatus==6}}" bindchange="bindChargstationsChange" value="{{chargstationsindex}}" range-key="chargStationName" range="{{chargstations}}">
+    <view class='input' bindtap='chargStationNameSelect' type='text'>{{chargStationName}}</view>
+    <!-- <picker class="picker" disabled="{{worksheetinfo.workStatus==6}}" bindchange="bindChargstationsChange" value="{{chargstationsindex}}" range-key="chargStationName" range="{{chargstations}}">
       <text>{{chargstations[chargstationsindex].chargStationName}}</text>
-    </picker>
+    </picker> -->
   </view>
   <view class="context">
     <text>地址</text>

+ 93 - 68
pages/worksheetinfo/findstation.js

@@ -9,27 +9,22 @@ Page({
     longitude: null,
     latitude: null,
     tips: [],
-    searchString: null
+    searchString: '',
+    keywords: '',
+    pagesize:30,
+    pagenum:1,
+    total:-1,
+    loadTotal: 0,
+    dataLoading: false,
+    finishedLoadTap: 0,
+    chargList: [],
   },
   onLoad(e) {
-    let {
-      lonlat,
-      city
-    } = e;
-    var longitude = lonlat.split(",")[0];
-    var latitude = lonlat.split(",")[1];
-    console.log({
-      lonlat,
-      longitude,
-      latitude,
-      city
-    });
-    this.setData({
-      lonlat,
-      longitude,
-      latitude,
-      city
-    })
+    this.getNextPage()
+  },
+
+  bindScrollTolowerEvent: function(){
+    this.getNextPage();
   },
   bindInput2(e) {
 
@@ -62,76 +57,106 @@ Page({
     let {
       keywords
     } = e.currentTarget.dataset;
+
     let pages = getCurrentPages();
-    let prevPage = pages[0]; //首页
     //console.log(pages);
     //console.log(e);
     console.log(keywords);
     if (keywords) {
+      let pages = getCurrentPages();
+      let prevPage = pages[pages.length - 2]; //上一个页面
+      let worksheetinfo = prevPage.data.worksheetinfo;
+      let chargStationName = keywords.chargStationName
+      worksheetinfo.chargStationId =  keywords.id;
       prevPage.setData({
-        keywords
+        chargStationName,
+        worksheetinfo
       });
-      console.log(keywords.name, keywords.location);
-      //amap.getPoiAround(keywords.name, keywords.location)
-      //.then(d => {
-      //  console.log(d);
-      //  let {
-      //    markers
-      //  } = d;
-      //  markers.forEach((item, index) => {
-      //    item.callout = {}; //marker绑定点击事件后,导致气泡一闪一闪,不想显示
-      //    item.iconPath = "/images/marker.png";
-      //    item.width = '88rpx';
-      //    item.height = '112rpx';
-      //    item.address = d.poisData[index].cityname + d.poisData[index].adname + d.poisData[index].address;
-      //  })
-      //  prevPage.setData({
-      //    markers
-      //  });
-      //  prevPage.showMarkerInfo(markers[0]);
-      //  prevPage.changeMarkerColor(0);
-      //})
-      //.catch(e => {
-      //  console.log(e);
-      //})
     }
     //let url = `/pages/index/index`;
     //wx.navigateBack({
     //  url
     // });
-    let {
-      city,
-      longitude,
-      latitude
-    } = this.data;
-    let url = `/pages/search_result/search_result?city=${city}&longitude=${longitude}&latitude=${latitude}&name=${keywords.name}&location=${keywords.location}`;
-    wx.navigateTo({
-      url
+
+    wx.navigateBack({
+      delta: 1
     });
   },
   bindSearch(e) {
     let {
       searchString: keywords
     } = this.data;
-    let pages = getCurrentPages();
-    let prevPage = pages[0]; //首页
-    if (keywords) {
-      prevPage.setData({
-        keywords
-      });
-      let {
-        city,
-        longitude,
-        latitude
-      } = this.data;
-      let url = `/pages/search_result/search_result?city=${city}&longitude=${longitude}&latitude=${latitude}&searchString=${keywords}`;
-      wx.navigateTo({
-        url
-      });
-    }
+    console.info(keywords)
+    this.setData({
+      keywords,
+      pagenum:1,
+      chargList: []
+    })  
+    this.getNextPage();
+
   },
   cancel(e) {
     console.log(e);
     wx.navigateBack();
+  },
+  getNextPage(){
+    let userInfo = wx.getStorageSync('userInfo');
+    let isLogin = wx.getStorageSync('isLogin');
+
+    if(this.data.chargList.length == this.data.total){
+      this.setData({
+        finishedLoadTap:this.data.finishedLoadTap+1
+      })
+      if(this.data.finishedLoadTap>0){
+        wx.showToast({
+          title: '全部加载完毕',
+          icon: 'success',
+          duration: 2000
+        })
+      }
+      return
+    }
+
+    if(this.data.dataLoading){
+      return
+    }
+    this.setData({
+      dataLoading: true
+    })
+    wx.showLoading({
+      title: '数据加载中....',
+    })
+
+  let that = this;
+
+  if (userInfo && isLogin) {
+
+
+    wx.request({
+      url: getApp().globalData.postHeadAgreement + '/restapi/wechat/userChargStationsWeb',
+      data: {
+        userId: userInfo.userId,
+        searchString:that.data.keywords,
+        pagenum: this.data.pagenum++,
+        pagesize: this.data.pagesize,
+      },
+      method: 'POST',
+      success(res) {
+        let chargList = res.data.rows;
+
+        console.log(chargList);
+        // that.rechargeTimeOrder(chargemoneylogs);
+        wx.hideLoading()
+        that.setData({
+          chargList: that.data.chargList.concat(chargList),
+          total: res.data.total,
+          dataLoading: false,
+        });
+      }
+    });
+
   }
+
+
+  },
 });

+ 6 - 9
pages/worksheetinfo/findstation.wxml

@@ -6,16 +6,13 @@
   <input type='text' placeholder-class="section_phcolor" placeholder="请输入搜索内容" focus="true" confirm-type='search' bindinput="bindInput" bindconfirm="bindSearch" />
   <view class='cancel' bindtap='cancel'>取消</view>
 </view>
-<scroll-view class='context' scroll-y='true' wx:if="{{tips.length!=0}}">
-  <view bindtap="bindSearch2" data-keywords="{{item}}" class="text_box" hover-class='active' wx:for="{{tips}}" wx:key="key" wx:if="{{item.location.length!=0}}">
-    <view class='search'>
-      <image src='/images/search.png'></image>
-    </view>
+<scroll-view class='context' scroll-y='true' wx:if="{{chargList.length!=0}}" bindscrolltolower="bindScrollTolowerEvent">
+  <view bindtap="bindSearch2" data-keywords="{{item}}" class="text_box" hover-class='active' wx:for="{{chargList}}" wx:key="key" >
     <view class='text_context'>
-      <text class='bold'>{{item.name}}</text>
-      <text class="h1">{{item.district}}{{item.address}}</text>
+      <text class='bold'>{{item.chargStationName}}</text>
+      <!-- <text class="h1">{{item.district}}{{item.address}}</text> -->
     </view>
-    <text class="right">所有站场</text>
+    <!-- <text class="right">所有站场</text> -->
   </view>
 </scroll-view>
-<view class='no_result' bindtap='bindSearch' wx:if="{{tips.length==0}}">没有搜索结果</view>
+<view class='no_result' bindtap='bindSearch' wx:if="{{chargList.length==0}}">没有搜索结果</view>

+ 1 - 0
pages/worksheetinfo/findstation.wxss

@@ -107,6 +107,7 @@ page {
   text-overflow: ellipsis;
   white-space: nowrap;
   overflow: hidden;
+  padding-left: 30rpx;
 }
 
 text {