From f7da132d49f18fff0c2ad32718680c16d51e7729 Mon Sep 17 00:00:00 2001 From: "Mr.jiang" <714156421@qq.com> Date: Wed, 28 Aug 2024 16:51:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=99=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/its-calendar/its-calendar.vue | 49 ++- components/its-calendar/its-calendar1.vue | 37 +- components/its-calendar/its-calendar2.vue | 338 ++++++++++++++++ components/pretty-times/pretty-times.scss | 2 +- components/pretty-times/pretty-times.vue | 108 +++-- components/pretty-times/pretty-times1.vue | 467 ++++++++++++++++++++++ my/order/revenueDetails.vue | 2 +- pages/my/mangshi.vue | 195 +++++++-- pages/my/mangshi2.vue | 286 +++++++++++++ utils/date.js | 21 +- 10 files changed, 1396 insertions(+), 109 deletions(-) create mode 100644 components/its-calendar/its-calendar2.vue create mode 100644 components/pretty-times/pretty-times1.vue create mode 100644 pages/my/mangshi2.vue diff --git a/components/its-calendar/its-calendar.vue b/components/its-calendar/its-calendar.vue index a912534..d774e5d 100644 --- a/components/its-calendar/its-calendar.vue +++ b/components/its-calendar/its-calendar.vue @@ -14,7 +14,15 @@ @click.stop="(nowTimes < item.timeStamp) || (msformatArr.indexOf(item.hours) == -1) ? hosts(item) : ''" :style="[{'color':((nowTimes > item.timeStamp) || (msformatArr.indexOf(item.hours) !== -1 ) ? '#999999' : '')},{'background':((nowTimes > item.timeStamp) || (msformatArr.indexOf(item.hours) !== -1 ) ? '#fff' : '')},{'fontSize':((nowTimes < item.timeStamp) && (msformatArr.indexOf(item.hours) !== -1 )) || (msformatArr.indexOf(item.hours) !== -1 ) ? '32rpx' : '30rpx'}, {'letter-spacing':((nowTimes < item.timeStamp) && (msformatArr.indexOf(item.hours) !== -1 )) || (msformatArr.indexOf(item.hours) !== -1 ) ? '4rpx' : '0rpx'}]"> - {{ ((nowTimes < item.timeStamp) && (msformatArr.indexOf(item.hours) !== -1)) || (msformatArr.indexOf(item.hours) !== -1) ? '约满' : item.hours }} + + {{item.hours}} + + {{(nowTimes > item.timeStamp) || (msformatArr.indexOf(item.hours) !== -1 )?'不可预约':'可预约'}} + + + + + 添加时间 @@ -60,7 +68,7 @@ let today = new Date(); let nowTime = today.getTime() // 当前时间戳 this.nowTimes = parseInt(nowTime / 1000) - for (let i = 0; i < 5; i++) { + for (let i = 0; i < 3; i++) { let newDate = new Date(today.getTime() + i * 1000 * 60 * 60 * 24) let month = (parseInt(newDate.getMonth()) + 1) > 9 ? (parseInt(newDate.getMonth()) + 1) : "0" + (parseInt( newDate.getMonth()) + 1) // 当前月份 @@ -72,9 +80,9 @@ if (remTime == 0) { week = "今天" } else if (remTime == 86400) { - week = "明天" + week = "" } else if (remTime == 172800) { - week = "后天" + week = "" } else { if (backDays == 0) { week = "周日" @@ -102,7 +110,7 @@ this.dayArr = dateArr let timeArr = [] - for (let i = 0; i < 5; i++) { + for (let i = 0; i < 3; i++) { // let as = new Date(new Date().toLocaleDateString()).getTime() / 1000 let as = new Date(new Date().toLocaleDateString()).getTime() / 1000 + i * 60 * 60 * 24 let staTime = this.sta_num * 60 * 60 + as @@ -231,6 +239,18 @@ \ No newline at end of file diff --git a/components/pretty-times/pretty-times.scss b/components/pretty-times/pretty-times.scss index 86bb771..5746c9b 100644 --- a/components/pretty-times/pretty-times.scss +++ b/components/pretty-times/pretty-times.scss @@ -92,7 +92,7 @@ } &.active{ // background: #0094D7; - border: 1px solid #FB5D6B; + border: 1px solid rgb(40, 186, 146); font-weight: bold; } .all{ diff --git a/components/pretty-times/pretty-times.vue b/components/pretty-times/pretty-times.vue index 7dffff8..97641e5 100644 --- a/components/pretty-times/pretty-times.vue +++ b/components/pretty-times/pretty-times.vue @@ -2,6 +2,10 @@ + + 设置不可接单时间 + (只能设置近3天的时间) + @@ -12,7 +16,7 @@ - + @@ -27,27 +31,10 @@ - - - - - - {{item.time}} - {{item.disable?disableText:undisableText}} - - - - - - 预约时间:{{orderDateTime}} - - 保存 + 添加时间 @@ -102,9 +89,11 @@ }, beginTime: { type: String, + default: "00:30" }, endTime: { type: String, + default: "23:30" }, appointTime: { // 预约的时间 type: Array, @@ -124,6 +113,9 @@ handler(val) { if (val && val.length) { this.initOnload() + }else{ + this.orderTimeArr={} + this.initOnload() } } }, @@ -156,8 +148,21 @@ }, methods: { initOnload() { - this.dateArr = initData() // 日期栏初始化 - console.log(this.dateArr) + var danqian=initData() // 日期栏初始化 + // this.dateArr = initData() // 日期栏初始化 + let newObj = []; + for (let i = 0; i < 3; i++) { + let key = danqian[i]; + if (key.week == '今天') { + key.week = "今天" + } else if (key.week == "明天") { + key.week = "" + } else if (key.week == '后天') { + key.week = "" + } + newObj.push(key) + } + this.dateArr = newObj this.timeArr = initTime(this.beginTime, this.endTime, this.timeInterval, this.isQuantum) //时间选项初始化 this.timeQuanBegin = this.timeQuanEnd = "" let isFullTime = true @@ -185,7 +190,6 @@ } } } - } else { //判断是当前这一天,选中时间小于当前时间则禁用 if (this.selectDate == this.nowDate && currentTime().time > item.time) { @@ -218,13 +222,11 @@ // 对多选操作的已选时间的回显 if (this.isMultiple && (this.orderTimeArr[this.selectDate] || []).includes(item.time)) { - item.isActive = true + item.isActive = false } - } }) - this.orderDateTime = isFullTime ? "暂无选择" : this.selectDate this.timeActive = -1 for (let i = 0, len = this.timeArr.length; i < len; i++) { @@ -246,6 +248,7 @@ // 时间选择事件 selectTimeEvent(index, item) { if (this.isQuantum) { + console.log("333333") return this.handleSelectQuantum(index, item) } @@ -265,6 +268,7 @@ // 选择时间段 handleSection(index, item) { + console.log("handleSection") if (item.disable) return function clearTime() { @@ -324,7 +328,7 @@ end: `${this.selectDate} ${item.end}:00`, } } - console.log(this.orderTimeArr) + console.log("handleSelectQuantum",this.orderTimeArr) }, handleChange() { this.timeQuanBegin > this.timeQuanEnd && ([this.timeQuanBegin, this.timeQuanEnd] = [this.timeQuanEnd, this @@ -340,7 +344,6 @@ }) return } - console.log(this.orderTimeArr) if (this.isMultiple) { if (this.isQuantum) { this.$emit('change', this.orderTimeArr) @@ -363,11 +366,28 @@ \ No newline at end of file diff --git a/components/pretty-times/pretty-times1.vue b/components/pretty-times/pretty-times1.vue new file mode 100644 index 0000000..f5c9717 --- /dev/null +++ b/components/pretty-times/pretty-times1.vue @@ -0,0 +1,467 @@ + + + + + + 设置不可接单时间 + (只能设置近3天的时间) + + + + + + {{item.week}} + {{item.date}} + + + + + + + + + + + {{item.begin}}~{{item.end}} + {{item.time}} + {{item.disable?disableText:undisableText}} + + + + + + + + + + {{item.time}} + {{item.disable?disableText:undisableText}} + + + + + + + + 预约时间:{{orderDateTime}} + + + 添加时间 + + + + + + + + \ No newline at end of file diff --git a/my/order/revenueDetails.vue b/my/order/revenueDetails.vue index 83b4f6c..1000531 100644 --- a/my/order/revenueDetails.vue +++ b/my/order/revenueDetails.vue @@ -1553,7 +1553,7 @@ 联系客服 - 联系客户 + 联系客户 diff --git a/pages/my/mangshi.vue b/pages/my/mangshi.vue index 8568693..6c726a2 100644 --- a/pages/my/mangshi.vue +++ b/pages/my/mangshi.vue @@ -1,12 +1,33 @@ - - - + + 是否接单 + + + + 选择接单时问 + + + 开始时间 + {{starTime}} + + + 结束时间 + + 次日 + {{endTime}} + + + + + + + - 忙时时间 + 不可接单时间 {{item}} @@ -14,12 +35,18 @@ - 保存选择 + 保存选择1 + 保存选择2 - diff --git a/utils/date.js b/utils/date.js index 6609192..af0b4ec 100644 --- a/utils/date.js +++ b/utils/date.js @@ -3,6 +3,20 @@ function strFormat(str) { return str < 10 ? `0${str}` : str } // 获取当前时间 +export function tomorrow() { + + // 获取当前日期 + const today = new Date(); + // 增加一天 + today.setDate(today.getDate() + 1); + // 格式化日期为YYYY-MM-DD + const tomorrow = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`; + + return { + tomorrow + } +} +// 获取当前时间 export function currentTime() { const myDate = new Date(); const y = myDate.getFullYear() @@ -14,9 +28,11 @@ export function currentTime() { const min = myDate.getMinutes() const secon = myDate.getSeconds() const time = strFormat(hour) + ':' + strFormat(min) + ':' + strFormat(secon); + const times = strFormat(hour) + ':' + strFormat(min) return { date, - time + time, + times } } @@ -34,7 +50,8 @@ export function timeStamp(time, isQuantum) { allDate: `${year}/${strFormat(month)}/${strFormat(date)}`, date: `${strFormat(year)}-${strFormat(month)}-${strFormat(date)}`, //返回的日期 07-01 day: `星期${days[day]}`, //返回的礼拜天数 星期一 - hour: strFormat(hour) + ':' + strFormat(min) + (isQuantum ? "" : ':00') //返回的时钟 08:00 + hour: strFormat(hour) + ':' + strFormat(min) //返回的时钟 08:00 + // hour: strFormat(hour) + ':' + strFormat(min) + (isQuantum ? "" : ':00') //返回的时钟 08:00 } }