预约时间bug
This commit is contained in:
parent
aa0b756c14
commit
10feded749
|
@ -4,10 +4,13 @@
|
||||||
<div v-for="(item, index) in dayList" :key="index">
|
<div v-for="(item, index) in dayList" :key="index">
|
||||||
<div class="inner" style="font-size: medium;">
|
<div class="inner" style="font-size: medium;">
|
||||||
第{{ index + 1 }}天
|
第{{ index + 1 }}天
|
||||||
<el-checkbox v-model="isAvailableArray[index]" label="这天可预约" style="margin-left: 10px;"/>
|
<el-checkbox v-model="isAvailableArray[index]" v-if="timeList[index].length != 0" label="这天可预约" style="margin-left: 10px;"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 时间段部分 -->
|
<!-- 时间段部分 -->
|
||||||
<div class="time-picker">
|
<div class="time-picker">
|
||||||
|
<el-button circle @click="addList(index, 0)" v-if="timeList[index].length == 0"><el-icon>
|
||||||
|
<Plus />
|
||||||
|
</el-icon></el-button>
|
||||||
<div v-for="(item, row) in timeList[index]" :key="row" class="box">
|
<div v-for="(item, row) in timeList[index]" :key="row" class="box">
|
||||||
<span>第 {{ row + 1 }} 个时间段</span>
|
<span>第 {{ row + 1 }} 个时间段</span>
|
||||||
<el-time-select v-model="timeList[index][row].startTime"
|
<el-time-select v-model="timeList[index][row].startTime"
|
||||||
|
@ -40,7 +43,7 @@
|
||||||
<el-button circle @click="addList(index, row)"><el-icon>
|
<el-button circle @click="addList(index, row)"><el-icon>
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon></el-button>
|
</el-icon></el-button>
|
||||||
<el-button circle @click="subList(index, row)" v-if="row + 1 > 1"><el-icon>
|
<el-button circle @click="subList(index, row)" v-if="row >= 0"><el-icon>
|
||||||
<Minus />
|
<Minus />
|
||||||
</el-icon></el-button>
|
</el-icon></el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,8 +123,16 @@ const maxOptions = ref(
|
||||||
const flag = ref(0) //第一个人数下标
|
const flag = ref(0) //第一个人数下标
|
||||||
var arr = new Array(4)
|
var arr = new Array(4)
|
||||||
const emit = defineEmits(['time-Info']) //组件绑定
|
const emit = defineEmits(['time-Info']) //组件绑定
|
||||||
|
|
||||||
|
const initTimeList = () => {
|
||||||
|
for (var i = 0; i < 4; i ++ ) {
|
||||||
|
timeList.value[i].splice(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
init()
|
init()
|
||||||
|
initTimeList()
|
||||||
for(let i=0; i<4; i++) { //开始时初始化人数的数组
|
for(let i=0; i<4; i++) { //开始时初始化人数的数组
|
||||||
for(let j=0; j<6; j++) {
|
for(let j=0; j<6; j++) {
|
||||||
for(let k=0;k<50;k++) {
|
for(let k=0;k<50;k++) {
|
||||||
|
@ -164,12 +175,7 @@ const onSubmit =()=> {
|
||||||
}
|
}
|
||||||
const resetForm=()=>{
|
const resetForm=()=>{
|
||||||
for(let i=0;i<4;i++) {
|
for(let i=0;i<4;i++) {
|
||||||
timeList.value[i] = [{
|
timeList.value[i].splice(0, timeList.value[i].length)
|
||||||
startTime: '',
|
|
||||||
endTime: '',
|
|
||||||
minNumValue: '',
|
|
||||||
maxNumValue: '',
|
|
||||||
}]
|
|
||||||
isAvailableArray.value[i] = false
|
isAvailableArray.value[i] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,14 @@ const isValidPlus = (val) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const transfer = (val, arr, isAvailableArr) => {
|
export const transfer = (val, arr, isAvailableArr) => {
|
||||||
|
console.log('这是val:', val)
|
||||||
for (var i = 0; i < val.length; i ++ ) {
|
for (var i = 0; i < val.length; i ++ ) {
|
||||||
for (var j = 0; j < val[i].length; j ++ ) {
|
for (var j = 0; j < val[i].length; j ++ ) {
|
||||||
arr[i][j].timeSlot = val[i][j].startTime + "-" + val[i][j].endTime
|
arr[i][j].timeSlot = val[i][j].startTime + "-" + val[i][j].endTime
|
||||||
arr[i][j].numberRange = "(" + val[i][j].minNumValue + "," + val[i][j].maxNumValue + ")"
|
arr[i][j].numberRange = "(" + val[i][j].minNumValue + "," + val[i][j].maxNumValue + ")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log(arr)
|
console.log('这是arr:', arr)
|
||||||
for (var i = 0; i < 4; i ++ ) {
|
for (var i = 0; i < 4; i ++ ) {
|
||||||
for (var j = 0; j < 6; j ++ ) {
|
for (var j = 0; j < 6; j ++ ) {
|
||||||
if(isValidPlus(arr[i][j])) {
|
if(isValidPlus(arr[i][j])) {
|
||||||
|
@ -51,9 +52,15 @@ export const transfer = (val, arr, isAvailableArr) => {
|
||||||
numberRangeArr.push(arr[i][j].numberRange)
|
numberRangeArr.push(arr[i][j].numberRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(val[i].length == 0){
|
||||||
|
newArr[i].timeSlot = "00:00-00:00"
|
||||||
|
newArr[i].numberRange = "(0,0)"
|
||||||
|
newArr[i].isAvailable = 0
|
||||||
|
}else{
|
||||||
newArr[i].timeSlot = timeSlotArr.join(';')
|
newArr[i].timeSlot = timeSlotArr.join(';')
|
||||||
newArr[i].numberRange = numberRangeArr.join(';')
|
newArr[i].numberRange = numberRangeArr.join(';')
|
||||||
newArr[i].isAvailable = isAvailableArr[i] ? 1 : 0
|
newArr[i].isAvailable = isAvailableArr[i] ? 1 : 0
|
||||||
|
}
|
||||||
timeSlotArr = []
|
timeSlotArr = []
|
||||||
numberRangeArr = []
|
numberRangeArr = []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user