瀏覽代碼

优化充电桩详情分页和统计信息

小郭 3 月之前
父節點
當前提交
050f9d445e
共有 2 個文件被更改,包括 24 次插入6 次删除
  1. 1 1
      app.js
  2. 23 5
      pages/charginfo/charginfo.js

+ 1 - 1
app.js

@@ -9,7 +9,7 @@ App({
     // postHeadAgreement: 'http://192.168.105.171:10301',
     
     // 正式
-    // postHeadAgreement: 'https://cdglyy.pjnes.com/cloud/chargapi',
+     //postHeadAgreement: 'https://cdglyy.pjnes.com/cloud/chargapi',
     helpPhoneNum: '4009608068',
     version:'2.0'
   },

+ 23 - 5
pages/charginfo/charginfo.js

@@ -22,7 +22,7 @@ Page({
     slowFree:0,
     fastSum:0,
     slowSum:0,
-    pagesize:30,
+    pagesize:10,
     pagenum:1,
     total:-1,
     loadTotal: 0,
@@ -159,9 +159,27 @@ 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
+        });
+      }
+    });
+  },
   previewImage(e){
     var that = this,
     //获取当前图片的下表
@@ -176,7 +194,6 @@ Page({
     })
   },
   getPage(){
-
     if(this.data.chargList.length == this.data.total){
       this.setData({
         finishedLoadTap:this.data.finishedLoadTap+1
@@ -210,11 +227,12 @@ Page({
       data: {
         id: that.data.chargid,
         pagenum: this.data.pagenum++,
-        pagesize: 30,
+        pagesize: 10,
       },
       method: 'POST',
       success(res) {
         console.log(res);
+        console.log(that.data.pagenum+":num");
         let chargList = res.data.chargList.rows;
 
         chargList.forEach(key => {
@@ -245,7 +263,7 @@ Page({
         wx.hideLoading()
         that.setData({
           chargList: that.data.chargList.concat(chargList),
-          total: res.data.chargList.total,
+          total: res.data.total,
           dataLoading: false,
           fastFree : res.data.fastFree,
           slowFree : res.data.slowFree,