|
@@ -25,21 +25,24 @@
|
|
|
</scroll-view>
|
|
|
|
|
|
<view class="times">
|
|
|
- <view class="time_list">
|
|
|
- <view class="day" v-for="(item,_index) in timeArr" :key="_index" :class="{'disable':item.disable,
|
|
|
- 'active':isMultiple?item.isActive:_index==timeActive}" :style="{color:isMultiple?item.isActive? '#fff':'#333'
|
|
|
- :_index==timeActive?'#fff':'#333',backgroundColor:isMultiple?item.isActive? selectedItemColor:''
|
|
|
- :_index==timeActive?selectedItemColor:''}" @click="selectTimeEvent(_index,item)">
|
|
|
- <text>{{item.disable?disableText:undisableText}}</text>
|
|
|
- <view>{{item.time}}</view>
|
|
|
- <view >{{item.sum}}</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <scroll-view scroll-y="true" >
|
|
|
+ <view class="time_list">
|
|
|
+ <view class="day" v-for="(item,_index) in timeArr" :key="_index" :class="{'disable':item.disable,
|
|
|
+ 'active':isMultiple?item.isActive:_index==timeActive}" :style="{color:isMultiple?item.isActive? '#fff':'#333'
|
|
|
+ :_index==timeActive?'#fff':'#333',backgroundColor:isMultiple?item.isActive? selectedItemColor:''
|
|
|
+ :_index==timeActive?selectedItemColor:''}" @click="selectTimeEvent(_index,item)">
|
|
|
+ <view class="disableText">{{item.disable?disableText:undisableText}}</view>
|
|
|
+ <view class="time">{{item.begin}}~{{item.end}}</view>
|
|
|
+ <view class="num" >{{item.reservationSum}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="">
|
|
|
- 预约时间:{{orderDateTime}}
|
|
|
- </view>
|
|
|
+<!-- <view class="">
|
|
|
+ 预约时间:{{orderDateTime.begin}}
|
|
|
+ </view> -->
|
|
|
<button @click="reservationPopup()" class="confirm_button" >确认预约</button>
|
|
|
<uni-popup ref="outcomePopup" :is-mask-click="false" >
|
|
|
<view class="outcome_popup_layout">
|
|
@@ -47,7 +50,7 @@
|
|
|
预约成功
|
|
|
</view>
|
|
|
<view class="outcome_text" >
|
|
|
- 你已经预约:{{orderDateTime}}直播主持课程
|
|
|
+ 你已经预约:{{orderDateTime.begin}}直播主持课程
|
|
|
</view>
|
|
|
<button class="outcome_button" @click="outcomeButton()" >确认</button>
|
|
|
</view>
|
|
@@ -61,7 +64,7 @@
|
|
|
props: {
|
|
|
isQuantum: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
+ default: true
|
|
|
},
|
|
|
isMultiple: { //是否多选
|
|
|
type: Boolean,
|
|
@@ -124,9 +127,16 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- disableTimeSlot: {
|
|
|
+ // disableTimeSlot: {
|
|
|
+ // handler(val) {
|
|
|
+ // if (val && val.length) {
|
|
|
+ // this.initOnload()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ shcedule_list:{
|
|
|
handler(val) {
|
|
|
- if (val && val.length) {
|
|
|
+ if(val && val.length){
|
|
|
this.initOnload()
|
|
|
}
|
|
|
}
|
|
@@ -137,54 +147,73 @@
|
|
|
return {
|
|
|
data:[
|
|
|
{
|
|
|
- "teacher_id": 6,
|
|
|
- "teacher_name": "张老师",
|
|
|
- "list": {
|
|
|
- "id": 6,
|
|
|
- "course_id": 1,
|
|
|
- "teacher_id": 6,
|
|
|
- "start_time": 1731823931,
|
|
|
- "end_time": 1731324931,
|
|
|
- "duration": 60,
|
|
|
- "course_number": 30,
|
|
|
- "reservation_number": 0,
|
|
|
- "teacher_name": "张老师",
|
|
|
- "teacher_desc": "擅长舞蹈",
|
|
|
- "course_name": "拳击初级课",
|
|
|
- "course_image": "../../static/logo2.jpg",
|
|
|
- "course_desc": "拳击讲解",
|
|
|
- "address": "一方天地"
|
|
|
+ "teacher_id": 6,
|
|
|
+ "teacher_name": "张老师",
|
|
|
+ "list": [
|
|
|
+ {
|
|
|
+ "id": 4,
|
|
|
+ "course_id": 1,
|
|
|
+ "teacher_id": 6,
|
|
|
+ "start_time": 1732060800,
|
|
|
+ "end_time": 1732063500,
|
|
|
+ "duration": 45,
|
|
|
+ "course_number": 0,
|
|
|
+ "reservation_number": 0,
|
|
|
+ "teacher_name": "张老师",
|
|
|
+ "teacher_desc": "擅长舞蹈",
|
|
|
+ "course_name": "拳击初级课",
|
|
|
+ "course_image": "../../static/logo2.jpg",
|
|
|
+ "course_desc": "拳击讲解",
|
|
|
+ "address": "一方天地",
|
|
|
+ "reservation_status": 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "id": 6,
|
|
|
+ "course_id": 1,
|
|
|
+ "teacher_id": 6,
|
|
|
+ "start_time": 1732064400,
|
|
|
+ "end_time": 1732068000,
|
|
|
+ "duration": 60,
|
|
|
+ "course_number": 30,
|
|
|
+ "reservation_number": 0,
|
|
|
+ "teacher_name": "张老师",
|
|
|
+ "teacher_desc": "擅长舞蹈",
|
|
|
+ "course_name": "拳击初级课",
|
|
|
+ "course_image": "../../static/logo2.jpg",
|
|
|
+ "course_desc": "拳击讲解",
|
|
|
+ "address": "一方天地",
|
|
|
+ "reservation_status": 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "teacher_id": 7,
|
|
|
+ "teacher_name": "王老师",
|
|
|
+ "list": [
|
|
|
+ {
|
|
|
+ "id": 7,
|
|
|
+ "course_id": 1,
|
|
|
+ "teacher_id": 7,
|
|
|
+ "start_time": 1732520086,
|
|
|
+ "end_time": 1732520086,
|
|
|
+ "duration": 60,
|
|
|
+ "course_number": 30,
|
|
|
+ "reservation_number": 0,
|
|
|
+ "teacher_name": "王老师",
|
|
|
+ "teacher_desc": "从业20年,资深老教室",
|
|
|
+ "course_name": "拳击初级课",
|
|
|
+ "course_image": "../../static/logo2.jpg",
|
|
|
+ "course_desc": "拳击讲解",
|
|
|
+ "address": "一方天地",
|
|
|
+ "reservation_status": 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- "teacher_id": 7,
|
|
|
- "teacher_name": "王老师",
|
|
|
- "list": {
|
|
|
- "id": 7,
|
|
|
- "course_id": 1,
|
|
|
- "teacher_id": 7,
|
|
|
- "start_time": 1731324931,
|
|
|
- "end_time": 1731823931,
|
|
|
- "duration": 60,
|
|
|
- "course_number": 30,
|
|
|
- "reservation_number": 0,
|
|
|
- "teacher_name": "王老师",
|
|
|
- "teacher_desc": "从业20年,资深老教室",
|
|
|
- "course_name": "拳击初级课",
|
|
|
- "course_image": "../../static/logo2.jpg",
|
|
|
- "course_desc": "拳击讲解",
|
|
|
- "address": "一方天地"
|
|
|
- }
|
|
|
- }
|
|
|
],
|
|
|
-
|
|
|
- course_number: 30,
|
|
|
- reservation_number: 0,
|
|
|
- teacher_desc: "",
|
|
|
- course_name: "",
|
|
|
- course_image: "",
|
|
|
- start_time: 1731823931,//开始时间戳
|
|
|
- end_time: 1731324931,//结束时间戳
|
|
|
+ shcedule_list:[],//排课列表
|
|
|
+ teacher_desc: "",//当前老师的一个介绍
|
|
|
+ course_name: "",//当前老师的名字
|
|
|
+ course_image: "",//当前老师的图片
|
|
|
orders_product_id:0,//商品id
|
|
|
course_id:0,//课程id
|
|
|
schedule_id:0,//排课id
|
|
@@ -203,9 +232,6 @@
|
|
|
timeQuanEnd: "", //时间段结束时间
|
|
|
// isTime:[],
|
|
|
|
|
|
- // teacherList: ['王老师', '崔老师','王老师', '崔老师'],
|
|
|
- // days: ['周一', '周二', '周三', '周四', '周五'],
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
onLoad(e) {
|
|
@@ -216,26 +242,17 @@
|
|
|
this.course_id = course_id
|
|
|
},
|
|
|
onShow() {
|
|
|
- //doto 这行代码应该放在请求成功之后执行
|
|
|
- this.defaultTeacherDesc()
|
|
|
-
|
|
|
- // this.selectDate = this.nowDate =this.currentTime().date
|
|
|
-
|
|
|
- this.initOnload()
|
|
|
|
|
|
- if(this.orders_product_id > 0 && this.course_id > 0){
|
|
|
+ if(this.orders_product_id > 0 && this.course_id > 0){
|
|
|
|
|
|
this.$http.request('api/course/get_schedule_list',{orders_product_id:this.orders_product_id,course_id:this.course_id},'post').then((res)=>{
|
|
|
if(res.code === "success"){
|
|
|
- this.data = res.data;
|
|
|
-
|
|
|
-
|
|
|
- // this.selectDate = this.nowDate =this.currentTime().date
|
|
|
- // this.defaultTeacherDesc()
|
|
|
- // this.initOnload()
|
|
|
+ this.data = res.data
|
|
|
+ this.defaultTeacherDesc()
|
|
|
+ this.initOnload()
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
@@ -246,22 +263,13 @@
|
|
|
|
|
|
this.teacherActive = index;
|
|
|
|
|
|
- if(!this.isMultiple){
|
|
|
- this.orderDateTime = "暂无选择"
|
|
|
- }
|
|
|
-
|
|
|
if(this.data.length >0){
|
|
|
-
|
|
|
if(this.teacherActive == index){
|
|
|
-
|
|
|
- this.course_number = this.data[index]["list"].course_number
|
|
|
- this.reservation_number = this.data[index]["list"].reservation_number
|
|
|
- this.teacher_desc = this.data[index]["list"].teacher_desc
|
|
|
- this.course_name = this.data[index]["list"].course_name
|
|
|
- this.course_image = this.data[index]["list"].course_image
|
|
|
- this.start_time = this.data[index]["list"].start_time
|
|
|
- this.selectDate =
|
|
|
- this.schedule_id = this.data[index]["list"].id
|
|
|
+ this.shcedule_list = this.data[index]["list"]
|
|
|
+ this.schedule_id = this.data[index].teacher_id
|
|
|
+ this.course_name = this.shcedule_list[0].course_name
|
|
|
+ this.teacher_desc = this.shcedule_list[0].teacher_desc
|
|
|
+ this.course_image = this.shcedule_list[0].course_image
|
|
|
this.initOnload()
|
|
|
}
|
|
|
|
|
@@ -271,15 +279,15 @@
|
|
|
|
|
|
//默认选项
|
|
|
defaultTeacherDesc(){
|
|
|
+ this.teacherActive = 0
|
|
|
if(this.data.length>0){
|
|
|
- this.course_number = this.data[0]["list"].course_number
|
|
|
- this.reservation_number = this.data[0]["list"].reservation_number
|
|
|
- this.teacher_desc = this.data[0]["list"].teacher_desc
|
|
|
- this.course_name = this.data[0]["list"].course_name
|
|
|
- this.course_image = this.data[0]["list"].course_image
|
|
|
- this.teacherActive = 0;
|
|
|
- this.start_time = this.data[0]["list"].start_time
|
|
|
- this.schedule_id = this.data[0]["list"].id//排课id
|
|
|
+ this.schedule_id = this.data[0].teacher_id
|
|
|
+ this.shcedule_list = this.data[0]["list"]
|
|
|
+ this.course_name = this.shcedule_list[0].course_name
|
|
|
+ this.teacher_desc = this.shcedule_list[0].teacher_desc
|
|
|
+ this.course_image = this.shcedule_list[0].course_image
|
|
|
+ console.log(this.shcedule_list);
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
//预约课程事件
|
|
@@ -301,7 +309,7 @@
|
|
|
return
|
|
|
}
|
|
|
//没有选择预约时间
|
|
|
- if(this.orderDateTime === "暂无选择"){
|
|
|
+ if(this.timeActive < 0){
|
|
|
uni.showToast({
|
|
|
title:"请选择预约时间",
|
|
|
icon:"none"
|
|
@@ -309,12 +317,9 @@
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //
|
|
|
+
|
|
|
this.$http.request("api/course/reservation/",{orders_product_id:this.orders_product_id,schedule_id:this.schedule_id},'post').then((res)=>{
|
|
|
if(res.code === 'success'){
|
|
|
- if(this.reservation_number < this.course_number){
|
|
|
- this.reservation_number++
|
|
|
- }
|
|
|
this.handleSubmit();
|
|
|
this.initOnload();
|
|
|
this.$refs.outcomePopup.open("center")
|
|
@@ -336,87 +341,28 @@
|
|
|
|
|
|
initOnload() {
|
|
|
this.dateArr = this.initData() // 日期栏初始化
|
|
|
- this.timeArr = this.initTime(this.beginTime, this.endTime, this.timeInterval, this.isQuantum) //时间选项初始化
|
|
|
+ this.timeArr = this.initTime(this.isQuantum) //时间选项初始化
|
|
|
+ console.log(this.timeArr);
|
|
|
this.timeQuanBegin = this.timeQuanEnd = ""
|
|
|
console.log(this.orderTimeArr)
|
|
|
let isFullTime = true
|
|
|
this.timeArr.forEach((item, index) => {
|
|
|
// 时间段
|
|
|
- //todo this.isQuantum这个逻辑以后优化可能会用到,现在是只能选着一个时间,后面如果需要优化就使用这个this.isQuantum=true这个逻辑
|
|
|
if (this.isQuantum) {
|
|
|
- const cur_be_time = `${this.selectDate} ${item.begin}:00`
|
|
|
- const cur_end_time = `${this.selectDate} ${item.end}:00`
|
|
|
- for (let time of this.disableTimeSlot) {
|
|
|
- const [begin_time = "", end_time = ""] = time
|
|
|
- if (begin_time && end_time && (begin_time <= cur_be_time && cur_end_time <= end_time)) {
|
|
|
- item.disable = true
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.selectDate == this.nowDate && this.currentTime().time > `${item.begin}:00`) {
|
|
|
- item.disable = true
|
|
|
- }
|
|
|
- // 多选时间段的切换日期不清除
|
|
|
- if (this.orderTimeArr[this.selectDate]) {
|
|
|
- for (let items of this.orderTimeArr[this.selectDate]) {
|
|
|
- if (items[0].split(' ')[1] === `${item.begin}:00` && items[1].split(' ')[1] ===
|
|
|
- `${item.end}:00`) {
|
|
|
- item.isActive = true
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- //判断是当前这一天,选中时间小于当前时间则禁用
|
|
|
- // if (this.selectDate == this.nowDate && this.currentTime().time > item.time) {
|
|
|
- // item.disable = true
|
|
|
- // }
|
|
|
|
|
|
- if(this.reservation_number === this.course_number){
|
|
|
- item.disableSum = true
|
|
|
+ if(this.shcedule_list[index].reservation_status === 1){
|
|
|
+ item.disable = true
|
|
|
}
|
|
|
-
|
|
|
// 将预约的时间禁用
|
|
|
this.appointTime.forEach(t => {
|
|
|
let [date, time] = t.split(' ')
|
|
|
- if (date == this.selectDate && item.time == time) {
|
|
|
+ if (date == this.selectDate && item.begin == time) {
|
|
|
item.disable = true
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- // 禁用时间段
|
|
|
- const cur_time = `${this.selectDate} ${item.time}`
|
|
|
-
|
|
|
- for (let time of this.disableTimeSlot) {
|
|
|
- const [begin_time = "", end_time = ""] = time
|
|
|
- if (begin_time && end_time && (begin_time <= cur_time && cur_time <= end_time)) {
|
|
|
- item.disable = true
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 判断是否当前日期时间都被预约
|
|
|
- if (!item.disable) {
|
|
|
- isFullTime = false
|
|
|
- }
|
|
|
- this.isSection && (item.isInclude = false)
|
|
|
-
|
|
|
- // 对多选操作的已选时间的回显
|
|
|
- if (this.isMultiple && (this.orderTimeArr[this.selectDate] || []).includes(item.time)) {
|
|
|
- item.isActive = true
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
-
|
|
|
- // this.orderDateTime = isFullTime ? "暂无选择" : `${this.selectDate}`
|
|
|
this.timeActive = -1
|
|
|
- // for (let i = 0, len = this.timeArr.length; i < len; i++) {
|
|
|
- // if (!this.timeArr[i].disable) {
|
|
|
- // this.orderDateTime = `${this.selectDate} ${this.timeArr[i].time}`
|
|
|
- // this.timeActive = i
|
|
|
- // return
|
|
|
- // }
|
|
|
- // }
|
|
|
},
|
|
|
|
|
|
// 日期选择事件
|
|
@@ -424,135 +370,47 @@
|
|
|
if(this.dateActive == index)return
|
|
|
this.dateActive = index
|
|
|
this.selectDate = item.date
|
|
|
- if(!this.isMultiple){
|
|
|
- this.orderDateTime = "暂无选择"
|
|
|
- }
|
|
|
this.initOnload()
|
|
|
},
|
|
|
|
|
|
// 时间选择事件
|
|
|
selectTimeEvent(index, item) {
|
|
|
+ if (item.disable) return
|
|
|
+ if(item.disableSum) return
|
|
|
+
|
|
|
if (this.isQuantum) {
|
|
|
return this.handleSelectQuantum(index, item)
|
|
|
|
|
|
}
|
|
|
- if (item.disable) return
|
|
|
- if(item.disableSum) return
|
|
|
+
|
|
|
|
|
|
- if (this.isMultiple) {
|
|
|
- item.isActive = !item.isActive
|
|
|
- this.timeArr = this.timeArr.slice()
|
|
|
- this.orderTimeArr[this.selectDate] = this.timeArr.reduce((prev, cur) => {
|
|
|
- cur.isActive && prev.push(cur.time)
|
|
|
- return prev
|
|
|
- }, [])
|
|
|
- } else {
|
|
|
- console.log("hhh");
|
|
|
- this.timeActive = index
|
|
|
- this.orderDateTime = `${this.selectDate} ${item.time}`
|
|
|
- }
|
|
|
+ // if (this.isMultiple) {
|
|
|
+ // item.isActive = !item.isActive
|
|
|
+ // this.timeArr = this.timeArr.slice()
|
|
|
+ // this.orderTimeArr[this.selectDate] = this.timeArr.reduce((prev, cur) => {
|
|
|
+ // cur.isActive && prev.push(cur.time)
|
|
|
+ // return prev
|
|
|
+ // }, [])
|
|
|
+ // } else {
|
|
|
+
|
|
|
+ // this.timeActive = index
|
|
|
+ // this.orderDateTime = `${this.selectDate} ${item.time}`
|
|
|
+ // }
|
|
|
},
|
|
|
|
|
|
- // 选择时间段
|
|
|
- handleSection(index, item) {
|
|
|
- if (item.disable) return
|
|
|
-
|
|
|
- function clearTime() {
|
|
|
- this.timeQuanBeginIndex = index
|
|
|
- this.timeQuanBegin = item.time
|
|
|
- this.timeQuanEnd = ""
|
|
|
- }
|
|
|
-
|
|
|
- if (!this.timeQuanBegin) {
|
|
|
- clearTime.call(this)
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.timeQuanEnd && this.timeQuanBegin) {
|
|
|
- let isDisble = false
|
|
|
- let start = this.timeQuanBeginIndex
|
|
|
- let end = index
|
|
|
- start > end && ([start, end] = [end, start])
|
|
|
- for (let i = start + 1; i < end; i++) {
|
|
|
- if (this.timeArr[i].disable) {
|
|
|
- isDisble = true
|
|
|
- clearTime.call(this)
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- if (!isDisble) {
|
|
|
- for (let i = start + 1; i < end; i++) {
|
|
|
- this.timeArr[i].isInclude = true
|
|
|
- }
|
|
|
- }
|
|
|
- this.timeQuanEnd = item.time
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (this.timeQuanBegin && this.timeQuanEnd) {
|
|
|
- this.timeArr.forEach(t => {
|
|
|
- t.isInclude = false
|
|
|
- })
|
|
|
- clearTime.call(this)
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
handleSelectQuantum(index, item) {
|
|
|
if (item.disable) return
|
|
|
- if (this.isMultiple) {
|
|
|
- item.isActive = !item.isActive
|
|
|
- this.timeArr = this.timeArr.slice()
|
|
|
- this.orderTimeArr[this.selectDate] = this.timeArr.reduce((prev, cur) => {
|
|
|
- const cur_be_time = `${this.selectDate} ${cur.begin}:00`
|
|
|
- const cur_end_time = `${this.selectDate} ${cur.end}:00`
|
|
|
- cur.isActive && prev.push([cur_be_time, cur_end_time])
|
|
|
- return prev
|
|
|
- }, [])
|
|
|
- } else {
|
|
|
this.timeActive = index
|
|
|
this.orderDateTime = {
|
|
|
- begin: `${this.selectDate} ${item.begin}:00`,
|
|
|
- end: `${this.selectDate} ${item.end}:00`,
|
|
|
+ begin: `${this.selectDate} ${item.begin}`,
|
|
|
+ end: `${this.selectDate} ${item.end}`,
|
|
|
}
|
|
|
- }
|
|
|
- console.log(this.orderTimeArr)
|
|
|
- },
|
|
|
- handleChange() {
|
|
|
- this.timeQuanBegin > this.timeQuanEnd && ([this.timeQuanBegin, this.timeQuanEnd] = [this.timeQuanEnd, this
|
|
|
- .timeQuanBegin
|
|
|
- ])
|
|
|
+
|
|
|
},
|
|
|
- handleSubmit() {
|
|
|
- // if (this.isSection) {
|
|
|
- // this.handleChange()
|
|
|
- // this.$emit('change', {
|
|
|
- // beginTime: `${this.selectDate} ${this.timeQuanBegin}`,
|
|
|
- // endTime: `${this.selectDate} ${this.timeQuanEnd}`
|
|
|
- // })
|
|
|
- // return
|
|
|
- // }
|
|
|
- // console.log(this.orderDateTime)
|
|
|
-
|
|
|
-
|
|
|
- if (this.isMultiple) {
|
|
|
- //这是多选模式的时候走的逻辑
|
|
|
- if (this.isQuantum) {
|
|
|
- this.$emit('change', this.orderTimeArr)
|
|
|
- return
|
|
|
- }
|
|
|
- let time = []
|
|
|
- for (let date in this.orderTimeArr) {
|
|
|
- this.orderTimeArr[date].forEach(item => {
|
|
|
- time.push(`${date} ${item}`)
|
|
|
- })
|
|
|
- }
|
|
|
- // this.$emit('change', time)
|
|
|
- //this.isTime = time
|
|
|
- } else {
|
|
|
- //这是单选模式
|
|
|
- this.appointTime.push(this.orderDateTime);
|
|
|
- // this.$emit('change', this.orderDateTime)
|
|
|
- }
|
|
|
|
|
|
+ handleSubmit() {
|
|
|
+ this.appointTime.push(this.orderDateTime.begin)
|
|
|
+ console.log(this.appointTime);
|
|
|
},
|
|
|
|
|
|
|
|
@@ -599,9 +457,9 @@
|
|
|
//获取最近7天的日期和礼拜天数
|
|
|
initData() {
|
|
|
const time = []
|
|
|
- // const date = new Date()
|
|
|
- //const now = date.getTime() //获取当前日期的时间戳
|
|
|
- const now = this.start_time *1000
|
|
|
+ const date = new Date()
|
|
|
+ const now = date.getTime() //获取当前日期的时间戳
|
|
|
+ // const now = this.start_time *1000
|
|
|
let timeStr = 3600 * 24 * 1000 //一天的时间戳
|
|
|
let obj = {
|
|
|
0: "今天",
|
|
@@ -619,36 +477,24 @@
|
|
|
},
|
|
|
|
|
|
//时间数组
|
|
|
- initTime(startTime = '10:00:00', endTime = '21:00:00', timeInterval = 1, isQuantum = false) {
|
|
|
+ // this.shcedule_list[{"start_time":1732060800,"end_time":1732063500}];
|
|
|
+ initTime( isQuantum) {
|
|
|
const time = []
|
|
|
- const date = this.timeStamp(Date.now()).allDate
|
|
|
- const startDate = `${date} ${startTime}`
|
|
|
- const endDate = `${date} ${endTime}`
|
|
|
- const startTimeStamp = new Date(startDate).getTime()
|
|
|
- const endTimeStamp = new Date(endDate).getTime()
|
|
|
- const timeStr = 3600 * 1000 * timeInterval
|
|
|
- const sum = (endTimeStamp - startTimeStamp) / timeStr
|
|
|
- const count = sum % 2 == 0 ? sum : (sum - 1)
|
|
|
- for (let i = startTimeStamp; i <= endTimeStamp; i = i + timeStr) {
|
|
|
-
|
|
|
+ this.shcedule_list.forEach((cruTiem)=>{
|
|
|
+ let starTimeStamp = cruTiem.start_time * 1000
|
|
|
+ let endTimeStamp = cruTiem.end_time * 1000
|
|
|
+ let timeStr = 60 * 1000 * cruTiem.duration
|
|
|
+ console.log(starTimeStamp,endTimeStamp);
|
|
|
+ // timeStr = 60 * 1000 * i.duration
|
|
|
if (isQuantum) {
|
|
|
- num++
|
|
|
time.push({
|
|
|
- begin: this.timeStamp(i, isQuantum).hour,
|
|
|
- end: this.timeStamp(i + timeStr, isQuantum).hour,
|
|
|
- disable: false
|
|
|
- })
|
|
|
- } else {
|
|
|
-
|
|
|
- time.push({
|
|
|
- time: this.timeStamp(i).hour,
|
|
|
- sum: `${this.reservation_number}/${this.course_number}`,
|
|
|
- disableSum:false,
|
|
|
+ begin: this.timeStamp(starTimeStamp , isQuantum).hour,
|
|
|
+ end: this.timeStamp(endTimeStamp , isQuantum).hour,
|
|
|
+ reservationSum:`${cruTiem.reservation_number}/${cruTiem.course_number}`,
|
|
|
disable: false
|
|
|
})
|
|
|
}
|
|
|
- if (isQuantum && num >= count) return time
|
|
|
- }
|
|
|
+ })
|
|
|
return time
|
|
|
},
|
|
|
}
|
|
@@ -715,7 +561,7 @@
|
|
|
white-space: nowrap;
|
|
|
height: 75px;
|
|
|
background-color: #fff;
|
|
|
- position: relative;
|
|
|
+ position: relative;
|
|
|
padding-top: 10rpx;
|
|
|
}
|
|
|
.days{
|
|
@@ -726,7 +572,7 @@
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
- margin: 0rpx 10rpx;
|
|
|
+ margin: 0rpx 20rpx;
|
|
|
height: 115rpx;
|
|
|
text{
|
|
|
margin: 10rpx 0rpx;
|
|
@@ -738,28 +584,33 @@
|
|
|
}
|
|
|
.times{
|
|
|
// border: 2rpx solid;
|
|
|
+ scroll-view{
|
|
|
+ width: 100%;
|
|
|
+ // white-space: nowrap;
|
|
|
+ height: 300px;
|
|
|
+ background-color: #fff;
|
|
|
+ // position: relative;
|
|
|
+ padding-top: 10rpx;
|
|
|
+ }
|
|
|
.time_list{
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
background-color: #ffffff;
|
|
|
- // border: 2rpx solid;
|
|
|
- .time{
|
|
|
- display: inline-flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- width: 115rpx;
|
|
|
- height: 115rpx;
|
|
|
- // border: 2rpx solid;
|
|
|
- }
|
|
|
+
|
|
|
.day{
|
|
|
- display: inline-flex;
|
|
|
+ display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
- width: 115rpx;
|
|
|
- height: 115rpx;
|
|
|
+ width: 200rpx;
|
|
|
+ height: 200rpx;
|
|
|
background-color: #f3f3f3;
|
|
|
margin: 10rpx;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ .time{
|
|
|
+ margin: 20rpx;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|