预约日期

dev
lion 2 weeks ago
parent 93ddf21640
commit bc38b4c882

@ -163,15 +163,15 @@
export default {
data() {
const d = new Date()
const year = d.getFullYear()
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
const date = d.getDate()
const pad = (n) => (n < 10 ? '0' + n : '' + n)
const fmtDate = (dt) => `${dt.getFullYear()}-${pad(dt.getMonth() + 1)}-${pad(dt.getDate())}`
const dMax = new Date(d.getTime())
dMax.setDate(dMax.getDate() + 6)
return {
showInfo: false,
showBook: false,
minDate: `${year}-${month}-${date + 1}`,
maxDate: `${year}-${month}-${date + 7}`,
minDate: fmtDate(d),
maxDate: fmtDate(dMax),
showCalendar: false,
list: ["暂无通知通告"],
info: {},
@ -190,8 +190,9 @@
return this.util.shareInfo
},
onLoad() {
this.minDate = this.$moment().add(1, 'days').format('YYYY-MM-DD');
this.maxDate = this.$moment().add(7, 'days').format('YYYY-MM-DD');
// 7 ~ +6
this.minDate = this.$moment().format('YYYY-MM-DD');
this.maxDate = this.$moment().add(6, 'days').format('YYYY-MM-DD');
this.loadInfo();
this.loadNotice();
},
@ -345,12 +346,16 @@
that.util.toast("您选择的日期不可预约")
}
},
filterCalendarByRange(list) {
var that = this;
return (list || []).filter(function(p) {
return !that.$moment(p.date).isAfter(that.maxDate, 'day') && !that.$moment(p.date).isBefore(that.minDate, 'day');
});
},
openCalendar() {
var that = this;
var edate = this.$moment().add('days', 7).format("yyyy-MM-DD");
var ndate = this.$moment().add('days', 1).format("yyyy-MM-DD")
this.loadCalendar(ndate, edate, function(res) {
that.listCalendar = res || [];
this.loadCalendar(this.minDate, this.maxDate, function(res) {
that.listCalendar = that.filterCalendarByRange(res);
that.bindCalendarFormatter();
that.showCalendar = true;
that.$nextTick(function() {
@ -365,6 +370,9 @@
if (!dateStr) {
dateStr = this.$moment(day.date).format("yyyy-MM-DD");
}
if (this.$moment(dateStr).isAfter(this.maxDate, 'day') || this.$moment(dateStr).isBefore(this.minDate, 'day')) {
return day;
}
for (var m of this.listCalendar) {
if (dateStr == m.date) {
if (m.is_open == 1)

@ -86,21 +86,21 @@
<view class="box-card-content">
<u-form-item label="参观人数" v-if="type=='user'" labelWidth="120" prop="total" ref="total">
<u-number-box slot="right" v-model="form.total" inputWidth="44" color="#EF9525"
bgColor="#FCF6E3" :min="minCount" :max="maxCount" class="plus">
<view slot="input" class="slotinput">
<u-input @blur="checkValue" type="number" v-model='form.total'></u-input>
bgColor="#FCF6E3" :min="minCount" :max="maxCount" class="plus">
<view slot="input" class="slotinput">
<u-input @blur="checkValue" type="number" v-model='form.total'></u-input>
</view>
</u-number-box>
</u-form-item>
<u-form-item v-else label="人数" labelWidth="120" prop="total" ref="total">
<!-- {{form.total}} 请添加参与名单 -->
<u-number-box slot="right" v-model="form.total" inputWidth="44" color="#EF9525"
bgColor="#FCF6E3" :min="minCount" :max="maxCount" class="plus">
<view slot="input" class="slotinput">
<u-input @blur="checkValue" type="number" v-model='form.total'></u-input>
</view>
<!-- {{form.total}} 请添加参与名单 -->
<u-number-box slot="right" v-model="form.total" inputWidth="44" color="#EF9525"
bgColor="#FCF6E3" :min="minCount" :max="maxCount" class="plus">
<view slot="input" class="slotinput">
<u-input @blur="checkValue" type="number" v-model='form.total'></u-input>
</view>
</u-number-box>
</u-form-item>
<!-- <view class="box-tips" v-if="type=='team'">
@ -138,7 +138,7 @@
</view>
</view>
</view>
<view class="box-visitor">
<block v-for="(item,index) in form.details_list" :key="index">
<view class="box-visitor-item">
@ -336,10 +336,10 @@
data() {
const d = new Date()
const year = d.getFullYear()
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
const date = d.getDate()
const pad = (n) => (n < 10 ? '0' + n : '' + n)
const fmtDate = (dt) => `${dt.getFullYear()}-${pad(dt.getMonth() + 1)}-${pad(dt.getDate())}`
const dMax = new Date(d.getTime())
dMax.setDate(dMax.getDate() + 6)
return {
showAuthorization: false,
successshow: false,
@ -350,11 +350,11 @@
scrollheight: "",
notice: [{
title: "观展须知",
content: "观展须知的内容",
content: "观展须知的内容",
isTemplate:false
}, {
title: "批量上传帮助",
content: "<p>1.批量上传EXCEL的以xlsx结尾</p><p>2.第一行为标题行 姓名 手机号 证件号 行动不便者</p><p>3.文件是从微信聊天记录中选取或者微信文件传输助手</p><img src='@host@/export.png?v=1.1' style='width:100%'/>",
content: "<p>1.批量上传EXCEL的以xlsx结尾</p><p>2.第一行为标题行 姓名 手机号 证件号 行动不便者</p><p>3.文件是从微信聊天记录中选取或者微信文件传输助手</p><img src='@host@/export.png?v=1.1' style='width:100%'/>",
isTemplate:true
}],
specialtype: false,
@ -403,8 +403,8 @@
showAdd: false,
showInfo: false,
showBook: false,
minDate: `${year}-${month}-${date + 1}`,
maxDate: `${year}-${month}-${date + 7}`,
minDate: fmtDate(d),
maxDate: fmtDate(dMax),
showCalendar: false,
listDatePrice: [],
currentDate: {},
@ -470,6 +470,8 @@
this.$refs.formUser.setRules(this.rules);
},
onLoad(options) {
this.minDate = this.$moment().format('YYYY-MM-DD');
this.maxDate = this.$moment().add(6, 'days').format('YYYY-MM-DD');
this.loadConfig();
this.loadInfo();
this.openNoticeInfo(0);
@ -521,13 +523,13 @@
clearInterval(this.t)
clearTimeout(this.timer)
},
methods: {
checkValue(value) {
if (value > this.maxCount) {
this.form.total = this.maxCount;
} else if (value < this.minCount) {
this.form.total = this.minCount;
}
methods: {
checkValue(value) {
if (value > this.maxCount) {
this.form.total = this.maxCount;
} else if (value < this.minCount) {
this.form.total = this.minCount;
}
},
//
closePhone() {
@ -625,7 +627,7 @@
downLoad() {
const downloadTask = uni.downloadFile({
url: 'https://leyiyuyue.szgmbwg.org.cn/res/Template.xlsx', //
success: (res) => {
success: (res) => {
var filePath = res.tempFilePath
if (res.statusCode === 200) {
uni.openDocument({
@ -957,18 +959,25 @@
}
},
filterCalendarByRange(list) {
var that = this;
return (list || []).filter(function(p) {
return !that.$moment(p.date).isAfter(that.maxDate, 'day') && !that.$moment(p.date).isBefore(that.minDate, 'day');
});
},
openCalendar() {
var that = this;
var edate = this.$moment().add('days', 7).format("yyyy-MM-DD");
var ndate = this.$moment().add('days', 1).format("yyyy-MM-DD")
this.loadCalendar(ndate, edate, function(res) {
that.listCalendar = res;
this.loadCalendar(this.minDate, this.maxDate, function(res) {
that.listCalendar = that.filterCalendarByRange(res);
that.showCalendar = true;
});
},
formatter(day) {
let date = this.$moment(day.date).format("yyyy-MM-DD");
if (this.$moment(date).isAfter(this.maxDate, 'day') || this.$moment(date).isBefore(this.minDate, 'day')) {
return day;
}
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) {
if (m.remain_count == 0) {
@ -1163,14 +1172,14 @@
<style lang="scss">
@import url("@/static/css/bookbox.css");
.slotinput {
&>view {
width: 80rpx;
height: 30rpx;
border-radius: 0;
border: none;
}
.slotinput {
&>view {
width: 80rpx;
height: 30rpx;
border-radius: 0;
border: none;
}
}
.timeitem-none {
color: #ccc;
@ -1341,15 +1350,15 @@
.u-radio-group .u-radio {
margin-bottom: 10rpx;
margin-right: 10rpx
}
.book-box-row-timeitem {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 32%;
padding: 19rpx 21rpx!important;
}
.book-box-row-timeitem-txt {
width:100%
}
.book-box-row-timeitem {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 32%;
padding: 19rpx 21rpx!important;
}
.book-box-row-timeitem-txt {
width:100%
}
</style>
Loading…
Cancel
Save