diff --git a/pages/activity/info.vue b/pages/activity/info.vue index 2ea81ae..29da975 100644 --- a/pages/activity/info.vue +++ b/pages/activity/info.vue @@ -174,11 +174,14 @@ res.isCanBook = that.$moment(nt).isBefore(res.end_plan); that.list = res; let numberArr = [] + let nowTime = that.getNowTime() for(var m of res.numbers){ m.label = m.name + "(" + that.timeFormat(m.start_time,"yyyy年MM月DD日") + " " + that.getHm(m.start_time)+"-"+that.getHm(m.end_time) + ")" - if(m.has_total==m.total&&m.total!=0){ + if(m.has_total==m.total&&m.total!=0 || that.compareDate(nowTime,m.end_plan)){ m.disabled = true } + + numberArr.push(m) } that.numbers = numberArr @@ -194,6 +197,23 @@ } }) + }, + // 比较时间 + getNowTime(){ + const date = new Date(); + let year = date.getFullYear(); + let month = date.getMonth() + 1; + let day = date.getDate(); + let hours = date.getHours() + let minutes = date.getMinutes() + let seconds =date.getSeconds() + month = month > 9 ? month : '0' + month; + day = day > 9 ? day : '0' + day; + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + }, + compareDate(d1, d2) { + let reg = new RegExp('-', 'g') + return ((new Date(d1.replace(reg, '/'))) > (new Date(d2.replace(reg, '/')))) }, topSwiperTab(e) { var that = this;