Commit 050d98a7 authored by Steven杜宇's avatar Steven杜宇

// 预约

parent ccc88569
......@@ -199,6 +199,9 @@ class YHServiceOrderListView: YHBaseViewController {
} else if type == 34 {
//在港递交预约
let vc = YHResignAppointContainerViewController()
vc.renewalId = stepId
UIViewController.current?.navigationController?.pushViewController(vc)
} else if type == 35 {
//查看续签结果
......
......@@ -46,7 +46,8 @@ class YHResignAppointContainerViewController: YHBaseViewController {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if self.viewModel.appointInfoListModel.renewal_List.count <= 0 { // 没有预约过
var isNotAppointed = self.viewModel.scheduleInfoList.renewal_List.count <= 0
if isNotAppointed { // 没有预约过
// 请求预约人员列表
YHHUD.show(.progress(message: "加载中..."))
self.viewModel.getResignAppointUserlist(renewalId: self.renewalId) {
......@@ -60,6 +61,7 @@ class YHResignAppointContainerViewController: YHBaseViewController {
}
} else { // 预约过
self.scheduleVC.scheduleArr = self.viewModel.scheduleInfoList.renewal_List
self.scheduleVC.view.isHidden = false
self.appointVC.view.isHidden = true
}
......
......@@ -11,7 +11,18 @@ import UIKit
class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
var renewalId: Int = 0
var familyArr: [String] = ["", "", "", "", ""]
var scheduleArr: [YHResignAppointGroup] = [] {
didSet {
self.tableView.reloadData()
}
}
var isTogether: Bool {
get {
return true
// return scheduleArr.count <= 1
}
}
lazy var tableView: UITableView = {
let tableView = UITableView(frame: CGRect.zero, style:.grouped)
......@@ -33,20 +44,20 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
return tableView
}()
lazy var tipsBtn: UIButton = {
lazy var guideBtn: UIButton = {
let button = UIButton()
button.setTitle("递交提示", for: .normal)
button.setTitle("在港递交指引", for: .normal)
button.titleLabel?.font = .PFSC_R(ofSize: 11)
button.setTitleColor(UIColor.mainTextColor, for: .normal)
button.setImage(UIImage(named: "resign_appoint_tips_btn"), for: .normal)
button.setImage(UIImage(named: "resign_appint_guide"), for: .normal)
button.centerTextAndImage(imageAboveText: true, spacing: 0.0)
return button
}()
lazy var submitBtn: UIButton = {
lazy var nextBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.setTitle("确认提交", for: .normal)
btn.setTitle("下一步,去查看递交凭证", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
btn.addTarget(self, action: #selector(didSubmitBtnClicked), for: .touchUpInside)
......@@ -57,16 +68,16 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(tipsBtn)
view.addSubview(submitBtn)
tipsBtn.snp.makeConstraints { make in
make.left.equalTo(22)
make.width.equalTo(44)
make.height.equalTo(48)
make.centerY.equalTo(submitBtn)
view.addSubview(guideBtn)
view.addSubview(nextBtn)
guideBtn.snp.makeConstraints { make in
make.left.equalTo(20)
make.width.equalTo(66)
make.height.equalTo(41)
make.centerY.equalTo(nextBtn)
}
submitBtn.snp.makeConstraints { make in
make.left.equalTo(tipsBtn.snp.right).offset(22)
nextBtn.snp.makeConstraints { make in
make.left.equalTo(guideBtn.snp.right).offset(20)
make.right.equalTo(-20)
make.top.equalTo(8)
make.height.equalTo(48)
......@@ -102,21 +113,24 @@ class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return familyArr.count
return scheduleArr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedSingleInfoCell
if 0 <= indexPath.row && indexPath.row < familyArr.count {
if indexPath.row == 4 {
let cell1 = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedMultipleInfoCell
return cell1
if 0 <= indexPath.row && indexPath.row < scheduleArr.count {
let model = scheduleArr[indexPath.row]
if isTogether {
let cell = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedSingleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedSingleInfoCell
cell.updateModel(model)
return cell
}
// 分组
let cell2 = tableView.dequeueReusableCell(withIdentifier: YHResignHaveAppointedMultipleInfoCell.cellReuseIdentifier, for: indexPath) as! YHResignHaveAppointedMultipleInfoCell
return cell2
}
return cell
let defaultCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return defaultCell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......@@ -125,9 +139,8 @@ extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITa
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.row && indexPath.row < familyArr.count {
let model = familyArr[indexPath.row]
if 0 <= indexPath.row && indexPath.row < scheduleArr.count {
let model = scheduleArr[indexPath.row]
}
}
......@@ -136,7 +149,7 @@ extension YHResignAppointSubmitScheduleViewController: UITableViewDelegate, UITa
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 16
return 0.1
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
......@@ -299,7 +299,7 @@ class YHResignAppointTimeViewController: YHBaseViewController {
}
}
var param: [String : Any] = ["renewal_id" : renewalId,
let param: [String : Any] = ["renewal_id" : renewalId,
"is_together" : self.togetherSetting.is_together,
"batch" : batchs]
printLog(param)
......
......@@ -26,9 +26,9 @@ class YHResignAppointedScheduleLineView: UIView {
var steps:[YHScheduleLineStepModel] = {
let model1 = YHScheduleLineStepModel(title: "入境香港准备", time: "")
let model2 = YHScheduleLineStepModel(title: "已确认在港", time: "2024-03-14")
let model3 = YHScheduleLineStepModel(title: "银河递交续签资料", time: "2024-03-14", isNeedUserAction: false)
let model4 = YHScheduleLineStepModel(title: "查看递交回执", time: "2024-03-14")
let model2 = YHScheduleLineStepModel(title: "已确认在港", time: "")
let model3 = YHScheduleLineStepModel(title: "银河递交续签资料", time: "", isNeedUserAction: false)
let model4 = YHScheduleLineStepModel(title: "查看递交回执", time: "")
let model5 = YHScheduleLineStepModel(title: "在港等待获批/离港", time: "")
let model6 = YHScheduleLineStepModel(title: "在港等缴费领取新签证", time: "")
let model7 = YHScheduleLineStepModel(title: "更新续签旅行证件", time: "")
......@@ -61,6 +61,26 @@ class YHResignAppointedScheduleLineView: UIView {
createUI()
}
// 已确认在港时间 银河递交续签资料时间 查看递交回执时间
func updateDates(confirmDate: String, submitDate: String, watchDate: String) {
if steps.count >= 2 { // 已确认在港节点
let confirmModel = steps[1]
confirmModel.time = confirmDate
}
if steps.count >= 3 { // 银河递交续签资料节点
let submitModel = steps[2]
submitModel.time = submitDate
}
if steps.count >= 4 { // 查看递交回执节点
let watchModel = steps[3]
watchModel.time = watchDate
}
self.collectView.reloadData()
}
func createUI() {
self.addSubview(collectView)
collectView.reloadData()
......@@ -101,6 +121,18 @@ extension YHResignAppointedScheduleLineView: UICollectionViewDelegate, UICollect
let model = steps[indexPath.item]
model.index = indexPath.item+1
cell.updateModel(model)
if indexPath.item == 0 {
cell.leftDotView.isHidden = true
cell.rightDotView.isHidden = false
} else if indexPath.item == steps.count-1 {
cell.leftDotView.isHidden = false
cell.rightDotView.isHidden = true
} else {
cell.leftDotView.isHidden = false
cell.rightDotView.isHidden = false
}
}
return cell
}
......
......@@ -9,7 +9,7 @@
import UIKit
class YHResignAppointedScheduleSingleItemView: UIView {
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
......@@ -18,17 +18,19 @@ class YHResignAppointedScheduleSingleItemView: UIView {
lazy var applicantNamesLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_M(ofSize: 14)
label.textColor = .mainTextColor
label.text = "申请人:"
return label
}()
lazy var confirmInHKLabel: UILabel = {
lazy var haveConfirmInHKLabel: UILabel = {
let label = UILabel()
label.text = "已确认在港"
label.font = UIFont.PFSC_M(ofSize: 13)
label.textColor = .init(hex: 0x3CC694)
label.isHidden = true
return label
}()
......@@ -39,11 +41,13 @@ class YHResignAppointedScheduleSingleItemView: UIView {
btn.setTitleColor(.white, for: .normal)
btn.setTitle("确认在港", for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 11)
btn.isHidden = true
return btn
}()
lazy var submitTimeLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "预约递交时间: 0000-00-00 00:00"
......@@ -52,6 +56,7 @@ class YHResignAppointedScheduleSingleItemView: UIView {
lazy var confirmHKTimeLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 12)
label.textColor = .mainTextColor(alpha: 0.5)
label.text = "确认在港时间: 0000-00-00 00:00"
......@@ -72,12 +77,114 @@ class YHResignAppointedScheduleSingleItemView: UIView {
fatalError("init(coder:) has not been implemented")
}
func updateModel(_ model: YHResignAppointGroup) {
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
}
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.addSubview(lineView)
self.addSubview(applicantNamesLabel)
self.addSubview(confirmInHKBtn)
self.addSubview(confirmInHKLabel)
self.addSubview(confirmHKTimeLabel)
self.addSubview(haveConfirmInHKLabel)
self.addSubview(submitTimeLabel)
self.addSubview(confirmHKTimeLabel)
self.addSubview(scheduleView)
......@@ -100,7 +207,7 @@ class YHResignAppointedScheduleSingleItemView: UIView {
make.centerY.equalTo(applicantNamesLabel)
}
confirmInHKLabel.snp.makeConstraints { make in
haveConfirmInHKLabel.snp.makeConstraints { make in
make.right.equalTo(-18)
make.top.equalTo(applicantNamesLabel)
make.height.equalTo(18)
......
......@@ -8,6 +8,12 @@
import UIKit
enum YHResignConfirmHKStatus: Int {
case waitConfirmHK = 0 // 待确认在港
case canConfirmHK = 1 // 可点击确认在港
case haveConfirmHK = 2 // 已确认在港
}
class YHResignHaveAppointedSingleInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHResignHaveAppointedSingleInfoCell"
......@@ -50,6 +56,30 @@ class YHResignHaveAppointedSingleInfoCell: UITableViewCell {
setupUI()
}
func updateModel(_ model: YHResignAppointGroup) {
batchView.updateModel(model)
}
// 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 setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
......
......@@ -13,7 +13,7 @@ class YHResignAppointViewModel: NSObject {
// 赴港人员列表
var appointUsers: [YHResignAppointMember] = []
// 预约列表预约
var appointInfoListModel: YHResignAppointListModel = YHResignAppointListModel()
var scheduleInfoList: YHResignAppointListModel = YHResignAppointListModel()
// 赴港人员列表
func getResignAppointUserlist(renewalId: Int, callBack: @escaping (_ success: Bool,_ error: YHErrorModel?)->()) {
......@@ -37,7 +37,6 @@ class YHResignAppointViewModel: NSObject {
} else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
self.appointUsers = []
self.appointUsers = self.getUsers()
callBack(false, error)
}
......@@ -81,16 +80,16 @@ class YHResignAppointViewModel: NSObject {
callBack(false, err)
return
}
self.appointInfoListModel = resultModel
self.scheduleInfoList = resultModel
callBack(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
self.appointInfoListModel = YHResignAppointListModel()
self.scheduleInfoList = YHResignAppointListModel()
callBack(false,err)
}
} failBlock: { err in
self.appointInfoListModel = YHResignAppointListModel()
self.scheduleInfoList = YHResignAppointListModel()
callBack(false,err)
}
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon-展开@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon-展开@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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