Browse Source

练琴预约,课程订单 数据对接

zhangshuling 4 years ago
parent
commit
10a69ad8c4

+ 40 - 32
pages/classOrder/classOrder.js

@@ -1,4 +1,7 @@
 // pages/classOrder/classOrder.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
@@ -7,18 +10,17 @@ Page({
   data: {
     loading: '上拉加载',
     flag: 0,
-    list:[
-      {},
-      {},
-      {},
-      {},
-      {},
-    ]
+    list: [
+    ],
+    pageNum: 0,
+    hasNextPage: true,
   },
 
-  getDetail:function(){
+  getDetail: function (e) {
+    let id = e.currentTarget.dataset.id
+    let cid = e.currentTarget.dataset.cid
     wx.navigateTo({
-      url: '/pages/orderClassDetail/orderClassDetail',
+      url: '/pages/orderClassDetail/orderClassDetail?id='+id+'&cid='+cid,
     })
   },
 
@@ -26,7 +28,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    this.queryList()
   },
 
   /**
@@ -68,28 +70,10 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    if (this.data.flag == 0) {
-      this.setData({
-        loading: '加载中',
-        flag: 1
-      })
-      setTimeout(() => {
-        this.setData({
-          list: [{},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-          ],
-          loading: '没有更多数据',
-          flag: 2
-        })
-      }, 2000);
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
     }
   },
 
@@ -98,5 +82,29 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  queryList: function () {
+    const urls = urlDef.urls;
+    let stu = wx.getStorageSync('student');
+    if (stu) {
+      let params = { 'q.studentId': stu.studentId, 'q.orgId': stu.orgId, 'q.valid': 1 }
+      params.pageNum = this.data.pageNum
+      util.apiPost(urls.get_course_order, params).then(rs => {
+        let list = rs.list
+        list.map(o => {
+          if (o.payDate) {
+            o.payDate = o.payDate.replace('T', ' ').substring(0, 16)
+          }
+          if (o.refundDate ) {
+            o.refundDate = o.refundDate.replace('T', ' ').substring(0, 16)
+          }
+        })
+        this.setData({
+          'hasNextPage': rs.hasNextPage,
+          'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+          'list': this.data.list.concat(list)
+        })
+      })
+    }
   }
 })

+ 14 - 10
pages/classOrder/classOrder.wxml

@@ -1,17 +1,21 @@
 <view class="container">
   <view class="order-view">
     <view class="order-list">
-      <view class="order-box" wx:for="{{list}}" wx:key="index" bindtap="getDetail">
-        <view class="order-type">1v1</view>
-        <view class="order-name">小象钢琴</view>
-        <view class="order-nums">x 48次(48课时)</view>
-        <view class="order-addr">智慧汉阳校区</view>
-        <view class="order-price">原价:¥ 6000.00</view>
-        <view class="order-teacher">老师:小象老师</view>
-        <view class="order-payMoney">实付:<text>¥ 5500.00</text></view>
+      <view class="order-box" wx:for="{{list}}" wx:key="index" bindtap="getDetail" data-id="{{item.id}}" data-cid="{{item.orderClassesId}}">
+        <view class="order-type">{{item.orderType == 2 ? '练琴卡' : (item.kindId == 1 ?'1v1' : '集体')}}</view>
+        <view class="order-name">{{item.classesName}}
+                <block wx:if="{{item.refundStatus == 4}}">[已退款]</block>
+        </view>
+        <view class="order-nums" wx:if="{{item.orderType == 1}}">× {{item.nums}}次 ({{item.classesTimes}}课时)</view>
+        <view class="order-nums" wx:if="{{item.orderType == 2}}">× {{item.nums}}(天)</view>
+        <view class="order-addr">{{item.address}}</view>
+        <view class="order-price">原价:¥ {{item.totalAmount}}</view>
+        <view class="order-teacher">老师:{{item.teacherName}}</view>
+        <view class="order-payMoney">实付:<text>¥ {{item.classesActualAmount}}</text></view>
         <view class="order-title">订单号</view>
-        <view class="order-orderNum">162390234A33C</view>
-        <view class="order-payTime">付款时间:2021-01-22 15:33</view>
+        <view class="order-orderNum">{{item.orderNum}} </view>
+        <view class="order-payTime">付款时间:{{item.payDate}}</view>
+        <view class="order-payTime" wx:if="{{item.refundStatus == 4}}">退款时间:{{item.refundDate}}</view>
       </view>
     </view>
   </view>

+ 2 - 2
pages/index/index.js

@@ -106,7 +106,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.loadIndexData();
+
   },
 
   /**
@@ -120,7 +120,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.loadIndexData();
   },
 
   /**

+ 135 - 52
pages/makePiano/makePiano.js

@@ -1,6 +1,7 @@
 // pages/makePiano/makePiano.js
 const app = getApp()
 const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
@@ -9,17 +10,17 @@ Page({
   data: {
     animationBox: {},
     animationBg: {},
-    weekList:[],
-    curIndex:0,
+    weekList: [],
+    curIndex: 0,
     array: [
       '全部时间',
-      '08:00 ~ 10:00', 
-      '10:00 ~ 12:00', 
-      '12:00 ~ 14:00', 
-      '14:00 ~ 16:00', 
-      '16:00 ~ 18:00', 
-      '18:00 ~ 20:00', 
-      '20:00 ~ 22:00', 
+      '08:00 ~ 10:00',
+      '10:00 ~ 12:00',
+      '12:00 ~ 14:00',
+      '14:00 ~ 16:00',
+      '16:00 ~ 18:00',
+      '18:00 ~ 20:00',
+      '20:00 ~ 22:00',
     ],
     objectArray: [
       {
@@ -56,21 +57,23 @@ Page({
       }
     ],
     index: 0,
-    schoolList:[
-      {},
-      {},
-      {},
-      {},
-      {},
+    schoolList: [
     ],
-    loading:'上拉加载',
-    flag:0,
+    loading: '上拉加载',
+    flag: 0,
+    curStu: null,
+    pageNum: 0,
+    hasNextPage: true,
+    schoolIndex: 0
   },
 
-  getWeek:function(e){
+  getWeek: function (e) {
     this.setData({
-      curIndex : e.currentTarget.dataset.index
+      curIndex: e.currentTarget.dataset.index,
+      pageNum: 0,
+      schoolList: [],
     })
+    this.queryList();
   },
 
   bindPickerChange: function (e) {
@@ -84,10 +87,11 @@ Page({
     wx.getLocation({
       type: 'wgs84',
       success(res) {
-        console.log(res)
+        // console.log(res)
         wx.setStorageSync('latlng', res)
+        that.queryList()
       },
-      fail(res){
+      fail(res) {
         wx.hideLoading({
           success: (res) => {
             wx.showModal({
@@ -100,14 +104,14 @@ Page({
     })
   },
 
-  showSelect:function(){
+  showSelect: function () {
     var animation = wx.createAnimation({
       timingFunction: 'linear',
     })
     this.animation = animation
     var num = 0
     var opacity = 0
-    if(this.data.yFlag == false){
+    if (this.data.yFlag == false) {
       num = 165
       opacity = 0.4
       this.setData({
@@ -122,7 +126,7 @@ Page({
     }
     animation.translateY(num).step()
     this.setData({
-      animationBox:animation.export()
+      animationBox: animation.export()
     })
 
     var animation2 = wx.createAnimation({
@@ -132,22 +136,23 @@ Page({
 
     animation2.opacity(opacity).step()
     this.setData({
-      animationBg:animation2.export()
+      animationBg: animation2.export()
     })
-
   },
-  
+
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
     var list = []
-    for(var i = 0; i < 7; i++){
+    for (var i = 0; i < 7; i++) {
       var date = util.fun_date(i)
       var week = util.fun_week(date)
       var json = {
-        date: date.substring(5,date.length),
+        date: date.substring(5, date.length),
+        ds: date, // 日期 y-m-d
+        ws: new Date(date).getDay(), // 星期
         week: week
       }
       list.push(json)
@@ -197,29 +202,10 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    if(this.data.flag == 0){
-      this.setData({
-        loading: '加载中',
-        flag: 1
-      })
-      setTimeout(() => {
-        this.setData({
-          schoolList:[
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-          ],
-          loading: '没有更多数据',
-          flag: 2
-        })
-      }, 2000);
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
     }
   },
 
@@ -228,5 +214,102 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  queryList: function () {
+    const urls = urlDef.urls;
+    let stu = wx.getStorageSync('student');
+    if (stu) {
+      this.setData({ curStu: stu })
+      let latlng = wx.getStorageSync('latlng')
+      let latitude = latlng.latitude //30.55473
+      let longitude = latlng.longitude
+      let countyCode = '420101'
+      let params = { 'q.coordinate': longitude + ',' + latitude, 'q.studentId': stu.studentId };
+      // 'q.regionId': countyCode.substring(0, 4) + '00'
+      params['q.regionId'] = countyCode.substring(0, 4) + '00'
+      params.pageNum = this.data.pageNum
+      util.apiPost(urls.get_near_school, params).then(rs => {
+
+        let list = rs.list;
+        list.map(s => {
+          s.dist = this.showDist(s.distance)
+        })
+
+
+        this.setData({
+          'hasNextPage': rs.hasNextPage,
+          'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+          'schoolList': this.data.schoolList.concat(list)
+        })
+
+        // 默认查询第一个学校的课程
+        if (list && list.length > 0) {
+          this.queryClassesList(list[0].id)
+        }
+      })
+    }
+  },
+  showDist(d) {
+    if (d <= 0) {
+      return '无法定位';
+    }
+    if (d > 1000) {
+      return (d / 1000).toFixed(2) + 'km';
+    }
+    return d + 'm';
+  },
+  selectSchool: function (e) {
+    let index = e.currentTarget.dataset.index;
+    let id = e.currentTarget.dataset.id;
+
+    this.setData({ 'schoolIndex': index })
+    this.queryClassesList(id)
+  },
+  collectSchool: function (e) {
+    let id = e.currentTarget.dataset.id;
+    const urls = urlDef.urls;
+    util.apiPost(urls.collect_school + '?q.orgId=' + id + '&q.studentId=' + this.data.curStu.studentId).then((rs) => {
+      this.setData({
+        pageNum: 0,
+        schoolList: []
+      })
+      this.queryList()
+    });
+  },
+  queryClassesList: function (sid) {
+    const urls = urlDef.urls;
+
+    let sl = this.data.schoolList;
+    let s = sl.filter(o => o.id == sid)[0];
+
+    let w = this.data.weekList[this.data.curIndex];
+
+    let date = w.ds
+    let week = w.ws
+
+    let params = { 'q.orgId': sid, 'q.studentId': this.data.curStu.studentId, 'q.date': date, 'q.week': week }
+    // params['q.timeScope'] = ''; 时段
+    util.apiPost(urls.query_school_attence, params).then(rs => {
+      s.items = rs
+      this.setData({ schoolList: sl })
+    })
+  },
+  doAppointment: function (e) {
+    let id = e.currentTarget.dataset.id;
+    const urls = urlDef.urls;
+    let w = this.data.weekList[this.data.curIndex];
+    util.apiPost(urls.do_appointment + '?q.studentId=' + this.data.curStu.studentId + '&q.planId=' + id + '&q.orgId=' + this.data.curStu.orgId + '&q.visitDate=' + w.ds).then(rs => {
+      if (rs.success > 0) {
+        wx.showToast({
+          title: '预约成功'
+        })
+        this.queryClassesList(this.data.curStu.orgId)
+      } else {
+        wx.showToast({
+          title: rs.msg,
+          icon: 'none',
+        })
+      }
+    });
   }
 })

+ 16 - 16
pages/makePiano/makePiano.wxml

@@ -28,8 +28,8 @@
     <view class="week-list">
       <view class="week-box {{curIndex == index ? 'cur-week' : ''}}" wx:for="{{weekList}}" wx:key="index"
         data-index="{{index}}" bindtap="getWeek">
-        <view class="weekDay">{{item.week}}</view>
-        <view class="weekDate">{{item.date}}</view>
+        <view class="weekDay">{{ item.week}}</view>
+        <view class="weekDate">{{ item.date}}</view>
       </view>
     </view>
   </view>
@@ -40,39 +40,39 @@
     <view class="school-list">
       <view class="school-box" wx:for="{{schoolList}}" wx:key="index">
         <view class="school-title">
-          <view class="school-name">智慧汉阳校区</view>
+          <view class="school-name">{{ item.name}}</view>
           <view class="school-dis">
             <view class="disImg">
               <image src="/images/local.png"></image>
             </view>
-            <view class="disNum">10.00km</view>
+            <view class="disNum">{{ item.dist}}</view>
           </view>
         </view>
         <view class="school-addr">
-          <view class="address">武汉市汉阳区龙阳大道特6号</view>
-          <view class="showMore {{index == 0 ? 'curSchool' : ''}}">
+          <view class="address">{{ item.address}}</view>
+          <view class="showMore {{schoolIndex == index ? 'curSchool' : ''}}" bindtap="selectSchool" data-id="{{ item.id}}" data-index="{{index}}">
             <image class="" src="/images/showMore.png"></image>
           </view>
         </view>
         <view class="school-tel">
-          <view class="telNum">13222222222</view>
-          <view class="getTel">
-            <image src="/images/getTel.png"></image>
+          <view class="telNum">{{ item.telephone}}</view>
+          <view class="getTel"  bindtap="collectSchool" data-id="{{ item.id}}" >
+            <image src="{{ item.collect == 1? '/images/cur-getTel.png' : '/images/getTel.png'}}"></image>
           </view>
         </view>
-        <view class="school-class-list">
-          <view class="class-none" style="display:none">该时间段未排课</view>
-          <view class="class-list" wx:if="{{index == 0}}" wx:for="{{3}}" wx:key="cIndex" wx:for-index="cItem">
+        <view class="school-class-list" wx:if="{{schoolIndex == index}}">
+          <view class="class-none" wx:if="{{(! item.items) ||  item.items.length == 0}}">该时间段未排课</view>
+          <view class="class-list"  wx:for="{{ item.items}}" wx:key="cIndex" wx:for-index="cItem">
             <view class="class-box">
               <view class="class-time">
-                13:20 ~ 14:05
+                {{ item.time}}
               </view>
               <view class="class-get-view">
                 <view class="class-stu-num">
-                  1/3
+                  {{ item.hasVisitNum}}/{{ item.maxNum}}
                 </view>
-                <view class="class-get-btn">
-                  预约
+                <view class="class-get-btn" bindtap="doAppointment" data-id="{{item.id}}">
+                 {{ item.hasVisitNum < item.maxNum ?  '预约' : '已约满'}}
                 </view>
               </view>
             </view>

+ 49 - 3
pages/orderClassDetail/orderClassDetail.js

@@ -1,15 +1,30 @@
 // pages/orderClassDetail/orderClassDetail.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
+    id: null,
+    cid: null,
+    order: {},
+    items: [],
+    images: []
 
   },
 
-  showImg:function(){
-    const list = ['https://file.schoolwisdoms.com/image/26cf1980-5b25-4c2e-af7f-376677d76033.jpg',]
+  showImg: function () {
+    let list = this.data.images;
+    if (list.length == 0) {
+      wx.showToast({
+        title: '未上传合同',
+        icon: 'none',
+      })
+      return
+    }
     wx.previewImage({
       current: list[0],
       urls: list,
@@ -20,7 +35,21 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    let id = options.id
+    let cid = options.cid
+    this.setData({ id: id, cid: cid })
+
+    const urls = urlDef.urls;
+    let params = {
+      'q.orderId': id
+    }
+    util.apiPost(urls.get_order, params).then(rs => {
+      if (rs != null) {
+        this.setData({ items: rs, order: rs[0] })
+
+        this.queryContract()
+      }
+    })
   },
 
   /**
@@ -70,5 +99,22 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  queryContract: function () {
+    const urls = urlDef.urls;
+    let params = {
+      'q.orderId': this.data.cid
+    }
+    util.apiPost(urls.get_contract_images, params).then(rs => {
+      if (rs != null) {
+        let images = [];
+        if (rs && rs.length > 0) {
+          rs.forEach(r => {
+            images.push(r.imgUrl);
+          });
+          this.setData({ images: images })
+        }
+      }
+    })
   }
 })

+ 44 - 39
pages/piano/piano.js

@@ -1,27 +1,26 @@
 // pages/piano/piano.js
+const app = getApp()
+const util = require("../../utils/util")
+const urlDef = require("../../utils/urls")
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-   
-    list:[
-      {},
-      {},
-      {},
-      {},
-      {},
-      {},
+    beginDate: null,
+    endDate: null,
+    list: [
     ],
-    loading:'上拉加载',
-    flag:0,
-   
+    loading: '上拉加载',
+    flag: 0,
+    pageNum: 0,
+    hasNextPage: true,
   },
 
-  
 
-  getPiano:function(){
+
+  getPiano: function () {
     wx.navigateTo({
       url: '/pages/makePiano/makePiano',
     })
@@ -32,20 +31,26 @@ Page({
    */
   onLoad: function (options) {
 
+
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function () {
-
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    let now = new Date();
+    // 显示近7天的预约记录
+    let bd = util.formatTime(now).substring(0, 10).replace(/\//g, '-')
+    let edd = new Date(now.setDate(now.getDate() + 7));
+    let ed = util.formatTime(edd).substring(0, 10).replace(/\//g, '-')
+    this.setData({ beginDate: bd, endDate: ed, list: [] });
+    this.queryList();
   },
 
   /**
@@ -66,36 +71,17 @@ Page({
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {
-   
+
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-    if(this.data.flag == 0){
-      this.setData({
-        loading: '加载中',
-        flag: 1
-      })
-      setTimeout(() => {
-        this.setData({
-          list:[
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-            {},
-          ],
-          loading: '没有更多数据',
-          flag: 2
-        })
-      }, 2000);
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
     }
   },
 
@@ -104,5 +90,24 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  queryList: function () {
+    const urls = urlDef.urls;
+    let stu = wx.getStorageSync('student');
+    if (stu) {
+      let params = { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId, 'q.orgId': stu.orgId }
+      params.pageNum = this.data.pageNum
+      util.apiPost(urls.query_appointment_list, params).then(rs => {
+        let list = rs.list
+        list.map(o => {
+          o.visitDate = o.visitDate.substring(0, 10)
+        })
+        this.setData({
+          'hasNextPage': rs.hasNextPage,
+          'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+          'list': this.data.list.concat(list)
+        })
+      })
+    }
   }
 })

+ 5 - 5
pages/piano/piano.wxml

@@ -7,15 +7,15 @@
   <view class="piano-list">
     <view class="piano-box" wx:for="{{list}}" wx:key="index">
       <view class="piano-detail">
-        <view class="piano-title">钢琴编号1</view>
-        <view class="addr">智慧汉阳校区</view>
-        <view class="piano-time">2021-02-20 14:00 ~ 14:45</view>
+        <view class="piano-title">{{item.pianoName}}</view>
+        <view class="addr">{{item.orgName}}</view>
+        <view class="piano-time">{{item.visitDate}} {{item.beginTime}} ~ {{item.endTime}}</view>
       </view>
       <view class="piano-date">
-        2021-02-02 10:18
+        {{item.createdDate}}
       </view>
     </view>
   </view>
   <view class="getPiano" bindtap="getPiano">去预约</view>
-  <view class="loading">{{loading}}</view>
+  <view class="loading">{{loading}}</view> 
 </view>

+ 1 - 1
pages/piano/piano.wxss

@@ -23,7 +23,7 @@
 .piano-date {
   height: 60rpx;
   line-height: 60rpx;
-  font-size: 28rpx;
+  font-size: 26rpx;
   color: #666;
   margin-right: 25rpx;
 }

+ 23 - 21
pages/task/task.js

@@ -14,24 +14,17 @@ Page({
     beginDate: null,
     endDate: null,
     status: 0,
-    list:[
-      {},
-      {},
-      {}
-    ]
+    loading: '上拉加载',
+    list: [],
+    pageNum: 0,
+    hasNextPage: true,
   },
 
   changeIndex: function (e) {
     if (e.detail == 0) {
-      this.setData({ 'status': 0 })
-      this.setData({
-        doName: '做作业'
-      })
+      this.setData({ 'status': 0, pageNum: 0, list: [], doName: '做作业' })
     } else {
-      this.setData({ 'status': 1 })
-      this.setData({
-        doName: '查看详情'
-      })
+      this.setData({ 'status': 1, pageNum: 0, list: [], doName: '查看详情' })
     }
     this.queryList()
   },
@@ -46,10 +39,8 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    // let bd = options.beginDate
-    // let ed = options.endDate
-    let bd = '2020-01-01'
-    let ed = '2021-01-01'
+    let bd = options.beginDate
+    let ed = options.endDate
     if (bd && ed) {
       this.setData({ 'beginDate': bd, 'endDate': ed })
     } else {
@@ -96,7 +87,11 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    if (this.data.hasNextPage) {
+      let pn = this.data.pageNum
+      this.setData({ loading: '加载中', 'pageNum': ++pn })
+      this.queryList()
+    }
   },
 
   /**
@@ -110,8 +105,11 @@ Page({
     let stu = wx.getStorageSync('student');
     if (stu) {
       this.setData('curStu', stu);
-      util.apiPost(urls.my_homework, { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId, 'q.status': this.data.status }).then(rs => {
-        rs.map(o => {
+      let params = { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId, 'q.status': this.data.status }
+      params.pageNum = this.data.pageNum
+      util.apiPost(urls.my_homework, params).then(rs => {
+        let list = rs.list;
+        list.map(o => {
           if (o.beginTime) {
             o.beginTime = o.beginTime.substring(11, 16)
           }
@@ -125,7 +123,11 @@ Page({
             o.homeworkContent = this.parseContent(o.homeworkContent)
           }
         })
-        this.setData({ 'list': rs })
+        this.setData({
+          'hasNextPage': rs.hasNextPage,
+          'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',
+          'list': this.data.list.concat(list)
+        })
       })
     }
   },

+ 1 - 1
pages/task/task.wxml

@@ -22,5 +22,5 @@
     </view>
   </view>
   <!-- end -->
-
+  <view class="loading">{{loading}}</view> 
 </view>

+ 8 - 0
pages/task/task.wxss

@@ -40,4 +40,12 @@ page{
     color: #cc6031;
   }
 
+.loading {
+  height: 200rpx;
+  line-height: 100rpx;
+  background: #f1f1f1;
+  color: #999;
+  text-align: center;
+}
+
 /* end */