Commit e0aee03d authored by Steven杜宇's avatar Steven杜宇

// 预约

parent d3eb5a36
......@@ -497,7 +497,6 @@
04912F7A2CB7A5F400CC3105 /* YHResignAppointApplicantInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F792CB7A5F400CC3105 /* YHResignAppointApplicantInfoCell.swift */; };
04912F7C2CB7A7EE00CC3105 /* YHResignAppointShowTimeItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F7B2CB7A7EE00CC3105 /* YHResignAppointShowTimeItemView.swift */; };
04912F7E2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F7D2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift */; };
04912F802CB7CC0000CC3105 /* YHResignAppointedScheduleMultipleItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F7F2CB7CC0000CC3105 /* YHResignAppointedScheduleMultipleItemView.swift */; };
04912F822CB7CFAE00CC3105 /* YHResignAppointedScheduleLineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F812CB7CFAE00CC3105 /* YHResignAppointedScheduleLineView.swift */; };
04912F842CB7D14D00CC3105 /* YHResignAppointedScheduleLineCollectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F832CB7D14D00CC3105 /* YHResignAppointedScheduleLineCollectCell.swift */; };
04912F862CB7EF6200CC3105 /* YHResignHaveAppointedMultipleInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04912F852CB7EF6100CC3105 /* YHResignHaveAppointedMultipleInfoCell.swift */; };
......@@ -1436,7 +1435,6 @@
04912F792CB7A5F400CC3105 /* YHResignAppointApplicantInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointApplicantInfoCell.swift; sourceTree = "<group>"; };
04912F7B2CB7A7EE00CC3105 /* YHResignAppointShowTimeItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointShowTimeItemView.swift; sourceTree = "<group>"; };
04912F7D2CB7B2BA00CC3105 /* YHResignAppointOptionResultCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointOptionResultCell.swift; sourceTree = "<group>"; };
04912F7F2CB7CC0000CC3105 /* YHResignAppointedScheduleMultipleItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointedScheduleMultipleItemView.swift; sourceTree = "<group>"; };
04912F812CB7CFAE00CC3105 /* YHResignAppointedScheduleLineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointedScheduleLineView.swift; sourceTree = "<group>"; };
04912F832CB7D14D00CC3105 /* YHResignAppointedScheduleLineCollectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignAppointedScheduleLineCollectCell.swift; sourceTree = "<group>"; };
04912F852CB7EF6100CC3105 /* YHResignHaveAppointedMultipleInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignHaveAppointedMultipleInfoCell.swift; sourceTree = "<group>"; };
......@@ -3564,7 +3562,6 @@
04912F732CB7743900CC3105 /* YHResignAppointSelectTimeItemView.swift */,
04912F7B2CB7A7EE00CC3105 /* YHResignAppointShowTimeItemView.swift */,
04912F752CB77F4500CC3105 /* YHResignLeaveHKSwitchItemView.swift */,
04912F7F2CB7CC0000CC3105 /* YHResignAppointedScheduleMultipleItemView.swift */,
04912F872CB8FF3000CC3105 /* YHResignAppointedScheduleSingleItemView.swift */,
04912F812CB7CFAE00CC3105 /* YHResignAppointedScheduleLineView.swift */,
04F4A5292CB8D5FA0026D469 /* YHForwardArriveHKAlertView.swift */,
......@@ -5279,7 +5276,6 @@
04CA2BEC2CB7740000F36DE7 /* YHResignUploadTravelCardListfootView.swift in Sources */,
A5ACE9362B4564F7002C94D2 /* YHNetworkStatusManager.swift in Sources */,
048787D52BCE880B0036E221 /* YHServiceOrderListViewController.swift in Sources */,
04912F802CB7CC0000CC3105 /* YHResignAppointedScheduleMultipleItemView.swift in Sources */,
0431F8842C9579F7003B84F4 /* YHResignTemplateSheetView.swift in Sources */,
A5D0012A2BABC84A001F003C /* YHFileListHeaerView.swift in Sources */,
0430E68C2C786257000511E2 /* YHAdopterIncomeViewModel.swift in Sources */,
......
......@@ -11,6 +11,7 @@ import UIKit
class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
var renewalId: Int = 0
let viewModel = YHResignAppointViewModel()
var scheduleArr: [YHResignAppointGroup] = [] {
didSet {
self.tableView.reloadData()
......@@ -19,8 +20,7 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
var isTogether: Bool {
get {
return true
// return scheduleArr.count <= 1
return scheduleArr.count <= 1
}
}
......@@ -30,7 +30,7 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
tableView.sectionHeaderTopPadding = 0.0
}
tableView.estimatedSectionHeaderHeight = 0.1
tableView.estimatedSectionFooterHeight = 16.0
tableView.estimatedSectionFooterHeight = 0.1
tableView.contentInsetAdjustmentBehavior = .never
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
......@@ -108,6 +108,24 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
@objc func didSubmitBtnClicked() {
}
func clickConfirmHKButton(status: YHResignConfirmHKStatus) {
if status == .waitConfirmHK { // 待确认在港
// 展示提前到港弹窗
let alert = YHForwardArriveHKAlertView.alertView()
alert.confirmBlock = {
[weak self] isConfirm in
guard let self = self else { return }
if isConfirm {
// 去修改预约递交时间
}
}
alert.show()
} else if status == .canConfirmHK { // 可点击确认在港
}
}
}
extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITableViewDataSource {
......@@ -123,10 +141,22 @@ extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITa
if isTogether {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedSingleInfoCell
cell.updateModel(model)
cell.clickConfirmBtnBlock = {
[weak self] status in
guard let self = self else { return }
self.clickConfirmHKButton(status: status)
}
return cell
}
// 分组
let cell2 = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedMultipleInfoCell
model.batchIndex = indexPath.row+1
cell2.updateModel(model)
cell2.clickConfirmBtnBlock = {
[weak self] status in
guard let self = self else { return }
self.clickConfirmHKButton(status: status)
}
return cell2
}
let defaultCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
......@@ -145,7 +175,10 @@ extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITa
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 0.1
if scheduleArr.count <= 1 {
return 0.1
}
return 52.0
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
......@@ -158,7 +191,48 @@ extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITa
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if scheduleArr.count <= 1 {
let view = UIView()
return view
}
let view = UIView()
let whiteContentView = UIView()
view.addSubview(whiteContentView)
let titleLabel = UILabel()
titleLabel.numberOfLines = 0
titleLabel.font = UIFont.PFSC_M(ofSize: 17)
titleLabel.textColor = .mainTextColor
titleLabel.text = "赴港递交已预约"
whiteContentView.addSubview(titleLabel)
let modifyBtn = UIButton()
modifyBtn.setTitle("修改", for: .normal)
modifyBtn.setTitleColor(.brandMainColor, for: .normal)
modifyBtn.titleLabel?.font = .PFSC_M(ofSize: 14)
whiteContentView.addSubview(modifyBtn)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(0)
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(-16)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(18)
make.right.equalTo(-18)
make.height.equalTo(24)
}
modifyBtn.snp.makeConstraints { make in
make.width.equalTo(28)
make.height.equalTo(24)
make.right.equalTo(-18)
make.centerY.equalTo(titleLabel)
}
return view
}
}
......
......@@ -22,7 +22,6 @@ class YHResignAppointTimeViewController: YHBaseViewController {
var togetherArr: [YHResignAppointTogetherSetting] = []
lazy var togetherSetting = {
let model = YHResignAppointTogetherSetting()
// 默认一起递交
model.is_together = 1
return model
}()
......@@ -125,6 +124,7 @@ class YHResignAppointTimeViewController: YHBaseViewController {
selectGroupArr.removeAll()
if isOnyOne { // 只有一个人
self.togetherSetting.is_together = 0
let model1 = YHResignAppointTimeSettingModel()
selectGroupArr.append(model1)
self.tableView.reloadData()
......@@ -132,8 +132,8 @@ class YHResignAppointTimeViewController: YHBaseViewController {
}
// 有多人
// 一起递交数据
togetherArr.append(togetherSetting)
// 默认一起递交数据
togetherArr.append(self.togetherSetting)
// 分组数据
let model1 = YHResignAppointTimeSettingModel()
if self.togetherSetting.is_together == 2 { // 不一起递交 需显示候选人列表
......@@ -299,6 +299,7 @@ class YHResignAppointTimeViewController: YHBaseViewController {
}
}
let param: [String : Any] = ["renewal_id" : renewalId,
"is_together" : self.togetherSetting.is_together,
"batch" : batchs]
......
......@@ -36,6 +36,8 @@ class YHResignAppointGroup: SmartCodable {
var determine_hk_at: String = ""
var actually_submit_at: String = ""
var result_file_at: String = ""
// 自定义 第几批
var batchIndex: Int = 0
required init() {
......
......@@ -42,14 +42,14 @@ class YHResignAppointedScheduleLineView: UIView {
flowLayout.minimumLineSpacing = 0.0
flowLayout.scrollDirection = .horizontal
let collectinoView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectinoView.backgroundColor = .init(hex: 0xF8F9FB)
collectinoView.register(YHResignAppointedScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignAppointedScheduleLineCollectCell.cellReuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.bounces = false
collectinoView.showsHorizontalScrollIndicator = false
return collectinoView
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
collectionView.backgroundColor = .clear
collectionView.register(YHResignAppointedScheduleLineCollectCell.self, forCellWithReuseIdentifier:YHResignAppointedScheduleLineCollectCell.cellReuseIdentifier)
collectionView.delegate = self
collectionView.dataSource = self
collectionView.bounces = false
collectionView.showsHorizontalScrollIndicator = false
return collectionView
}()
required init?(coder: NSCoder) {
......@@ -82,10 +82,13 @@ class YHResignAppointedScheduleLineView: UIView {
}
func createUI() {
self.backgroundColor = .init(hex: 0xF8F9FB)
self.addSubview(collectView)
collectView.reloadData()
collectView.snp.makeConstraints { make in
make.edges.equalToSuperview()
make.left.equalTo(9)
make.right.equalTo(-9)
make.top.bottom.equalToSuperview()
}
}
}
......
//
// YHResignAppointedScheduleItemView.swift
// galaxy
//
// Created by edy on 2024/10/10.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignAppointedScheduleMultipleItemView: UIView {
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var markView:UIView = {
let view = UIView()
view.backgroundColor = .brandMainColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = .mainTextColor
label.text = "第X批"
return label
}()
lazy var confirmInHKLabel: UILabel = {
let label = UILabel()
label.text = "已确认在港"
label.font = UIFont.PFSC_M(ofSize: 13)
label.textColor = .init(hex: 0x3CC694)
return label
}()
lazy var confirmInHKBtn: UIButton = {
let btn = UIButton()
btn.layer.cornerRadius = 2.0
btn.backgroundColor = .brandMainColor
btn.setTitleColor(.white, for: .normal)
btn.setTitle("确认在港", for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 11)
return btn
}()
lazy var applicantNamesLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = .mainTextColor
label.text = "申请人:"
return label
}()
lazy var submitTimeLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "预约递交时间: 0000-00-00 00:00"
return label
}()
lazy var confirmHKTimeLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "确认在港时间: 0000-00-00 00:00"
return label
}()
lazy var scheduleView: YHResignAppointedScheduleLineView = {
let view = YHResignAppointedScheduleLineView(frame: .zero)
return view
}()
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createUI() {
self.addSubview(lineView)
self.addSubview(markView)
self.addSubview(titleLabel)
self.addSubview(confirmInHKBtn)
self.addSubview(confirmHKTimeLabel)
self.addSubview(applicantNamesLabel)
self.addSubview(submitTimeLabel)
self.addSubview(confirmHKTimeLabel)
self.addSubview(scheduleView)
lineView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(0.5)
}
markView.snp.makeConstraints { make in
make.width.equalTo(3)
make.height.equalTo(12)
make.left.equalTo(18)
make.centerY.equalTo(titleLabel)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(markView.snp.right).offset(8)
make.height.equalTo(22)
make.top.equalTo(18)
}
confirmInHKBtn.snp.makeConstraints { make in
make.right.equalTo(-18)
make.width.equalTo(68)
make.height.equalTo(28)
make.centerY.equalTo(titleLabel)
}
applicantNamesLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
}
submitTimeLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(applicantNamesLabel.snp.bottom).offset(8)
}
confirmHKTimeLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(submitTimeLabel.snp.bottom).offset(8)
}
scheduleView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(confirmHKTimeLabel.snp.bottom).offset(18)
make.height.equalTo(84.0)
make.bottom.equalTo(-18)
}
}
}
......@@ -10,6 +10,10 @@ import UIKit
class YHResignAppointedScheduleSingleItemView: UIView {
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
var confirmHKStatus: YHResignConfirmHKStatus = .waitConfirmHK
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
......@@ -41,6 +45,7 @@ class YHResignAppointedScheduleSingleItemView: UIView {
btn.setTitleColor(.white, for: .normal)
btn.setTitle("确认在港", for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 11)
btn.addTarget(self, action: #selector(didConfirmInHKBtnClicked), for: .touchUpInside)
btn.isHidden = true
return btn
}()
......@@ -77,6 +82,10 @@ class YHResignAppointedScheduleSingleItemView: UIView {
fatalError("init(coder:) has not been implemented")
}
@objc func didConfirmInHKBtnClicked() {
clickConfirmBtnBlock?(self.confirmHKStatus)
}
func updateModel(_ model: YHResignAppointGroup) {
var names = "申请人:"
for (index, user) in model.user_list.enumerated() {
......@@ -86,8 +95,8 @@ class YHResignAppointedScheduleSingleItemView: UIView {
}
}
applicantNamesLabel.text = names
submitTimeLabel.text = model.ready_to_submit_at
confirmHKTimeLabel.text = model.determine_hk_at
submitTimeLabel.text = "预约递交时间: " + model.ready_to_submit_at
confirmHKTimeLabel.text = "确认在港时间: " + model.determine_hk_at
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
......@@ -103,6 +112,7 @@ class YHResignAppointedScheduleSingleItemView: UIView {
} else {
confirmStatus = !model.determine_hk_at.isEmpty ? .haveConfirmHK : .canConfirmHK
}
self.confirmHKStatus = confirmStatus
haveConfirmInHKLabel.isHidden = (confirmStatus != .haveConfirmHK)
confirmInHKBtn.isHidden = (confirmStatus == .haveConfirmHK)
......@@ -196,7 +206,7 @@ class YHResignAppointedScheduleSingleItemView: UIView {
applicantNamesLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.right.equalTo(-18-71-5)
make.top.equalTo(lineView.snp.bottom).offset(18)
}
......
......@@ -12,108 +12,272 @@ class YHResignHaveAppointedMultipleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedMultipleInfoCell"
lazy var whiteContentView: UIView = {
var confirmHKStatus: YHResignConfirmHKStatus = .waitConfirmHK
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var markView:UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
view.backgroundColor = .brandMainColor
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_M(ofSize: 17)
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = .mainTextColor
label.text = "赴港递交已预约"
label.text = "第X批"
return label
}()
lazy var modifyBtn: UIButton = {
lazy var haveConfirmInHKLabel: UILabel = {
let label = UILabel()
label.text = "已确认在港"
label.font = UIFont.PFSC_M(ofSize: 13)
label.textColor = .init(hex: 0x3CC694)
return label
}()
lazy var confirmInHKBtn: UIButton = {
let btn = UIButton()
btn.setTitle("修改", for: .normal)
btn.setTitleColor(.brandMainColor, for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 14)
btn.layer.cornerRadius = 2.0
btn.backgroundColor = .brandMainColor
btn.setTitleColor(.white, for: .normal)
btn.setTitle("确认在港", for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 11)
btn.addTarget(self, action: #selector(didConfirmInHKBtnClicked), for: .touchUpInside)
return btn
}()
lazy var batchView: UIView = {
let view = UIView()
lazy var applicantNamesLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = .mainTextColor
label.text = "申请人:"
return label
}()
lazy var submitTimeLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "预约递交时间: 0000-00-00 00:00"
return label
}()
lazy var confirmHKTimeLabel: UILabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "确认在港时间: 0000-00-00 00:00"
return label
}()
lazy var scheduleView: YHResignAppointedScheduleLineView = {
let view = YHResignAppointedScheduleLineView(frame: .zero)
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
createUI()
}
@objc func didConfirmInHKBtnClicked() {
clickConfirmBtnBlock?(self.confirmHKStatus)
}
func setupUI() {
func updateModel(_ model: YHResignAppointGroup) {
titleLabel.text = "第\(String.convertNumberToChineseText(model.batchIndex))批"
var names = "申请人:"
for (index, user) in model.user_list.enumerated() {
names += user.name
if index != model.user_list.count-1 {
names += "、"
}
}
applicantNamesLabel.text = names
submitTimeLabel.text = "预约递交时间: " + model.ready_to_submit_at
confirmHKTimeLabel.text = "确认在港时间: " + model.determine_hk_at
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let nowDateString = dateFormatter.string(from: Date())
var confirmStatus = YHResignConfirmHKStatus.waitConfirmHK
// 是否到了预约递交时间
let isArriveSubmitTime = compareDates(model.ready_to_submit_at, nowDateString)
if !isArriveSubmitTime {
// 待确认在港
confirmStatus = .waitConfirmHK
} else {
confirmStatus = !model.determine_hk_at.isEmpty ? .haveConfirmHK : .canConfirmHK
}
self.confirmHKStatus = confirmStatus
haveConfirmInHKLabel.isHidden = (confirmStatus != .haveConfirmHK)
confirmInHKBtn.isHidden = (confirmStatus == .haveConfirmHK)
if confirmStatus == .waitConfirmHK {
confirmInHKBtn.setTitle("待确认在港", for: .normal)
confirmInHKBtn.setTitleColor(.mainTextColor, for: .normal)
confirmInHKBtn.backgroundColor = .init(hex: 0xF4F6FA)
confirmInHKBtn.snp.updateConstraints { make in
make.width.equalTo(71)
}
} else if confirmStatus == .canConfirmHK {
confirmInHKBtn.setTitle("确认在港", for: .normal)
confirmInHKBtn.setTitleColor(.white, for: .normal)
confirmInHKBtn.backgroundColor = .brandMainColor
confirmInHKBtn.snp.updateConstraints { make in
make.width.equalTo(68)
}
}
confirmHKTimeLabel.removeFromSuperview()
confirmHKTimeLabel.snp.removeConstraints()
if confirmStatus == .haveConfirmHK { // 已确认在港 需要显示确认在港时间
self.addSubview(confirmHKTimeLabel)
confirmHKTimeLabel.snp.remakeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(submitTimeLabel.snp.bottom).offset(8)
}
scheduleView.snp.remakeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(confirmHKTimeLabel.snp.bottom).offset(18)
make.height.equalTo(84.0)
make.bottom.equalTo(-18)
}
} else { // 不需要显示确认在港时间
scheduleView.snp.remakeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(submitTimeLabel.snp.bottom).offset(18)
make.height.equalTo(84.0)
make.bottom.equalTo(-18)
}
}
scheduleView.updateDates(confirmDate: model.determine_hk_at, submitDate: model.actually_submit_at, watchDate: model.result_file_at)
self.setNeedsLayout()
self.layoutIfNeeded()
}
// dateString1 是否不小于dateString2
func compareDates(_ dateString1: String, _ dateString2: String) -> Bool {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
// 将字符串转换为 Date 对象
guard let date1 = dateFormatter.date(from: dateString1),
let date2 = dateFormatter.date(from: dateString2) else {
print("日期格式错误")
return false
}
// 比较日期
if date1 < date2 {
print("\(dateString1) 小于 \(dateString2)")
return false
}
return true
}
func createUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(modifyBtn)
whiteContentView.addSubview(batchView)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(0)
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(-16)
self.backgroundColor = .white
self.contentView.backgroundColor = .white
self.contentView.layer.cornerRadius = kCornerRadius6
self.addSubview(lineView)
self.addSubview(markView)
self.addSubview(titleLabel)
self.addSubview(confirmInHKBtn)
self.addSubview(haveConfirmInHKLabel)
self.addSubview(confirmHKTimeLabel)
self.addSubview(applicantNamesLabel)
self.addSubview(submitTimeLabel)
self.addSubview(confirmHKTimeLabel)
self.addSubview(scheduleView)
lineView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(0.5)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
markView.snp.makeConstraints { make in
make.width.equalTo(3)
make.height.equalTo(12)
make.left.equalTo(18)
make.centerY.equalTo(titleLabel)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(markView.snp.right).offset(8)
make.height.equalTo(22)
make.top.equalTo(18)
}
confirmInHKBtn.snp.makeConstraints { make in
make.right.equalTo(-18)
make.height.equalTo(24)
make.width.equalTo(68)
make.height.equalTo(28)
make.centerY.equalTo(titleLabel)
}
modifyBtn.snp.makeConstraints { make in
make.width.equalTo(28)
make.height.equalTo(24)
haveConfirmInHKLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.centerY.equalTo(titleLabel)
make.height.equalTo(18)
}
batchView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
make.bottom.equalTo(0)
make.top.equalTo(titleLabel.snp.bottom).offset(12)
applicantNamesLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(titleLabel.snp.bottom).offset(16)
}
updateUI()
}
func updateUI() {
let arr = ["", ""]
batchView.removeSubviews()
var lastView: YHResignAppointedScheduleMultipleItemView? = nil
for (index, model) in arr.enumerated() {
let itemView = YHResignAppointedScheduleMultipleItemView(frame: .zero)
batchView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(0)
make.right.equalTo(0)
if index == 0 {
make.top.equalTo(0)
} else {
if let lastView = lastView {
make.top.equalTo(lastView.snp.bottom)
}
}
if index == arr.count - 1 {
make.bottom.equalTo(0)
}
lastView = itemView
}
submitTimeLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(applicantNamesLabel.snp.bottom).offset(8)
}
confirmHKTimeLabel.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(submitTimeLabel.snp.bottom).offset(8)
}
scheduleView.snp.makeConstraints { make in
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(confirmHKTimeLabel.snp.bottom).offset(18)
make.height.equalTo(84.0)
make.bottom.equalTo(-18)
}
}
}
......@@ -18,6 +18,8 @@ class YHResignHaveAppointedSingleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedSingleInfoCell"
var clickConfirmBtnBlock: ((YHResignConfirmHKStatus)->())?
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
......@@ -44,6 +46,11 @@ class YHResignHaveAppointedSingleInfoCell: UITableViewCell {
lazy var batchView: YHResignAppointedScheduleSingleItemView = {
let view = YHResignAppointedScheduleSingleItemView(frame: .zero)
view.clickConfirmBtnBlock = {
[weak self] status in
guard let self = self else { return }
self.clickConfirmBtnBlock?(status)
}
return view
}()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment