diff --git a/pages/activity/index.vue b/pages/activity/index.vue index 0a71e62..19f6aa8 100644 --- a/pages/activity/index.vue +++ b/pages/activity/index.vue @@ -5,7 +5,7 @@ - {{item.status==0?"已结束":"活动进行中"}} + {{item.rate_name}} {{isUnde(item.orders_count)}} @@ -20,7 +20,7 @@ {{isUnde(item.target_name)}} - + 立即报名 @@ -90,9 +90,14 @@ }) }, openInfo(obj) { - uni.navigateTo({ - url: "info?id=" + obj.id - }) + if (obj.rate_name == "进行中") + uni.navigateTo({ + url: "info?id=" + obj.id + }) + else { + this.util.toast("当前选择活动" + obj.rate_name + "不可报名"); + + } }, loadActivity() { var that = this; @@ -100,7 +105,7 @@ api: '/api/mobile/activity/index', data: { latitude: that.latitude, - longitude: that.longitude, + longitude: that.longitude }, utilSuccess: function(res) { that.list = res.data; @@ -118,8 +123,8 @@ } }, getHm(val) { - if (val) { - return this.$moment(val).format("HH:mm") + if (val) { + return this.$moment(val).format("HH:mm") } else return ""; } } diff --git a/pages/guide/index.vue b/pages/guide/index.vue index 9c4c298..de499f6 100644 --- a/pages/guide/index.vue +++ b/pages/guide/index.vue @@ -72,7 +72,8 @@ api: '/api/mobile/activity/index', data: { latitude: that.latitude, - longitude: that.longitude + longitude: that.longitude, + time_type: 2 }, utilSuccess: function(res) { for (var m of res.data) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 9105982..9ecb8d5 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -46,11 +46,16 @@ + 'book-box-row-dateitem-none':item.is_open==0, + 'book-box-row-dateitem-none':item.remain_count==0}" @click="handleDate(index)"> - {{item.is_open==1?'余票':"闭馆"}} + + {{item.remain_count==0?"售罄":"余票"}} + 闭馆 + {{item.week}} {{item.datef}} @@ -202,14 +207,20 @@ if (e.length != 0) { var date = e[0] - - this.load3Day(date, function(isCanbook) { - if (isCanbook) { - that.showCalendar = false; - } else { - that.util.toast("您选择的日期已经闭馆") - } - }); + var mod = this.listCalendar.filter((p) => { + return p.is_open == 1 && p.remain_count != 0 && p.date == date; + }) + if (mod.length != 0) { + this.load3Day(date, function(isCanbook) { + if (isCanbook) { + that.showCalendar = false; + } else { + that.util.toast("您选择的日期不可预约") + } + }); + } else { + that.util.toast("您选择的日期不可预约") + } } }, openCalendar() { @@ -226,7 +237,11 @@ let date = this.$moment(day.date).format("yyyy-MM-DD"); if (date == m.date) { if (m.is_open == 1) - day.bottomInfo = '余票' + if (m.remain_count == 0) { + day.bottomInfo = '售罄' + } else { + day.bottomInfo = '余票' + } else { day.bottomInfo = '闭馆' } @@ -243,12 +258,20 @@ return; } if (cdate.is_open === 0) { + uni.showToast({ + icon: "none", + title: "该日期已经闭馆" + }) + return; + } + if (cdate.remain_count === 0) { uni.showToast({ icon: "none", title: "该日期已经售罄" }) return; } + for (var m of list) { m.checked = false; } @@ -318,6 +341,8 @@ }, openBook() { var that = this; + this.currentTime = this.currentDate = {}; + var sdate = that.$moment().format("yyyy-MM-DD"); that.showBook = true; that.load3Day(sdate) @@ -399,7 +424,7 @@ m.week = week; } if (m.date == selectDate) { - if (m.is_open == 1) { + if (m.is_open == 1 && m.remain_count > 0) { m.checked = true; that.currentDate = m; that.currentIndex = i; diff --git a/pages/order/visitorderinfo.vue b/pages/order/visitorderinfo.vue index a1b84a9..4026dfc 100644 --- a/pages/order/visitorderinfo.vue +++ b/pages/order/visitorderinfo.vue @@ -71,7 +71,7 @@ 预约时需要个人姓名、联系方式和参观时间等信息,预约成功后生成预约二维码,可于个人中心查看。当天凭有效身份证件或预约二维码核销入场。 + class="orderBoxInfoRowTxt">{{info.type==1?vinfo.person_notice:vinfo.team_notice}} @@ -82,10 +82,12 @@ export default { data() { return { - info: {} + info: {}, + vinfo: {} } }, - onLoad(options) { + onLoad(options) { + this.loadIntroduce(); if (!this.util.isNull(options.id)) { this.loadInfo(options.id); } @@ -107,6 +109,19 @@ } }) }, + loadIntroduce() { + var that = this; + this.util.request({ + api: '/api/mobile/visit/introduce', + utilSuccess: function(res) { + that.vinfo = res; + }, + utilFail: function(res) { + + } + }) + + }, loadInfo(id) { var that = this; this.util.request({ diff --git a/pages/park/book.vue b/pages/park/book.vue index 1e0b363..be8942b 100644 --- a/pages/park/book.vue +++ b/pages/park/book.vue @@ -2,9 +2,8 @@ - + 已选:{{selectInfo}} - 选择已预约的参观 > @@ -27,13 +26,27 @@ - 请认真阅读、知悉并遵守《实训基地预约停车须知》 + 请认真阅读、知悉并遵守《本馆停车须知》 确定 + + + + + {{notice.name}} + + + + + 知道了 + + + @@ -68,7 +81,7 @@ color="#EF9525"> - 活动时间:{{item.activity.start_time}} + 活动时间:{{item.activity.start_time}} 报名数量:{{item.total}} @@ -92,7 +105,8 @@ }, data() { return { - showSelectorder: true, + showInfo: false, + showSelectorder: false, selectInfo: "--", showSelecttime: false, plateNumber: ['苏', 'E', '', '', '', '', ''], @@ -111,7 +125,9 @@ listOrder: [], listActivtyOrder: [], orderType: 1, - orderid: 0, + orderid: "", + bookinfo: {}, + notice: {} } }, onLoad(options) { @@ -122,9 +138,21 @@ if (!that.util.isNull(options.currentPark)) { this.form.type = options.currentPark; } - this.loadOrder(function() { - that.loadactivityOrder(function() {}) - }); + + if (!that.util.isNull(options.bookinfo)) { + let bookinfo = JSON.parse(unescape(options.bookinfo)); + this.bookinfo = bookinfo; + this.form.time = bookinfo.time; + this.selectInfo = bookinfo.info; + + if (this.orderType == 2) + this.form.activity_order_id = bookinfo.orderid + else + this.form.visit_order_id = bookinfo.orderid + this.orderid = bookinfo.orderid + } + that.loadConfigInfo(); + that.util.getUserInfo(function(r) { that.form.mobile = r.mobile; }, true); @@ -133,6 +161,31 @@ }, methods: { + loadConfigInfo() { + var that = this; + this.util.request({ + api: '/api/mobile/other/config-show', + data: { + tag: "car_park_notice" + }, + utilSuccess: function(res) { + that.notice = res; + }, + utilFail: function(res) { + uni.showToast({ + icon: "none", + title: res, + duration: 2000 + }) + } + }) + }, + openNotice() { + this.showInfo = true; + }, + closeInfo() { + this.showInfo = false; + }, handleConfirmOrder() { if (this.orderid === 0) { this.util.toast("请选择预约的活动或者预约的参观"); @@ -157,9 +210,10 @@ } else { this.listActivtyOrder[index].checked = true - this.selectInfo = this.$moment(this.listActivtyOrder[index].activity.start_time).format("MM月DD日 hh:mm") - - this.form.time = this.$moment(this.listActivtyOrder[index].activity.start_time).format("YYYY-MM-DD hh:mm:ss"); + this.selectInfo = this.$moment(this.listActivtyOrder[index].activity.start_time).format("MM月DD日 hh:mm") + + this.form.time = this.$moment(this.listActivtyOrder[index].activity.start_time).format( + "YYYY-MM-DD hh:mm:ss"); this.form.activity_order_id = this.orderid = this.listActivtyOrder[index].id; } this.orderType = type; diff --git a/pages/park/index.vue b/pages/park/index.vue index 9375c54..848cf24 100644 --- a/pages/park/index.vue +++ b/pages/park/index.vue @@ -7,22 +7,21 @@ - {{info.name}} + {{info.name||""}} - 预约可入场时间段:{{info.start_time}}-{{info.end_time}} - + 可入场时间段:{{info.start_time||""}}-{{info.end_time||""}} - 地址:{{info.address}} + 地址:{{info.address||""}} - 距离:11.3km + 距离:{{distance||"0"}}km @@ -31,31 +30,35 @@ 可预约车位 + @click="handleSelectPark(2)" :class="(currentPark==2?'parkbox-item-on':'')" + v-if="remain_big_park>0"> - 大中:{{info.big_park_total}} + 大中:{{remain_big_park}} + style="margin-left: 15rpx;" v-if="remain_small_park>0"> 小车:{{info.small_park_total}} + style="font-size: 28rpx;">小车:{{remain_small_park}} - (充电桩空闲{{info.charge_total}}) + (充电桩空闲0) + + + 选择信息:{{selectInfo.info||"暂未选择"}} + @@ -65,6 +68,52 @@ + + + + + 选择预约的活动或者预约的参观 + + + + + 预约的参观 + + + + + + + {{$u.timeFormat(new Date(item.date), 'mm月dd日')}} + {{item.time}}丨{{item.details_count}} 位观众 + + + + + + + 预约的活动 + + + + + + + 活动时间:{{item.activity.start_time}} + 报名数量:{{item.total}} + + + + + 确定 + + + + @@ -74,27 +123,90 @@ return { latitude: 31.299893, longitude: 120.626022, + userlatitude: 31.299893, + userlongitude: 120.626022, + distance: 0, info: {}, covers: [], currentPark: 1, - btnDisabled: false + btnDisabled: false, + showSelectorder: false, + listOrder: [], + listActivtyOrder: [], + selectInfo: { + info: "", + orderType: 1, + orderid: 0, + userlatitude: 31.299893, + userlongitude: 120.626022 + }, + remain_big_park: 0, + remain_small_park: 0 } }, onLoad() { var that = this; - this.loadInfo(); - this.loadOrder(function(res) { - that.loadactivityOrder(function(r) { - if (res.length + r.length == 0) { - that.util.toast("请先预约活动或参观") - that.btnDisabled = true; - } else { - that.btnDisabled = false; - } - }) + wx.getLocation({ + success(res) { + that.userlatitude = res.latitude; + that.userlongitude = res.longitude; + that.loadOrder(function(res) { + that.loadactivityOrder(function(r) { + if (res.length + r.length == 0) { + that.util.toast("您需要预约参观或者预约活动才可以停车"); + that.btnDisabled = true; + } else { + that.btnDisabled = false; + that.showSelectorder = true; + } + }) + }); + } }) + }, methods: { + handleConfirmOrder() { + if (this.selectInfo.orderid === 0) { + this.util.toast("请选择预约的活动或者预约的参观"); + return false; + } + this.showSelectorder = false; + }, + handleSelectOrder(index, type) { + for (var m of this.listActivtyOrder) { + m.checked = false; + } + for (var m of this.listOrder) { + m.checked = false; + } + if (type == 1) { + this.listOrder[index].checked = true; + this.selectInfo.info = this.$moment(this.listOrder[index].date).format("MM月DD日") + " " + this + .listOrder[ + index].time + this.selectInfo.time = this.$moment(this.listOrder[index].date + " " + this.listOrder[ + index].time.split("-")[0]).format("YYYY-MM-DD hh:mm:ss"); + this.selectInfo.orderid = this.orderid = this.listOrder[index].id; + } else { + this.listActivtyOrder[index].checked = true + this.selectInfo.info = this.$moment(this.listActivtyOrder[index].activity.start_time).format( + "MM月DD日 hh:mm") + + this.selectInfo.time = this.$moment(this.listActivtyOrder[index].activity.start_time).format( + "YYYY-MM-DD hh:mm:ss"); + this.selectInfo.orderid = this.orderid = this.listActivtyOrder[index].id; + } + this.orderType = type; + this.selectInfo.orderType = type; + this.loadInfo(); + }, + openselectorder() { + this.showSelectorder = true; + }, + closeorder() { + this.showSelectorder = false; + }, loadOrder(cb) { var that = this; this.util.request({ @@ -103,6 +215,10 @@ status: 1 }, utilSuccess: function(res) { + for (var mod of res) { + mod.checked = false; + } + that.listOrder = res; cb(res) }, utilFail: function(res) { @@ -118,6 +234,10 @@ status: 1 }, utilSuccess: function(res) { + for (var mod of res) { + mod.checked = false; + } + that.listActivtyOrder = res; cb(res); }, utilFail: function(res) { @@ -125,6 +245,7 @@ } }) }, + handleSelectPark(type) { this.currentPark = type; }, @@ -136,24 +257,31 @@ address: this.info.address }); }, - loadInfo(cb) { + loadInfo() { var that = this; this.util.request({ - api: '/api/mobile/carpark/index', - utilSuccess: function(r) { - var res = r[0]; - res.latitude = parseFloat(res.latitude); - res.longitude = parseFloat(res.longitude); - that.info = res; + api: '/api/mobile/carpark/show', + data: { + date: that.selectInfo.time, + latitude: that.userlatitude, + longitude: that.userlongitude + }, + utilSuccess: function(res) { + that.info = res.detail; + that.distance = res.distance; + that.info.latitude = parseFloat(res.detail.latitude); + that.info.longitude = parseFloat(res.detail.longitude); + that.remain_big_park = res.remain_big_park; + that.remain_small_park = res.remain_small_park; var mod = { - latitude: res.latitude, - longitude: res.longitude, + latitude: that.info.latitude, + longitude: that.info.longitude, width: 70, height: 70, - iconPath: '/static/img/location.png' + iconPath: '/static/img/location.png', + id: 1 } that.covers.push(mod); - cb(res); }, utilFail: function(res) { @@ -164,9 +292,16 @@ uni.$u.throttle(this.tobook, 500) }, tobook() { - uni.navigateTo({ - url: "book?id=" + this.info.id + "¤tPark=" + this.currentPark - }) + if (this.selectInfo.orderid === 0) { + this.util.toast("请选择预约的活动或者预约的参观"); + return false; + } else { + var json = escape(JSON.stringify(this.selectInfo)); + uni.navigateTo({ + url: "book?bookinfo=" + json + "&id=" + this.info.id + "¤tPark=" + this.currentPark + }) + } + } } } diff --git a/pages/visit/book.vue b/pages/visit/book.vue index ff513ed..5ab46a1 100644 --- a/pages/visit/book.vue +++ b/pages/visit/book.vue @@ -19,7 +19,11 @@ - {{item.is_open==1?'余票':"售罄"}} + + {{item.remain_count==0?"售罄":"余票"}} + 闭馆 + {{item.week}} {{item.datef}} @@ -107,7 +111,7 @@ - + 添加观众 @@ -182,7 +186,7 @@ - + @@ -286,6 +290,7 @@ maxCount: 1, config: {}, info: {}, + editIndex: -1, cardList: [{ idx: 1, name: '身份证' @@ -421,7 +426,7 @@ } if (this.form.card_type == 1) { - if (!uni.$u.test.idCard(this.form.idcard)) { + if (!that.util.isValidCardID(that.form.idcard)) { uni.showToast({ icon: "none", title: "请正确输入身份证号" @@ -522,7 +527,8 @@ try { this.$refs.formUser.validate().then(res => { if (that.formUser.card_type == 1) { - if (!uni.$u.test.idCard(that.formUser.idcard)) { + that.formUser.idcard = that.formUser.idcard.toUpperCase(); + if (!that.util.isValidCardID(that.formUser.idcard)) { uni.showToast({ icon: "none", title: "请正确输入身份证号" @@ -530,12 +536,27 @@ return false; } } - - that.form.details_list.push(that.formUser); + if (this.util.isNull(this.formUser.mobile)) { + uni.showToast({ + icon: "none", + title: "请填写手机号" + }) + return false; + } else if (!uni.$u.test.mobile(this.formUser.mobile)) { + uni.showToast({ + icon: "none", + title: "请正确填写手机号" + }) + return false; + } + //判断是不是编辑 如果是编辑 + if (that.editIndex != -1) { + that.form.details_list.splice(that.editIndex, 1, that.formUser) + } else + that.form.details_list.push(that.formUser); that.addUserAfter(); that.showAdd = false; - }).catch(errors => { - console.log(errors) + }).catch(errors => { uni.showToast({ icon: "none", title: "观众信息提交不正确" @@ -551,19 +572,33 @@ addUserAfter() { if (this.type == "user") { var user = this.form.details_list[0]; - this.form.leader = user.name; + if (this.form.leader != "") + this.form.leader = user.name; } }, closecalendar() { this.showCalendar = false; }, handleSelectDate(e) { - if (this.showCalendar && e.length != 0) { - this.load3Day(e[0]); - this.showCalendar = false; + let that = this; + if (e.length != 0) { + var date = e[0] + var mod = this.listCalendar.filter((p) => { + return p.is_open == 1 && p.remain_count != 0 && p.date == date; + }) + if (mod.length != 0) { + this.load3Day(date, function(isCanbook) { + if (isCanbook) { + that.showCalendar = false; + } else { + that.util.toast("您选择的日期不可预约") + } + }); + } else { + that.util.toast("您选择的日期不可预约") + } } - }, openCalendar() { var that = this; @@ -578,10 +613,14 @@ for (var m of this.listCalendar) { let date = this.$moment(day.date).format("yyyy-MM-DD"); if (date == m.date) { - if (m.is_open == 1) - day.bottomInfo = '余票' - else { - day.bottomInfo = '售罄' + if (m.is_open == 1) { + if (m.remain_count == 0) { + day.bottomInfo = '售罄' + } else { + day.bottomInfo = '余票' + } + } else { + day.bottomInfo = '闭馆' } } } @@ -598,14 +637,23 @@ }) return; } - console.log("cdate", cdate) if (cdate.is_open === 0) { + uni.showToast({ + icon: "none", + title: "该日期已经闭馆" + }) + return; + } + + + if (cdate.remain_count === 0) { uni.showToast({ icon: "none", title: "该日期已经售罄" }) return; } + for (var m of list) { m.checked = false; } @@ -630,21 +678,19 @@ this.currentTime = mod; this.$forceUpdate(); }, - load3Day(sdate) { //加载7天数据 + load3Day(sdate, callbak) { //加载7天数据 var that = this; that.listDatePrice = []; - var nt = this.$moment().format("yyyy-MM-DD"); - sdate = sdate == "" ? nt : sdate; var edate = this.$moment(sdate).add('days', 2).format("yyyy-MM-DD"); var ndate = this.$moment(sdate).add('days', 1).format("yyyy-MM-DD") - + var nt = this.$moment().format("yyyy-MM-DD"); 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; var i = 0; + let isOpenDate = false; for (var m of that.listDatePrice) { m.checked = false; m.datef = that.$moment(m.date).format("MM月DD日"); @@ -658,16 +704,16 @@ } else { m.week = week; } - if (m.date == selectDate) { - if (m.is_open == 1) { + if (m.is_open == 1 && m.remain_count > 0) { 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() { @@ -676,13 +722,19 @@ .format("yyyy-MM-DD")) }, 2000) } - }, 2000) + }, 2000) */ } } i++; } + if (callbak) + callbak(isOpenDate); + }) + + }, + loadCalendar(sdate, edate, cb) { var that = this; this.util.request({ @@ -719,10 +771,12 @@ }, openAdd(index) { this.formUser = this.$options.data().formUser; - console.log(index) if (index || index == 0) { + console.log(index) + this.editIndex = index; let r = Object.assign(this.formUser, this.form.details_list[index]); - } + } else + this.editIndex = -1; this.showAdd = true }, delUser(index) { diff --git a/utils/util.js b/utils/util.js index b3d378b..fd9197b 100755 --- a/utils/util.js +++ b/utils/util.js @@ -551,5 +551,7 @@ module.exports = { auditStatusDic: auditStatusDic, getUserProfile: getUserProfile, getUserInfo: getUserInfo, - toast: toast + toast: toast, + isValidCardID:isValidCardID + };