Commit 144f86d9 authored by Steven杜宇's avatar Steven杜宇

// 续期资料微信上传

parent 56c781f9
......@@ -230,7 +230,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
if let extMsg = res?.extMsg {
if extMsg == "my_certificate" { // 我的证件 微信文件上传
NotificationCenter.default.post(name: YhConstant.YhNotification.didMyCertificateWeChatFileUploadCallBackNotification, object: nil)
} else if extMsg == "wx_upload_renewal_data" {
NotificationCenter.default.post(name: YhConstant.YhNotification.didMyResignMaterialWeChatFileUploadCallBackNotification, object: nil)
}
}
}
}
......
......@@ -236,6 +236,11 @@ extension YHResignMaterialListVC {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectImageCount = 9
sheetView.tips = "支持的文件格式为jpg/jpeg、png、bmp、doc/docx、xls/xlsx、pdf,最多可上传99张图片或文件"
sheetView.uploadTypeArr = [ YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.wechatUpload, title:"微信上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")]
sheetView.fileTypes = [ "public.image",
"com.adobe.pdf",
"com.microsoft.word.doc",
......@@ -262,6 +267,13 @@ extension YHResignMaterialListVC {
success?()
}
}
sheetView.wechatUploadBlock = {
[weak self] in
guard let self = self else { return }
let token = YHLoginManager.shared.h5Token
let path = "/superApp/pages/wxUpload/wxUpload?param=\(token)&material_id=\(material.id)&template_id=\(material.template_id)&type=wx_upload_renewal_data"
YHShareManager.shared.openMiniProgram(path:path, title: "微信上传")
}
sheetView.show()
}
}
......@@ -135,6 +135,11 @@ class YHResignMaterialUploadVC: YHBaseViewController {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectImageCount = 99-items.count
sheetView.tips = "支持的文件格式为jpg/jpeg、png、bmp、doc/docx、xls/xlsx、pdf,最多可上传99张图片或文件"
sheetView.uploadTypeArr = [ YHCertificateUploadItem(type:.camera, title:"拍照上传"),
YHCertificateUploadItem(type:.photo, title:"相册上传"),
YHCertificateUploadItem(type:.phoneFile, title:"手机文件上传", subtitle:"从手机文件管理中上传"),
YHCertificateUploadItem(type:.wechatUpload, title:"微信上传"),
YHCertificateUploadItem(type:.cancel, title:"取消")]
sheetView.fileTypes = [ "public.image",
"com.adobe.pdf",
"com.microsoft.word.doc",
......@@ -161,6 +166,14 @@ class YHResignMaterialUploadVC: YHBaseViewController {
self.requestMaterialDetail()
}
}
sheetView.wechatUploadBlock = {
[weak self] in
guard let self = self else { return }
let token = YHLoginManager.shared.h5Token
let path = "/superApp/pages/wxUpload/wxUpload?param=\(token)&material_id=\(self.materialModel.id)&template_id=\(self.materialModel.template_id)&type=wx_upload_renewal_data"
YHShareManager.shared.openMiniProgram(path:path, title: "微信上传")
}
sheetView.show()
}
......@@ -559,6 +572,7 @@ extension YHResignMaterialUploadVC {
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotification(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(requestMaterialDetail), name: YhConstant.YhNotification.didMyResignMaterialWeChatFileUploadCallBackNotification, object: nil)
}
func removeNotify() {
......@@ -590,7 +604,7 @@ extension YHResignMaterialUploadVC {
extension YHResignMaterialUploadVC {
func requestMaterialDetail() {
@objc func requestMaterialDetail() {
YHHUD.show(.progress(message: "加载中..."))
viewModel.getMaterialDeal(orderId: orderId, id: batchId, materialId: materialId) {
......
......@@ -15,7 +15,6 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
weak var delegate:YHSpouseInfoVCProtocol?
var isNeedShowError = false
// 是否随行能编辑
var isFollowCanEdit = true
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -60,7 +59,6 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.removeAll()
isFollowCanEdit = !child.is18YearsOld()
// 随行
let title0 = YHFormTitleItem(type: .E)
let item00 = YHFormDetailItem(type: .ownCustody, value:String(child.isOwnCustody()))
let item01 = YHFormDetailItem(type: .birthday, value:child.birthday, tips:"请选择出生日期".local)
......@@ -68,26 +66,21 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let arr0:[YHFormItemProtocol] = [title0, item00, item01, item02]
items.append(arr0)
if child.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
if child.isFollow() {
let title1 = YHFormTitleItem(type: .F)
let item10 = YHFormDetailItem(type: .nationOrArea, value:child.nationality, tips: "请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
let title2 = YHFormTitleItem(type: .liveInfo)
let title2 = YHFormTitleItem(type: .G)
let item20 = YHFormDetailItem(type: .isLiveTother, value:String(child.isLiveTother()))
var arr2: [YHFormItemProtocol] = [title2, item20]
if !child.isLiveTother() { // 不同住 才需填写国家/地区
if !child.isLiveTother() {
let item21 = YHFormDetailItem(type: .nationOrArea, value:child.address.country, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if !child.address.country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = child.address.country.contains("中国".local)
if isLiveInChina {
var value = ""
......@@ -102,8 +95,7 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let item23 = YHFormDetailItem(type:.detailAddress, value:detailAddress, placeHolder:placeHolder, tips:placeHolder)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
if !isLiveInChina {
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year, value:String(child.isOverSeasOver1Year()))
arr2.append(item24)
}
......@@ -112,26 +104,20 @@ class YHChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.append(contentsOf:[arr1, arr2])
// 港澳通信证
var isHiddenHK = true
// 国籍
let nationality = child.nationality
// 居住国家
var liveCountry = child.address.country
// 居住海外是否满一年
var isLiveOverseaYear = child.isOverSeasOver1Year()
if child.isLiveTother(), let mainApplicantInfo = mainApplicantInfo {
// 与主申请人同住需要用主申请人居住信息判断
liveCountry = mainApplicantInfo.applicant_address.country
isLiveOverseaYear = mainApplicantInfo.isOverSeasOver1Year()
}
if child.nationality.contains("中国") { // 中国国籍
if child.nationality.contains("中国") {
let isLiveInChina = liveCountry.contains("中国".local)
if isLiveInChina || (!isLiveInChina && !isLiveOverseaYear) {
// 中国国籍&居住国内、中国国籍&居住国外不满一年 需展示“港澳通行证”询问框
isHiddenHK = false
}
}
......@@ -226,13 +212,13 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
if item is YHFormTitleItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:item.getTitle())
return cell
} else if item is YHFormDetailItem { // 具体信息
} else if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
let cellType = self.getCellType(detailItem)
......@@ -251,8 +237,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
select = Bool(value)!
}
if detailItem.type == .isAccompanyToHK, let child = child, child.is18YearsOld() { // 是否随行至香港
// 年满18岁不能随行 随行按钮不可编辑固定为否
if detailItem.type == .isAccompanyToHK, let child = child, child.is18YearsOld() {
cell.enableEdit = isFollowCanEdit
cell.disableEditTips = "年满十八岁的子女不能随行至香港"
}
......@@ -268,25 +253,25 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let option = (selectItem.title == "是".local ? true : false)
guard let self = self else { return }
if detailItem.type == .isAccompanyToHK { // 是否随行
if detailItem.type == .isAccompanyToHK {
self.child?.setFollow(option)
if let delegate = delegate, delegate.responds(to: #selector(YHSpouseInfoVCProtocol.updateStepView)) {
delegate.updateStepView()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
} else if detailItem.type == .isHandleHKPassPort {
self.child?.setNeedHandleHKPassPort(option)
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
} else if detailItem.type == .isLiveTother {
self.child?.setLiveTother(option)
if option {
self.child?.address.clearAddress()
}
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
} else if detailItem.type == .isLiveOverSeasMore1Year {
self.child?.setOverSearsOver1Year(option)
} else if detailItem.type == .ownCustody { // 抚养权
} else if detailItem.type == .ownCustody {
self.child?.setOwnCustody(option)
}
self.loadInfo()
......@@ -294,7 +279,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
return cell
} else if cellType == .selectSheet { // 选择列表面板
} else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
......@@ -303,7 +288,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.setTips(detailItem.tips, isShow:isNeedShowError && detailItem.isShowTips)
return cell
} else if cellType == .inputText { // 输入文字cell
} else if cellType == .inputText {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.placeHolder = detailItem.placeHolder
......@@ -389,19 +374,17 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
// 选国籍/现居住城市/详细地址
if detailItem.type == .nationOrArea {
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality { // 选国籍
if title.type == .F {
self.child?.nationality = country
} else if title.type == .liveInfo { // // 居住信息选国家地区
} else if title.type == .G {
self.child?.address.country = country
// 选择国家地区后需清空城市
self.child?.address.area = []
}
......@@ -443,10 +426,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
UIViewController.current?.present(addressPicker, animated: true, completion: nil)
} else if detailItem.type == .birthday { // 出生日期
// 子女选择年满18岁则【是否随行至香港】默认选择否,不可修改
// 如果未年满18岁则【是否随行至香港】可选择【是/否】,可修改
} else if detailItem.type == .birthday {
YHDatePickView.show(type: .yyyymmdd, title:"选择出生日期".local, lastIsTaday: true, currentDay: child?.birthday ?? "") { [weak self] date in
guard let self = self else { return }
......@@ -471,9 +451,7 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......@@ -490,7 +468,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHChildPrimaryInfoVC {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let child = child else { return false}
......@@ -509,7 +486,7 @@ extension YHChildPrimaryInfoVC {
return false
}
if !child.isLiveTother() { // 没有与主申请人同住
if !child.isLiveTother() {
if isEmptyString(child.address.country) {
return false
}
......@@ -520,7 +497,7 @@ extension YHChildPrimaryInfoVC {
if isEmptyString(child.address.details) {
return false
}
} else { // 住在国外
} else {
if isEmptyString(child.address.foreign) {
return false
}
......
......@@ -115,23 +115,20 @@ class YHBrotherInfoVC: YHBaseViewController {
let arr1:[YHFormItemProtocol] = [title1, item10, item11, item12, item13, item14, item15]
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation, value:brotherInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let title3 = YHFormTitleItem(type: .G)
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:brotherInfo.liveCountry, tips:"请选择国家/地区".local)
let arr3:[YHFormItemProtocol] = [title3, item30]
// 香港身份证
let title4 = YHFormTitleItem(type: .hkIdentityCardInfo)
let item40 = YHFormDetailItem(type: .isHaveHkIdentityCard, value:String(brotherInfo.isHaveHKIdentityCard()))
var arr4:[YHFormItemProtocol] = [title4, item40]
if brotherInfo.isHaveHKIdentityCard() { // 办理过香港身份证才显示证号
if brotherInfo.isHaveHKIdentityCard() {
let tips = isEmptyString(brotherInfo.hkIdentityCard) ? "请输入香港身份证号码".local : "请输入正确的香港身份证号码".local
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:brotherInfo.hkIdentityCard, tips: tips)
arr4.append(item41)
......@@ -207,13 +204,13 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
let cellType = getCellType(item)
if cellType == .title { // 标题
if cellType == .title {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:item.getTitle())
return cell
}
if cellType == .addItem { // 新增item cell
if cellType == .addItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
......@@ -223,12 +220,12 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFormDetailItem
if cellType == .inputText { // 输入文字cell
if cellType == .inputText {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码
if detailItem.type == .hkIdentityCardNumber {
let isEmptyValue = isEmptyString(detailItem.value)
var isUnvalidFormat = true
if let value = detailItem.value, value.isHKIdentityCardNumber() {
......@@ -288,7 +285,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .selectSheet { // 点击选择列表cell
if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
......@@ -297,14 +294,14 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .twoChoice { // 问答双项选择cell
if cellType == .twoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = item.getTitle()
cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家
if detailItem.type == .birthNation {
var select = false
if let value = detailItem.value {
select = Bool(value)!
......@@ -320,7 +317,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
} else if detailItem.type == .isHaveHkIdentityCard {
var select = false
if let value = detailItem.value {
select = Bool(value)!
......@@ -347,12 +344,12 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .onlyTwoChoice { // 仅有双项选择cell
if cellType == .onlyTwoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell
var isDead = false
if let brotherInfo = brotherInfo, brotherInfo.isDead() { // 已故
if let brotherInfo = brotherInfo, brotherInfo.isDead() {
isDead = true
}
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
......@@ -421,7 +418,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthday { // 出生日期
if detailItem.type == .birthday {
YHDatePickView.show(type: .yyyymmdd, title:"选择出生日期".local, lastIsTaday: true, currentDay: self.brotherInfo?.birthday ?? "") { [weak self] dateStr in
guard let self = self else { return }
......@@ -431,7 +428,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
if let selectDate = format.date(from:dateStr) {
let selectTimeInterval = selectDate.timeIntervalSince1970
let currentTimeInterval = Date().timeIntervalSince1970
// 出生日期须早于当前日期
if selectTimeInterval > currentTimeInterval {
YHHUD.flash(message: "出生日期不能晚于当前日期".local)
return
......@@ -443,13 +439,12 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .birthCity { // 出生城市
} else if detailItem.type == .birthCity {
var isBirthOverSeas = false
if let brotherInfo = brotherInfo {
isBirthOverSeas = brotherInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
let vc = YHAddressViewController()
......@@ -470,7 +465,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
} else if detailItem.type == .occupation {
let occupation = self.brotherInfo?.occupation ?? ""
YHSheetPickerView.show(type: .profession, selectTitle:occupation) {
......@@ -481,7 +476,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
} else if detailItem.type == .marriageState {
let marriage = self.brotherInfo?.married
YHSheetPickerView.show(type: .marriageText, selectTitle:marriage) {
[weak self] selectItem in
......@@ -491,7 +486,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
} else if detailItem.type == .liveNationOrArea {
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
......@@ -503,7 +498,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
}
self.navigationController?.pushViewController(vc)
} else if detailItem.type == .gender { // 性别
} else if detailItem.type == .gender {
guard let brotherInfo = brotherInfo else { return }
YHSheetPickerView.show(type: .gender, selectTitle:brotherInfo.sexName()) {
......@@ -518,9 +513,7 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......@@ -537,7 +530,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHBrotherInfoVC {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let brotherInfo = brotherInfo else { return false }
......@@ -577,7 +569,6 @@ extension YHBrotherInfoVC {
return true
}
// isSubmit 是否是提交 isSilent:是否显示toast
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool)->Void)?) {
if isSubmit {
......@@ -600,7 +591,6 @@ extension YHBrotherInfoVC {
}
guard let brotherInfo = brotherInfo else { return }
// 父母兄弟姐妹 随行必须置为0
brotherInfo.follow = 0
guard let info = brotherInfo.toDictionary() else { return }
......@@ -628,7 +618,6 @@ extension YHBrotherInfoVC {
}
}
// 静默保存 不显示toast和loading
func saveInfoSilent() {
guard let brotherInfo = brotherInfo else { return }
if brotherInfo.detailId == 0 { return }
......
......@@ -99,21 +99,19 @@ class YHParentInfoVC: YHBaseViewController {
items.removeAll()
// 基本信息
let title0 = YHFormTitleItem(type: .basicInfo)
let item00 = YHFormDetailItem(type: .onlyDoubleChoice)
item00.value = String(parentInfo.isDead())
let arr0:[YHFormItemProtocol] = [title0, item00]
// 父母亲信息
var arr1 = [YHFormItemProtocol]()
if parentInfo.relationType == .father { // 父亲
if parentInfo.relationType == .father {
let title1 = YHFormTitleItem(type: .fatherInfo)
let item10 = YHFormDetailItem(type: .fatherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
arr1.append(title1)
arr1.append(item10)
} else { // 母亲
} else {
let title1 = YHFormTitleItem(type: .motherInfo)
let item10 = YHFormDetailItem(type: .motherName, value:parentInfo.subsetName, tips:"请输入姓名".local)
......@@ -142,11 +140,10 @@ class YHParentInfoVC: YHBaseViewController {
items.append(contentsOf: [arr0, arr1])
}
if !parentInfo.isDead() { // 健在
if !parentInfo.isDead() {
let item14 = YHFormDetailItem(type: .marriageState, value:parentInfo.married, tips:"请选择婚姻状况".local)
arr1.append(item14)
// 职业信息
let title2 = YHFormTitleItem(type: .occupationInfo)
let item20 = YHFormDetailItem(type: .occupation, value:parentInfo.occupation, tips:"请选择职业".local)
var arr2:[YHFormItemProtocol] = [title2, item20]
......@@ -156,24 +153,22 @@ class YHParentInfoVC: YHBaseViewController {
arr2.append(item21)
}
// 居住信息
let title3 = YHFormTitleItem(type: .liveInfo)
let title3 = YHFormTitleItem(type: .G)
let item30 = YHFormDetailItem(type: .liveNationOrArea, value:parentInfo.liveCountry, tips:"请选择国家/地区".local)
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() { // 办理过香港身份证才显示证号
if parentInfo.isHaveHKIdentityCard() {
let tips = isEmptyString(parentInfo.hkIdentityCard) ? "请输入香港身份证号码".local : "请输入正确的香港身份证号码".local
let item41 = YHFormDetailItem(type: .hkIdentityCardNumber, value:parentInfo.hkIdentityCard, tips: tips)
arr4.append(item41)
}
items.append(contentsOf: [arr0, arr1, arr2, arr3, arr4])
} else { // 父母已故
} else {
if let hkIdentityCard = parentInfo.hkIdentityCard, !hkIdentityCard.isHKIdentityCardNumber() {
parentInfo.hkIdentityCard = ""
}
......@@ -251,14 +246,14 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
let cellType = getCellType(item)
if cellType == .title { // 标题
if cellType == .title {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:item.getTitle())
return cell
}
if cellType == .addItem { // 新增item cell
if cellType == .addItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemAddCell.cellReuseIdentifier, for: indexPath) as! YHFormItemAddCell
cell.title = item.getTitle()
return cell
......@@ -268,13 +263,13 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFormDetailItem
if cellType == .inputText { // 输入文字cell
if cellType == .inputText {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder
if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码
if detailItem.type == .hkIdentityCardNumber {
let isEmptyValue = isEmptyString(detailItem.value)
var isUnvalidFormat = true
if let value = detailItem.value, value.isHKIdentityCardNumber() {
......@@ -336,7 +331,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .selectSheet { // 点击选择列表cell
if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
......@@ -345,14 +340,14 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .twoChoice { // 问答双项选择cell
if cellType == .twoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed
cell.title = item.getTitle()
cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家
if detailItem.type == .birthNation {
var select = false
if let value = detailItem.value {
select = Bool(value)!
......@@ -368,7 +363,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
self.loadInfo()
saveInfoSilent()
}
} else if detailItem.type == .isHaveHkIdentityCard { // 是否办理过香港身份证
} else if detailItem.type == .isHaveHkIdentityCard {
var select = false
if let value = detailItem.value {
select = Bool(value)!
......@@ -395,12 +390,12 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
return cell
}
if cellType == .onlyTwoChoice { // 仅有双项选择cell
if cellType == .onlyTwoChoice {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemOnlyDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemOnlyDoubleChoiceCell
var isDead = false
if let parentInfo = parentInfo, parentInfo.isDead() { // 已故
if let parentInfo = parentInfo, parentInfo.isDead() {
isDead = true
}
let answers = [YHFormChoiceItem(title: "健在".local, isSelect: !isDead),
......@@ -469,7 +464,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .birthday { // 出生日期
if detailItem.type == .birthday {
YHDatePickView.show(type: .yyyymmdd, title:"选择出生日期".local, lastIsTaday: true, currentDay: self.parentInfo?.birthday ?? "") { [weak self] dateStr in
guard let self = self else { return }
......@@ -479,7 +474,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
if let selectDate = format.date(from:dateStr) {
let selectTimeInterval = selectDate.timeIntervalSince1970
let currentTimeInterval = Date().timeIntervalSince1970
// 出生日期须早于当前日期
if selectTimeInterval > currentTimeInterval {
YHHUD.flash(message: "出生日期不能晚于当前日期".local)
return
......@@ -491,13 +485,12 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .birthCity { // 出生城市
} else if detailItem.type == .birthCity {
var isBirthOverSeas = false
if let parentInfo = parentInfo {
isBirthOverSeas = parentInfo.isBirthOverSeas()
}
// 出生国外时 出生城市是输入框
if isBirthOverSeas { return }
let vc = YHAddressViewController()
......@@ -518,7 +511,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
}
self.present(vc, animated: true)
} else if detailItem.type == .occupation { // 职业
} else if detailItem.type == .occupation {
let occupation = self.parentInfo?.occupation ?? ""
YHSheetPickerView.show(type: .occupation, selectTitle:occupation) {
......@@ -529,7 +522,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .marriageState { // 婚姻
} else if detailItem.type == .marriageState {
YHSheetPickerView.show(type: .marriageText, selectTitle:self.parentInfo?.married) {
[weak self] selectItem in
guard let self = self else { return }
......@@ -538,7 +531,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
saveInfoSilent()
}
} else if detailItem.type == .liveNationOrArea { // 现居住国家/地区
} else if detailItem.type == .liveNationOrArea {
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] string in
......@@ -553,9 +546,7 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......@@ -572,7 +563,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
extension YHParentInfoVC {
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let parentInfo = parentInfo else { return false }
......@@ -597,9 +587,7 @@ extension YHParentInfoVC {
if parentInfo.isDead() {
return true
}
// 以下是父母未死的情况
if isEmptyString(parentInfo.married) || isEmptyString(parentInfo.occupation) || isEmptyString(parentInfo.liveCountry) {
return false
}
......@@ -620,7 +608,6 @@ extension YHParentInfoVC {
return true
}
// isSubmit 是否是提交 isSilent:是否显示toast
func saveInfo(isSubmit:Bool, isLoading:Bool, callBack:((Bool)->Void)?) {
if isSubmit {
......@@ -643,7 +630,6 @@ extension YHParentInfoVC {
}
guard let parentInfo = parentInfo else { return }
// 父母兄弟姐妹 随行必须置为0
parentInfo.follow = 0
guard let info = parentInfo.toDictionary() else { return }
......@@ -671,7 +657,6 @@ extension YHParentInfoVC {
}
}
// 静默保存 不显示toast和loading
func saveInfoSilent() {
guard let parentInfo = parentInfo else { return }
if parentInfo.detailId == 0 { return }
......
......@@ -16,7 +16,6 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var mainApplicantInfo: YHMyMainApplicantInfoModel?
weak var delegate:YHSpouseInfoVCProtocol?
// 是否显示未填写错误提示
var isNeedShowError = false
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -59,35 +58,30 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.removeAll()
// 随行
let title0 = YHFormTitleItem(type: .E)
let item0 = YHFormDetailItem(type: .isAccompanyToHK)
item0.value = String(spouse.isFollow())
let arr0:[YHFormItemProtocol] = [title0, item0]
items.append(arr0)
if spouse.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
if spouse.isFollow() {
let title1 = YHFormTitleItem(type: .F)
let item10 = YHFormDetailItem(type:.nationOrArea, value:spouse.nationality, placeHolder:"请选择".local, tips:"请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let title2 = YHFormTitleItem(type: .G)
let item20 = YHFormDetailItem(type:.isLiveTother, value:String(spouse.isLiveTother()))
arr2.append(title2)
arr2.append(item20)
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
if !spouse.isLiveTother() {
let item21 = YHFormDetailItem(type:.nationOrArea, value:spouse.address.country, placeHolder:"请选择".local, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if !spouse.address.country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = spouse.address.country.contains("中国".local)
if isLiveInChina {
var value:String? = ""
......@@ -104,8 +98,7 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
let item23 = YHFormDetailItem(type:.detailAddress, value:detailAddress, placeHolder:placeHolder, tips:tips)
arr2.append(item23)
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
if !isLiveInChina {
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(spouse.isOverSeasOver1Year())
arr2.append(item24)
......@@ -115,27 +108,20 @@ class YHSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.append(contentsOf:[arr1, arr2])
// 港澳通信证
var isHiddenHK = true
// 国籍
let nationality = spouse.nationality
// 居住国家
var liveCountry = spouse.address.country
// 居住海外是否满一年
var isLiveOverseaYear = spouse.isOverSeasOver1Year()
if spouse.isLiveTother(), let mainApplicantInfo = mainApplicantInfo {
// 与主申请人同住需要用主申请人居住信息判断
liveCountry = mainApplicantInfo.applicant_address.country
isLiveOverseaYear = mainApplicantInfo.isOverSeasOver1Year()
}
if nationality.contains("中国") { // 中国国籍
if nationality.contains("中国") {
let isLiveInChina = liveCountry.contains("中国".local)
if isLiveInChina || (!isLiveInChina && !isLiveOverseaYear) {
// 中国国籍&居住国内、中国国籍&居住国外不满一年 需展示“港澳通行证”询问框
isHiddenHK = false
}
}
......@@ -187,16 +173,15 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFormTitleItem { // 标题
if item is YHFormTitleItem {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormItemTitleCell
cell.setTitleAndSubTitle(title:item.getTitle())
return cell
} else if item is YHFormDetailItem { // 具体信息
} else if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
// 是否随行到香港 / 是否办理港澳通行证 / // 是否与主申请人同住 均用双项按钮cell
if detailItem.type == .isAccompanyToHK || detailItem.type == .isHandleHKPassPort || detailItem.type == .isLiveTother || detailItem.type == .isLiveOverSeasMore1Year {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
......@@ -219,7 +204,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false)
if detailItem.type == .isAccompanyToHK { // 是否随行
if detailItem.type == .isAccompanyToHK {
self.spouse?.setFollow(option)
self.loadInfo()
......@@ -227,21 +212,21 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
delegate.updateStepView()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
} else if detailItem.type == .isHandleHKPassPort {
self.spouse?.setNeedHandleHKPassPort(option)
self.loadInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
} else if detailItem.type == .isLiveTother {
self.spouse?.setLiveTother(option)
if option {
self.spouse?.address.clearAddress()
}
self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
} else if detailItem.type == .isLiveOverSeasMore1Year {
self.spouse?.setOverSearsOver1Year(option)
self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
} else if detailItem.type == .isLiveOverSeasMore1Year {
self.spouse?.setOverSearsOver1Year(option)
self.loadInfo()
}
......@@ -349,19 +334,17 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
// 选国籍/现居住城市/详细地址
if detailItem.type == .nationOrArea {
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality { // 选国籍
if title.type == .F {
self.spouse?.nationality = country
} else if title.type == .liveInfo {// 居住信息选国家地区
} else if title.type == .G {
self.spouse?.address.country = country
// 选择国家地区后需清空城市
self.spouse?.address.area = []
}
......@@ -408,9 +391,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......@@ -424,7 +405,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
}
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let spouse = spouse else { return false}
......@@ -436,7 +416,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
return false
}
if !spouse.isLiveTother() { // 没有与主申请人同住
if !spouse.isLiveTother() {
if isEmptyString(spouse.address.country) {
return false
}
......@@ -447,7 +427,7 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEmptyString(spouse.address.details) {
return false
}
} else { // 住在国外
} else {
if isEmptyString(spouse.address.foreign) {
return false
}
......
......@@ -23,10 +23,8 @@ enum YHFormTitleItemType:Int, CaseIterable {
case C
case D
case E
// 国籍
case nationality
// 居住信息
case liveInfo
case F
case G
case hkAndMacaoPassport
// 中国身份证
......@@ -257,9 +255,9 @@ class YHFormTitleItem : YHFormItemProtocol {
return "子女".local
case .E:
return "随行".local
case .nationality:
case .F:
return "国籍".local
case .liveInfo:
case .G:
return "居住信息".local
case .hkAndMacaoPassport:
return "港澳通行证".local
......@@ -319,9 +317,9 @@ class YHFormTitleItem : YHFormItemProtocol {
return "".local
case .E:
return "".local
case .nationality:
case .F:
return "".local
case .liveInfo:
case .G:
return "".local
case .hkAndMacaoPassport:
return "".local
......
......@@ -68,12 +68,12 @@ class YHGCChildPrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
if child.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
let title1 = YHFormTitleItem(type: .F)
let item10 = YHFormDetailItem(type: .nationOrArea, value:child.nationality, tips: "请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
let title2 = YHFormTitleItem(type: .liveInfo)
let title2 = YHFormTitleItem(type: .G)
let item20 = YHFormDetailItem(type: .isLiveTother, value:String(child.isLiveTother()))
var arr2: [YHFormItemProtocol] = [title2, item20]
......@@ -446,10 +446,10 @@ extension YHGCChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality { // 选国籍
if title.type == .F { // 选国籍
self.child?.nationality = country
} else if title.type == .liveInfo { // // 居住信息选国家地区
} else if title.type == .G { // // 居住信息选国家地区
self.child?.address.country = country
// 选择国家地区后需清空城市
self.child?.address.area = []
......
......@@ -16,7 +16,6 @@ class YHGCSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
var mainApplicantInfo: YHMyMainApplicantInfoModel?
weak var delegate:YHSpouseInfoVCProtocol?
// 是否显示未填写错误提示
var isNeedShowError = false
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
......@@ -59,23 +58,20 @@ class YHGCSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.removeAll()
// 随行
let title0 = YHFormTitleItem(type: .E)
let item0 = YHFormDetailItem(type: .isAccompanyToHK)
item0.value = String(spouse.isFollow())
let arr0:[YHFormItemProtocol] = [title0, item0]
items.append(arr0)
if spouse.isFollow() { // 随行才加后面的信息
// 国籍
let title1 = YHFormTitleItem(type: .nationality)
if spouse.isFollow() {
let title1 = YHFormTitleItem(type: .F)
let item10 = YHFormDetailItem(type:.nationOrArea, value:spouse.nationality, placeHolder:"请选择".local, tips:"请选择国籍".local)
let arr1:[YHFormItemProtocol] = [title1, item10]
// 居住信息
var arr2 = [YHFormItemProtocol]()
let title2 = YHFormTitleItem(type: .liveInfo)
let title2 = YHFormTitleItem(type: .G)
arr2.append(title2)
let item20 = YHFormDetailItem(type:.isLiveTother, value:String(spouse.isLiveTother()))
......@@ -87,15 +83,11 @@ class YHGCSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
arr2.append(item21)
}
if !spouse.isLiveTother() { // 不同住 才需填写国家/地区
if !spouse.isLiveTother() {
let item21 = YHFormDetailItem(type:.nationOrArea, value:spouse.address.country, placeHolder:"请选择".local, tips:"请选择国家/地区".local)
arr2.append(item21)
// 国家/地区已填写 才显示现居住城市和详细地址两行
if !spouse.address.country.isEmpty {
// 居住信息中选择中国才会显示现居住城市
let isLiveInChina = spouse.address.country.contains("中国".local)
if isLiveInChina {
var value:String? = ""
......@@ -114,8 +106,7 @@ class YHGCSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
addResidenceBlock()
if !isLiveInChina {// 在国外
// 是否在海外居住满1年及以上
if !isLiveInChina {
let item24 = YHFormDetailItem(type: .isLiveOverSeasMore1Year)
item24.value = String(spouse.isOverSeasOver1Year())
arr2.append(item24)
......@@ -131,26 +122,20 @@ class YHGCSpousePrimaryInfoVC: YHBaseViewController, YHFamilyMemberProtol {
items.append(contentsOf:[arr1, arr2])
// 港澳通信证
var isHiddenHK = true
// 国籍
let nationality = spouse.nationality
// 居住国家
var liveCountry = spouse.address.country
// 居住海外是否满一年
var isLiveOverseaYear = spouse.isOverSeasOver1Year()
if spouse.isLiveTother(), let mainApplicantInfo = mainApplicantInfo {
// 与主申请人同住需要用主申请人居住信息判断
liveCountry = mainApplicantInfo.applicant_address.country
isLiveOverseaYear = mainApplicantInfo.isOverSeasOver1Year()
}
if nationality.contains("中国") { // 中国国籍
if nationality.contains("中国") {
let isLiveInChina = liveCountry.contains("中国".local)
if isLiveInChina || (!isLiveInChina && !isLiveOverseaYear) {
// 中国国籍&居住国内、中国国籍&居住国外不满一年 需展示“港澳通行证”询问框
isHiddenHK = false
}
}
......@@ -211,7 +196,6 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFormDetailItem
// 是否随行到香港 / 是否办理港澳通行证 / // 是否与主申请人同住 均用双项按钮cell
if detailItem.type == .isAccompanyToHK ||
detailItem.type == .isHandleHKPassPort ||
detailItem.type == .isLiveTother ||
......@@ -230,7 +214,7 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.setTips(detailItem.tips, isShow: isNeedShowError && isShowTips)
if detailItem.type == .permanentResidenceStatus { // 永久居留身份
if detailItem.type == .permanentResidenceStatus {
var isSelectYES = false
var isSelectNO = false
......@@ -271,7 +255,7 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let selectItem:YHFormChoiceItem = arr[selectIndex]
let option = (selectItem.title == "是".local ? true : false)
if detailItem.type == .isAccompanyToHK { // 是否随行
if detailItem.type == .isAccompanyToHK {
self.spouse?.setFollow(option)
self.loadInfo()
......@@ -279,26 +263,26 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
delegate.updateStepView()
}
} else if detailItem.type == .isHandleHKPassPort { // 是否办理港澳通行证
} else if detailItem.type == .isHandleHKPassPort {
self.spouse?.setNeedHandleHKPassPort(option)
self.loadInfo()
} else if detailItem.type == .isLiveTother { // 是否与主申请人同住
} else if detailItem.type == .isLiveTother {
self.spouse?.setLiveTother(option)
if option {
self.spouse?.address.clearAddress()
}
self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
} else if detailItem.type == .isLiveOverSeasMore1Year {
self.spouse?.setOverSearsOver1Year(option)
self.loadInfo()
} else if detailItem.type == .isLiveOverSeasMore1Year { // 是否在海外居住满1年及以上
} else if detailItem.type == .isLiveOverSeasMore1Year {
self.spouse?.setOverSearsOver1Year(option)
self.loadInfo()
} else if detailItem.type == .permanentResidenceStatus { // 永久居留身份
} else if detailItem.type == .permanentResidenceStatus {
self.spouse?.setHavePermanentResidenceStatus(option)
self.loadInfo()
......@@ -407,19 +391,17 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
// 选国籍/现居住城市/详细地址
if detailItem.type == .nationOrArea {
let vc = YHSelectCountryViewController()
vc.backLocationStringController = {
[weak self] country in
guard let self = self else { return }
let title = arr[0] as! YHFormTitleItem
if title.type == .nationality { // 选国籍
if title.type == .F {
self.spouse?.nationality = country
} else if title.type == .liveInfo {// 居住信息选国家地区
} else if title.type == .G {
self.spouse?.address.country = country
// 选择国家地区后需清空城市
self.spouse?.address.area = []
}
......@@ -466,9 +448,7 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角
if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......@@ -482,7 +462,6 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
}
}
// 检查填写信息完整性
func checkIntegrity() -> Bool {
guard let spouse = spouse else { return false}
......@@ -498,7 +477,7 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
return false
}
if !spouse.isLiveTother() { // 没有与主申请人同住
if !spouse.isLiveTother() {
if isEmptyString(spouse.address.country) {
return false
}
......@@ -509,7 +488,7 @@ extension YHGCSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
if isEmptyString(spouse.address.details) {
return false
}
} else { // 住在国外
} else {
if isEmptyString(spouse.address.foreign) {
return false
}
......
......@@ -398,6 +398,8 @@ extension YhConstant {
// 我的证件 微信文件上传回调
public static let didMyCertificateWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.myCertificate.wechat.fileUpload")
public static let didMyResignMaterialWeChatFileUploadCallBackNotification = Notification.Name(rawValue: "com.yinhe.resignMaterial.wechat.fileUpload")
// 已经展示银河管家
public static let didLoadYhManagerNotification = Notification.Name(rawValue: "com.yinhe.didLoadYhManager")
public static let backToHomeNotification = Notification.Name(rawValue: "com.yinhe.backToHomeNotification")
......
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