Commit 24b53b7d authored by Steven杜宇's avatar Steven杜宇

// 父母信息

parent 55cd650c
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; }; 04A7BC8F2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */; };
04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; }; 04A7BC912B6B7B89000E8D47 /* YHTwoOptionAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */; };
04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; }; 04AF58C42B4FC51C0066011A /* YHLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */; };
04D765732B6A173C0055ECBB /* YHSpouseInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */; }; 04D765732B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; }; 6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; }; A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; }; A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51044192B495DD0006B60BB /* UIView+Extension.swift */; };
...@@ -289,7 +289,7 @@ ...@@ -289,7 +289,7 @@
04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyRequestViewModel.swift; sourceTree = "<group>"; }; 04A7BC8E2B6B2BC2000E8D47 /* YHFamilyRequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFamilyRequestViewModel.swift; sourceTree = "<group>"; };
04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTwoOptionAlertView.swift; sourceTree = "<group>"; }; 04A7BC902B6B7B89000E8D47 /* YHTwoOptionAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTwoOptionAlertView.swift; sourceTree = "<group>"; };
04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; }; 04AF58C32B4FC51C0066011A /* YHLocalizable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLocalizable.swift; sourceTree = "<group>"; };
04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInfoVC.swift; sourceTree = "<group>"; }; 04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHSpouseInfoContainerVC.swift; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; }; 58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_galaxy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; A51044172B493675006B60BB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
...@@ -497,7 +497,7 @@ ...@@ -497,7 +497,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
041B52972B5E8EA0007EBCEB /* YHFamilyMemberFormVC.swift */, 041B52972B5E8EA0007EBCEB /* YHFamilyMemberFormVC.swift */,
04D765722B6A173C0055ECBB /* YHSpouseInfoVC.swift */, 04D765722B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift */,
041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */, 041B52D52B5F899E007EBCEB /* YHSpouseInitialInfoVC.swift */,
042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */, 042FBBBA2B62806D00F9DE23 /* YHCertificateInfoController.swift */,
042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */, 042FBBBE2B639F0300F9DE23 /* YHSpouseBasicInfoVC.swift */,
...@@ -1467,7 +1467,7 @@ ...@@ -1467,7 +1467,7 @@
A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */, A5ACE9392B4564F7002C94D2 /* UIDevice+Extension.swift in Sources */,
041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */, 041B52912B5E67F3007EBCEB /* YHFormItemEnterDetailCell.swift in Sources */,
A5ACE9422B4564F7002C94D2 /* AppDelegate+Extension.swift in Sources */, A5ACE9422B4564F7002C94D2 /* AppDelegate+Extension.swift in Sources */,
04D765732B6A173C0055ECBB /* YHSpouseInfoVC.swift in Sources */, 04D765732B6A173C0055ECBB /* YHSpouseInfoContainerVC.swift in Sources */,
A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */, A5FD63BF2B6250BC00D1D9DA /* YHInformationPerfectCell.swift in Sources */,
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */, A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */,
A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */, A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */,
......
...@@ -439,7 +439,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -439,7 +439,7 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
// 配偶 // 配偶
if detailItem.relationType == .spouse { if detailItem.relationType == .spouse {
let vc = YHSpouseInfoVC() let vc = YHSpouseInfoContainerVC()
vc.spouse = detailItem vc.spouse = detailItem
vc.orderId = orderId vc.orderId = orderId
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
......
...@@ -11,8 +11,15 @@ import UIKit ...@@ -11,8 +11,15 @@ import UIKit
class YHParentInfoVC: YHBaseViewController { class YHParentInfoVC: YHBaseViewController {
var parentInfo: YHFamilyMember? var parentInfo: YHFamilyMember?
var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]() var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
var bottomView: YHSaveAndSubmitView = {
let view = YHSaveAndSubmitView.createView()
view.isHiddenSave = true
return view
}()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -40,7 +47,9 @@ class YHParentInfoVC: YHBaseViewController { ...@@ -40,7 +47,9 @@ class YHParentInfoVC: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
gk_navTitle = "父母信息填写".local if let parentInfo = parentInfo {
gk_navTitle = parentInfo.relationType == .father ? "父亲信息填写".local : "母亲信息填写".local
}
createUI() createUI()
loadBasicInfo() loadBasicInfo()
} }
...@@ -48,9 +57,23 @@ class YHParentInfoVC: YHBaseViewController { ...@@ -48,9 +57,23 @@ class YHParentInfoVC: YHBaseViewController {
func createUI() { func createUI() {
view.addSubview(tableView); view.addSubview(tableView);
view.addSubview(bottomView)
bottomView.submitBlock = {
[weak self] in
guard let self = self else { return }
self.submitInfo()
}
bottomView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.bottom.equalToSuperview().offset(-k_Height_safeAreaInsetsBottom())
make.height.equalTo(YHSaveAndSubmitView.height)
}
tableView.snp.makeConstraints { make in tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar) make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview().offset(-100) make.bottom.equalTo(bottomView.snp.top)
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16) make.right.equalToSuperview().offset(-16)
} }
...@@ -65,52 +88,88 @@ class YHParentInfoVC: YHBaseViewController { ...@@ -65,52 +88,88 @@ class YHParentInfoVC: YHBaseViewController {
items.removeAll() items.removeAll()
// 基本信息 // 基本信息
let title0:YHFormItemProtocol = YHFormTitleItem(type: .basicInfo) let title0 = YHFormTitleItem(type: .basicInfo)
let item00:YHFormItemProtocol = YHFormDetailItem(type: .onlyDoubleChoice) let item00 = YHFormDetailItem(type: .onlyDoubleChoice)
item00.value = String(parentInfo.isDead())
let arr0:[YHFormItemProtocol] = [title0, item00] let arr0:[YHFormItemProtocol] = [title0, item00]
// 父母亲信息 // 父母亲信息
var arr1 = [YHFormItemProtocol]() var arr1 = [YHFormItemProtocol]()
if parentInfo.relationType == .father { // 父亲 if parentInfo.relationType == .father { // 父亲
let title1:YHFormItemProtocol = YHFormTitleItem(type: .fatherInfo) let title1 = YHFormTitleItem(type: .fatherInfo)
let item10:YHFormItemProtocol = YHFormDetailItem(type: .fatherName) let item10 = YHFormDetailItem(type: .fatherName)
arr1.append(contentsOf: [title1, item10]) item10.value = parentInfo.subsetName
arr1.append(title1)
arr1.append(item10)
} else { // 母亲 } else { // 母亲
let title1:YHFormItemProtocol = YHFormTitleItem(type: .motherInfo) let title1 = YHFormTitleItem(type: .motherInfo)
let item10:YHFormItemProtocol = YHFormDetailItem(type: .motherName) let item10 = YHFormDetailItem(type: .motherName)
arr1.append(contentsOf: [title1, item10]) item10.value = parentInfo.subsetName
arr1.append(title1)
arr1.append(item10)
} }
let item11:YHFormItemProtocol = YHFormDetailItem(type: .birthday) let item11 = YHFormDetailItem(type: .birthday)
let item12:YHFormItemProtocol = YHFormDetailItem(type: .birthNation) item11.value = parentInfo.birthday
let item13:YHFormItemProtocol = YHFormDetailItem(type: .birthCity) let item12 = YHFormDetailItem(type: .birthNation)
arr1.append(contentsOf: [item11, item12, item13]) item12.value = String(parentInfo.isBirthOverSeas())
if parentInfo.deceased != 1 { // 健在 let item13 = YHFormDetailItem(type: .birthCity)
let item14:YHFormItemProtocol = YHFormDetailItem(type: .marriageState)
arr1.append(item14)
}
// 职业信息 if parentInfo.isBirthOverSeas() {
let title2:YHFormItemProtocol = YHFormTitleItem(type: .occupationInfo) item13.value = parentInfo.birthPlace?.foreign
let item20:YHFormItemProtocol = YHFormDetailItem(type: .occupation) item13.placeHolder = "请输入".local
let arr2:[YHFormItemProtocol] = [title2, item20] } else {
item13.value = parentInfo.birthPlace?.area?.joined(separator: ",")
// 居住信息 item13.placeHolder = "请选择".local
let title3:YHFormItemProtocol = YHFormTitleItem(type: .liveInfo) }
let item30:YHFormItemProtocol = YHFormDetailItem(type: .liveNationOrArea) let arr:[YHFormItemProtocol] = [item11, item12, item13]
let arr3:[YHFormItemProtocol] = [title3, item30] arr1.append(contentsOf: arr)
// 香港身份证 if parentInfo.isDead() {
let title4:YHFormItemProtocol = YHFormTitleItem(type: .hkIdentityCardInfo) items.append(contentsOf: [arr0, arr1])
let item40:YHFormItemProtocol = YHFormDetailItem(type: .isHaveHkIdentityCard) }
let item41:YHFormItemProtocol = YHFormDetailItem(type: .hkIdentityCardNumber)
let arr4:[YHFormItemProtocol] = [title4, item40, item41]
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4]) if !parentInfo.isDead() { // 健在
let item14 = YHFormDetailItem(type: .marriageState)
item14.value = parentInfo.married
arr1.append(item14)
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation)
item20.value = parentInfo.occupation
item20.placeHolder = "请输入".local
var arr2:[YHFormItemProtocol] = [title2, item20]
if parentInfo.isNowHaveJob() {
let item21 = YHFormDetailItem(type: .occupationName)
item21.value = parentInfo.occupationName
item21.placeHolder = "请输入".local
arr2.append(item21)
}
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let item30 = YHFormDetailItem(type: .liveNationOrArea)
item30.value = parentInfo.liveCountry
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard)
item40.value = String(parentInfo.isHaveHKIdentityCard())
var arr4:[YHFormItemProtocol] = [title4, item40]
if parentInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber)
item41.value = parentInfo.hkIdentityCard
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
}
tableView.reloadData() tableView.reloadData()
} }
func getCellType(_ item: Any) ->HKFormItemCellType { func getCellType(_ item: Any) ->HKFormItemCellType {
...@@ -120,23 +179,35 @@ class YHParentInfoVC: YHBaseViewController { ...@@ -120,23 +179,35 @@ class YHParentInfoVC: YHBaseViewController {
if item is YHFormDetailItem { if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthCity {
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isBirthOverSeas()
}
if isBirthOverSeas {
return .inputText
} else {
return .selectSheet
}
}
if detailItem.type == .fatherName if detailItem.type == .fatherName
|| detailItem.type == .motherName || detailItem.type == .motherName
|| detailItem.type == .nationOrArea || detailItem.type == .occupationName
|| detailItem.type == .hkIdentityCardNumber || detailItem.type == .hkIdentityCardNumber
{ {
return .inputText return .inputText
} }
if detailItem.type == .birthday if detailItem.type == .birthday
|| detailItem.type == .birthCity
|| detailItem.type == .marriageState || detailItem.type == .marriageState
|| detailItem.type == .occupation || detailItem.type == .occupation
|| detailItem.type == .liveNationOrArea || detailItem.type == .liveNationOrArea
{ {
return .selectSheet return .selectSheet
} }
if detailItem.type == .birthNation if detailItem.type == .birthNation || detailItem.type == .isHaveHkIdentityCard
|| detailItem.type == .isHaveHkIdentityCard
{ {
return .twoChoice return .twoChoice
} }
...@@ -177,72 +248,117 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -177,72 +248,117 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell return cell
} }
if cellType == .inputText { // 输入文字cell if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
if cellType == .selectSheet { // 点击选择列表cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.title = item.getTitle() cell.title = item.getTitle()
return cell return cell
} }
if cellType == .twoChoice { // 问答双项选择cell if item is YHFormDetailItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell let detailItem = item as! YHFormDetailItem
cell.title = item.getTitle()
cell.answerArr = nil
if item is YHFormDetailItem { if cellType == .inputText { // 输入文字cell
let detailItem = item as! YHFormDetailItem let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
if detailItem.type == .birthNation { cell.isMust = detailItem.isNeed
let answers = [YHFormChoiceItem(title: "国内".local, isSelect: true), cell.title = detailItem.getTitle()
YHFormChoiceItem(title: "国外".local, isSelect: false)] cell.text = detailItem.value
cell.answerArr = answers cell.textChange = {
} else if detailItem.type == .isHaveHkIdentityCard {
let answers = [YHFormChoiceItem(title: "是".local, isSelect: true), [weak self] (text, isEditEnd) in
YHFormChoiceItem(title: "否".local, isSelect: false)] guard let self = self else { return }
cell.answerArr = answers if detailItem.type == .fatherName {
self.parentInfo?.subsetName = text
} else if detailItem.type == .birthCity {
self.parentInfo?.birthPlace?.foreign = text
} else if detailItem.type == .occupationName {
self.parentInfo?.occupationName = text
} else if detailItem.type == .hkIdentityCardNumber {
self.parentInfo?.hkIdentityCard = text
}
if isEditEnd {
self.loadBasicInfo()
self.submitInfo()
}
} }
return cell
} }
return cell if cellType == .selectSheet { // 点击选择列表cell
} let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
if cellType == .onlyTwoChoice { // 仅有双项选择cell cell.title = detailItem.getTitle()
cell.detail = detailItem.value
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell return cell
var isDead = 0
if let dead = parentInfo?.deceased, dead == 1 { // 已故
isDead = 1
} }
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: isDead != 1),
YHFormChoiceItem(title: "已故".local, isSelect: isDead == 1)] if cellType == .twoChoice { // 问答双项选择cell
cell.answerArr = answers
cell.answerBlock = { [weak self] let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
(arr, selectIndex) in cell.isMust = detailItem.isNeed
let selectItem:YHFormChoiceItem = arr[selectIndex] cell.title = item.getTitle()
self?.parentInfo?.deceased = (selectItem.title == "已故" ? 1 : 0) cell.answerArr = nil
self?.loadBasicInfo()
if detailItem.type == .birthNation { // 出生国家
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "国内".local, isSelect: !select),
YHFormChoiceItem(title: "国外".local, isSelect: select)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
self.parentInfo?.setBirthOverSeas(selectItem.title == "国外".local)
self.loadBasicInfo()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
var select = false
if let value = detailItem.value {
select = Bool(value)!
}
let answers = [YHFormChoiceItem(title: "是".local, isSelect: select),
YHFormChoiceItem(title: "否".local, isSelect: !select)]
cell.answerArr = answers
cell.answerBlock = {
[weak self] (answers, index) in
guard let self = self else { return }
let selectItem = answers[index]
if detailItem.type == .isHaveHkIdentityCard {
self.parentInfo?.setHaveHKIdentityCard(selectItem.title == "是".local)
}
self.loadBasicInfo()
}
}
return cell
} }
return cell
}
if cellType == .addItem { // 新增item cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
}
if cellType == .degreeDetailInfo { // 学位cell
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDegreeInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDegreeInfoCell if cellType == .onlyTwoChoice { // 仅有双项选择cell
cell.title = item.getTitle()
return cell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell
var isDead = false
if let parentInfo = parentInfo, parentInfo.isDead() { // 已故
isDead = true
}
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
YHFormChoiceItem(title: "已故".local, isSelect: isDead)]
cell.answerArr = answers
cell.answerBlock = { [weak self]
(arr, selectIndex) in
let selectItem:YHFormChoiceItem = arr[selectIndex]
self?.parentInfo?.setIsDead(selectItem.title == "已故")
self?.loadBasicInfo()
}
return cell
}
} }
return createDefaultCell(indexPath) return createDefaultCell(indexPath)
} }
...@@ -293,6 +409,72 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -293,6 +409,72 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if !(0..<items.count).contains(indexPath.section) { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if !(0..<arr.count).contains(indexPath.row) { return }
let item = arr[indexPath.row]
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthday { // 出生日期
YHDatePickView.show(type: .yyyymmdd) { [weak self] date in
guard let self = self else { return }
if detailItem.type == .birthday {
self.parentInfo?.birthday = date
}
self.loadBasicInfo()
}
} else if detailItem.type == .birthCity { // 出生城市
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isOverSeasOver1Year()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.birthPlace?.area = [string2, string3, string4]
self.loadBasicInfo()
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
let occupation = self.parentInfo?.occupation ?? ""
YHFormPickerView.show(type: .occupation, selectTitle:occupation ) {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.occupation = selectType.title
self.loadBasicInfo()
}
} else if detailItem.type == .marriageState { // 婚姻
let marriage = self.parentInfo?.married
YHFormPickerView.show(type: .marriage, selectTitle:marriage) {
[weak self] selectType in
guard let self = self else { return }
self.parentInfo?.married = selectType.title
self.loadBasicInfo()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
let vc = YHAddressViewController()
vc.backLocationStringController = {
[weak self] (string1, string2, string3, string4) in
guard let self = self else { return }
print("\(string1)\n\(string2)\n\(string3)\n\(string4)")
self.parentInfo?.liveCountry = string2
self.loadBasicInfo()
}
self.present(vc, animated: true)
}
}
} }
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
...@@ -312,3 +494,24 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -312,3 +494,24 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
} }
} }
} }
extension YHParentInfoVC {
func submitInfo() {
guard let parentInfo = parentInfo else { return }
guard let info = parentInfo.toDictionary() else { return }
let dict:[String: Any] = ["orderId":parentInfo.orderId,
"relation":parentInfo.relationType.rawValue,
"step":parentInfo.step,
"next":false,
"info":info]
self.familyRequest.addOrSaveFamilyMember(params:dict) { success, error in
if success {
}
}
}
}
...@@ -15,7 +15,7 @@ import UIKit ...@@ -15,7 +15,7 @@ import UIKit
} }
class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { class YHSpouseInfoContainerVC: YHBaseViewController, YHSpouseInfoVCProtocol {
let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel() let familyRequest:YHFamilyRequestViewModel = YHFamilyRequestViewModel()
...@@ -153,7 +153,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol { ...@@ -153,7 +153,7 @@ class YHSpouseInfoVC: YHBaseViewController, YHSpouseInfoVCProtocol {
} }
} }
extension YHSpouseInfoVC { extension YHSpouseInfoContainerVC {
func saveInfo() { func saveInfo() {
guard let spouse = spouse else { return } guard let spouse = spouse else { return }
......
...@@ -697,6 +697,19 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol { ...@@ -697,6 +697,19 @@ class YHFamilyMember: SmartCodable, YHFormItemProtocol {
self.hasDegree = val ? "1" : "0" self.hasDegree = val ? "1" : "0"
} }
// 是否已故
func isDead() -> Bool {
return self.deceased == 1
}
func setIsDead(_ val:Bool) {
self.deceased = (val ? 1 : 0)
}
// 是否在职
func isNowHaveJob() -> Bool {
return self.occupation == "在职"
}
var relationType:YHFamilyMemberType { var relationType:YHFamilyMemberType {
......
...@@ -11,11 +11,27 @@ import UIKit ...@@ -11,11 +11,27 @@ import UIKit
class YHSaveAndSubmitView: UIView { class YHSaveAndSubmitView: UIView {
static let submitBtnHeight = 48.0 static let submitBtnHeight = 48.0
static let saveBtnWidth = 86.0
static let gap = 8.0 static let gap = 8.0
static let height = submitBtnHeight+gap*2 static let height = submitBtnHeight+gap*2
var saveBlock:(()->Void)? var saveBlock:(()->Void)?
var submitBlock:(()->Void)? var submitBlock:(()->Void)?
// 是否隐藏保存按钮
var isHiddenSave:Bool = false {
didSet {
self.saveBtn.isHidden = isHiddenSave
self.saveBtn.snp.updateConstraints { make in
make.width.equalTo(isHiddenSave ? 0 : Self.saveBtnWidth)
}
self.submitBtn.snp.updateConstraints { make in
make.left.equalTo(saveBtn.snp.right).offset(isHiddenSave ? 0.0 : 10)
}
self.setNeedsLayout()
self.layoutIfNeeded()
}
}
lazy var submitBtn:UIButton = { lazy var submitBtn:UIButton = {
let btn = UIButton() let btn = UIButton()
...@@ -71,7 +87,8 @@ class YHSaveAndSubmitView: UIView { ...@@ -71,7 +87,8 @@ class YHSaveAndSubmitView: UIView {
saveBtn.snp.makeConstraints { make in saveBtn.snp.makeConstraints { make in
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.size.equalTo(CGSize(width: 86.0, height: Self.submitBtnHeight)) make.height.equalTo(Self.submitBtnHeight)
make.width.equalTo(Self.saveBtnWidth)
make.top.equalTo(Self.gap) make.top.equalTo(Self.gap)
} }
......
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