소스 검색

Signed-off-by: yukangzhe <382985154@qq.com>

yukangzhe 3 년 전
부모
커밋
950aabe261
7개의 변경된 파일60개의 추가작업 그리고 24개의 파일을 삭제
  1. 15 13
      pages/Components/selectDate/selectDate.js
  2. 2 2
      pages/Components/selectDate/selectDate.wxml
  3. 6 7
      pages/piano/piano.js
  4. 2 1
      pages/piano/piano.wxml
  5. 14 0
      pages/queue/queue.js
  6. 2 1
      pages/queue/queue.wxml
  7. 19 0
      pages/queue/queue.wxss

+ 15 - 13
pages/Components/selectDate/selectDate.js

@@ -1,4 +1,5 @@
 // pages/Components/selectDate/selectDate.js
+const util = require('../../../utils/util')
 Component({
   lifetimes: {
     attached: function () {
@@ -6,9 +7,14 @@ Component({
       const year = date.getFullYear()
       const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
       const day = date.getDate() + 1 < 10 ? '0' + date.getDate() : date.getDate()
+
+      let now = new Date();
+      let edd = new Date(now.setDate(now.getDate() + 7));
+      let ed = util.formatTime(edd).substring(0, 10).replace(/\//g, '-')
       this.setData({
         endDate: year + '-' + month + '-' + day,
-        lastDate: year + '-' + month + '-' + day
+        lastDate: year + '-' + month + '-' + day,
+        initChangeDate: ed
       })
     }
   },
@@ -65,9 +71,9 @@ Component({
     },
 
     bindEndDateChange: function (e) {
-      if (e.detail.value > this.data.endDate) {
+      if (e.detail.value > this.data.initChangeDate) {
         this.setData({
-          endDate: this.data.lastDate
+          endDate: this.data.initChangeDate
         })
       } else {
         this.setData({
@@ -79,18 +85,20 @@ Component({
     resetDate: function () {
       this.setData({
         beginDate: this.data.initDate,
-        endDate: this.data.lastDate,
+        endDate: this.data.initChangeDate,
         typeIndex: 0
       })
       const date = new Date()
-      const dateArr = [date.getFullYear()+"-01"+"-01", this.data.lastDate];
-      this.triggerEvent("getDates", dateArr);
+      const dateArr = [date.getFullYear()+"-01"+"-01", this.data.initChangeDate];
+      const typeIndex = this.data.typeIndex 
+      this.triggerEvent("getDates", {dateArr,typeIndex});
       this.showSelect()
     },
 
     submitDate: function () {
       const dateArr = [this.data.beginDate, this.data.endDate];
-      this.triggerEvent("getDates", dateArr);
+      const typeIndex = this.data.typeIndex
+      this.triggerEvent("getDates", {dateArr,typeIndex});
       this.showSelect()
     },
 
@@ -133,13 +141,7 @@ Component({
 
     bindPickerChange:function(e){
       const typeIndex = e.detail.value
-      const name = this.data.typeArr[typeIndex]
-      const str = {
-        typeIndex,
-        name
-      }
       this.setData({
-        str,
         typeIndex
       })
       // this.triggerEvent("changeType",str)

+ 2 - 2
pages/Components/selectDate/selectDate.wxml

@@ -4,13 +4,13 @@
     <view class="select-title">选择时间段:</view>
     <view class="select-date-view">
       <view class="section">
-        <picker mode="date" value="{{beginDate}}" start="2000-01-01" end="{{endDate}}" bindchange="bindBeginDateChange">
+        <picker mode="date" value="{{beginDate}}" start="2000-01-01" end="{{initChangeDate}}" bindchange="bindBeginDateChange">
           <view class="picker">
             {{beginDate}}
           </view>
         </picker>
         <view> 至 </view>
-        <picker mode="date" value="{{endDate}}" start="{{beginDate}}" end="{{endDate}}" bindchange="bindEndDateChange">
+        <picker mode="date" value="{{endDate}}" start="{{beginDate}}" end="{{initChangeDate}}" bindchange="bindEndDateChange">
           <view class="picker">
             {{endDate}}
           </view>

+ 6 - 7
pages/piano/piano.js

@@ -16,6 +16,7 @@ Page({
     flag: 0,
     pageNum: 0,
     hasNextPage: true,
+    type: ''
   },
 
 
@@ -26,10 +27,6 @@ Page({
     })
   },
 
-  changeType:function(e){
-    console.log(e)
-  },
-
   /**
    * 生命周期函数--监听页面加载
    */
@@ -96,11 +93,13 @@ Page({
 
   },
   getDates: function (e) {
+   
     this.setData({
       list: [],
       pageNum: 0,
-      beginDate: e.detail[0],
-      endDate: e.detail[1],
+      beginDate: e.detail.dateArr[0],
+      endDate: e.detail.dateArr[1],
+      type: e.detail.typeIndex == 0 ? '' : e.detail.typeIndex,
       loading: '加载中'
     })
     this.queryList()
@@ -109,7 +108,7 @@ Page({
     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 }
+      let params = { 'q.beginDate': this.data.beginDate, 'q.endDate': this.data.endDate, 'q.studentId': stu.studentId,'q.type': this.data.type }
       params.pageNum = this.data.pageNum
       util.apiPost(urls.query_appointment_list, params).then(rs => {
         let list = rs.list

+ 2 - 1
pages/piano/piano.wxml

@@ -15,7 +15,8 @@
         <view class="piano-date">
         {{item.createdDate}}
         </view>
-      <view class="class-status" wx:if="{{item.attend == 0}}">已预约</view>
+      <view class="class-status" wx:if="{{item.attend == 0 && item.type != '2'}}">已预约</view>
+      <view class="class-status" wx:if="{{item.attend == 0 && item.type == '2'}}">排队中</view>
       <view class="class-status" wx:if="{{item.attend == 1}}">已点名</view>
       <view class="class-status" wx:if="{{item.attend == 2}}">已缺勤</view>
       <view class="class-status" wx:if="{{item.attend == 3}}">已取消</view>

+ 14 - 0
pages/queue/queue.js

@@ -16,6 +16,7 @@ Page({
     flag: 0,
     pageNum: 0,
     hasNextPage: true,
+    btnFlag: true
   },
 
   /**
@@ -98,6 +99,7 @@ Page({
           title: '排队成功',
           icon: 'success'
         })
+        this.queryList()
       }
     })
   },
@@ -107,6 +109,18 @@ Page({
     params.pageNum = this.data.pageNum
     util.apiPost(urls.queue_list, params).then(rs => {
       let list = rs.list
+      if(list.length > 0){
+        let stuId = wx.getStorageSync('student').studentId
+        for(var i in list){
+          if(list[i].studentId == stuId){
+            this.setData({
+              btnFlag: false
+            })
+            break
+          }
+        }
+      }
+
       this.setData({
         'hasNextPage': rs.hasNextPage,
         'loading': rs.hasNextPage ? '下拉刷新' : '没有更多数据',

+ 2 - 1
pages/queue/queue.wxml

@@ -17,5 +17,6 @@
     </view>
   </view>
   
-  <view  bindtap="doQueueUp">预约</view>
+  <view class="queueBtn"  bindtap="doQueueUp" wx:if="{{btnFlag}}">预约</view>
+  <view class="queueBtn cancelBtn" wx:else>已预约</view>
 </view>

+ 19 - 0
pages/queue/queue.wxss

@@ -36,4 +36,23 @@
 }
 .boyImg{
   transform: rotate(135deg);
+}
+
+.queueBtn{
+  width: 400rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+    background: #cc6031;
+    color: #FFF;
+    border-radius: 80rpx;
+    text-align: center;
+    margin: 20rpx 175rpx;
+    position: absolute;
+    bottom: 20rpx;
+}
+.cancelBtn{
+  background: #999;
+}
+.list-view{
+  padding-bottom: 100rpx;
 }