|
@@ -1,6 +1,8 @@
|
|
|
import OHeader from '@/components/o-header'
|
|
|
import item from '@/student/coupons/item'
|
|
|
import dayjs from 'dayjs'
|
|
|
+// import isBetween from 'dayjs/plugin/isBetween'
|
|
|
+// dayjs.extend(isBetween)
|
|
|
import { Button, Cell, CellGroup, Popup, showToast, Sticky, TimePicker } from 'vant'
|
|
|
import { defineComponent, onMounted, reactive, watch } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
@@ -99,31 +101,39 @@ export default defineComponent({
|
|
|
|
|
|
// 确认时间
|
|
|
const onConfirm = (val: any) => {
|
|
|
- console.log(val, 'val')
|
|
|
+ // console.log(val, 'val')
|
|
|
const selectedValues = val.selectedValues
|
|
|
const tempDate = dayjs(state.calendarDate)
|
|
|
.hour(selectedValues[0])
|
|
|
.minute(selectedValues[1])
|
|
|
.second(0)
|
|
|
- console.log(dayjs(tempDate).format('YYYY-MM-DD HH:mm:ss'), 'first', dayjs(tempDate).minute())
|
|
|
+ // console.log(dayjs(tempDate).format('YYYY-MM-DD HH:mm:ss'), 'first', dayjs(tempDate).minute())
|
|
|
// 时间加上每节课的时间,
|
|
|
const lastDate = dayjs(tempDate).minute(props.times + dayjs(tempDate).minute())
|
|
|
console.log(dayjs(lastDate).format('YYYY-MM-DD HH:mm:ss'), 'second')
|
|
|
console.log(
|
|
|
dayjs(tempDate).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
tempDate.toDate(),
|
|
|
- 'second tempDate'
|
|
|
+ 'second tempDate',
|
|
|
+ state.useTimer
|
|
|
)
|
|
|
|
|
|
let isActive = false
|
|
|
state.useTimer.forEach((item: any) => {
|
|
|
- if (dayjs(lastDate).isAfter(item.endTime)) {
|
|
|
+ // if (dayjs(lastDate).isBetween(item.startTime, item.endTime, null, '[]')) {
|
|
|
+ // isActive = true
|
|
|
+ // }
|
|
|
+ // 判断课程的时间范围在不在可排课时间范围内
|
|
|
+ if (
|
|
|
+ dayjs(tempDate).valueOf() >= dayjs(item.startTime).valueOf() &&
|
|
|
+ dayjs(lastDate).valueOf() <= dayjs(item.endTime).valueOf()
|
|
|
+ ) {
|
|
|
isActive = true
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- console.log(isActive, 'isActive')
|
|
|
- if (isActive) {
|
|
|
+ // console.log(isActive, 'isActive')
|
|
|
+ if (!isActive) {
|
|
|
showToast('您选择的时间超过可排课时间范围')
|
|
|
return
|
|
|
}
|
|
@@ -178,7 +188,7 @@ export default defineComponent({
|
|
|
|
|
|
{/* <div class={styles.selectTimer}>{dayjs(state.calendarDate).format('YYYY年MM月DD日')}</div> */}
|
|
|
|
|
|
- <CellGroup inset class={styles.cellGroup}>
|
|
|
+ <CellGroup inset class={styles.cellGroup} style={{ marginTop: '12px' }}>
|
|
|
{state.useTimer.map((item: any) => (
|
|
|
<Cell
|
|
|
center
|