Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
aea2e0e4
Commit
aea2e0e4
authored
Oct 18, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 预约
parent
1a3bbcc2
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
16 deletions
+122
-16
YHResignAppointTimeMultipleCell.swift
...HKAppoint(在港递交预约)/V/YHResignAppointTimeMultipleCell.swift
+0
-0
YHResignAppointTimeSingleCell.swift
...gnHKAppoint(在港递交预约)/V/YHResignAppointTimeSingleCell.swift
+122
-16
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/Resign(续签)/ResignHKAppoint(在港递交预约)/V/YHResignAppointTimeMultipleCell.swift
View file @
aea2e0e4
This diff is collapsed.
Click to expand it.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/Resign(续签)/ResignHKAppoint(在港递交预约)/V/YHResignAppointTimeSingleCell.swift
View file @
aea2e0e4
...
@@ -9,6 +9,12 @@
...
@@ -9,6 +9,12 @@
import
UIKit
import
UIKit
import
AttributedString
import
AttributedString
enum
YHDateCompareResult
:
Int
{
case
same
=
1
case
large
=
2
case
small
=
3
}
class
YHResignAppointTimeSingleCell
:
UITableViewCell
{
class
YHResignAppointTimeSingleCell
:
UITableViewCell
{
static
let
cellReuseIdentifier
=
"YHResignAppointTimeSingleCell"
static
let
cellReuseIdentifier
=
"YHResignAppointTimeSingleCell"
...
@@ -44,11 +50,31 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
...
@@ -44,11 +50,31 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
view
.
clickBlock
=
{
view
.
clickBlock
=
{
[
weak
self
]
in
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
selectDetailDate
(
title
:
"选择在港递交时间"
)
{
self
.
getDateInfo
{
[
weak
self
]
startDate
,
endDate
in
[
weak
self
]
dateStr
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
model
.
ready_to_submit_at
=
"2024-11-04 17:00"
let
view
=
YHRangeDatePickerSheetView2
.
sheetView
()
self
.
refreshBlock
?()
view
.
viewTitle
=
"选择预约在港递交时间"
view
.
minDateStr
=
startDate
view
.
maxDateStr
=
endDate
view
.
block
=
{
[
weak
self
]
(
selectDateStr
,
hourTime
)
in
guard
let
self
=
self
else
{
return
}
let
selectTimeStr
=
"
\(
selectDateStr
)
:
\(
hourTime
)
"
printLog
(
"
\(
selectTimeStr
)
"
)
// 选择在港递交时间
if
self
.
model
.
leave_hk_at
.
isEmpty
{
self
.
model
.
ready_to_submit_at
=
selectTimeStr
}
else
{
if
self
.
compareDates
(
selectTimeStr
,
self
.
model
.
leave_hk_at
)
==
.
large
{
// selectTimeStr > leave_hk_at
YHHUD
.
flash
(
message
:
"预约在港递交时间必须不大于预计离港时间"
)
return
}
self
.
model
.
ready_to_submit_at
=
selectTimeStr
}
self
.
refreshBlock
?()
}
view
.
show
()
//for test hjl
}
}
}
}
return
view
return
view
...
@@ -64,11 +90,33 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
...
@@ -64,11 +90,33 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
view
.
clickBlock
=
{
view
.
clickBlock
=
{
[
weak
self
]
in
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
selectDetailDate
(
title
:
"选择离港时间"
)
{
self
.
getDateInfo
{
[
weak
self
]
startDate
,
endDate
in
[
weak
self
]
dateStr
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
self
.
model
.
leave_hk_at
=
"2024-12-04 17:00"
let
view
=
YHRangeDatePickerSheetView2
.
sheetView
()
self
.
refreshBlock
?()
view
.
viewTitle
=
"选择预计离港时间"
view
.
minDateStr
=
startDate
view
.
maxDateStr
=
endDate
view
.
block
=
{
[
weak
self
]
(
selectDateStr
,
hourTime
)
in
guard
let
self
=
self
else
{
return
}
let
selectTimeStr
=
"
\(
selectDateStr
)
:
\(
hourTime
)
"
printLog
(
"
\(
selectTimeStr
)
"
)
// 选择离港时间
if
self
.
model
.
ready_to_submit_at
.
isEmpty
{
self
.
model
.
leave_hk_at
=
selectTimeStr
}
else
{
if
self
.
compareDates
(
selectTimeStr
,
self
.
model
.
ready_to_submit_at
)
==
.
small
{
// selectTimeStr < ready_to_submit_at
YHHUD
.
flash
(
message
:
"预计离港时间预约必须不小于在港递交时间"
)
return
}
self
.
model
.
leave_hk_at
=
selectTimeStr
}
self
.
refreshBlock
?()
}
view
.
show
()
}
}
}
}
return
view
return
view
...
@@ -139,14 +187,6 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
...
@@ -139,14 +187,6 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
self
.
layoutIfNeeded
()
self
.
layoutIfNeeded
()
}
}
func
selectDetailDate
(
title
:
String
,
selectBlock
:((
_
dateStr
:
String
)
->
())?)
{
YHDatePickView
.
show
(
type
:
.
yyyymmdd
,
title
:
title
,
lastIsTaday
:
false
,
currentDay
:
""
)
{
[
weak
self
]
dateStr
in
guard
let
self
=
self
else
{
return
}
selectBlock
?(
dateStr
)
}
}
func
setupUI
()
{
func
setupUI
()
{
self
.
selectionStyle
=
.
none
self
.
selectionStyle
=
.
none
...
@@ -191,4 +231,70 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
...
@@ -191,4 +231,70 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
make
.
bottom
.
equalToSuperview
()
make
.
bottom
.
equalToSuperview
()
}
}
}
}
func
getDateInfo
(
_
result
:
((
_
startTime
:
String
,
_
endTime
:
String
)
->
())?)
{
let
formatter
=
DateFormatter
()
formatter
.
dateFormat
=
"yyyy-MM-dd HH:mm"
var
startTimeStr
=
formatter
.
string
(
from
:
Date
())
var
endTimeStr
=
""
if
let
date
=
formatter
.
date
(
from
:
startTimeStr
)
{
let
endTimeStamp
=
date
.
timeIntervalSince1970
+
(
28.0
*
24.0
*
60.0
*
60.0
)
endTimeStr
=
formatter
.
string
(
from
:
Date
(
timeIntervalSince1970
:
endTimeStamp
))
}
if
let
firstUser
=
self
.
model
.
users
.
first
{
if
!
firstUser
.
stay_deadline_start
.
isEmpty
{
// 服务器起始时间不为空
startTimeStr
=
firstUser
.
stay_deadline_start
}
if
!
firstUser
.
stay_deadline
.
isEmpty
{
// 服务器结束时间不为空
endTimeStr
=
firstUser
.
stay_deadline
}
else
{
// 结束时间为空 则设置为开始时间后的28天
// 将字符串转换为 Date 对象
if
let
date
=
formatter
.
date
(
from
:
startTimeStr
)
{
let
endTimeStamp
=
date
.
timeIntervalSince1970
+
(
28.0
*
24.0
*
60.0
*
60.0
)
endTimeStr
=
formatter
.
string
(
from
:
Date
(
timeIntervalSince1970
:
endTimeStamp
))
}
}
}
let
duration
=
"START_DATE:
\(
startTimeStr
)
END_DATE:
\(
endTimeStr
)
"
printLog
(
"
\(
duration
)
"
)
YHHUD
.
flash
(
message
:
"
\(
duration
)
"
)
result
?(
startTimeStr
,
endTimeStr
)
}
// dateStr1 >= dateStr2 return true 否则 return false
func
compareDates
(
_
dateStr1
:
String
,
_
dateStr2
:
String
)
->
YHDateCompareResult
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd HH:mm"
let
dateFormatCount
=
dateFormatter
.
dateFormat
.
count
var
dateString1
=
dateStr1
if
dateString1
.
count
>
dateFormatCount
{
dateString1
=
String
(
dateString1
.
prefix
(
dateFormatCount
))
}
var
dateString2
=
dateStr2
if
dateString2
.
count
>
dateFormatCount
{
dateString2
=
String
(
dateString2
.
prefix
(
dateFormatCount
))
}
// 将字符串转换为 Date 对象
guard
let
date1
=
dateFormatter
.
date
(
from
:
dateString1
),
let
date2
=
dateFormatter
.
date
(
from
:
dateString2
)
else
{
print
(
"日期格式错误"
)
YHHUD
.
flash
(
message
:
"日期格式错误"
)
return
.
same
}
// 比较日期
if
date1
<
date2
{
return
.
small
}
else
if
date1
>
date2
{
return
.
large
}
return
.
same
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment