diff --git a/pages/index/index.vue b/pages/index/index.vue index 1c5e177..7ca5731 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -52,14 +52,13 @@ + 'book-box-row-dateitem-none':item.is_open==0 || item.remain_count==0 || item.outOfRange}" @click="handleDate(index)"> {{item.remain_count==0?"不可预约":"可预约"}} + v-if="item.is_open==1">{{(item.remain_count==0 || item.outOfRange)?"不可预约":"可预约"}} 闭馆 @@ -201,7 +200,9 @@ onLoad() { // 检测运行环境 this.isH5 = typeof window !== 'undefined' && window.location - + this.minDate = this.$moment().add(1, 'days').format('YYYY-MM-DD'); + this.maxDate = this.$moment().add(7, 'days').format('YYYY-MM-DD'); + this.loadInfo(); this.loadNotice(); }, @@ -323,11 +324,19 @@ } return day }, + applyDateRangeLimit(item) { + var minD = this.minDate; + var maxD = this.maxDate; + item.outOfRange = this.$moment(item.date).isAfter(maxD, 'day') || this.$moment(item.date).isBefore(minD, 'day'); + }, handleDate(index) { var nt = this.$moment().format("yyyy-MM-DD"); let list = this.listDatePrice; let cdate = list[index]; + if (cdate.outOfRange) { + return; + } if (cdate.is_open === 0) { uni.showToast({ icon: "none", @@ -487,6 +496,7 @@ let isOpenDate = false; for (var m of that.listDatePrice) { m.checked = false; + that.applyDateRangeLimit(m); m.datef = that.$moment(m.date).format("MM月DD日"); var week = that.$moment(m.date).format("dddd"); if (m.date == nt) @@ -499,7 +509,7 @@ m.week = week; } if (m.date == selectDate) { - if (m.is_open == 1 && m.remain_count > 0) { + if (!m.outOfRange && m.is_open == 1 && m.remain_count > 0) { m.checked = true; that.currentDate = m; that.currentIndex = i; @@ -589,7 +599,7 @@ } .box-top { - width: 100%; + width: 100%; font-size: 0; } diff --git a/pages/visit/book.vue b/pages/visit/book.vue index 157ae6b..1cec418 100644 --- a/pages/visit/book.vue +++ b/pages/visit/book.vue @@ -15,13 +15,13 @@ + 'book-box-row-dateitem-none':item.is_open==0 || item.remain_count==0 || item.outOfRange}" @click="handleDate(index)"> {{item.remain_count==0?"不可预约":"可预约"}} + v-if="item.is_open==1">{{(item.remain_count==0 || item.outOfRange)?"不可预约":"可预约"}} 闭馆 @@ -480,7 +480,9 @@ onLoad(options) { // 检测运行环境 this.isH5 = typeof window !== 'undefined' && window.location - + this.minDate = this.$moment().add(1, 'days').format('YYYY-MM-DD'); + this.maxDate = this.$moment().add(7, 'days').format('YYYY-MM-DD'); + this.loadConfig(); this.loadInfo(); this.openNoticeInfo(0); @@ -1022,11 +1024,19 @@ return day }, + applyDateRangeLimit(item) { + var minD = this.minDate; + var maxD = this.maxDate; + item.outOfRange = this.$moment(item.date).isAfter(maxD, 'day') || this.$moment(item.date).isBefore(minD, 'day'); + }, handleDate(index) { var nt = this.$moment().format("yyyy-MM-DD"); let list = this.listDatePrice; let cdate = list[index]; + if (cdate.outOfRange) { + return; + } if (cdate.is_open === 0) { uni.showToast({ icon: "none", @@ -1083,6 +1093,7 @@ let isOpenDate = false; for (var m of that.listDatePrice) { m.checked = false; + that.applyDateRangeLimit(m); m.datef = that.$moment(m.date).format("MM月DD日"); var week = that.$moment(m.date).format("dddd"); if (m.date == nt) @@ -1095,7 +1106,7 @@ m.week = week; } if (m.date == selectDate) { - if (m.is_open == 1 && m.remain_count > 0) { + if (!m.outOfRange && m.is_open == 1 && m.remain_count > 0) { m.checked = true; that.currentDate = m; that.currentIndex = i;