Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a53adc74
authored
Jul 01, 2026
by
岑成威
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 兜底用户信息覆盖手机号码
1 parent
6806f48a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
243 additions
and
260 deletions
components/OrderPopup/components/DateTime.vue
components/OrderPopup/index.vue
pages/common/dailyNewspaper/components/DailyPopup/components/DateTime.vue
components/OrderPopup/components/DateTime.vue
View file @
a53adc7
<
template
>
<
template
>
<view
class=
"date-list"
>
<view
v-if=
"ready && days.length"
class=
"date-list"
>
<picker-view
class=
"picker picker_max"
:value=
"dateValues"
indicator-class=
"indicator"
@
change=
"changeDate"
>
<picker-view
class=
"picker picker_max"
:value=
"dateValues"
indicator-class=
"indicator"
@
change=
"changeDate"
>
<picker-view-column>
<picker-view-column>
<template
v-for=
"(item, index) in days"
>
<template
v-for=
"(item, index) in days"
>
...
@@ -29,158 +29,155 @@ import dayjs from 'dayjs'
...
@@ -29,158 +29,155 @@ import dayjs from 'dayjs'
export
default
{
export
default
{
name
:
'DateTime'
,
name
:
'DateTime'
,
inject
:
[
'userInfo'
],
inject
:
[
'userInfo'
],
props
:
{
defaultTime
:
{
type
:
String
,
default
:
''
}
},
data
()
{
data
()
{
return
{
return
{
hours
:
[],
hours
:
[],
days
:
[],
days
:
[],
minutes
:
[],
minutes
:
[],
dateValues
:
[],
dateValues
:
[
0
],
hourValues
:
[],
hourValues
:
[
0
],
minuteValues
:
[],
minuteValues
:
[
0
],
loading
:
true
ready
:
false
,
currentDate
:
''
,
currentHour
:
''
,
currentMinute
:
''
}
}
},
},
props
:
{
},
mounted
()
{
this
.
initDate
()
},
methods
:
{
methods
:
{
initDate
()
{
getList
()
{
this
.
dateValues
=
[]
this
.
ready
=
false
this
.
hourValues
=
[]
this
.
initDate
()
this
.
minuteValues
=
[]
const
today
=
new
Date
()
this
.
getDateList
(
'2019/01/01'
,
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDate
()))
},
},
getDateList
(
starDay
,
endDay
)
{
buildDayList
()
{
const
arr
=
[];
const
days
=
[]
const
dates
=
[];
const
start
=
dayjs
(
'2019-01-01'
).
startOf
(
'day'
)
const
end
=
dayjs
().
startOf
(
'day'
)
// 设置两个日期UTC时间
let
cur
=
start
const
db
=
new
Date
(
starDay
);
while
(
cur
.
isBefore
(
end
)
||
cur
.
isSame
(
end
,
'day'
))
{
const
de
=
new
Date
(
endDay
);
days
.
push
(
cur
.
format
(
'YYYY/MM/DD'
))
// 获取两个日期GTM时间
cur
=
cur
.
add
(
1
,
'day'
)
const
s
=
db
.
getTime
()
-
24
*
60
*
60
*
1000
;
const
d
=
de
.
getTime
()
-
24
*
60
*
60
*
1000
;
// 获取到两个日期之间的每一天的毫秒数
for
(
let
i
=
s
;
i
<=
d
;)
{
i
=
i
+
24
*
60
*
60
*
1000
;
arr
.
push
(
parseInt
(
String
(
i
)));
}
// 获取每一天的时间 YY-MM-DD
for
(
const
j
in
arr
)
{
const
time
=
new
Date
(
arr
[
j
]);
const
year
=
time
.
getFullYear
();
const
mouth
=
time
.
getMonth
()
+
1
>=
10
?
time
.
getMonth
()
+
1
:
'0'
+
(
time
.
getMonth
()
+
1
);
const
day
=
time
.
getDate
()
>=
10
?
time
.
getDate
()
:
'0'
+
time
.
getDate
();
const
YYMMDD
=
year
+
'/'
+
mouth
+
'/'
+
day
;
dates
.
push
(
YYMMDD
);
}
}
this
.
getHourList
(
dates
)
return
days
},
},
getHourList
(
days
)
{
buildHourList
(
isToday
)
{
const
hours
=
[],
today
=
new
Date
();
const
len
=
isToday
?
dayjs
().
hour
()
+
1
:
24
for
(
let
hour
=
0
;
hour
<
today
.
getHours
()
+
1
;
hour
++
)
{
return
Array
.
from
({
length
:
len
},
(
_
,
i
)
=>
String
(
i
).
padStart
(
2
,
'0'
))
hours
.
push
(
hour
.
toString
().
padStart
(
2
,
'0'
));
}
this
.
getMinuteList
(
days
,
hours
)
},
},
getMinuteList
(
days
,
hours
)
{
buildMinuteList
(
isToday
,
hour
)
{
const
minutes
=
[];
const
now
=
dayjs
()
const
today
=
new
Date
()
const
isCurrentHour
=
isToday
&&
hour
===
now
.
format
(
'HH'
)
for
(
let
minute
=
0
;
minute
<
today
.
getMinutes
()
+
1
;
minute
++
)
{
const
len
=
isCurrentHour
?
now
.
minute
()
+
1
:
60
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
return
Array
.
from
({
length
:
len
},
(
_
,
i
)
=>
String
(
i
).
padStart
(
2
,
'0'
))
}
},
// 设置默认时间
pickIndex
(
list
,
value
,
fallbackLast
)
{
let
{
dateValues
,
hourValues
,
minuteValues
}
=
this
const
index
=
list
.
indexOf
(
value
)
const
HOUR_STR
=
today
.
getHours
().
toString
().
padStart
(
2
,
'0'
)
if
(
index
>=
0
)
return
index
const
MUNTUE_STR
=
today
.
getMinutes
().
toString
().
padStart
(
2
,
'0'
)
return
fallbackLast
?
Math
.
max
(
list
.
length
-
1
,
0
)
:
0
// const defalutHIndex = hours.indexOf(HOUR_STR)
},
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
applyPickerValues
(
dateValues
,
hourValues
,
minuteValues
)
{
dateValues
.
push
(
days
.
length
+
1
)
this
.
$nextTick
(()
=>
{
hourValues
.
push
(
hours
.
length
+
1
)
minuteValues
.
push
(
minutes
.
length
+
1
)
this
.
currentDate
=
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
currentHour
=
HOUR_STR
this
.
currentMinute
=
MUNTUE_STR
this
.
hours
=
hours
this
.
days
=
days
this
.
minutes
=
minutes
this
.
dateValues
=
dateValues
this
.
dateValues
=
dateValues
this
.
hourValues
=
hourValues
this
.
hourValues
=
hourValues
this
.
minuteValues
=
minuteValues
this
.
minuteValues
=
minuteValues
this
.
loading
=
false
this
.
ready
=
true
setTimeout
(()
=>
{
this
.
minuteValues
=
minuteValues
this
.
loading
=
false
},
100
)
this
.
$emit
(
'onComplete'
)
this
.
$emit
(
'onComplete'
)
})
},
},
changeDate
(
e
)
{
initDate
()
{
const
{
days
}
=
this
const
days
=
this
.
buildDayList
()
const
{
value
}
=
e
.
detail
if
(
!
days
.
length
)
{
const
index
=
value
[
0
]
this
.
days
=
[]
console
.
log
(
days
[
index
],
days
,
index
)
this
.
hours
=
[]
this
.
currentDate
=
days
[
index
]
this
.
minutes
=
[]
// 选择过去时间需要重新初始化时分
this
.
ready
=
false
const
today
=
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
$emit
(
'onComplete'
)
const
timeType
=
this
.
currentDate
!=
today
?
1
:
0
return
this
.
getAllTimeOrPartTime
(
timeType
)
}
},
changeHour
(
e
)
{
const
{
hours
,
days
,
dateValues
}
=
this
const
{
value
}
=
e
.
detail
const
index
=
value
[
0
]
this
.
currentHour
=
hours
[
index
]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
const
today
=
dayjs
()
// const dayIndex = dateValues[0]
const
todayStr
=
today
.
format
(
'YYYY/MM/DD'
)
// this.currentDate = days[dayIndex]
let
currentDate
=
todayStr
const
today
=
dayjs
().
format
(
'YYYY/MM/DD'
)
let
currentHour
=
today
.
format
(
'HH'
)
const
timeType
=
this
.
currentDate
!=
today
?
1
:
0
let
currentMinute
=
today
.
format
(
'mm'
)
this
.
getAllTimeOrPartTimeMinute
(
timeType
)
},
if
(
this
.
defaultTime
)
{
changeMinutes
(
e
)
{
const
parsed
=
dayjs
(
this
.
defaultTime
.
replace
(
/-/g
,
'/'
))
const
{
minutes
}
=
this
if
(
parsed
.
isValid
())
{
const
{
value
}
=
e
.
detail
currentDate
=
parsed
.
format
(
'YYYY/MM/DD'
)
const
index
=
value
[
0
]
currentHour
=
parsed
.
format
(
'HH'
)
this
.
currentMinute
=
minutes
[
index
]
currentMinute
=
parsed
.
format
(
'mm'
)
},
getAllTimeOrPartTime
(
type
)
{
const
today
=
new
Date
()
const
hours
=
[],
minutes
=
[],
hour_len
=
type
==
1
?
24
:
today
.
getHours
()
+
1
,
minute_len
=
type
==
1
?
60
:
today
.
getMinutes
()
+
1
;
for
(
let
hour
=
0
;
hour
<
hour_len
;
hour
++
)
{
hours
.
push
(
hour
.
toString
().
padStart
(
2
,
'0'
));
}
}
for
(
let
minute
=
0
;
minute
<
minute_len
;
minute
++
)
{
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
}
}
const
isToday
=
currentDate
===
todayStr
const
hours
=
this
.
buildHourList
(
isToday
)
const
minutes
=
this
.
buildMinuteList
(
isToday
,
currentHour
)
if
(
!
hours
.
includes
(
currentHour
))
currentHour
=
hours
[
hours
.
length
-
1
]
if
(
!
minutes
.
includes
(
currentMinute
))
currentMinute
=
minutes
[
minutes
.
length
-
1
]
this
.
currentDate
=
currentDate
this
.
currentHour
=
currentHour
this
.
currentMinute
=
currentMinute
this
.
days
=
days
this
.
hours
=
hours
this
.
hours
=
hours
this
.
minutes
=
minutes
this
.
minutes
=
minutes
this
.
applyPickerValues
(
[
this
.
pickIndex
(
days
,
currentDate
,
true
)],
[
this
.
pickIndex
(
hours
,
currentHour
,
true
)],
[
this
.
pickIndex
(
minutes
,
currentMinute
,
true
)]
)
},
},
getAllTimeOrPartTimeMinute
(
type
)
{
changeDate
(
e
)
{
const
today
=
new
Date
()
const
index
=
e
.
detail
.
value
[
0
]
const
currentHour
=
today
.
getHours
()
const
date
=
this
.
days
[
index
]
const
timeType
=
this
.
currentHour
!=
currentHour
?
1
:
0
if
(
!
date
)
return
const
minutes
=
[],
minute_len
=
type
==
1
||
timeType
==
1
?
60
:
today
.
getMinutes
()
+
1
;
this
.
currentDate
=
date
for
(
let
minute
=
0
;
minute
<
minute_len
;
minute
++
)
{
const
isToday
=
this
.
currentDate
===
dayjs
().
format
(
'YYYY/MM/DD'
)
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
this
.
hours
=
this
.
buildHourList
(
isToday
)
if
(
!
this
.
hours
.
includes
(
this
.
currentHour
))
{
this
.
currentHour
=
this
.
hours
[
this
.
hours
.
length
-
1
]
}
}
const
minutes
=
this
.
buildMinuteList
(
isToday
,
this
.
currentHour
)
this
.
minutes
=
minutes
this
.
minutes
=
minutes
if
(
!
this
.
minutes
.
includes
(
this
.
currentMinute
))
{
this
.
currentMinute
=
this
.
minutes
[
this
.
minutes
.
length
-
1
]
}
this
.
$nextTick
(()
=>
{
this
.
hourValues
=
[
this
.
pickIndex
(
this
.
hours
,
this
.
currentHour
,
true
)]
this
.
minuteValues
=
[
this
.
pickIndex
(
this
.
minutes
,
this
.
currentMinute
,
true
)]
})
},
changeHour
(
e
)
{
const
index
=
e
.
detail
.
value
[
0
]
const
hour
=
this
.
hours
[
index
]
if
(
hour
==
null
)
return
this
.
currentHour
=
hour
const
isToday
=
this
.
currentDate
===
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
minutes
=
this
.
buildMinuteList
(
isToday
,
this
.
currentHour
)
if
(
!
this
.
minutes
.
includes
(
this
.
currentMinute
))
{
this
.
currentMinute
=
this
.
minutes
[
this
.
minutes
.
length
-
1
]
}
this
.
$nextTick
(()
=>
{
this
.
minuteValues
=
[
this
.
pickIndex
(
this
.
minutes
,
this
.
currentMinute
,
true
)]
})
},
changeMinutes
(
e
)
{
const
index
=
e
.
detail
.
value
[
0
]
const
minute
=
this
.
minutes
[
index
]
if
(
minute
==
null
)
return
this
.
currentMinute
=
minute
},
},
getResult
()
{
getResult
()
{
console
.
log
(
this
.
currentDate
,
this
.
currentHour
,
this
.
currentMinute
)
const
str
=
`
${
this
.
currentDate
}
${
this
.
currentHour
}
:
${
this
.
currentMinute
}
:00`
let
str
=
''
return
dayjs
(
str
.
replace
(
/-/g
,
'/'
)).
format
(
'YYYY/MM/DD HH:mm:ss'
)
str
=
this
.
currentDate
+
' '
+
this
.
currentHour
+
':'
+
this
.
currentMinute
+
":00"
const
result
=
dayjs
(
str
).
format
(
'YYYY/MM/DD HH:mm:ss'
)
return
result
}
}
}
}
}
}
...
...
components/OrderPopup/index.vue
View file @
a53adc7
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
</
template
>
</
template
>
<view
v-if=
"componentObject[popupType]"
:class=
"['popup-body', { 'hide-footer': componentObject[popupType].hideFooter }, { 'hide-search': componentObject[popupType].hideSearch }, { 'hide-footer-search': componentObject[popupType].hideFooter && componentObject[popupType].hideSearch }]"
>
<view
v-if=
"componentObject[popupType]"
:class=
"['popup-body', { 'hide-footer': componentObject[popupType].hideFooter }, { 'hide-search': componentObject[popupType].hideSearch }, { 'hide-footer-search': componentObject[popupType].hideFooter && componentObject[popupType].hideSearch }]"
>
<scroll-view
scroll-y
:class=
"['popup-scroll-view', { show: componentObject[popupType].loadComplete }]"
>
<scroll-view
scroll-y
:class=
"['popup-scroll-view', { show: componentObject[popupType].loadComplete }]"
>
<component
:is=
"componentObject[popupType].name"
:params
.
sync=
"componentObject[popupType]"
:data=
"data"
:dataKey=
"dataKey"
:isDefeatOrder=
"isDefeatOrder"
:defaultTime=
"defaultTime"
:positionTypeList=
"positionTypeList"
:show-marketing-icon=
"showMarketingIcon"
:boutique-order-types-only=
"boutiqueOrderTypesOnly"
ref=
"componentRef"
@
choose=
"chooseContent = $event"
@
openSkuPopup=
"openSkuPopup"
@
onComplete=
"componentObject[popupType].loadComplete = true"
@
confirm=
"confirm"
></component>
<component
:is=
"componentObject[popupType].name"
:params
.
sync=
"componentObject[popupType]"
:data=
"data"
:dataKey=
"dataKey"
:isDefeatOrder=
"isDefeatOrder"
:defaultTime=
"d
atePickerD
efaultTime"
:positionTypeList=
"positionTypeList"
:show-marketing-icon=
"showMarketingIcon"
:boutique-order-types-only=
"boutiqueOrderTypesOnly"
ref=
"componentRef"
@
choose=
"chooseContent = $event"
@
openSkuPopup=
"openSkuPopup"
@
onComplete=
"componentObject[popupType].loadComplete = true"
@
confirm=
"confirm"
></component>
<
template
v-if=
"componentObject[popupType].noData"
>
<
template
v-if=
"componentObject[popupType].noData"
>
<view
class=
"nothing flex"
>
暂无数据
</view>
<view
class=
"nothing flex"
>
暂无数据
</view>
</
template
>
</
template
>
...
@@ -171,6 +171,11 @@ export default {
...
@@ -171,6 +171,11 @@ export default {
const
{
sceneType
}
=
uni
.
$storage
.
get
(
'userInfo'
)
const
{
sceneType
}
=
uni
.
$storage
.
get
(
'userInfo'
)
return
sceneType
return
sceneType
},
},
datePickerDefaultTime
()
{
if
(
this
.
defaultTime
)
return
this
.
defaultTime
const
data
=
this
.
data
||
{}
return
data
.
pay2Time
||
data
.
successDate
||
''
}
},
},
mounted
()
{
mounted
()
{
},
},
...
@@ -187,6 +192,9 @@ export default {
...
@@ -187,6 +192,9 @@ export default {
})
})
},
},
open
()
{
open
()
{
if
(
this
.
componentObject
[
this
.
popupType
])
{
this
.
componentObject
[
this
.
popupType
].
loadComplete
=
false
}
this
.
$refs
.
popup
.
open
()
this
.
$refs
.
popup
.
open
()
// 等待当前 tick 的响应式 watcher(如 externalData → cacheData)执行完再初始化
// 等待当前 tick 的响应式 watcher(如 externalData → cacheData)执行完再初始化
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
...
...
pages/common/dailyNewspaper/components/DailyPopup/components/DateTime.vue
View file @
a53adc7
<
template
>
<
template
>
<view
class=
"date-list"
>
<view
v-if=
"ready && days.length"
class=
"date-list"
>
<picker-view
class=
"picker picker_max"
:value=
"dateValues"
indicator-class=
"indicator"
@
change=
"changeDate"
>
<picker-view
class=
"picker picker_max"
:value=
"dateValues"
indicator-class=
"indicator"
@
change=
"changeDate"
>
<picker-view-column>
<picker-view-column>
<template
v-for=
"(item, index) in days"
>
<template
v-for=
"(item, index) in days"
>
...
@@ -29,160 +29,141 @@ import dayjs from 'dayjs'
...
@@ -29,160 +29,141 @@ import dayjs from 'dayjs'
export
default
{
export
default
{
name
:
'DateTime'
,
name
:
'DateTime'
,
inject
:
[
'userInfo'
],
inject
:
[
'userInfo'
],
data
()
{
data
()
{
return
{
return
{
hours
:
[],
hours
:
[],
days
:
[],
days
:
[],
minutes
:
[],
minutes
:
[],
dateValues
:
[],
dateValues
:
[
0
],
hourValues
:
[],
hourValues
:
[
0
],
minuteValues
:
[],
minuteValues
:
[
0
],
loading
:
true
ready
:
false
,
currentDate
:
''
,
currentHour
:
''
,
currentMinute
:
''
}
}
},
},
props
:
{
props
:
{
params
:
Object
,
},
startDate
:
String
,
endDate
:
String
mounted
()
{
this
.
initDate
()
},
},
methods
:
{
methods
:
{
initDate
()
{
getList
()
{
this
.
dateValues
=
[]
this
.
ready
=
false
this
.
hourValues
=
[]
this
.
initDate
()
this
.
minuteValues
=
[]
const
today
=
new
Date
()
this
.
getDateList
(
'2019/01/01'
,
new
Date
(
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDate
()))
},
},
getDateList
(
starDay
,
endDay
)
{
buildDayList
()
{
const
arr
=
[];
const
days
=
[]
const
dates
=
[];
const
start
=
dayjs
((
this
.
startDate
||
'2019-01-01'
).
replace
(
/
\/
/g
,
'-'
)).
startOf
(
'day'
)
const
end
=
dayjs
((
this
.
endDate
||
dayjs
().
format
(
'YYYY-MM-DD'
)).
replace
(
/
\/
/g
,
'-'
)).
startOf
(
'day'
)
// 设置两个日期UTC时间
if
(
!
start
.
isValid
()
||
!
end
.
isValid
()
||
end
.
isBefore
(
start
))
return
days
const
db
=
new
Date
(
starDay
);
let
cur
=
start
const
de
=
new
Date
(
endDay
);
while
(
cur
.
isBefore
(
end
)
||
cur
.
isSame
(
end
,
'day'
))
{
// 获取两个日期GTM时间
days
.
push
(
cur
.
format
(
'YYYY/MM/DD'
))
const
s
=
db
.
getTime
()
-
24
*
60
*
60
*
1000
;
cur
=
cur
.
add
(
1
,
'day'
)
const
d
=
de
.
getTime
()
-
24
*
60
*
60
*
1000
;
// 获取到两个日期之间的每一天的毫秒数
for
(
let
i
=
s
;
i
<=
d
;)
{
i
=
i
+
24
*
60
*
60
*
1000
;
arr
.
push
(
parseInt
(
String
(
i
)));
}
// 获取每一天的时间 YY-MM-DD
for
(
const
j
in
arr
)
{
const
time
=
dayjs
(
arr
[
j
]);
if
(
!
time
.
isValid
())
continue
;
// 跳过无效日期
const
year
=
time
.
year
();
const
month
=
time
.
month
()
+
1
;
// 注意:dayjs 的 month() 返回 0-11
const
day
=
time
.
date
();
const
mouthStr
=
month
>=
10
?
month
:
'0'
+
month
;
const
dayStr
=
day
>=
10
?
day
:
'0'
+
day
;
const
YYMMDD
=
year
+
'/'
+
mouthStr
+
'/'
+
dayStr
;
dates
.
push
(
YYMMDD
);
}
}
this
.
getHourList
(
dates
)
return
days
},
},
getHourList
(
days
)
{
buildHourList
(
isToday
)
{
const
hours
=
[],
today
=
new
Date
();
const
len
=
isToday
?
dayjs
().
hour
()
+
1
:
24
for
(
let
hour
=
0
;
hour
<
today
.
getHours
()
+
1
;
hour
++
)
{
return
Array
.
from
({
length
:
len
},
(
_
,
i
)
=>
String
(
i
).
padStart
(
2
,
'0'
))
hours
.
push
(
hour
.
toString
().
padStart
(
2
,
'0'
));
}
this
.
getMinuteList
(
days
,
hours
)
},
},
getMinuteList
(
days
,
hours
)
{
buildMinuteList
(
isToday
,
hour
)
{
const
minutes
=
[];
const
now
=
dayjs
()
const
today
=
new
Date
()
const
isCurrentHour
=
isToday
&&
hour
===
now
.
format
(
'HH'
)
for
(
let
minute
=
0
;
minute
<
today
.
getMinutes
()
+
1
;
minute
++
)
{
const
len
=
isCurrentHour
?
now
.
minute
()
+
1
:
60
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
return
Array
.
from
({
length
:
len
},
(
_
,
i
)
=>
String
(
i
).
padStart
(
2
,
'0'
))
}
},
// 设置默认时间
pickIndex
(
list
,
value
,
fallbackLast
)
{
let
{
dateValues
,
hourValues
,
minuteValues
}
=
this
const
index
=
list
.
indexOf
(
value
)
const
HOUR_STR
=
today
.
getHours
().
toString
().
padStart
(
2
,
'0'
)
if
(
index
>=
0
)
return
index
const
MUNTUE_STR
=
today
.
getMinutes
().
toString
().
padStart
(
2
,
'0'
)
return
fallbackLast
?
Math
.
max
(
list
.
length
-
1
,
0
)
:
0
// const defalutHIndex = hours.indexOf(HOUR_STR)
},
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
applyPickerValues
(
dateValues
,
hourValues
,
minuteValues
)
{
dateValues
.
push
(
days
.
length
+
1
)
this
.
$nextTick
(()
=>
{
hourValues
.
push
(
hours
.
length
+
1
)
minuteValues
.
push
(
minutes
.
length
+
1
)
this
.
currentDate
=
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
currentHour
=
HOUR_STR
this
.
currentMinute
=
MUNTUE_STR
this
.
hours
=
hours
this
.
days
=
days
this
.
minutes
=
minutes
this
.
dateValues
=
dateValues
this
.
dateValues
=
dateValues
this
.
hourValues
=
hourValues
this
.
hourValues
=
hourValues
this
.
minuteValues
=
minuteValues
this
.
minuteValues
=
minuteValues
this
.
loading
=
false
this
.
ready
=
true
setTimeout
(()
=>
{
this
.
minuteValues
=
minuteValues
this
.
loading
=
false
},
100
)
this
.
$emit
(
'onComplete'
)
this
.
$emit
(
'onComplete'
)
})
},
},
changeDate
(
e
)
{
initDate
()
{
const
{
days
}
=
this
const
days
=
this
.
buildDayList
()
const
{
value
}
=
e
.
detail
if
(
!
days
.
length
)
{
const
index
=
value
[
0
]
this
.
days
=
[]
this
.
currentDate
=
days
[
index
]
this
.
hours
=
[]
// 选择过去时间需要重新初始化时分
this
.
minutes
=
[]
const
today
=
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
ready
=
false
const
timeType
=
this
.
currentDate
!=
today
?
1
:
0
this
.
$emit
(
'onComplete'
)
this
.
getAllTimeOrPartTime
(
timeType
)
return
},
changeHour
(
e
)
{
const
{
hours
,
days
,
dateValues
}
=
this
const
{
value
}
=
e
.
detail
const
index
=
value
[
0
]
this
.
currentHour
=
hours
[
index
]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const
today
=
dayjs
().
format
(
'YYYY/MM/DD'
)
const
timeType
=
this
.
currentDate
!=
today
?
1
:
0
this
.
getAllTimeOrPartTimeMinute
(
timeType
)
},
changeMinutes
(
e
)
{
const
{
minutes
}
=
this
const
{
value
}
=
e
.
detail
const
index
=
value
[
0
]
this
.
currentMinute
=
minutes
[
index
]
},
getAllTimeOrPartTime
(
type
)
{
const
today
=
new
Date
()
const
hours
=
[],
minutes
=
[],
hour_len
=
type
==
1
?
24
:
today
.
getHours
()
+
1
,
minute_len
=
type
==
1
?
60
:
today
.
getMinutes
()
+
1
;
for
(
let
hour
=
0
;
hour
<
hour_len
;
hour
++
)
{
hours
.
push
(
hour
.
toString
().
padStart
(
2
,
'0'
));
}
for
(
let
minute
=
0
;
minute
<
minute_len
;
minute
++
)
{
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
}
}
const
today
=
dayjs
()
const
todayStr
=
today
.
format
(
'YYYY/MM/DD'
)
const
currentDate
=
todayStr
const
currentHour
=
today
.
format
(
'HH'
)
const
currentMinute
=
today
.
format
(
'mm'
)
const
hours
=
this
.
buildHourList
(
true
)
const
minutes
=
this
.
buildMinuteList
(
true
,
currentHour
)
this
.
currentDate
=
currentDate
this
.
currentHour
=
currentHour
this
.
currentMinute
=
currentMinute
this
.
days
=
days
this
.
hours
=
hours
this
.
hours
=
hours
this
.
minutes
=
minutes
this
.
minutes
=
minutes
this
.
applyPickerValues
(
[
this
.
pickIndex
(
days
,
currentDate
,
true
)],
[
this
.
pickIndex
(
hours
,
currentHour
,
true
)],
[
this
.
pickIndex
(
minutes
,
currentMinute
,
true
)]
)
},
},
getAllTimeOrPartTimeMinute
(
type
)
{
changeDate
(
e
)
{
const
today
=
new
Date
()
const
index
=
e
.
detail
.
value
[
0
]
const
currentHour
=
today
.
getHours
()
const
date
=
this
.
days
[
index
]
const
timeType
=
this
.
currentHour
!=
currentHour
?
1
:
0
if
(
!
date
)
return
const
minutes
=
[],
minute_len
=
type
==
1
||
timeType
==
1
?
60
:
today
.
getMinutes
()
+
1
;
this
.
currentDate
=
date
for
(
let
minute
=
0
;
minute
<
minute_len
;
minute
++
)
{
const
isToday
=
this
.
currentDate
===
dayjs
().
format
(
'YYYY/MM/DD'
)
minutes
.
push
(
minute
.
toString
().
padStart
(
2
,
'0'
));
this
.
hours
=
this
.
buildHourList
(
isToday
)
if
(
!
this
.
hours
.
includes
(
this
.
currentHour
))
{
this
.
currentHour
=
this
.
hours
[
this
.
hours
.
length
-
1
]
}
}
const
minutes
=
this
.
buildMinuteList
(
isToday
,
this
.
currentHour
)
this
.
minutes
=
minutes
this
.
minutes
=
minutes
if
(
!
this
.
minutes
.
includes
(
this
.
currentMinute
))
{
this
.
currentMinute
=
this
.
minutes
[
this
.
minutes
.
length
-
1
]
}
this
.
$nextTick
(()
=>
{
this
.
hourValues
=
[
this
.
pickIndex
(
this
.
hours
,
this
.
currentHour
,
true
)]
this
.
minuteValues
=
[
this
.
pickIndex
(
this
.
minutes
,
this
.
currentMinute
,
true
)]
})
},
},
getResult
()
{
changeHour
(
e
)
{
let
str
=
''
const
index
=
e
.
detail
.
value
[
0
]
str
=
this
.
currentDate
+
' '
+
this
.
currentHour
+
':'
+
this
.
currentMinute
const
hour
=
this
.
hours
[
index
]
// + ":00"
if
(
hour
==
null
)
return
const
result
=
dayjs
(
str
).
format
(
'YYYY-MM-DD HH:mm'
)
this
.
currentHour
=
hour
return
result
const
isToday
=
this
.
currentDate
===
dayjs
().
format
(
'YYYY/MM/DD'
)
this
.
minutes
=
this
.
buildMinuteList
(
isToday
,
this
.
currentHour
)
if
(
!
this
.
minutes
.
includes
(
this
.
currentMinute
))
{
this
.
currentMinute
=
this
.
minutes
[
this
.
minutes
.
length
-
1
]
}
this
.
$nextTick
(()
=>
{
this
.
minuteValues
=
[
this
.
pickIndex
(
this
.
minutes
,
this
.
currentMinute
,
true
)]
})
},
changeMinutes
(
e
)
{
const
index
=
e
.
detail
.
value
[
0
]
const
minute
=
this
.
minutes
[
index
]
if
(
minute
==
null
)
return
this
.
currentMinute
=
minute
},
getResult
()
{
const
str
=
`
${
this
.
currentDate
}
${
this
.
currentHour
}
:
${
this
.
currentMinute
}
:00`
return
dayjs
(
str
.
replace
(
/-/g
,
'/'
)).
format
(
'YYYY/MM/DD HH:mm:ss'
)
}
}
}
}
}
}
...
@@ -193,11 +174,9 @@ export default {
...
@@ -193,11 +174,9 @@ export default {
height
:
100%
;
height
:
100%
;
display
:
grid
;
display
:
grid
;
grid-template-columns
:
repeat
(
3
,
1
fr
);
grid-template-columns
:
repeat
(
3
,
1
fr
);
.picker
{
.picker
{
height
:
100%
;
height
:
100%
;
text-align
:
center
;
text-align
:
center
;
.view
{
.view
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
@@ -206,7 +185,6 @@ export default {
...
@@ -206,7 +185,6 @@ export default {
height
:
toRpx
(
72
);
height
:
toRpx
(
72
);
}
}
}
}
/
deep
/
.indicator
{
/
deep
/
.indicator
{
height
:
toRpx
(
72
);
height
:
toRpx
(
72
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment