From efd0c3fc052a1c5ef14f02e7b789cf50f62d20ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=BF=94=E5=AE=87-=E6=97=85=E7=AE=A1=E5=AE=B6?= <153298343@qq.com> Date: Fri, 20 May 2022 12:18:36 +0800 Subject: [PATCH] up --- pages/index/index.vue | 19 ++++++++++++++----- pages/visit/book.vue | 27 ++++++++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 5b4b19a..c058504 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -75,12 +75,13 @@ + :class="{'book-box-row-timeitem-on':item.checked}" :key="index" + @click="handleSelectTime(index)"> {{item.start_time+'-'+item.end_time}} - {{item.total}}张 + {{item.remain_count}}张 @@ -230,6 +231,13 @@ this.util.toast("请提前一天预约"); return; } + if (cdate.is_open === 0) { + uni.showToast({ + icon: "none", + title: "该日期已经售罄" + }) + return; + } for (var m of list) { m.checked = false; } @@ -370,8 +378,9 @@ m.week = "后天"; } else { m.week = week; - } - if (m.date == selectDate) { + } + + if (m.date == selectDate ) { m.checked = true; that.currentDate = m; that.currentIndex = i; @@ -384,7 +393,7 @@ } idx++; } - } + } i++; } }) diff --git a/pages/visit/book.vue b/pages/visit/book.vue index cbf99d6..7ffc7b5 100644 --- a/pages/visit/book.vue +++ b/pages/visit/book.vue @@ -49,7 +49,7 @@ {{item.start_time+'-'+item.end_time}} - {{item.total}}张 + {{item.remain_count}}张 @@ -316,7 +316,6 @@ title: (options.from == 'user' ? "个人预约" : "团队预约") }) - this.form.total = this.minCount; //= (type == 'user' ? 1 : 8); //this.maxCount = (type == 'user' ? 5 : 50); var that = this; that.util.getUserInfo(function(r) { @@ -341,7 +340,9 @@ } else { that.maxCount = res.team_max_count; that.minCount = res.team_min_count; - } + } + + that.form.total = that.minCount; }, utilFail: function(res) { @@ -548,10 +549,12 @@ this.showCalendar = false; }, handleSelectDate(e) { - if (e.length != 0 && (e[0] != this.currentDate.date)) { + if (this.showCalendar && e.length != 0 && e[0] != this.currentDate.date) { this.load3Day(e[0]); this.showCalendar = false; } + + }, openCalendar() { var that = this; @@ -586,6 +589,14 @@ }) return; } + console.log("cdate", cdate) + if (cdate.is_open === 0) { + uni.showToast({ + icon: "none", + title: "该日期已经售罄" + }) + return; + } for (var m of list) { m.checked = false; } @@ -623,6 +634,7 @@ var mt = this.$moment().add('days', 1).format("yyyy-MM-DD"); var ht = this.$moment().add('days', 2).format("yyyy-MM-DD"); + var selectDate = (nt == sdate) ? ndate : sdate; this.loadCalendar(sdate, edate, function(res) { that.listDatePrice = res; @@ -640,7 +652,8 @@ } else { m.week = week; } - if (m.date == selectDate) { + + if (m.date == selectDate && m.is_open == 1) { m.checked = true; that.currentDate = m; that.currentIndex = i; @@ -648,8 +661,6 @@ for (var mod of m.rules) { mod.checked = false; if (that.bcurrentTime) { - console.log(that.bcurrentTime) - console.log("mod", mod) if (mod.id == that.bcurrentTime.id) mod.checked = true; that.currentTime = that.bcurrentTime; @@ -661,6 +672,8 @@ } idx++; } + } else { + selectDate = that.$moment(selectDate).add('days', 1).format("yyyy-MM-DD"); } i++; }