From 4b0d29b3bd074b9c072476b4e5fd06b6c48ca8c4 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 21 Feb 2023 14:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/activity/info.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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;