|
@@ -38,7 +38,10 @@ Page({
|
|
|
hasNextPage: true,
|
|
|
schoolIndex: 0,
|
|
|
timeScope: '0,0',
|
|
|
- yFlag: false
|
|
|
+ yFlag: false,
|
|
|
+ endDate: '2099-12-31',
|
|
|
+ punishType: 0,
|
|
|
+ maxLength: 2,
|
|
|
},
|
|
|
|
|
|
getTimeDate: function (e) {
|
|
@@ -188,7 +191,8 @@ Page({
|
|
|
}
|
|
|
this.setData({
|
|
|
weekList: list,
|
|
|
- homeName: wx.getStorageSync('wxLocalName')
|
|
|
+ homeName: wx.getStorageSync('wxLocalName'),
|
|
|
+ maxLength:parseInt(options.maxLength)
|
|
|
})
|
|
|
|
|
|
},
|
|
@@ -389,8 +393,18 @@ Page({
|
|
|
util.apiPost(urls.query_school_attence, params).then(rs => {
|
|
|
s.moreFlag = true
|
|
|
s.items = rs
|
|
|
+ if(rs[0].endDate){
|
|
|
+ this.setData({
|
|
|
+ endDate: rs[0].endDate,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(rs[0].punishType){
|
|
|
+ this.setData({
|
|
|
+ punishType: rs[0].punishType
|
|
|
+ })
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- schoolList: sl
|
|
|
+ schoolList: sl,
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
@@ -416,10 +430,50 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
doAppointment: function (e) {
|
|
|
+ if (this.data.punishType == 1) {
|
|
|
+ if (this.data.maxLength >= 1) {
|
|
|
+ wx.hideLoading({
|
|
|
+ success: (res) => {},
|
|
|
+ })
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '预约上限已满',
|
|
|
+ showCancel: false, //是否显示取消按钮
|
|
|
+ cancelText: "否", //默认是“取消”
|
|
|
+ cancelColor: '#999999', //取消文字的颜色
|
|
|
+ confirmText: "确定", //默认是“确定”
|
|
|
+ // confirmColor: 'skyblue', //确定文字的颜色
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if (this.data.punishType == 2) {
|
|
|
+ let date = new Date()
|
|
|
+ const year = date.getFullYear()
|
|
|
+ const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
|
|
+ const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
|
|
+ const curDate = year + '/' + month + "/" + day
|
|
|
+ console.log(curDate)
|
|
|
+ let endDate = this.data.endDate.replace(/-/g, '/')
|
|
|
+ if (curDate <= endDate) {
|
|
|
+ let newEndDate = year + '年' + this.data.endDate.substring(5, 7) + '月' + this.data.endDate.substring(8, 10) + '日'
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: newEndDate + '前不可预约课程',
|
|
|
+ showCancel: false, //是否显示取消按钮
|
|
|
+ cancelText: "否", //默认是“取消”
|
|
|
+ cancelColor: '#999999', //取消文字的颜色
|
|
|
+ confirmText: "确定", //默认是“确定”
|
|
|
+ // confirmColor: 'skyblue', //确定文字的颜色
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
wx.showLoading({
|
|
|
title: '处理中',
|
|
|
mask: true
|
|
|
})
|
|
|
+
|
|
|
let id = e.currentTarget.dataset.id;
|
|
|
const index = e.currentTarget.dataset.index
|
|
|
const cIndex = e.currentTarget.dataset.cindex
|