This commit is contained in:
@jyuhsin
2025-05-27 11:56:08 +08:00
parent 42c957bc85
commit 1ab84aadc4
3 changed files with 82 additions and 21 deletions
@@ -65,7 +65,7 @@ layout("/mobile/platform.html"){
background-color: #0e78c5;
}
.calendar-left {
width: calc(100% - 20px);
/*width: calc(100% - 20px);*/
overflow-x: auto;
display: flex;
height: 90%;
@@ -139,13 +139,13 @@ layout("/mobile/platform.html"){
</div>
</div>
</div>
<div class="calendar-right">
<!--<div class="calendar-right">
<van-icon size="16" color="white" name="arrow-down" @click="calendarVisible=true"></van-icon>
<van-calendar class="top_pop" v-model="calendarVisible" color="#246fb4" position="top" @confirm="onConfirm"
:default-date="selectDate?.toDate()"
:formatter="calendarFormatter"
title="选择开始日期"></van-calendar>
</div>
</div>-->
</div>
<div class="container">
@@ -153,6 +153,15 @@ layout("/mobile/platform.html"){
<tr v-for="item in timeData">
<td class="time">{{item.start_time + '-' + item.end_time}}</td>
<td>
<div v-if="item.disabled === true" class="state">{{ item.tooltip }}</div>
<div @click="chooseTime(item)" v-else class="state" style="background-color: #e8ffef; color: #52986a">
<span v-if="!times.map(o => o.fullDay).includes(selectDate.format('YYYY-MM-DD') + ' ' + item.start_time + '-' + item.end_time)">可预约</span>
<span v-else>
<van-icon name="passed" size="26" style="line-height: 36px;position: unset"></van-icon>
</span>
</div>
</td>
<!--<td>
<div v-if="isCanRe(item)===3" class="state" style="background-color: #0e78c5;color: #fff3f3">
已预约
</div>
@@ -167,7 +176,7 @@ layout("/mobile/platform.html"){
</div>
<div v-if="isCanRe(item) === 0" class="state">已过期</div>
<div v-if="isCanRe(item) === 4" class="state">不可预约</div>
</td>
</td>-->
</tr>
</table>
<van-empty v-else image="error" :description="moment(selectDate).format('YYYY-MM-DD') + '不能预约'"></van-empty>
@@ -300,7 +309,7 @@ layout("/mobile/platform.html"){
setWeekList(startDate) {
const wk = []
let count = 0
while (wk.length < 7) {
while (wk.length < 8) {
const addDate = moment(startDate).add(count, 'd')
let dis = false
if(this.allowDayList.length > 0 && !this.allowDayList.includes(moment(addDate).format('YYYY-MM-DD'))) {
@@ -377,8 +386,6 @@ layout("/mobile/platform.html"){
}
},
isCanRe(item) {
const now = new Date()
const end = moment().format('YYYY-MM-DD') + ' ' + item.end_time + ':00'
const itemFullTime = this.selectDate.format('YYYY-MM-DD') + " " + item.start_time + "-" + item.end_time
if(this.site.notApplyTimeList && this.site.notApplyTimeList.length > 0) {
@@ -394,18 +401,14 @@ layout("/mobile/platform.html"){
const c = moment(sTime).isBefore(moment(notApplyStartTime)) && moment(eTime).isAfter(moment(notApplyEndTime))
if(a || b || c) {
return 4
this.$set(item, 'disabled', true)
this.$set(item, 'tooltip', '不可预约')
}
}
}
if (this.alreadyReserveRecord.includes(itemFullTime)) {
return 3
}
if (now.getTime() >= new Date(end).getTime() && this.selectDate.format('YYYY-MM-DD') === moment().format('YYYY-MM-DD')) {
return 0
} else {
return item.hasCount >= item.allowCount ? 2 : 1
this.$set(item, 'disabled', true)
this.$set(item, 'tooltip', '已预约')
}
},
async onLoad() {