Commit 42988e1c authored by pete谢兆麟's avatar pete谢兆麟

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents 7ac846d3 d95698ae
......@@ -75,6 +75,10 @@
04256E1B2C75C60C00A37BA4 /* YHHKMemberModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E1A2C75C60C00A37BA4 /* YHHKMemberModel.swift */; };
04256E1D2C75C74200A37BA4 /* YHAppointHKResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E1C2C75C74200A37BA4 /* YHAppointHKResultModel.swift */; };
04256E1F2C7618A800A37BA4 /* YHAppointWarmTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E1E2C7618A800A37BA4 /* YHAppointWarmTipsCell.swift */; };
04256E212C76CA7800A37BA4 /* YHActivateHKVisaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E202C76CA7800A37BA4 /* YHActivateHKVisaCell.swift */; };
04256E232C76D22400A37BA4 /* YHAppointItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E222C76D22400A37BA4 /* YHAppointItem.swift */; };
04256E252C76E26100A37BA4 /* YHNoNeedAppointMembersCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E242C76E26100A37BA4 /* YHNoNeedAppointMembersCell.swift */; };
04256E272C77127600A37BA4 /* YHWaitAppointMembersCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04256E262C77127600A37BA4 /* YHWaitAppointMembersCell.swift */; };
0425E63D2BA9345200A5E763 /* YHSchemeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */; };
0425E6402BA9357D00A5E763 /* YHScemeItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0425E63F2BA9357D00A5E763 /* YHScemeItemModel.swift */; };
0425E6422BA95B1B00A5E763 /* YHSchemeTableFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0425E6412BA95B1B00A5E763 /* YHSchemeTableFooterView.swift */; };
......@@ -811,6 +815,10 @@
04256E1A2C75C60C00A37BA4 /* YHHKMemberModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKMemberModel.swift; sourceTree = "<group>"; };
04256E1C2C75C74200A37BA4 /* YHAppointHKResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppointHKResultModel.swift; sourceTree = "<group>"; };
04256E1E2C7618A800A37BA4 /* YHAppointWarmTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppointWarmTipsCell.swift; sourceTree = "<group>"; };
04256E202C76CA7800A37BA4 /* YHActivateHKVisaCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHActivateHKVisaCell.swift; sourceTree = "<group>"; };
04256E222C76D22400A37BA4 /* YHAppointItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAppointItem.swift; sourceTree = "<group>"; };
04256E242C76E26100A37BA4 /* YHNoNeedAppointMembersCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNoNeedAppointMembersCell.swift; sourceTree = "<group>"; };
04256E262C77127600A37BA4 /* YHWaitAppointMembersCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHWaitAppointMembersCell.swift; sourceTree = "<group>"; };
0425E63C2BA9345200A5E763 /* YHSchemeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeTableViewCell.swift; sourceTree = "<group>"; };
0425E63F2BA9357D00A5E763 /* YHScemeItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHScemeItemModel.swift; sourceTree = "<group>"; };
0425E6412BA95B1B00A5E763 /* YHSchemeTableFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSchemeTableFooterView.swift; sourceTree = "<group>"; };
......@@ -1620,6 +1628,7 @@
04256DD92C72D9F800A37BA4 /* M */ = {
isa = PBXGroup;
children = (
04256E222C76D22400A37BA4 /* YHAppointItem.swift */,
04256E1A2C75C60C00A37BA4 /* YHHKMemberModel.swift */,
04256E1C2C75C74200A37BA4 /* YHAppointHKResultModel.swift */,
);
......@@ -1635,6 +1644,9 @@
04256DE52C7310BE00A37BA4 /* YHSelectApplicantGroupCell.swift */,
04256DE72C7314B500A37BA4 /* YHSelectApplicantCell.swift */,
04256DED2C73338200A37BA4 /* YHGrabNumberListCell.swift */,
04256E202C76CA7800A37BA4 /* YHActivateHKVisaCell.swift */,
04256E242C76E26100A37BA4 /* YHNoNeedAppointMembersCell.swift */,
04256E262C77127600A37BA4 /* YHWaitAppointMembersCell.swift */,
04256DF12C734E7E00A37BA4 /* YHGrabFileCell.swift */,
04256DF52C736A0800A37BA4 /* YHServiceItemCell.swift */,
04256DE32C72E3FA00A37BA4 /* YHInfoItemOptionView.swift */,
......@@ -4484,6 +4496,7 @@
A5ACE9402B4564F7002C94D2 /* String+Extension.swift in Sources */,
045EEEE42B9F171A0022A143 /* YHMySignatureDetailModel.swift in Sources */,
A5EB6C722C69FB9A0081FB6C /* YHOffivialApprovalGuildLineCheckView.swift in Sources */,
04256E272C77127600A37BA4 /* YHWaitAppointMembersCell.swift in Sources */,
047AA3D72C4A4399009C4554 /* YHInvitationWithGiftsShareView.swift in Sources */,
A58A8C8F2BA6978100632765 /* YHMineCertificateEntryViewController.swift in Sources */,
045EEF1B2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift in Sources */,
......@@ -4606,6 +4619,8 @@
045EEEF42B9F171A0022A143 /* YHSpouseBasicInfoVC.swift in Sources */,
A5FD63C32B63438A00D1D9DA /* YHContactMainItemStatusModel.swift in Sources */,
045EEEEA2B9F171A0022A143 /* YHFamilyInitialInfo.swift in Sources */,
04256E232C76D22400A37BA4 /* YHAppointItem.swift in Sources */,
04256E212C76CA7800A37BA4 /* YHActivateHKVisaCell.swift in Sources */,
043BA8752C241B38006EF02D /* YHAddFriendCardCell.swift in Sources */,
A5C382CF2B5F9A9100C5E65C /* YHServiceCenterMainViewModel.swift in Sources */,
045EEEA52B9F171A0022A143 /* YHImageViewController.swift in Sources */,
......@@ -4687,6 +4702,7 @@
A5F886B62C61F76200B63CF5 /* YHLongtapPictureSheetView.swift in Sources */,
045EEF1C2B9F171A0022A143 /* YHAddressPresentAnimated.swift in Sources */,
04E86E0D2B70D51D00A35F4B /* YHWebViewViewController.swift in Sources */,
04256E252C76E26100A37BA4 /* YHNoNeedAppointMembersCell.swift in Sources */,
A5EF21312BA6DF94005027E6 /* YHMineSchemeViewController.swift in Sources */,
045EEE872B9F171A0022A143 /* YHPreviewControllerHoldViewController.swift in Sources */,
0419A0A22C49099A00A5FCFA /* YHInvitationWithGiftsShareBottomView.swift in Sources */,
......
......@@ -12,9 +12,20 @@ class YHCertificateAppointViewController: YHBaseViewController {
var orderId: Int = 0
var items = ["", "", "", ""]
var items: [YHAppointItem] = []
// 无需预约办证人员
var noNeedAppointMembers:[YHHKMemberModel] = []
// 需要办证人员
var waitAppointMembers:[YHHKMemberModel] = []
let viewModel = YHCerAppointViewModel()
// 是否赴港办证
var isNeedGoHK: Int = 2 // 0不需要 1需要赴港 2没有选择
// 有没有预约人员
var reservationToHK: Int = 0 // 0没有预约 1已经预約
// 申请人是否统一赴港激活签证
var isAllMembersGo: Bool = true // 默认一起去
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 16.0
......@@ -31,6 +42,9 @@ class YHCertificateAppointViewController: YHBaseViewController {
tableView.register(YHSelectApplicantGroupCell.self, forCellReuseIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier)
tableView.register(YHAppointWarmTipsCell.self, forCellReuseIdentifier: YHAppointWarmTipsCell.cellReuseIdentifier)
tableView.register(YHGrabNumberListCell.self, forCellReuseIdentifier: YHGrabNumberListCell.cellReuseIdentifier)
tableView.register(YHActivateHKVisaCell.self, forCellReuseIdentifier: YHActivateHKVisaCell.cellReuseIdentifier)
tableView.register(YHNoNeedAppointMembersCell.self, forCellReuseIdentifier: YHNoNeedAppointMembersCell.cellReuseIdentifier)
tableView.register(YHWaitAppointMembersCell.self, forCellReuseIdentifier: YHWaitAppointMembersCell.cellReuseIdentifier)
return tableView
}()
......@@ -52,7 +66,58 @@ class YHCertificateAppointViewController: YHBaseViewController {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
}
self.requetIsGoToHK()
self.requetIsGoToHK {
self.requetAppointMembers {
self.updateData()
}
}
}
func updateData() {
items.removeAll()
// *赴港办证
let item1 = YHAppointItem(type: .goHKMakeCertificate)
items.append(item1)
if self.isNeedGoHK != 1 { // 是否赴港办证没有选择是
self.tableView.reloadData()
return
}
// 赴港办证选择了是
// *温馨提示
let item2 = YHAppointItem(type: .warmTips)
items.append(item2)
// *无需预约办证成员(未满11岁)
if self.noNeedAppointMembers.count > 0 {
let item3 = YHAppointItem(type: .noNeedMakeCertificateMembers)
items.append(item3)
}
if self.reservationToHK == 0 { // 没有预约过人员
// 赴港激活签证 申请人是否统一赴港激活签证
let item4 = YHAppointItem(type: .activeVisa)
items.append(item4)
if self.isAllMembersGo { // 申请人统一赴港激活签证
} else { // 申请人不是统一赴港激活签证
}
} else { // 有预约过的人员
if waitAppointMembers.count > 0 {
let item5 = YHAppointItem(type: .needReAppointMembers)
items.append(item5)
}
}
self.tableView.reloadData()
}
}
......@@ -64,7 +129,12 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
if 0 <= indexPath.row, indexPath.row < items.count {
let item = items[indexPath.row]
if item.type == .goHKMakeCertificate {
// 赴港办证
let cell = tableView.dequeueReusableCell(withIdentifier: YHCertificateAppointOptionCell.cellReuseIdentifier, for: indexPath) as! YHCertificateAppointOptionCell
// 此处btnIndex 是从左到右按钮的index从0算起
// 按钮排序如下 [是0,否1]
......@@ -81,35 +151,65 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
guard let self = self else { return }
// 此处index表示第index个按钮
let isNeedHK = (index == 0)
YHHUD.show(.progress(message: "加载中..."))
self.saveNeedGoToHK(isNeed: isNeedHK) {
[weak self] success in
YHHUD.hide()
guard let self = self else { return }
if success {
self.isNeedGoHK = isNeedHK ? 1 : 0
}
self.tableView.reloadData()
self.updateData()
}
}
if self.reservationToHK == 1 { // 已经预约过
// 是否赴港办证不能点击否 index 0是是按钮 1是否按钮
cell.disableBtn(index: 1)
}
return cell
}
if item.type == .warmTips {
// 温馨提示
let cell = tableView.dequeueReusableCell(withIdentifier: YHAppointWarmTipsCell.cellReuseIdentifier, for: indexPath) as! YHAppointWarmTipsCell
return cell
}
if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantGroupCell
if item.type == .noNeedMakeCertificateMembers {
// 无需预约办证成员(未满11岁)
let cell = tableView.dequeueReusableCell(withIdentifier: YHNoNeedAppointMembersCell.cellReuseIdentifier, for: indexPath) as! YHNoNeedAppointMembersCell
cell.members = noNeedAppointMembers
return cell
}
if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHAppointWarmTipsCell.cellReuseIdentifier, for: indexPath) as! YHAppointWarmTipsCell
if item.type == .activeVisa {
// 赴港激活签证
let cell = tableView.dequeueReusableCell(withIdentifier: YHActivateHKVisaCell.cellReuseIdentifier, for: indexPath) as! YHActivateHKVisaCell
return cell
}
if item.type == .needReAppointMembers {
// 待预约赴港成员
let cell = tableView.dequeueReusableCell(withIdentifier: YHWaitAppointMembersCell.cellReuseIdentifier, for: indexPath) as! YHWaitAppointMembersCell
cell.members = waitAppointMembers
return cell
}
if item.type == .confirmGoHKInfo {
// 请您确认第X批赴港信息
let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectApplicantGroupCell.cellReuseIdentifier, for: indexPath) as! YHSelectApplicantGroupCell
return cell
}
if item.type == .grabingNumberBatch {
// 赴港办理抢号中批次
let cell = tableView.dequeueReusableCell(withIdentifier: YHGrabNumberListCell.cellReuseIdentifier, for: indexPath) as! YHGrabNumberListCell
return cell
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
......@@ -155,12 +255,13 @@ extension YHCertificateAppointViewController: UITableViewDelegate, UITableViewDa
extension YHCertificateAppointViewController {
func requetIsGoToHK() {
func requetIsGoToHK(completion:(()->())?) {
viewModel.getIsNeedGoToHK(orderId: orderId) {
[weak self] needGoHK in
[weak self] needGoHK, reservationToHK in
guard let self = self else { return }
self.isNeedGoHK = needGoHK
self.tableView.reloadData()
self.reservationToHK = reservationToHK
completion?()
}
}
......@@ -168,8 +269,38 @@ extension YHCertificateAppointViewController {
YHHUD.show(.progress(message: "加载中..."))
viewModel.saveNeedGoHK(orderId: orderId, need: isNeed) {
success in
YHHUD.hide()
callback?(success)
}
}
func requetAppointMembers(completion:(()->())?) {
YHHUD.show(.progress(message: "加载中..."))
viewModel.getGoHKFamilyMembers(orderId: orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
let users = self.viewModel.hkUsers
noNeedAppointMembers.removeAll()
waitAppointMembers.removeAll()
for user in users {
if user.isAtLeast11Years() {
waitAppointMembers.append(user)
} else {
noNeedAppointMembers.append(user)
}
}
let item1 = YHHKMemberModel()
item1.name = "艾师傅"
let item2 = YHHKMemberModel()
item2.name = "艾傅"
waitAppointMembers.append(contentsOf: [item1, item2])
completion?()
}
}
}
//
// YHAppointItem.swift
// galaxy
//
// Created by edy on 2024/8/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHAppointItemType: Int {
case none = 0
// 赴港办证
case goHKMakeCertificate = 1
// 温馨提示
case warmTips = 2
// 无需预约办证成员(未满11岁)
case noNeedMakeCertificateMembers = 3
// 赴港激活签证
case activeVisa = 4
// 请您确认第一批赴港信息
case confirmGoHKInfo = 5
// 待预约赴港成员
case needReAppointMembers = 6
// 赴港办理抢号中批次
case grabingNumberBatch = 7
// 赴港办理已抢号批次
case haveGrabedNumberBatch = 8
}
class YHAppointItem: NSObject {
var type: YHAppointItemType = .none
init(type: YHAppointItemType) {
self.type = type
}
}
......@@ -45,6 +45,63 @@ class YHHKMemberModel: SmartCodable {
self.url = url
self.approvalDate = approvalDate
}
func isAtLeast11Years() -> Bool {
return self._isAtLeast11Years(from: self.birthday)
}
func getAgeAndMonth() -> String {
return self._getAgeAndMonths(from: self.birthday)
}
private func _isAtLeast11Years(from birthDateString: String) -> Bool {
// 1. 将生日字符串转换为 Date 对象
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
guard let birthDate = dateFormatter.date(from: birthDateString) else {
return false
}
// 2. 计算当前日期和生日之间的年龄差
let currentDate = Date()
let calendar = Calendar.current
let ageComponents = calendar.dateComponents([.year], from: birthDate, to: currentDate)
guard let age = ageComponents.year else {
return false
}
// 3. 判断年龄是否大于或等于 11 岁
return age >= 11
}
// 返回X岁Y个月
func _getAgeAndMonths(from birthDateString: String) -> String {
// 1. 将生日字符串转换为 Date 对象
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
guard let birthDate = dateFormatter.date(from: birthDateString) else {
return "0岁"
}
// 2. 计算当前日期和生日之间的年龄差和月龄差
let currentDate = Date()
let calendar = Calendar.current
let dateComponents = calendar.dateComponents([.year, .month], from: birthDate, to: currentDate)
guard let years = dateComponents.year, let months = dateComponents.month else {
return "0岁"
}
var text = ""
if years > 0 {
text += "\(years)岁"
}
if months > 0 {
text += "\(months)个月"
}
return text
}
}
//
// YHActivateHKVisaCell.swift
// galaxy
//
// Created by edy on 2024/8/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import AttributedString
class YHActivateHKVisaCell: UITableViewCell {
static let cellReuseIdentifier = "YHActivateHKVisaCell"
// 此处index 是按钮从左到右由0开始
var selectIndex = -1 {
didSet {
optionView.selectIndex = selectIndex
}
}
var selectBlock:((Int)->())?
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
let a: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor))
let b: ASAttributedString = .init("赴港激活签证", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
label.attributed.text = a+b
return label
}()
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var optionView: YHInfoItemOptionView = {
let view = YHInfoItemOptionView(frame: .zero)
view.title = "申请人是否统一赴港激活签证"
view.options = ["是", "否"]
view.selectIndex = 0
view.selectBlock = {
[weak self] index in
guard let self = self else { return }
self.selectBlock?(index)
}
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(lineView)
whiteContentView.addSubview(optionView)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(18)
make.right.equalTo(-18)
}
lineView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.left.right.equalToSuperview()
make.height.equalTo(0.5)
}
optionView.snp.makeConstraints { make in
make.top.equalTo(lineView.snp.bottom).offset(0)
make.left.equalTo(18)
make.right.equalTo(0)
make.bottom.equalTo(0)
}
}
}
......@@ -27,9 +27,11 @@ class YHAppointWarmTipsCell: UITableViewCell {
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(bgImgView)
bgImgView.snp.makeConstraints { make in
make.top.equalTo(16)
......
......@@ -20,6 +20,10 @@ class YHCertificateAppointOptionCell: UITableViewCell {
}
}
func disableBtn(index: Int) {
optionsView.setOptionBtnDisabled(index)
}
var selectBlock:((Int)->())?
lazy var whiteContentView: UIView = {
......@@ -56,7 +60,7 @@ class YHCertificateAppointOptionCell: UITableViewCell {
lazy var optionsView: YHInfoItemOptionView = {
let view = YHInfoItemOptionView(frame: .zero)
view.title = "是否赴港办证"
view.setOptions(["是", "否"])
view.options = ["是", "否"]
view.selectIndex = -1
view.selectBlock = {
[weak self] index in
......
......@@ -18,7 +18,15 @@ class YHInfoItemOptionView: UIView {
let btnHeight = 32.0
let titleMaxWidth = 113.0
let baseBtnTag = 9527
var options: [String] = []
var options: [String] = [] {
didSet {
for (index, text) in options.enumerated() {
if let btn = self.viewWithTag(baseBtnTag + index) as? UIButton {
btn.setTitle(text, for: .normal)
}
}
}
}
var selectBlock:((Int)->())?
var title: String = "" {
......@@ -47,15 +55,6 @@ class YHInfoItemOptionView: UIView {
}
}
func setOptions(_ options:[String]) {
self.options = options
for (index, text) in options.enumerated() {
if let btn = self.viewWithTag(baseBtnTag + index) as? UIButton {
btn.setTitle(text, for: .normal)
}
}
}
var selectIndex: Int = -1 {
didSet {
for (index, _) in options.enumerated() {
......@@ -112,6 +111,14 @@ class YHInfoItemOptionView: UIView {
btn.setTitleColor(isSelect ? UIColor.brandMainColor : UIColor.init(hex: 0x222222), for: .normal)
}
func setOptionBtnDisabled(_ index: Int) {
if let btn = self.viewWithTag(baseBtnTag + index) as? UIButton {
setOptionBtnSelected(btn: btn, isSelect:false)
btn.isEnabled = false
btn.setTitleColor(.mainTextColor(alpha: 0.18), for: .normal)
}
}
override init(frame: CGRect) {
super.init(frame: frame)
createUI()
......
//
// YHNoNeedAppointMembersCell.swift
// galaxy
//
// Created by edy on 2024/8/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHNoNeedAppointMembersCell: UITableViewCell {
static let cellReuseIdentifier = "YHNoNeedAppointMembersCell"
var members:[YHHKMemberModel] = [] {
didSet {
var text = ""
for (index, user) in members.enumerated() {
text += "\(user.name) (\(user.getAgeAndMonth()))"
if index != members.count-1 {
text += "、"
}
}
detailLabel.text = text
}
}
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = .mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14)
label.text = "无需预约办证成员(未满11岁)"
return label
}()
lazy var detailLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = .mainTextColor(alpha: 0.7)
label.font = UIFont.PFSC_R(ofSize: 14)
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(detailLabel)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(18)
make.right.equalTo(-18)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(8)
make.left.equalTo(18)
make.right.equalTo(-18)
make.bottom.equalTo(-16)
}
}
}
......@@ -87,7 +87,7 @@ class YHSelectApplicantGroupCell: UITableViewCell {
let view = YHInfoItemOptionView(frame: .zero)
view.titleGap = 22.0
view.title = "赴港办证时间"
view.setOptions(["具体日期", "具体时段"])
view.options = ["具体日期", "具体时段"]
view.selectIndex = 0
view.selectBlock = {
index in
......
//
// YHWaitAppointMembersCell.swift
// galaxy
//
// Created by edy on 2024/8/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHWaitAppointMembersCell: UITableViewCell {
static let cellReuseIdentifier = "YHWaitAppointMembersCell"
var members:[YHHKMemberModel] = [] {
didSet {
var text = ""
for (index, user) in members.enumerated() {
text += "\(user.name)"
if index != members.count-1 {
text += "、"
}
}
detailLabel.text = text
}
}
lazy var whiteContentView: UIView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius6
return view
}()
lazy var titleLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = .mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14)
label.text = "待预约赴港成员"
return label
}()
lazy var lineView: UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var detailLabel: UILabel = {
let label = UILabel()
label.numberOfLines = 0
label.textColor = .mainTextColor(alpha: 0.7)
label.font = UIFont.PFSC_R(ofSize: 14)
return label
}()
lazy var bottomBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .brandMainColor
btn.setTitle("去预约", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = .PFSC_M(ofSize: 14)
btn.layer.cornerRadius = 4.0
btn.addTarget(self, action: #selector(didBottomBtnClicked), for: .touchUpInside)
return btn
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
@objc func didBottomBtnClicked() {
}
func setupUI() {
self.selectionStyle = .none
self.backgroundColor = .clear
self.contentView.backgroundColor = .clear
contentView.addSubview(whiteContentView)
whiteContentView.addSubview(titleLabel)
whiteContentView.addSubview(detailLabel)
whiteContentView.addSubview(bottomBtn)
whiteContentView.addSubview(lineView)
whiteContentView.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(0)
}
titleLabel.snp.makeConstraints { make in
make.top.equalTo(16)
make.left.equalTo(18)
make.right.equalTo(-18)
}
lineView.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.left.equalTo(0)
make.right.equalTo(0)
make.height.equalTo(0.5)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(lineView.snp.bottom).offset(16)
make.left.equalTo(18)
make.right.equalTo(-18)
}
bottomBtn.snp.makeConstraints { make in
make.top.equalTo(detailLabel.snp.bottom).offset(16)
make.left.equalTo(18)
make.right.equalTo(-18)
make.height.equalTo(45)
make.bottom.equalTo(-16)
}
}
}
......@@ -123,9 +123,8 @@ class YHCerAppointViewModel: NSObject {
}
// 是否需要赴港
func getIsNeedGoToHK(orderId: Int, callback:((_ needGoHK: Int)->())?) {
func getIsNeedGoToHK(orderId: Int, callback:((_ needGoHK: Int, _ reservationToHK: Int)->())?) {
// 1需要赴港 0不需要 2没有选择
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.AppointHK.isNeedGoHK
let _ = YHNetRequest.getRequest(url: strUrl,params: ["order_id" : orderId]) {
......@@ -135,21 +134,31 @@ class YHCerAppointViewModel: NSObject {
printLog("model 是 ==> \(json)")
if json.code == 200 {
// is_need_to_hk 1需要赴港 0不需要 2没有选择
// reservation_to_hk 0没有预约 1已经预約
var isNeedGoHK = 2
var reserveToHK = 0
if let dic = json.data as? [String:Any] {
if let needGoHK = dic["is_need_to_hk"] as? Int {
isNeedGoHK = needGoHK
}
if let dic = json.data as? [String:Any], let needGoHK = dic["is_need_to_hk"] as? Int {
callback?(needGoHK)
if let reservationToHK = dic["reservation_to_hk"] as? Int {
reserveToHK = reservationToHK
}
callback?(isNeedGoHK, reserveToHK)
} else {
callback?(2)
callback?(2, 0)
}
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(2)
callback?(2, 0)
}
} failBlock: { err in
callback?(2)
callback?(2, 0)
}
}
......
......@@ -352,7 +352,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
// }
let vc = YHCertificateAppointViewController()
vc.orderId = 151085
vc.orderId = 151090
self.navigationController?.pushViewController(vc)
return
}
......
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