二手回收后台,师傅端,用户端
刘帅
2026-08-31 6bb77b58a58b2587bf55ef414645e53b4caf104f
改派时间选择问题
1个文件已修改
59 ■■■■■ 已修改文件
master/pageA/againAssign/againAssign.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
master/pageA/againAssign/againAssign.vue
@@ -214,13 +214,10 @@
                })
            },
            initDoorTimeOptions() {
                const now = new Date()
                const currentYear = now.getFullYear()
                const earliestTime = this.getEarliestDoorTime()
                const currentYear = earliestTime.getFullYear()
                this.years = this.createRange(currentYear, currentYear + 10)
                this.months = this.createRange(1, 12)
                this.hours = this.createRange(0, 23)
                this.minutes = this.createRange(0, 59)
                this.setDoorTimeValueByDate(now)
                this.setDoorTimeValueByDate(earliestTime)
            },
            createRange(start, end) {
                const list = []
@@ -233,23 +230,39 @@
                return String(value).padStart(2, '0')
            },
            setDoorTimeValueByDate(date) {
                const yearIndex = Math.max(0, this.years.findIndex(item => Number(item) === date.getFullYear()))
                const monthIndex = date.getMonth()
                this.updateDays(this.years[yearIndex], this.months[monthIndex])
                const earliestTime = this.getEarliestDoorTime()
                const selectedTime = date < earliestTime ? earliestTime : date
                const yearIndex = Math.max(0, this.years.findIndex(item => Number(item) === selectedTime.getFullYear()))
                const isEarliestYear = selectedTime.getFullYear() === earliestTime.getFullYear()
                this.months = this.createRange(isEarliestYear ? earliestTime.getMonth() + 1 : 1, 12)
                const monthIndex = this.months.findIndex(item => Number(item) === selectedTime.getMonth() + 1)
                const isEarliestMonth = isEarliestYear && selectedTime.getMonth() === earliestTime.getMonth()
                this.days = this.createRange(isEarliestMonth ? earliestTime.getDate() : 1,
                    this.getMonthDays(selectedTime.getFullYear(), selectedTime.getMonth() + 1))
                const dayIndex = this.days.findIndex(item => Number(item) === selectedTime.getDate())
                const isEarliestDay = isEarliestMonth && selectedTime.getDate() === earliestTime.getDate()
                this.hours = this.createRange(isEarliestDay ? earliestTime.getHours() : 0, 23)
                const hourIndex = this.hours.findIndex(item => Number(item) === selectedTime.getHours())
                const isEarliestHour = isEarliestDay && selectedTime.getHours() === earliestTime.getHours()
                this.minutes = this.createRange(isEarliestHour ? earliestTime.getMinutes() : 0, 59)
                const minuteIndex = this.minutes.findIndex(item => Number(item) === selectedTime.getMinutes())
                this.doorTimeValue = [
                    yearIndex,
                    monthIndex,
                    date.getDate() - 1,
                    date.getHours(),
                    date.getMinutes()
                    dayIndex,
                    hourIndex,
                    minuteIndex
                ]
                this.tempDoorTimeValue = [...this.doorTimeValue]
            },
            getEarliestDoorTime() {
                const earliestTime = new Date()
                earliestTime.setSeconds(0, 0)
                earliestTime.setMinutes(earliestTime.getMinutes() + 1)
                return earliestTime
            },
            getMonthDays(year, month) {
                return new Date(Number(year), Number(month), 0).getDate()
            },
            updateDays(year, month) {
                this.days = this.createRange(1, this.getMonthDays(year, month))
            },
            openDoorTimePicker() {
                if (!this.years.length) {
@@ -263,14 +276,14 @@
            },
            changeDoorTime(e) {
                const value = [...e.detail.value]
                const year = this.years[value[0]]
                const month = this.months[value[1]]
                const maxDay = this.getMonthDays(year, month)
                if (value[2] >= maxDay) {
                    value[2] = maxDay - 1
                }
                this.updateDays(year, month)
                this.tempDoorTimeValue = value
                const selectedTime = new Date(
                    Number(this.years[value[0]]),
                    Number(this.months[value[1]]) - 1,
                    Number(this.days[value[2]]),
                    Number(this.hours[value[3]]),
                    Number(this.minutes[value[4]])
                )
                this.setDoorTimeValueByDate(selectedTime)
            },
            confirmDoorTimePicker() {
                this.doorTimeValue = [...this.tempDoorTimeValue]