Commit 6a1e4b75 authored by Steven杜宇's avatar Steven杜宇

// 子女信息

parent 6160004a
This diff is collapsed.
......@@ -11,8 +11,7 @@ import UIKit
class YHChildBasicInfoVC: YHBaseViewController {
var child:YHFamilyMember?
var cardInfo: YHCNIdentityCard?
weak var delegate:YHSpouseInfoVCProtocol?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -23,6 +22,8 @@ class YHChildBasicInfoVC: YHBaseViewController {
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
......@@ -49,11 +50,13 @@ class YHChildBasicInfoVC: YHBaseViewController {
func createUI() {
view.addSubview(tableView);
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-100)
make.top.equalToSuperview().offset(topHeight)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
}
}
......@@ -247,12 +250,19 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0
}
......
//
// YHChildInfoContainerVC.swift
// galaxy
//
// Created by edy on 2024/2/5.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
//@objc protocol YHchildInfoVCProtocol {
//
// @objc optional func updateStepView()
// @objc optional func saveInfo()
//}
class YHChildInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var orderId:Int = 0
var child:YHFamilyMember? {
didSet {
initalInfoVC.child = child
certificateVC.familyMember = child
basicInfoVC.child = child
}
}
var currentIndex = 0 {
didSet {
currentIndex %= self.children.count
stepView.currentIndex = currentIndex
for (i, vc) in self.children.enumerated() {
vc.view.isHidden = (currentIndex != i)
if currentIndex == i {
}
}
}
}
var stepView:YHStepView = {
let step = YHStepView()
return step
}()
var bottomView: YHSaveAndSubmitView = {
return YHSaveAndSubmitView.createView()
}()
let initalInfoVC = YHChildPrimaryInfoVC()
let uploadVC = UIViewController()
let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHChildBasicInfoVC()
override func viewDidLoad() {
super.viewDidLoad()
createUI()
}
func createUI() {
guard child != nil else { return }
initalInfoVC.delegate = self
certificateVC.delegate = self
basicInfoVC.delegate = self
updateStepView()
currentIndex = 0
view.addSubview(stepView)
view.addSubview(bottomView)
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.didClickSubmitBtn()
}
bottomView.saveBlock = {
[weak self] in
guard let self = self else { return }
self.saveInfo()
}
stepView.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.right.equalTo(view)
make.height.equalTo(YHStepView.height)
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.height.equalTo(YHSaveAndSubmitView.height)
}
}
func didClickSubmitBtn() {
currentIndex += 1;
}
func updateStepView() {
guard let child = child else { return }
for vc in self.children {
vc.willMove(toParent: nil)
vc.removeFromParent()
}
if child.isFollow() {
self.addChild(initalInfoVC)
self.addChild(uploadVC)
self.addChild(certificateVC)
self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(certificateVC.view)
self.view.addSubview(uploadVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "证件上传".local, "证件信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
}
} else {
self.addChild(initalInfoVC)
self.addChild(basicInfoVC)
self.view.addSubview(basicInfoVC.view)
self.view.addSubview(initalInfoVC.view)
stepView.dataSource = ["初始信息".local, "基本信息".local]
stepView.block = {[weak self] (index) in
guard let self = self else { return }
print("follow:%d", self.orderId)
}
}
self.view.bringSubviewToFront(stepView)
self.view.bringSubviewToFront(bottomView)
}
}
extension YHChildInfoContainerVC {
func saveInfo() {
guard let child = child else { return }
guard let info = child.toDictionary() else { return }
let dict:[String: Any] = ["orderId":child.orderId,
"relation":child.relationType.rawValue,
"step":child.step,
"next":false,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { [weak self] success, error in
guard let self = self else { return }
if success {
}
}
}
}
......@@ -8,9 +8,10 @@
import UIKit
class YHChildInitialInfoVC: YHBaseViewController {
class YHChildPrimaryInfoVC: YHBaseViewController {
var child:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -21,6 +22,8 @@ class YHChildInitialInfoVC: YHBaseViewController {
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.estimatedSectionHeaderHeight = 14.0
tableView.estimatedSectionFooterHeight = 1.0
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear
tableView.separatorStyle = .none
......@@ -38,36 +41,6 @@ class YHChildInitialInfoVC: YHBaseViewController {
return tableView
}()
lazy var submitBtn:UIButton = {
let btn = UIButton()
btn.setTitle("提交".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor(hexString:"#4388FF")
btn.layer.cornerRadius = 8.0
btn.addTarget(self, action: #selector(didClickSubmitBtn), for: .touchUpInside)
return btn
}()
lazy var saveBtn:UIButton = {
let btn = UIButton()
btn.setTitle("保存", for: .normal)
btn.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
btn.setTitleColor(UIColor(hexString:"#222222"), for: .normal)
btn.backgroundColor = UIColor(hexString:"#F8F9FB")
btn.layer.cornerRadius = 8.0
btn.addTarget(self, action: #selector(didClickSaveBtn), for: .touchUpInside)
return btn
}()
lazy var bottomView:UIView = {
let view = UIView()
view.backgroundColor = .white
view.addSubview(submitBtn)
view.addSubview(saveBtn)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "子女信息填写".local
......@@ -94,16 +67,55 @@ class YHChildInitialInfoVC: YHBaseViewController {
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
let item10 = YHFormDetailItem(type: .nationOrArea)
item10.value = child.nationality
item10.placeHolder = "请选择".local
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let item20 = YHFormDetailItem(type: .isLiveTother)
item20.value = String(child.isLiveTother())
arr2.append(title2)
arr2.append(item20)
if !child.isLiveTother() { // 不同住 才需填写国家/地区
let item21 = YHFormDetailItem(type: .nationOrArea)
item21.value = child.address?.country
item21.placeHolder = "请选择".local
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if let address = child.address {
if let country = address.country, !country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = country.contains("中国".local)
if isLiveInChina {
let item22 = YHFormDetailItem(type: .liveCity)
if let area = address.area {
item22.value = area.joined(separator: "/")
}
item22.placeHolder = "请选择城市".local
arr2.append(item22)
}
let item23 = YHFormDetailItem(type: .detailAddress)
let arr2:[YHFormItemProtocol] = [title2, item20, item21, item22, item23]
item23.value = address.details
item23.placeHolder = (isLiveInChina ? "请填写小区、楼栋、单元室等".local : "请填写国外居住地".local)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(child.isOverSeasOver1Year())
arr2.append(item24)
}
}
}
}
// 港澳通信证
let title3 = YHFormTitleItem(type: .hkAndMacaoPassport)
......@@ -111,43 +123,22 @@ class YHChildInitialInfoVC: YHBaseViewController {
item30.value = String(child.isNeedHandleHKPassPort())
let arr3:[YHFormItemProtocol] = [title3, item30]
items.append(contentsOf:[arr1, arr2, arr3])
}
tableView.reloadData()
}
func createUI() {
view.addSubview(tableView);
view.addSubview(bottomView)
let submitBtnHeight = 48.0
let gap = 8.0
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalTo(view)
make.height.equalTo(submitBtnHeight+gap*2+k_Height_safeAreaInsetsBottom())
}
saveBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: 86.0, height: 48.0))
make.top.equalTo(8)
}
submitBtn.snp.makeConstraints { make in
make.left.equalTo(saveBtn.snp.right).offset(10)
make.right.equalToSuperview().offset(-16)
make.height.equalTo(48)
make.centerY.equalTo(saveBtn)
}
let topHeight = k_Height_NavigationtBarAndStatuBar+YHStepView.height
let bottomHeight = k_Height_safeAreaInsetsBottom() + YHSaveAndSubmitView.height
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
make.top.equalToSuperview().offset(topHeight)
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
make.bottom.equalToSuperview().offset(-bottomHeight)
}
}
......@@ -161,7 +152,7 @@ class YHChildInitialInfoVC: YHBaseViewController {
}
extension YHChildInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......@@ -209,21 +200,29 @@ extension YHChildInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] (arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false)
guard let self = self else { return }
if detailItem.type == .isAccompanyToHK { // 是否随行
let follow = (selectItem.title == "是".local ? 1 : 0)
self?.child?.follow = follow
self?.loadSponseInfo()
self.child?.setFollow(option)
self.loadSponseInfo()
if let delegate = self.delegate {
delegate.updateStepView?()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
let handlePassport = (selectItem.title == "是".local ? 1 : 0)
self?.child?.isHandled = handlePassport
self?.loadSponseInfo()
self.child?.setNeedHandleHKPassPort(option)
self.loadSponseInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
let isLiveTother = (selectItem.title == "是".local ? 1 : 0)
self?.child?.finishFollow = (selectItem.title == "是".local ? 1 : 0)
self?.loadSponseInfo()
self.child?.setLiveTother(option)
if option {
self.child?.address?.country = nil
self.child?.address?.details = nil
self.child?.address?.area = nil
}
self.loadSponseInfo()
}
}
return cell
......@@ -285,12 +284,19 @@ extension YHChildInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
return 52.0
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 14.0
}
......@@ -318,3 +324,5 @@ extension YHChildInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
}
}
......@@ -456,7 +456,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
// 子女
if detailItem.relationType == .child {
let vc = YHChildInitialInfoVC()
let vc = YHChildInfoContainerVC()
vc.child = detailItem
self.navigationController?.pushViewController(vc)
return
......
......@@ -51,7 +51,7 @@ class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
return YHSaveAndSubmitView.createView()
}()
let initalInfoVC = YHSpouseInitialInfoVC()
let initalInfoVC = YHSpousePrimaryInfoVC()
let uploadVC = UIViewController()
let certificateVC = YHCertificateInfoController()
let basicInfoVC = YHSpouseBasicInfoVC()
......@@ -157,22 +157,11 @@ extension YHSpouseInfoContainerVC {
func saveInfo() {
guard let spouse = spouse else { return }
guard var info = spouse.toDictionary() else { return }
guard let info = spouse.toDictionary() else { return }
// let certi = [ "cnIdentityCard":
// ["id":116871,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2017-01-01","issue_date_end_at":"2029-01-01","img_front":"","img_back":""],
// "passport":["id":116872,"number":"421087199005010811","issue_at":"深圳","issue_date_start_at":"2020-01-01","issue_date_end_at":"2023-01-01","img_front":"","img_back":"","passport_type":3],
// "hkMacaoPass":["id":118182,"number":"P103265(1)","issue_at":"SFAA","issue_date_start_at":"2024-01-31","issue_date_end_at":"2024-01-31","img_front":"","img_back":""]
// ]
//
// if let cer = info["certificates"] {
// info["certificates"] = certi
// }
let cer = info["certificates"]
let dict:[String: Any] = ["orderId":self.orderId,
let dict:[String: Any] = ["orderId":spouse.orderId,
"relation":spouse.relationType.rawValue,
"step":0,
"step":spouse.step,
"next":false,
"info":info]
......
......@@ -9,7 +9,7 @@
import UIKit
import SmartCodable
class YHSpouseInitialInfoVC: YHBaseViewController {
class YHSpousePrimaryInfoVC: YHBaseViewController {
var spouse:YHFamilyMember?
weak var delegate:YHSpouseInfoVCProtocol?
......@@ -141,7 +141,7 @@ class YHSpouseInitialInfoVC: YHBaseViewController {
}
extension YHSpouseInitialInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return items.count
......
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