This commit is contained in:
@jyuhsin
2025-03-19 14:41:09 +08:00
parent 309b2069e0
commit ef30224867
7 changed files with 217 additions and 174 deletions
@@ -204,7 +204,7 @@ layout("/mobile/platform.html"){
</van-cell>
<van-cell title="预约地点">{{site.name}}</van-cell>
<van-field
<!--<van-field
v-model="joinUser"
rows="2"
autosize
@@ -213,7 +213,7 @@ layout("/mobile/platform.html"){
maxlength="50"
placeholder="请输入参加人员"
show-word-limit
></van-field>
></van-field>-->
<van-field
v-model="message"
rows="4"
@@ -295,10 +295,10 @@ layout("/mobile/platform.html"){
calendarFormatter() {
return (day) => {
// 休息日不能选择
let week = day.date.getDay()
/*let week = day.date.getDay()
if (week === 0 || week === 6) {
day.type = 'disabled'
}
}*/
return day
}
}
@@ -320,12 +320,23 @@ layout("/mobile/platform.html"){
//这里要排除掉休息日
setWeekList(startDate) {
const wk = []
let d = null
do {
d = moment(startDate).day()
if(!this.site.openWeekTime.includes(d)) {
startDate = moment(startDate).add(1, 'd')
}
} while (!this.site.openWeekTime.includes(d))
wk.push(moment(startDate))
let count = 1
while (wk.length < 7) {
const addDate = moment(startDate).add(count, 'd')
const nextDay = addDate.day()
//这里不是休息日才能加到数组里
if (addDate.day() !== 0 && addDate.day() !== 6 && !this.holidays.includes(moment(addDate).format('YYYY-MM-DD'))) {
/*if (addDate.day() !== 0 && addDate.day() !== 6 && !this.holidays.includes(moment(addDate).format('YYYY-MM-DD'))) {
wk.push(addDate)
}*/
if(this.site.openWeekTime.includes(nextDay)) {
wk.push(addDate)
}
count++
@@ -399,12 +410,11 @@ layout("/mobile/platform.html"){
async onLoad() {
this.loading = true
$.post('/mobile/activity/site/info/getDetail', {id: this.site_id}).then(res => {
if (res.code === 0) {
this.site = res.data
}
this.loading = false
})
const resp = await $.post('/mobile/activity/site/info/getDetail', {id: this.site_id})
if (resp.code === 0) {
this.site = resp.data
}
this.loading = false
},
async getReserve() {
const resp = await $.post('/mobile/activity/site/info/getReserve', {
@@ -446,9 +456,9 @@ layout("/mobile/platform.html"){
async created() {
this.site_id = getQueryString('id')
this.selectDate = this.getLatestWorkDay()
this.setWeekList(this.selectDate)
await this.getReserve()
await this.onLoad()
this.setWeekList(this.selectDate)
await this.getMyReservation()
}
@@ -457,4 +467,4 @@ layout("/mobile/platform.html"){
<!--#
}
#-->
#-->