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

// 预约

parent 61638ff9
...@@ -15,12 +15,14 @@ class YHResignAppointContainerViewController: YHBaseViewController { ...@@ -15,12 +15,14 @@ class YHResignAppointContainerViewController: YHBaseViewController {
lazy var appointVC: YHResignAppointTimeViewController = { lazy var appointVC: YHResignAppointTimeViewController = {
let vc = YHResignAppointTimeViewController() let vc = YHResignAppointTimeViewController()
vc.renewalId = renewalId
vc.view.isHidden = true vc.view.isHidden = true
return vc return vc
}() }()
lazy var scheduleVC: YHResignAppointSubmitScheduleViewController = { lazy var scheduleVC: YHResignAppointSubmitScheduleViewController = {
let vc = YHResignAppointSubmitScheduleViewController() let vc = YHResignAppointSubmitScheduleViewController()
vc.renewalId = renewalId
vc.view.isHidden = true vc.view.isHidden = true
return vc return vc
}() }()
......
...@@ -10,6 +10,7 @@ import UIKit ...@@ -10,6 +10,7 @@ import UIKit
class YHResignAppointSubmitScheduleViewController: YHBaseViewController { class YHResignAppointSubmitScheduleViewController: YHBaseViewController {
var renewalId: Int = 0
var familyArr: [String] = ["", "", "", "", ""] var familyArr: [String] = ["", "", "", "", ""]
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
......
...@@ -12,6 +12,8 @@ import SwifterSwift ...@@ -12,6 +12,8 @@ import SwifterSwift
class YHResignAppointTimeViewController: YHBaseViewController { class YHResignAppointTimeViewController: YHBaseViewController {
var renewalId: Int = 0
// 所有预约人员 // 所有预约人员
var allAppointUsers: [YHResignAppointMember] = [] var allAppointUsers: [YHResignAppointMember] = []
...@@ -243,6 +245,64 @@ class YHResignAppointTimeViewController: YHBaseViewController { ...@@ -243,6 +245,64 @@ class YHResignAppointTimeViewController: YHBaseViewController {
@objc func didSubmitBtnClicked() { @objc func didSubmitBtnClicked() {
// 判断是否有分组没有选择时间
var isNoSelectTime = false
for group in self.selectGroupArr {
group.isClickSubmit = true
var noSeletTime = false
if group.notleaveHK {
noSeletTime = group.ready_to_submit_at.isEmpty
} else {
noSeletTime = (group.ready_to_submit_at.isEmpty && group.leave_hk_at.isEmpty)
}
if noSeletTime {
isNoSelectTime = true
}
}
if isNoSelectTime { // 有分组没有选择时间
self.tableView.reloadData()
return
}
requestSubmit()
}
func requestSubmit() {
var batchs: [[String : Any]] = []
for group in self.selectGroupArr {
group.isClickSubmit = false
if group.users.count <= 0 { // 说明是一起递交
let allUserIds = allAppointUsers.map {
let item = $0
return "\(item.id)"
}
let dict = ["ready_to_submit_at" : group.ready_to_submit_at,
"leave_hk_at" : group.notleaveHK ? group.leave_hk_at : "",
"users" : allUserIds] as! [String : Any]
batchs.append(dict)
} else { // 说明是分批递交
let selectUser = group.users.filter {
let item = $0
return item.isSelected
}
let selectUserIds = selectUser.map {
let item = $0
return "\(item.id)"
}
let dict = ["ready_to_submit_at" : group.ready_to_submit_at,
"leave_hk_at" : group.leave_hk_at,
"users" : selectUserIds] as! [String : Any]
batchs.append(dict)
}
}
var param: [String : Any] = ["renewal_id" : renewalId,
"is_together" : self.togetherSetting.is_together,
"batch" : batchs]
printLog(param)
} }
} }
......
...@@ -16,6 +16,7 @@ class YHResignAppointTimeSettingModel: SmartCodable { ...@@ -16,6 +16,7 @@ class YHResignAppointTimeSettingModel: SmartCodable {
var notleaveHK: Bool = false // 暂不离港 var notleaveHK: Bool = false // 暂不离港
var users: [YHResignAppointMember] = [] var users: [YHResignAppointMember] = []
var itemIndex: Int = 0 // 第几批 var itemIndex: Int = 0 // 第几批
var isClickSubmit: Bool = false
required init() { required init() {
......
...@@ -52,6 +52,7 @@ class YHResignAppointApplicantCell: UICollectionViewCell { ...@@ -52,6 +52,7 @@ class YHResignAppointApplicantCell: UICollectionViewCell {
func updateApplicantInfo(_ applicant: YHResignAppointMember) { func updateApplicantInfo(_ applicant: YHResignAppointMember) {
nameLabel.text = applicant.apply_name nameLabel.text = applicant.apply_name
nameLabel.textColor = applicant.isSelected ? .brandMainColor : .mainTextColor
let imgName = applicant.isSelected ? "login_privacy_agree" : "login_privacy_disagree_glay" let imgName = applicant.isSelected ? "login_privacy_agree" : "login_privacy_disagree_glay"
selectImgView.image = UIImage(named: imgName) selectImgView.image = UIImage(named: imgName)
} }
......
...@@ -31,8 +31,10 @@ class YHResignAppointTimeMultipleCell: UITableViewCell { ...@@ -31,8 +31,10 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
let titleLabel = UILabel(frame: CGRect(x: 18, y: 16, width: KScreenWidth, height: 24.0)) let titleLabel = UILabel(frame: CGRect(x: 18, y: 16, width: KScreenWidth, height: 24.0))
titleLabel.numberOfLines = 0
titleLabel.font = UIFont.PFSC_M(ofSize: 17)
let mustTag: ASAttributedString = .init("* ", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor)) let mustTag: ASAttributedString = .init("* ", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor))
var title: ASAttributedString = .init("请确认第X批递交信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor)) var title: ASAttributedString = .init("请确认第?批递交信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
title = mustTag + title title = mustTag + title
titleLabel.attributed.text = title titleLabel.attributed.text = title
return titleLabel return titleLabel
...@@ -49,7 +51,7 @@ class YHResignAppointTimeMultipleCell: UITableViewCell { ...@@ -49,7 +51,7 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
label.numberOfLines = 0 label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 14) label.font = UIFont.PFSC_R(ofSize: 14)
label.textColor = UIColor.mainTextColor label.textColor = UIColor.mainTextColor
label.text = "选择第X批赴港递交的申请人" label.text = "选择第?批赴港递交的申请人"
return label return label
}() }()
...@@ -137,8 +139,12 @@ class YHResignAppointTimeMultipleCell: UITableViewCell { ...@@ -137,8 +139,12 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
func updateModel(_ model: YHResignAppointTimeSettingModel) { func updateModel(_ model: YHResignAppointTimeSettingModel) {
self.model = model self.model = model
titleLabel.text = "请确认第\(model.itemIndex+1)批赴港递交信息"
subTitleLabel.text = "选择第\(model.itemIndex+1)批赴港递交的申请人" let mustTag: ASAttributedString = .init("* ", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor))
var title: ASAttributedString = .init("请确认第\(String.convertNumberToChineseText(model.itemIndex+1))批赴港递交信息", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
title = mustTag + title
titleLabel.attributed.text = title
subTitleLabel.text = "选择第\(String.convertNumberToChineseText(model.itemIndex+1))批赴港递交的申请人"
self.leaveHKSwithView.switchBtn.setOn(self.model.notleaveHK, animated: false) self.leaveHKSwithView.switchBtn.setOn(self.model.notleaveHK, animated: false)
self.arr.removeAll() self.arr.removeAll()
...@@ -147,6 +153,14 @@ class YHResignAppointTimeMultipleCell: UITableViewCell { ...@@ -147,6 +153,14 @@ class YHResignAppointTimeMultipleCell: UITableViewCell {
// 预计离港时间控件显示逻辑 // 预计离港时间控件显示逻辑
let isHiddenLeaveHKTime = self.model.notleaveHK let isHiddenLeaveHKTime = self.model.notleaveHK
// 时间控件显示
submitTimeItemView.detail = model.ready_to_submit_at
leaveTimeItemView.detail = model.leave_hk_at
// 时间控件红色提示显示
submitTimeItemView.isNeedShowErrorTips = (model.isClickSubmit && model.ready_to_submit_at.isEmpty)
leaveTimeItemView.isNeedShowErrorTips = (model.isClickSubmit && model.leave_hk_at.isEmpty)
leaveTimeItemView.removeFromSuperview() leaveTimeItemView.removeFromSuperview()
leaveTimeItemView.snp.removeConstraints() leaveTimeItemView.snp.removeConstraints()
......
...@@ -86,6 +86,14 @@ class YHResignAppointTimeSingleCell: UITableViewCell { ...@@ -86,6 +86,14 @@ class YHResignAppointTimeSingleCell: UITableViewCell {
self.leaveHKSwithView.switchBtn.setOn(self.model.notleaveHK, animated: false) self.leaveHKSwithView.switchBtn.setOn(self.model.notleaveHK, animated: false)
let isHiddenLeaveHKTime = self.model.notleaveHK let isHiddenLeaveHKTime = self.model.notleaveHK
// 时间控件显示
submitTimeItemView.detail = model.ready_to_submit_at
leaveTimeItemView.detail = model.leave_hk_at
// 时间控件红色提示显示
submitTimeItemView.isNeedShowErrorTips = (model.isClickSubmit && model.ready_to_submit_at.isEmpty)
leaveTimeItemView.isNeedShowErrorTips = (model.isClickSubmit && model.leave_hk_at.isEmpty)
leaveTimeItemView.removeFromSuperview() leaveTimeItemView.removeFromSuperview()
leaveTimeItemView.snp.removeConstraints() leaveTimeItemView.snp.removeConstraints()
......
...@@ -19,6 +19,14 @@ func isEmptyString(_ string: String?) -> Bool { ...@@ -19,6 +19,14 @@ func isEmptyString(_ string: String?) -> Bool {
extension String { extension String {
//阿拉伯数字转文字
static func convertNumberToChineseText(_ number: Int) -> String {
let numberFormatter = NumberFormatter()
numberFormatter.locale = Locale(identifier: "zh_CN")
numberFormatter.numberStyle = .spellOut
return numberFormatter.string(from: NSNumber(value: number)) ?? ""
}
static func hasQueryParameters(urlString: String) -> Bool { static func hasQueryParameters(urlString: String) -> Bool {
if urlString.contains("?") { if urlString.contains("?") {
return true return true
......
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