liuguofeng 6 mēneši atpakaļ
vecāks
revīzija
88fb37a8ee

+ 1 - 1
jiaoyu_mp/pages/car/index.vue

@@ -39,7 +39,7 @@
 			<view class="price_box">
 				合计:<text class="price_total">¥{{priceTotal}}</text>
 			</view>
-			<view class="to_order" @click="toOrder()" >预约</view>
+			<view class="to_order" @click="toOrder()" >下单</view>
 		</view>
 	</view>
 </template>

+ 1 - 1
jiaoyu_mp/pages/car/order.vue

@@ -38,7 +38,7 @@
 			<view class="price_box">
 				合计:<text class="price_total">¥{{priceTotal}}</text>
 			</view>
-			<button class="to_order" @click="createOrder()" data-eventsync="true">提交预约</button>
+			<button class="to_order" @click="createOrder()" data-eventsync="true">提交订单</button>
 		</view>
 		<uni-popup ref="popup" type="bottom" class="popup" background-color="#FFFFFF" @touchmove.stop.prevent="()=>{}">
 			<view class="coupon_list">

+ 1 - 1
jiaoyu_mp/pages/course/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="course_layout">
 		<view class="course_list">
-			<view class="course_item" v-for="(item,index) in 2" :key="index">
+			<view class="course_item" v-for="(item,index) in productList" :key="index">
 				<view class="course_title">
 					<view class="left">
 						<image src="../../static/logo2.jpg"></image>

+ 1 - 1
jiaoyu_mp/pages/product/index.vue

@@ -68,7 +68,7 @@
 					首页
 				</view>
 			</navigator>
-			<navigator url="/pages/car/index" open-type="switchTab" class="to_car" >
+			<navigator url=" " open-type="switchTab" class="to_car" >
 				<image src="../../static/user_icon/user_favo.png" class="car_icon" ></image>
 				<view class="text">
 					收藏

+ 173 - 322
jiaoyu_mp/pagesA/course/reservation.vue

@@ -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;
+							
+						}
 					}
 			}
 		}

+ 149 - 99
jiaoyu_mp/pagesA/course/usercourse.vue

@@ -7,35 +7,37 @@
 			<view class="course_status_item" > 已取消 </view>
 		</view>
 		<view class="course_list">
-			<view class="course_item">
+			<view class="course_item"  v-for="(item,index) in productList" :key="index">
 				<view class="course_title">
 					<view class="course_prc">
-						<image src="../../static/logo2.jpg" mode=""></image>
+						<image :src="item.teacher_pic" mode=""></image>
 					</view>
 					<view class="title">
 						<view class="title_text">
 							<view class="tea_name">
-								王老师
+								{{item.teacher_name}}
+								<!-- 王老师 -->
 							</view>
-							<view class="btn_1"  @click="cancelPopup()">
+							<view class="btn_1"  @click="cancelPopup(index)" v-if="!item.status" >
 								取消预约
 							</view>
-<!-- 							<view class="btn_2" v-if="false">
+							<view class="btn_2" v-if="item.status">
 								已取消
 							</view>
-							<view class="btn_3" v-if="false">
+<!-- 							<view class="btn_3" v-if="false">
 								已完成
 							</view> -->
 						</view>
 						<view class="subtilte">
-							少儿架子鼓进阶课程
+							{{item.course_name}}
 						</view>
 						<view class="course_arrt">
 							<view class="text">
 								上课地址:
 							</view>
 							<view class="attr">
-								深圳市龙华区民治街道和平路3号
+								{{item.course_address}}
+								<!-- 深圳市龙华区民治街道和平路3号 -->
 							</view>
 						</view>
 					</view>
@@ -45,91 +47,8 @@
 						上课时间
 					</view>
 					<view class="time">
-						2024--10-24周三上午10:30
-					</view>
-				</view>
-			</view>
-			<view class="course_item">
-				<view class="course_title">
-					<view class="course_prc">
-						
-					</view>
-					<view class="title">
-						<view class="title_text">
-							<view class="tea_name">
-								王老师
-							</view>
-							<view class="btn_1"  @click="cancelPopup()">
-								取消预约
-							</view>
-<!-- 							<view class="btn_2" v-if="false">
-								已取消
-							</view>
-							<view class="btn_3" v-if="false">
-								已完成
-							</view> -->
-						</view>
-						<view class="subtilte">
-							少儿架子鼓进阶课程
-						</view>
-						<view class="course_arrt">
-							<view class="text">
-								上课地址:
-							</view>
-							<view class="attr">
-								深圳市龙华区民治街道和平路3号
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="classTime">
-					<view class="text">
-						上课时间
-					</view>
-					<view class="time">
-						2024--10-24周三上午10:30
-					</view>
-				</view>
-			</view>
-			<view class="course_item">
-				<view class="course_title">
-					<view class="course_prc">
-						
-					</view>
-					<view class="title">
-						<view class="title_text">
-							<view class="tea_name">
-								王老师
-							</view>
-							<view class="btn_1" @click="cancelPopup()">
-								取消预约
-							</view>
-<!-- 							<view class="btn_2" v-if="false">
-								已取消
-							</view>
-							<view class="btn_3" v-if="false">
-								已完成
-							</view> -->
-						</view>
-						<view class="subtilte">
-							少儿架子鼓进阶课程
-						</view>
-						<view class="course_arrt">
-							<view class="text">
-								上课地址:
-							</view>
-							<view class="attr">
-								深圳市龙华区民治街道和平路3号
-							</view>
-						</view>
-					</view>
-				</view>
-				<view class="classTime">
-					<view class="text">
-						上课时间
-					</view>
-					<view class="time">
-						2024--10-24周三上午10:30
+							{{timeStamp(item.start_time *1000).date+' '+timeStamp(item.start_time *1000).hour}}
+						<!-- 2024--10-24周三上午10:30 -->
 					</view>
 				</view>
 			</view>
@@ -146,7 +65,7 @@
 					<view class="btn_1" @click="closeCancel()">
 						在想想
 					</view>
-					<view class="btn_2" @click="closeCancel()">
+					<view class="btn_2" @click="cancelCourse()">
 						确认
 					</view>
 				</view>
@@ -161,20 +80,140 @@
 		data(){
 			
 			return{
-				
+				//产品列表
+				productList:[
+					 {
+					        "id": 8,
+					        "uid": 3513,
+					        "schedule_id": 6,
+					        "order_id": 31,
+					        "orders_product_id": 33,
+					        "product_id": 11,
+					        "status": 0,
+					        "teacher_id": 6,
+					        "course_id": 2,
+					        "start_time": 1730888928,
+					        "end_time": 1730888928,
+					        "insert_time": 1731317292,
+					        "update_time": 1731317292,
+					        "teacher_name": "张老师",
+					        "teacher_desc": "擅长舞蹈",
+					        "teacher_pic": "../../static/logo2.jpg",
+					        "course_name": "拳击高级课",
+					        "course_address": "龙华"
+					      },
+					      {
+					        "id": 6,
+					        "uid": 3513,
+					        "schedule_id": 6,
+					        "order_id": 31,
+					        "orders_product_id": 33,
+					        "product_id": 11,
+					        "status": 0,
+					        "teacher_id": 6,
+					        "course_id": 2,
+					        "start_time": 1730888928,
+					        "end_time": 1730888928,
+					        "insert_time": 1731313905,
+					        "update_time": 1731313905,
+					        "teacher_name": "张老师",
+					        "teacher_desc": "擅长舞蹈",
+					        "teacher_pic": "../../static/logo2.jpg",
+					        "course_name": "拳击高级课",
+					        "course_address": "龙华"
+					      },
+				],
+				// 请求参数
+				requestParam:{
+					name:"",
+					page:1,
+				},
+				// 是否最后一页
+				isLast:false,
+				// 是否请求中
+				isReqing:false,
+				//当前取消的index
+				curIndex:0,
 			};
 		},
 		onLoad() {
 			
+		},
+		onShow() {
+			// 没有数据的话,或者请求中,不允许刷新
+			if( this.isReqing )		return ;
+			// 请求参数
+			this.requestParam.name	= "";
+			// 请求参数
+			this.requestParam.page	= 1;
+			// 是否是最后一页
+			this.isLast			 	= false;
+			// 设置请求中
+			this.isReqing			= true;
+			this.$http.request('api/course/reservation_list',this.requestParam.page).then((re)=>{
+				// 设置非请求中
+				this.isReqing		= false;
+				// 成功结果
+				if( re.code == 'success' ){
+					if(re.data.last_page <= this.requestParam.page ) this.isLast = true;
+					this.productList = re.data.data;
+				}
+			});
 		},
 		methods:{
-			cancelPopup(){
+			//弹出层
+			cancelPopup(index){
+				this.curIndex = index;
+				
 				this.$refs.cancelPopup.open("center");
 			},
+			//关闭弹出层
 			closeCancel(){
 				this.$refs.cancelPopup.close();
-			}
-		}
+			},
+			//取消预约事件
+			cancelCourse(){
+			let {id , schedule_id, orders_product_id} = this.productList[this.curIndex]
+				console.log(id , schedule_id, orders_product_id);
+				this.$http.request("api/course/cancel_reservation/",{id:id,schedule_id:schedule_id,orders_product_id:orders_product_id},'post').then((res)=>{
+					if(res.code == 'success'){
+						uni.showToast({
+							title:`${res.msg}`,
+							icon:"none"
+						})
+					}else{
+						uni.showToast({
+							title:`${res.msg}`,
+							icon:"error"
+						})
+					}
+				})
+				this.$refs.cancelPopup.close();
+			},
+			
+			
+			
+			strFormat(str) {
+				return str < 10 ? `0${str}` : str
+			},
+			//时间戳转日期
+			 timeStamp(time) {
+				const dates = new Date(time)
+				const year = dates.getFullYear()
+				const month = dates.getMonth() + 1
+				const date = dates.getDate()
+				const day = dates.getDay()
+				const hour = dates.getHours()
+				const min = dates.getMinutes()
+				const days = [ '日', '一', '二', '三', '四', '五', '六']
+				return {
+					allDate: `${year}/${this.strFormat(month)}/${this.strFormat(date)}`,
+					date: `${this.strFormat(year)}-${this.strFormat(month)}-${this.strFormat(date)}`, //返回的日期 07-01
+					day: `周${days[day]}`, //返回的礼拜天数  星期一
+					hour: this.strFormat(hour) + ':' + this.strFormat(min) //返回的时钟 08:00
+				}
+			},
+		},
 	}
 	
 </script>
@@ -208,11 +247,12 @@
 				display: flex;
 				.course_prc{
 					width: 164rpx;
-					// background-color: aqua;
+					 
 					image{
 						width: 164rpx;
 						height: 164rpx;
 						border-radius: 20rpx;
+						border: 2rpx solid;
 					}
 				}
 				.title{
@@ -235,6 +275,16 @@
 							border: 2rpx solid #00bba5;
 							border-radius: 40rpx;
 						}
+						.btn_2{
+							display: inline-flex;
+							justify-content: center;
+							align-items: center;
+							width: 200rpx;
+							padding: 10rpx;
+							color: #FFFFFF;
+							background-color: #d3d3d3;
+							border-radius: 40rpx;
+						}
 					}
 					.subtilte{
 						padding: 5rpx 5rpx 5rpx 0rpx;

+ 1 - 1
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pages/car/index.wxml

@@ -1 +1 @@
-<view><view wx:if="{{a}}" class="to_bottom"> -----还没有产品啦-----</view><view class="car_list"><view wx:for="{{b}}" wx:for-item="item" wx:key="n" class="car_item" bindlongpress="{{item.m}}"><view class="check_label" bindtap="{{item.b}}"><image class="checkbox" src="{{item.a}}"></image></view><view class="box_left"><image class="car_image" src="{{item.c}}" mode=""></image></view><view class="box_center"><view class="car_name">{{item.d}}</view><view class="car_spec">{{item.e}}</view><view class="car_price"><text class="price">¥{{item.f}}</text><text class="market_price">¥{{item.g}}</text></view></view><view class="box_right"><view class="buy_num_box"><button class="buy_num_sub" bindtap="{{item.h}}" data-eventsync="true"><image class="sub_icon" src="{{c}}" mode=""></image></button><input type="number" class="buy_num" placeholder="数量" bindblur="{{item.i}}" value="{{item.j}}" bindinput="{{item.k}}"></input><button class="buy_num_add" bindtap="{{item.l}}" data-eventsync="true"><image class="add_icon" src="{{d}}" mode=""></image></button></view></view></view></view><view class="to_bottom"> -----到底啦-----</view><view class="bottom_box"><view class="check_all_label" bindtap="{{f}}"><image class="checkbox" src="{{e}}"></image><text class="checkall">全选</text></view><view class="price_box"> 合计:<text class="price_total">¥{{g}}</text></view><view class="to_order" bindtap="{{h}}">预约</view></view></view>
+<view><view wx:if="{{a}}" class="to_bottom"> -----还没有产品啦-----</view><view class="car_list"><view wx:for="{{b}}" wx:for-item="item" wx:key="n" class="car_item" bindlongpress="{{item.m}}"><view class="check_label" bindtap="{{item.b}}"><image class="checkbox" src="{{item.a}}"></image></view><view class="box_left"><image class="car_image" src="{{item.c}}" mode=""></image></view><view class="box_center"><view class="car_name">{{item.d}}</view><view class="car_spec">{{item.e}}</view><view class="car_price"><text class="price">¥{{item.f}}</text><text class="market_price">¥{{item.g}}</text></view></view><view class="box_right"><view class="buy_num_box"><button class="buy_num_sub" bindtap="{{item.h}}" data-eventsync="true"><image class="sub_icon" src="{{c}}" mode=""></image></button><input type="number" class="buy_num" placeholder="数量" bindblur="{{item.i}}" value="{{item.j}}" bindinput="{{item.k}}"></input><button class="buy_num_add" bindtap="{{item.l}}" data-eventsync="true"><image class="add_icon" src="{{d}}" mode=""></image></button></view></view></view></view><view class="to_bottom"> -----到底啦-----</view><view class="bottom_box"><view class="check_all_label" bindtap="{{f}}"><image class="checkbox" src="{{e}}"></image><text class="checkall">全选</text></view><view class="price_box"> 合计:<text class="price_total">¥{{g}}</text></view><view class="to_order" bindtap="{{h}}">下单</view></view></view>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pages/car/order.wxml


+ 1 - 1
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pages/course/index.js

@@ -37,7 +37,7 @@ const _sfc_main = {
 };
 function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
   return {
-    a: common_vendor.f(2, (item, index, i0) => {
+    a: common_vendor.f($data.productList, (item, index, i0) => {
       return {
         a: common_vendor.t(item.course_name),
         b: common_vendor.t(item.desc),

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pages/product/index.wxml


+ 124 - 231
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/reservation.js

@@ -4,7 +4,7 @@ const _sfc_main = {
   props: {
     isQuantum: {
       type: Boolean,
-      default: false
+      default: true
     },
     isMultiple: {
       //是否多选
@@ -76,7 +76,14 @@ const _sfc_main = {
         }
       }
     },
-    disableTimeSlot: {
+    // disableTimeSlot: {
+    // 	handler(val) {
+    // 		if (val && val.length) {
+    // 			this.initOnload()
+    // 		}
+    // 	}
+    // },
+    shcedule_list: {
       handler(val) {
         if (val && val.length) {
           this.initOnload();
@@ -90,53 +97,75 @@ const _sfc_main = {
         {
           "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": "一方天地"
-          }
+          "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": 1732068e3,
+              "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": 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": "一方天地"
-          }
+          "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
+            }
+          ]
         }
       ],
-      course_number: 30,
-      reservation_number: 0,
+      shcedule_list: [],
+      //排课列表
       teacher_desc: "",
+      //当前老师的一个介绍
       course_name: "",
+      //当前老师的名字
       course_image: "",
-      start_time: 1731823931,
-      //开始时间戳
-      end_time: 1731324931,
-      //结束时间戳
+      //当前老师的图片
       orders_product_id: 0,
       //商品id
       course_id: 0,
@@ -167,8 +196,6 @@ const _sfc_main = {
       timeQuanEnd: ""
       //时间段结束时间
       // isTime:[],
-      // teacherList: ['王老师', '崔老师','王老师', '崔老师'],
-      // days: ['周一', '周二', '周三', '周四', '周五'],
     };
   },
   onLoad(e) {
@@ -177,12 +204,12 @@ const _sfc_main = {
     this.course_id = course_id;
   },
   onShow() {
-    this.defaultTeacherDesc();
-    this.initOnload();
     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.defaultTeacherDesc();
+          this.initOnload();
         }
       });
     }
@@ -193,33 +220,27 @@ const _sfc_main = {
       if (this.teacherActive == index)
         return;
       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();
         }
       }
     },
     //默认选项
     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;
+        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);
       }
     },
     //预约课程事件
@@ -238,7 +259,7 @@ const _sfc_main = {
         });
         return;
       }
-      if (this.orderDateTime === "暂无选择") {
+      if (this.timeActive < 0) {
         common_vendor.index.showToast({
           title: "请选择预约时间",
           icon: "none"
@@ -247,9 +268,6 @@ const _sfc_main = {
       }
       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");
@@ -268,52 +286,21 @@ const _sfc_main = {
     },
     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);
       this.timeArr.forEach((item, index) => {
         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`) {
+          if (this.shcedule_list[index].reservation_status === 1) {
             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.reservation_number === this.course_number) {
-            item.disableSum = 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)
-            ;
-          this.isSection && (item.isInclude = false);
-          if (this.isMultiple && (this.orderTimeArr[this.selectDate] || []).includes(item.time)) {
-            item.isActive = true;
-          }
         }
       });
       this.timeActive = -1;
@@ -324,113 +311,30 @@ const _sfc_main = {
         return;
       this.dateActive = index;
       this.selectDate = item.date;
-      if (!this.isMultiple) {
-        this.orderDateTime = "暂无选择";
-      }
       this.initOnload();
     },
     // 时间选择事件
     selectTimeEvent(index, item) {
-      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}`;
-      }
-    },
-    // 选择时间段
-    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);
+      if (this.isQuantum) {
+        return this.handleSelectQuantum(index, item);
       }
     },
     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`
-        };
-      }
-      console.log(this.orderTimeArr);
-    },
-    handleChange() {
-      this.timeQuanBegin > this.timeQuanEnd && ([this.timeQuanBegin, this.timeQuanEnd] = [
-        this.timeQuanEnd,
-        this.timeQuanBegin
-      ]);
+      this.timeActive = index;
+      this.orderDateTime = {
+        begin: `${this.selectDate} ${item.begin}`,
+        end: `${this.selectDate} ${item.end}`
+      };
     },
     handleSubmit() {
-      if (this.isMultiple) {
-        if (this.isQuantum) {
-          this.$emit("change", this.orderTimeArr);
-          return;
-        }
-        for (let date in this.orderTimeArr) {
-          this.orderTimeArr[date].forEach((item) => {
-          });
-        }
-      } else {
-        this.appointTime.push(this.orderDateTime);
-      }
+      this.appointTime.push(this.orderDateTime.begin);
+      console.log(this.appointTime);
     },
     //字符串拼接
     strFormat(str) {
@@ -475,7 +379,8 @@ const _sfc_main = {
     //获取最近7天的日期和礼拜天数
     initData() {
       const time = [];
-      const now = this.start_time * 1e3;
+      const date = /* @__PURE__ */ new Date();
+      const now = date.getTime();
       let timeStr = 3600 * 24 * 1e3;
       let obj = {
         0: "今天"
@@ -494,35 +399,23 @@ const _sfc_main = {
       return time;
     },
     //时间数组
-    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 * 1e3 * 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 * 1e3;
+        let endTimeStamp = cruTiem.end_time * 1e3;
+        60 * 1e3 * cruTiem.duration;
+        console.log(starTimeStamp, endTimeStamp);
         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;
     }
   }
@@ -561,22 +454,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
     f: common_vendor.f($data.timeArr, (item, _index, i0) => {
       return {
         a: common_vendor.t(item.disable ? $props.disableText : $props.undisableText),
-        b: common_vendor.t(item.time),
-        c: common_vendor.t(item.sum),
-        d: _index,
-        e: item.disable ? 1 : "",
-        f: ($props.isMultiple ? item.isActive : _index == $data.timeActive) ? 1 : "",
-        g: $props.isMultiple ? item.isActive ? "#fff" : "#333" : _index == $data.timeActive ? "#fff" : "#333",
-        h: $props.isMultiple ? item.isActive ? $props.selectedItemColor : "" : _index == $data.timeActive ? $props.selectedItemColor : "",
-        i: common_vendor.o(($event) => $options.selectTimeEvent(_index, item), _index)
+        b: common_vendor.t(item.begin),
+        c: common_vendor.t(item.end),
+        d: common_vendor.t(item.reservationSum),
+        e: _index,
+        f: item.disable ? 1 : "",
+        g: ($props.isMultiple ? item.isActive : _index == $data.timeActive) ? 1 : "",
+        h: $props.isMultiple ? item.isActive ? "#fff" : "#333" : _index == $data.timeActive ? "#fff" : "#333",
+        i: $props.isMultiple ? item.isActive ? $props.selectedItemColor : "" : _index == $data.timeActive ? $props.selectedItemColor : "",
+        j: common_vendor.o(($event) => $options.selectTimeEvent(_index, item), _index)
       };
     }),
-    g: common_vendor.t($data.orderDateTime),
-    h: common_vendor.o(($event) => $options.reservationPopup()),
-    i: common_vendor.t($data.orderDateTime),
-    j: common_vendor.o(($event) => $options.outcomeButton()),
-    k: common_vendor.sr("outcomePopup", "46f39ab6-0"),
-    l: common_vendor.p({
+    g: common_vendor.o(($event) => $options.reservationPopup()),
+    h: common_vendor.t($data.orderDateTime.begin),
+    i: common_vendor.o(($event) => $options.outcomeButton()),
+    j: common_vendor.sr("outcomePopup", "46f39ab6-0"),
+    k: common_vendor.p({
       ["is-mask-click"]: false
     })
   };

+ 1 - 1
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/reservation.wxml

@@ -1 +1 @@
-<view class="reservation_layout"><view class="header_title"><view class="left"><view class="title">{{a}}</view><view class="subtitle">{{b}}</view></view><view class="right"><image src="{{c}}" class="image" mode=""></image></view></view><view class="teacher_list"><view wx:for="{{d}}" wx:for-item="item" wx:key="b" bindtap="{{item.c}}" class="{{['teacher_item', item.d]}}"><text>{{item.a}}</text></view></view><view class="course"><scroll-view scroll-x><view class="days"><view wx:for="{{e}}" wx:for-item="item" wx:key="c" bindtap="{{item.d}}" class="{{['day', item.e && 'borderb']}}" style="{{'color:' + item.f}}"><text>{{item.a}}</text><view>{{item.b}}</view></view></view></scroll-view><view class="times"><view class="time_list"><view wx:for="{{f}}" wx:for-item="item" wx:key="d" class="{{['day', item.e && 'disable', item.f && 'active']}}" style="{{'color:' + item.g + ';' + ('background-color:' + item.h)}}" bindtap="{{item.i}}"><text>{{item.a}}</text><view>{{item.b}}</view><view>{{item.c}}</view></view></view></view></view><view class=""> 预约时间:{{g}}</view><button bindtap="{{h}}" class="confirm_button">确认预约</button><uni-popup wx:if="{{l}}" class="r" u-s="{{['d']}}" u-r="outcomePopup" u-i="46f39ab6-0" bind:__l="__l" u-p="{{l}}"><view class="outcome_popup_layout"><view class="outcome_title"> 预约成功 </view><view class="outcome_text"> 你已经预约:{{i}}直播主持课程 </view><button class="outcome_button" bindtap="{{j}}">确认</button></view></uni-popup></view>
+<view class="reservation_layout"><view class="header_title"><view class="left"><view class="title">{{a}}</view><view class="subtitle">{{b}}</view></view><view class="right"><image src="{{c}}" class="image" mode=""></image></view></view><view class="teacher_list"><view wx:for="{{d}}" wx:for-item="item" wx:key="b" bindtap="{{item.c}}" class="{{['teacher_item', item.d]}}"><text>{{item.a}}</text></view></view><view class="course"><scroll-view scroll-x><view class="days"><view wx:for="{{e}}" wx:for-item="item" wx:key="c" bindtap="{{item.d}}" class="{{['day', item.e && 'borderb']}}" style="{{'color:' + item.f}}"><text>{{item.a}}</text><view>{{item.b}}</view></view></view></scroll-view><view class="times"><scroll-view scroll-y="true"><view class="time_list"><view wx:for="{{f}}" wx:for-item="item" wx:key="e" class="{{['day', item.f && 'disable', item.g && 'active']}}" style="{{'color:' + item.h + ';' + ('background-color:' + item.i)}}" bindtap="{{item.j}}"><view class="disableText">{{item.a}}</view><view class="time">{{item.b}}~{{item.c}}</view><view class="num">{{item.d}}</view></view></view></scroll-view></view></view><button bindtap="{{g}}" class="confirm_button">确认预约</button><uni-popup wx:if="{{k}}" class="r" u-s="{{['d']}}" u-r="outcomePopup" u-i="46f39ab6-0" bind:__l="__l" u-p="{{k}}"><view class="outcome_popup_layout"><view class="outcome_title"> 预约成功 </view><view class="outcome_text"> 你已经预约:{{h}}直播主持课程 </view><button class="outcome_button" bindtap="{{i}}">确认</button></view></uni-popup></view>

+ 14 - 11
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/reservation.wxss

@@ -69,7 +69,7 @@
   flex-direction: column;
   justify-content: center;
   align-items: center;
-  margin: 0rpx 10rpx;
+  margin: 0rpx 20rpx;
   height: 115rpx;
 }
 .reservation_layout .course .days .day text {
@@ -78,27 +78,30 @@
 .reservation_layout .course .days .day.borderb {
   border-bottom: 2px solid #51bf81;
 }
+.reservation_layout .course .times scroll-view {
+  width: 100%;
+  height: 300px;
+  background-color: #fff;
+  padding-top: 10rpx;
+}
 .reservation_layout .course .times .time_list {
   display: flex;
   flex-wrap: wrap;
   background-color: #ffffff;
 }
-.reservation_layout .course .times .time_list .time {
-  display: inline-flex;
-  justify-content: center;
-  align-items: center;
-  width: 115rpx;
-  height: 115rpx;
-}
 .reservation_layout .course .times .time_list .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;
+}
+.reservation_layout .course .times .time_list .day .time {
+  margin: 20rpx;
 }
 .reservation_layout .confirm_button {
   font-size: 40rpx;

+ 137 - 10
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/usercourse.js

@@ -1,18 +1,133 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
-const common_assets = require("../../common/assets.js");
 const _sfc_main = {
   data() {
-    return {};
+    return {
+      //产品列表
+      productList: [
+        {
+          "id": 8,
+          "uid": 3513,
+          "schedule_id": 6,
+          "order_id": 31,
+          "orders_product_id": 33,
+          "product_id": 11,
+          "status": 0,
+          "teacher_id": 6,
+          "course_id": 2,
+          "start_time": 1730888928,
+          "end_time": 1730888928,
+          "insert_time": 1731317292,
+          "update_time": 1731317292,
+          "teacher_name": "张老师",
+          "teacher_desc": "擅长舞蹈",
+          "teacher_pic": "../../static/logo2.jpg",
+          "course_name": "拳击高级课",
+          "course_address": "龙华"
+        },
+        {
+          "id": 6,
+          "uid": 3513,
+          "schedule_id": 6,
+          "order_id": 31,
+          "orders_product_id": 33,
+          "product_id": 11,
+          "status": 0,
+          "teacher_id": 6,
+          "course_id": 2,
+          "start_time": 1730888928,
+          "end_time": 1730888928,
+          "insert_time": 1731313905,
+          "update_time": 1731313905,
+          "teacher_name": "张老师",
+          "teacher_desc": "擅长舞蹈",
+          "teacher_pic": "../../static/logo2.jpg",
+          "course_name": "拳击高级课",
+          "course_address": "龙华"
+        }
+      ],
+      // 请求参数
+      requestParam: {
+        name: "",
+        page: 1
+      },
+      // 是否最后一页
+      isLast: false,
+      // 是否请求中
+      isReqing: false,
+      //当前取消的index
+      curIndex: 0
+    };
   },
   onLoad() {
   },
+  onShow() {
+    if (this.isReqing)
+      return;
+    this.requestParam.name = "";
+    this.requestParam.page = 1;
+    this.isLast = false;
+    this.isReqing = true;
+    this.$http.request("api/course/reservation_list", this.requestParam.page).then((re) => {
+      this.isReqing = false;
+      if (re.code == "success") {
+        if (re.data.last_page <= this.requestParam.page)
+          this.isLast = true;
+        this.productList = re.data.data;
+      }
+    });
+  },
   methods: {
-    cancelPopup() {
+    //弹出层
+    cancelPopup(index) {
+      this.curIndex = index;
       this.$refs.cancelPopup.open("center");
     },
+    //关闭弹出层
     closeCancel() {
       this.$refs.cancelPopup.close();
+    },
+    //取消预约事件
+    cancelCourse() {
+      let { id, schedule_id, orders_product_id } = this.productList[this.curIndex];
+      console.log(id, schedule_id, orders_product_id);
+      this.$http.request("api/course/cancel_reservation/", { id, schedule_id, orders_product_id }, "post").then((res) => {
+        if (res.code == "success") {
+          common_vendor.index.showToast({
+            title: `${res.msg}`,
+            icon: "none"
+          });
+        } else {
+          common_vendor.index.showToast({
+            title: `${res.msg}`,
+            icon: "error"
+          });
+        }
+      });
+      this.$refs.cancelPopup.close();
+    },
+    strFormat(str) {
+      return str < 10 ? `0${str}` : str;
+    },
+    //时间戳转日期
+    timeStamp(time) {
+      const dates = new Date(time);
+      const year = dates.getFullYear();
+      const month = dates.getMonth() + 1;
+      const date = dates.getDate();
+      const day = dates.getDay();
+      const hour = dates.getHours();
+      const min = dates.getMinutes();
+      const days = ["日", "一", "二", "三", "四", "五", "六"];
+      return {
+        allDate: `${year}/${this.strFormat(month)}/${this.strFormat(date)}`,
+        date: `${this.strFormat(year)}-${this.strFormat(month)}-${this.strFormat(date)}`,
+        //返回的日期 07-01
+        day: `周${days[day]}`,
+        //返回的礼拜天数  星期一
+        hour: this.strFormat(hour) + ":" + this.strFormat(min)
+        //返回的时钟 08:00
+      };
     }
   }
 };
@@ -26,13 +141,25 @@ if (!Math) {
 }
 function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
   return {
-    a: common_assets._imports_0$2,
-    b: common_vendor.o(($event) => $options.cancelPopup()),
-    c: common_vendor.o(($event) => $options.cancelPopup()),
-    d: common_vendor.o(($event) => $options.cancelPopup()),
-    e: common_vendor.o(($event) => $options.closeCancel()),
-    f: common_vendor.o(($event) => $options.closeCancel()),
-    g: common_vendor.sr("cancelPopup", "110bae46-0")
+    a: common_vendor.f($data.productList, (item, index, i0) => {
+      return common_vendor.e({
+        a: item.teacher_pic,
+        b: common_vendor.t(item.teacher_name),
+        c: !item.status
+      }, !item.status ? {
+        d: common_vendor.o(($event) => $options.cancelPopup(index), index)
+      } : {}, {
+        e: item.status
+      }, item.status ? {} : {}, {
+        f: common_vendor.t(item.course_name),
+        g: common_vendor.t(item.course_address),
+        h: common_vendor.t($options.timeStamp(item.start_time * 1e3).date + " " + $options.timeStamp(item.start_time * 1e3).hour),
+        i: index
+      });
+    }),
+    b: common_vendor.o(($event) => $options.closeCancel()),
+    c: common_vendor.o(($event) => $options.cancelCourse()),
+    d: common_vendor.sr("cancelPopup", "110bae46-0")
   };
 }
 const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/usercourse.wxml


+ 11 - 0
jiaoyu_mp/unpackage/dist/dev/mp-weixin/pagesA/course/usercourse.wxss

@@ -32,6 +32,7 @@
   width: 164rpx;
   height: 164rpx;
   border-radius: 20rpx;
+  border: 2rpx solid;
 }
 .course_list .course_item .course_title .title {
   flex: 1;
@@ -55,6 +56,16 @@
   border: 2rpx solid #00bba5;
   border-radius: 40rpx;
 }
+.course_list .course_item .course_title .title .title_text .btn_2 {
+  display: inline-flex;
+  justify-content: center;
+  align-items: center;
+  width: 200rpx;
+  padding: 10rpx;
+  color: #FFFFFF;
+  background-color: #d3d3d3;
+  border-radius: 40rpx;
+}
 .course_list .course_item .course_title .title .subtilte {
   padding: 5rpx 5rpx 5rpx 0rpx;
   font-size: 26rpx;

+ 1 - 1
jiaoyu_mp/unpackage/dist/dev/mp-weixin/project.private.config.json

@@ -10,7 +10,7 @@
       "list": [
         {
           "name": "pagesA/course/index",
-          "pathName": "pages/index/index",
+          "pathName": "pagesA/course/reservation",
           "query": "",
           "launchMode": "default",
           "scene": null

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels