diff --git a/pages/index/index.vue b/pages/index/index.vue index 270f961..9105982 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -50,7 +50,7 @@ - {{item.is_open==1?'余票':"售罄"}} + {{item.is_open==1?'余票':"闭馆"}} {{item.week}} {{item.datef}} @@ -198,9 +198,18 @@ this.showCalendar = false; }, handleSelectDate(e) { + let that = this; + if (e.length != 0) { - this.load3Day(e[0]); - this.showCalendar = false; + var date = e[0] + + this.load3Day(date, function(isCanbook) { + if (isCanbook) { + that.showCalendar = false; + } else { + that.util.toast("您选择的日期已经闭馆") + } + }); } }, openCalendar() { @@ -219,7 +228,7 @@ if (m.is_open == 1) day.bottomInfo = '余票' else { - day.bottomInfo = '售罄' + day.bottomInfo = '闭馆' } } } @@ -363,7 +372,7 @@ }) }, - load3Day(sdate) { //加载7天数据 + load3Day(sdate, callbak) { //加载7天数据 var that = this; that.listDatePrice = []; var edate = this.$moment(sdate).add('days', 2).format("yyyy-MM-DD"); @@ -375,6 +384,7 @@ this.loadCalendar(sdate, edate, function(res) { that.listDatePrice = res; var i = 0; + let isOpenDate = false; for (var m of that.listDatePrice) { m.checked = false; m.datef = that.$moment(m.date).format("MM月DD日"); @@ -388,16 +398,16 @@ } else { m.week = week; } - if (m.date == selectDate) { if (m.is_open == 1) { m.checked = true; that.currentDate = m; that.currentIndex = i; that.loadDefaultTime(m.rules); + isOpenDate = true; } else { - - uni.showToast({ + isOpenDate = false; + /* uni.showToast({ icon: "none", title: selectDate + "不可以预约", complete() { @@ -406,12 +416,17 @@ .format("yyyy-MM-DD")) }, 2000) } - }, 2000) + }, 2000) */ } } i++; } + if (callbak) + callbak(isOpenDate); + }) + + }, loadDefaultTime(rules) { var that = this; diff --git a/pages/order/parkorder.vue b/pages/order/parkorder.vue index b1bef90..91f4417 100644 --- a/pages/order/parkorder.vue +++ b/pages/order/parkorder.vue @@ -9,7 +9,7 @@ - 苏E44444 + {{item.plate}} 待参观 @@ -88,11 +88,8 @@ utilSuccess: function(res) { that.loadOrder() }, - utilFail: function(res) { - uni.showToast({ - icon: "none", - title: res - }) + utilFail: function(res) { + that.util.toast(res); } }) console.log('用户点击确定'); diff --git a/pages/visit/book.vue b/pages/visit/book.vue index f01d366..ff513ed 100644 --- a/pages/visit/book.vue +++ b/pages/visit/book.vue @@ -464,10 +464,7 @@ }) }, utilFail: function(res) { - uni.showToast({ - icon: "none", - title: res - }) + that.util.toast(res); } }) @@ -535,8 +532,10 @@ } that.form.details_list.push(that.formUser); + that.addUserAfter(); that.showAdd = false; - }).catch(errors => { + }).catch(errors => { + console.log(errors) uni.showToast({ icon: "none", title: "观众信息提交不正确" @@ -549,11 +548,17 @@ } }, + addUserAfter() { + if (this.type == "user") { + var user = this.form.details_list[0]; + this.form.leader = user.name; + } + }, closecalendar() { this.showCalendar = false; }, handleSelectDate(e) { - if (this.showCalendar && e.length != 0 ) { + if (this.showCalendar && e.length != 0) { this.load3Day(e[0]); this.showCalendar = false; } @@ -605,7 +610,7 @@ m.checked = false; } cdate.checked = true; - + this.loadDefaultTime(cdate.rules); this.currentDate = cdate; @@ -613,16 +618,16 @@ this.$forceUpdate(); }, handleSelectTime(index) { - var mod = this.currentDate.rules[index]; - if (mod.remain_count == 0) { - this.util.toast("该时段已售罄"); - return false - } - for (var m of this.currentDate.rules) { - m.checked = false; - } - mod.checked = true; - this.currentTime = mod; + var mod = this.currentDate.rules[index]; + if (mod.remain_count == 0) { + this.util.toast("该时段已售罄"); + return false + } + for (var m of this.currentDate.rules) { + m.checked = false; + } + mod.checked = true; + this.currentTime = mod; this.$forceUpdate(); }, load3Day(sdate) { //加载7天数据 @@ -654,25 +659,25 @@ m.week = week; } - if (m.date == selectDate) { - if (m.is_open == 1) { - m.checked = true; - that.currentDate = m; - that.currentIndex = i; - that.loadDefaultTime(m.rules); - } else { - - uni.showToast({ - icon: "none", - title: selectDate + "不可以预约", - complete() { - setTimeout(function() { - that.load3Day(that.$moment(selectDate).add('days', 1) - .format("yyyy-MM-DD")) - }, 2000) - } - }, 2000) - } + if (m.date == selectDate) { + if (m.is_open == 1) { + m.checked = true; + that.currentDate = m; + that.currentIndex = i; + that.loadDefaultTime(m.rules); + } else { + + uni.showToast({ + icon: "none", + title: selectDate + "不可以预约", + complete() { + setTimeout(function() { + that.load3Day(that.$moment(selectDate).add('days', 1) + .format("yyyy-MM-DD")) + }, 2000) + } + }, 2000) + } } i++; } @@ -734,6 +739,7 @@ .timeitem-none { color: #ccc; } + .box-visitor-item { display: flex; justify-content: space-between; diff --git a/utils/util.js b/utils/util.js index 24765bb..b3d378b 100755 --- a/utils/util.js +++ b/utils/util.js @@ -112,11 +112,20 @@ const alert = msg => { }; // 订单状态 const toast = msg => { - uni.showToast({ - icon: "none", - title: msg, - duration: 2000 - }) + // setTimeout(function() { + // uni.showToast({ + // icon: "none", + // title: msg, + // duration: 2000 + // }) + // }, 2000) + + uni.showModal({ + title: '', + content: msg, + showCancel: false + }); + }; // 订单状态 @@ -173,6 +182,7 @@ const request = options => { uni.request({ ...options, success: function(res) { + uni.hideLoading(); if (res.statusCode != 200) { if (options.utilFail != undefined) { if (res.statusCode == 401) { @@ -203,7 +213,7 @@ const request = options => { complete: function(res) { if (!options.customLoading) { uni.hideNavigationBarLoading(); - uni.hideLoading(); + } else { // 当前页面请求数量-1 if (options.bindThis) {