Commit bd7f937e authored by David黄金龙's avatar David黄金龙

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

* 'qmas-1130' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  主申请人 修改逻辑
parents ac26e5dd bbf153c1
...@@ -149,6 +149,8 @@ class YHFamilyMemberViewModel : YHBaseViewModel{ ...@@ -149,6 +149,8 @@ class YHFamilyMemberViewModel : YHBaseViewModel{
} else { } else {
mainModel.certificates.hkMacaoPass.imgBack = url mainModel.certificates.hkMacaoPass.imgBack = url
} }
case .other:
mainModel.certificates.passport.imgFront = url
} }
if let saveInfoSilentBlock = saveInfoSilentBlock { if let saveInfoSilentBlock = saveInfoSilentBlock {
saveInfoSilentBlock() saveInfoSilentBlock()
......
...@@ -83,6 +83,8 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -83,6 +83,8 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceLabel.text = "港澳通行证反面" backSurfaceLabel.text = "港澳通行证反面"
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
break
} }
} }
} }
...@@ -422,6 +424,8 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -422,6 +424,8 @@ class YHIdentityCardCell: UITableViewCell {
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
case .passport: case .passport:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
case .other:
break
} }
frontImageButton.setContent("card_upload", "点击上传") frontImageButton.setContent("card_upload", "点击上传")
} }
...@@ -434,6 +438,8 @@ class YHIdentityCardCell: UITableViewCell { ...@@ -434,6 +438,8 @@ class YHIdentityCardCell: UITableViewCell {
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
case .passport: case .passport:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
break
} }
backSurfaceImageButton.setContent("card_upload", "点击上传") backSurfaceImageButton.setContent("card_upload", "点击上传")
} }
......
...@@ -166,14 +166,18 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable ...@@ -166,14 +166,18 @@ extension YHMainApplicantInformationViewController: UITableViewDelegate, UITable
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if stepView.currentIndex == 1 { if stepView.currentIndex == 1 {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationCardTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHMainInformationCardTableViewCell.self)
cell.type = YHCardType(rawValue: indexPath.row) ?? .identity if dataSource?[indexPath.row].models?.first?.id == .id5 {
cell.type = .identity
}
if dataSource?[indexPath.row].models?.first?.id == .id6 {
cell.type = .passport
}
if dataSource?[indexPath.row].models?.first?.id == .id7 {
cell.type = .other
}
cell.viewModel = viewModel cell.viewModel = viewModel
cell.backSurfaceDeleteButton.isHidden = true cell.backSurfaceDeleteButton.isHidden = true
cell.frontDeleteButton.isHidden = true cell.frontDeleteButton.isHidden = true
cell.informationBlock = {[weak self] type, image, isLeft in
guard let self = self else { return }
}
return cell return cell
} else { } else {
let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self) let cell = tableView.dequeueReusableCell(withClass: YHMainInformationTableViewCell.self)
......
...@@ -38,6 +38,7 @@ class YHCardExampleView: UIView { ...@@ -38,6 +38,7 @@ class YHCardExampleView: UIView {
make.height.equalTo(207) make.height.equalTo(207)
make.top.equalTo(109) make.top.equalTo(109)
} }
case .other: break
} }
} }
} }
......
...@@ -13,6 +13,7 @@ import Kingfisher ...@@ -13,6 +13,7 @@ import Kingfisher
enum YHCardType: Int { enum YHCardType: Int {
case identity = 0 //中国身份证 case identity = 0 //中国身份证
case passport = 1 //港澳通行证 case passport = 1 //港澳通行证
case other = 2 //护照
} }
class YHMainInformationCardTableViewCell: UITableViewCell { class YHMainInformationCardTableViewCell: UITableViewCell {
...@@ -51,7 +52,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -51,7 +52,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "") self.backSurfaceImageButton.setContent("", "")
} }
} }
} else { } else if type == .passport {
if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 { if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hk_macao_pass.img_front) {[weak self] success, error in self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.hk_macao_pass.img_front) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
...@@ -72,6 +73,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -72,6 +73,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.setContent("", "") self.backSurfaceImageButton.setContent("", "")
} }
} }
} else {
if viewModel.mainModel.certificates.passport.img_front.count != 0 {
self.viewModel.getPublicImageUrl(viewModel.mainModel.certificates.passport.img_front) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
self.frontImageButton.kf.setBackgroundImage(with: URL(string: url), for: .normal, completionHandler: { _ in
self.frontDeleteButton.isHidden = false
})
self.frontImageButton.setContent("", "")
}
}
} }
} }
} }
...@@ -84,12 +96,22 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -84,12 +96,22 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceLabel.text = "身份证国徽面" backSurfaceLabel.text = "身份证国徽面"
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .passport: case .passport:
titleLabel.text = "港澳通行证(选填)" titleLabel.text = "港澳通行证(选填)"
frontLabel.text = "港澳通行证正面" frontLabel.text = "港澳通行证正面"
backSurfaceLabel.text = "港澳通行证反面" backSurfaceLabel.text = "港澳通行证反面"
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
backSurfaceLabel.isHidden = false
backSurfaceImageButton.isHidden = false
case .other:
titleLabel.text = "护照(选填)"
frontLabel.text = "护照资料页"
backSurfaceLabel.isHidden = true
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
backSurfaceImageButton.isHidden = true
} }
} }
} }
...@@ -289,11 +311,15 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -289,11 +311,15 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
} }
@objc func exampleClick() { @objc func exampleClick() {
if type == .other {
YHAdopterCardExampleView.exampleView(type: .chinaTravel).show()
} else {
let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) let view = YHCardExampleView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type view.type = type
let window = UIApplication.shared.yhKeyWindow() let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) window?.addSubview(view)
} }
}
@objc func frontImageClick() { @objc func frontImageClick() {
if type == .identity { if type == .identity {
...@@ -309,7 +335,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -309,7 +335,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
} }
return return
} }
} else { } else if type == .passport {
if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 { if viewModel.mainModel.certificates.hk_macao_pass.img_front.count != 0 {
// let vc = YHImageViewController() // let vc = YHImageViewController()
// vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_front // vc.imgString = viewModel.mainModel.certificates.hk_macao_pass.img_front
...@@ -321,6 +347,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -321,6 +347,17 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
UIViewController.current?.navigationController?.pushViewController(vc) UIViewController.current?.navigationController?.pushViewController(vc)
} }
return
}
} else {
if viewModel.mainModel.certificates.passport.img_front.count != 0 {
if viewModel.mainModel.certificates.passport.img_front.isEmpty == false {
let vc = YHImageViewController()
vc.imgString = viewModel.mainModel.certificates.passport.img_front
UIViewController.current?.navigationController?.pushViewController(vc)
}
return return
} }
} }
...@@ -345,7 +382,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -345,7 +382,7 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
if self.type == .identity { if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in
} }
} else { } else if self.type == .passport {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
} }
} }
...@@ -425,6 +462,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -425,6 +462,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_cn_card_front"), for: .normal)
case .passport: case .passport:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal) frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
case .other:
frontImageButton.setBackgroundImage(UIImage(named: "service_hk_card_front"), for: .normal)
} }
frontImageButton.setContent("card_upload", "点击上传") frontImageButton.setContent("card_upload", "点击上传")
} }
...@@ -437,6 +476,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell { ...@@ -437,6 +476,8 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_cn_card_back"), for: .normal)
case .passport: case .passport:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal) backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
case .other:
backSurfaceImageButton.setBackgroundImage(UIImage(named: "service_hk_card_back"), for: .normal)
} }
backSurfaceImageButton.setContent("card_upload", "点击上传") backSurfaceImageButton.setContent("card_upload", "点击上传")
} }
......
...@@ -45,17 +45,28 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -45,17 +45,28 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let item3 = YHItemModel(id: .id5, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: "", message: "\(mainModel.is_handled)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择是否办理过港澳通行证") let item3 = YHItemModel(id: .id5, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: "", message: "\(mainModel.is_handled)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择是否办理过港澳通行证")
let section2 = YHSectionItemModel(title: "港澳通行证", models: [item3]) let section2 = YHSectionItemModel(title: "港澳通行证", models: [item3])
let addressCountry = mainModel.address.country let addressCountry = mainModel.address.country
let nationality = mainModel.nationality
let is_live_oversea_year = mainModel.is_live_oversea_year
if (nationality.contains("中国") && addressCountry.contains("中国")) || (nationality.contains("中国") && is_live_oversea_year == 0) {
if addressCountry.contains("中国") || addressCountry == "" { if addressCountry.contains("中国") || addressCountry == "" {
return [section, section1, section2] return [section, section1, section2]
} else { } else {
return [section, section11, section2] return [section, section11, section2]
} }
} else {
if addressCountry.contains("中国") || addressCountry == "" {
return [section, section1]
} else {
return [section, section11]
}
}
} }
func getDocumentInformation(_ isShowPrompt: Bool) -> [YHSectionItemModel] { func getDocumentInformation(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
var flag = false var flag = false
let nationality = mainModel.nationality let nationality = mainModel.nationality
if nationality.contains("China") { let is_live_oversea_year = mainModel.is_live_oversea_year
if nationality.contains("中国-China") {
flag = true flag = true
} }
...@@ -70,29 +81,43 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -70,29 +81,43 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
section1String = "中国身份证(选填)" section1String = "中国身份证(选填)"
} }
let section = YHSectionItemModel(title: section1String, models: [item, item1, item2, item3]) let section = YHSectionItemModel(title: section1String, models: [item, item1, item2, item3])
let item10 = YHItemModel(id: .id12, isNeed: true, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.number, isShowPrompts: isShowPrompt, alertMessage:"请输入旅行证件号码")
let item11 = YHItemModel(id: .id13, isNeed: true, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
let item12 = YHItemModel(id: .id14, isNeed: true, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.hk_macao_pass.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item13 = YHItemModel(id: .id15, isNeed: true, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.hk_macao_pass.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
let section1 = YHSectionItemModel(title: "港澳通行证", models: [item10, item11, item12, item13])
let item4 = YHItemModel(id: .id16, isNeed: !flag, title: "证件类别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.certificates.passport.passport_type)", type: .id, isShowPrompts: isShowPrompt, alertMessage:"请选择件类别")
let item5 = YHItemModel(id: .id17, isNeed: !flag, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.number, isShowPrompts: isShowPrompt, alertMessage:"请输入证件号码")
let item6 = YHItemModel(id: .id18, isNeed: !flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
let item7 = YHItemModel(id: .id19, isNeed: !flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item8 = YHItemModel(id: .id20, isNeed: !flag, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
var section2String = "" var section2String = ""
if flag { if mainModel.is_handled == 1 {
section2String = "护照及其他旅行证件(选填)" section2String = "港澳通行证"
flag = true
} else { } else {
section2String = "护照及其他旅行证件" section2String = "港澳通行证(选填)"
flag = false
} }
let section2 = YHSectionItemModel(title: section2String, models: [item4, item5, item6, item7, item8]) let item10 = YHItemModel(id: .id12, isNeed: flag, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.number, isShowPrompts: isShowPrompt, alertMessage:"请输入旅行证件号码")
if mainModel.is_handled == 1 { let item11 = YHItemModel(id: .id13, isNeed: flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.hk_macao_pass.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
return [section, section1, section2] let item12 = YHItemModel(id: .id14, isNeed: flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.hk_macao_pass.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item13 = YHItemModel(id: .id15, isNeed: flag, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.hk_macao_pass.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
let section1 = YHSectionItemModel(title: section2String, models: [item10, item11, item12, item13])
var section3String = ""
if is_live_oversea_year == 1 || !nationality.contains("中国") {
section3String = "护照"
flag = true
} else { } else {
section3String = "护照(选填)"
flag = false
}
let item5 = YHItemModel(id: .id17, isNeed: flag, title: "证件号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.number, isShowPrompts: isShowPrompt, alertMessage:"请输入证件号码")
let item6 = YHItemModel(id: .id18, isNeed: flag, title: "签发地", isUserKeyBoard: true, prompts: "请输入", message: mainModel.certificates.passport.issue_at, isShowPrompts: isShowPrompt, alertMessage:"请输入签发地")
let item7 = YHItemModel(id: .id19, isNeed: flag, title: "签发日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.issue_date_start_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择签发日期")
let item8 = YHItemModel(id: .id20, isNeed: flag, title: "届满日期", isUserKeyBoard: false, prompts: "请选择", message: mainModel.certificates.passport.issue_date_end_at, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择届满日期")
let section2 = YHSectionItemModel(title: section3String, models: [item5, item6, item7, item8])
let addressCountry = mainModel.address.country
if (nationality.contains("中国") && addressCountry.contains("中国")) || (nationality.contains("中国") && is_live_oversea_year == 0) {
return [section, section1]
} else if nationality.contains("中国") && is_live_oversea_year == 1 {
return [section, section2] return [section, section2]
} else {
return [section2]
} }
} }
...@@ -112,7 +137,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -112,7 +137,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} }
} }
let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择出生城市;") let item5 = YHItemModel(id: .id26, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请输入", message: string, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市;")
let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市") let item55 = YHItemModel(id: .id34, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.birth_place.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入出生城市")
let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.sex )", type: .sex, alertMessage:"请选择性别") let item6 = YHItemModel(id: .id27, isNeed: true, title: "性别", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.sex )", type: .sex, alertMessage:"请选择性别")
let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.married )", type: .marry, isShowPrompts: isShowPrompt, alertMessage:"请选择婚姻状况") let item7 = YHItemModel(id: .id28, isNeed: true, title: "婚姻状况", isUserKeyBoard: false, prompts: "请选择", message: "\(mainModel.married )", type: .marry, isShowPrompts: isShowPrompt, alertMessage:"请选择婚姻状况")
...@@ -122,10 +147,6 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -122,10 +147,6 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} }
let section = YHSectionItemModel(title: "主申请人信息", models: [item, item1, item2, item3, item4, item555, item6, item7]) let section = YHSectionItemModel(title: "主申请人信息", models: [item, item1, item2, item3, item4, item555, item6, item7])
let item8 = YHItemModel(id: .id29, isNeed: true, title: "手机号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.mobile, isShowPrompts: isShowPrompt, alertMessage:"请输入手机号码")
let item9 = YHItemModel(id: .id30, isNeed: false, title: "电子邮箱", isUserKeyBoard: true, prompts: "请输入", message: mainModel.email, isShowPrompts: isShowPrompt, alertMessage:"")
let section1 = YHSectionItemModel(title: "联系方式", models: [item8, item9])
let item10 = YHItemModel(id: .id31, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.has_hk_id )", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择") let item10 = YHItemModel(id: .id31, isNeed: true, title: "是否办理过", isUserKeyBoard: false, prompts: nil, message: "\(mainModel.has_hk_id )", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item11 = YHItemModel(id: .id35, isNeed: true, title: "香港身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.hk_id_number, isShowPrompts: isShowPrompt, alertMessage:"请输入香港身份证号码") let item11 = YHItemModel(id: .id35, isNeed: true, title: "香港身份证号码", isUserKeyBoard: true, prompts: "请输入", message: mainModel.hk_id_number, isShowPrompts: isShowPrompt, alertMessage:"请输入香港身份证号码")
let section2 = YHSectionItemModel(title: "香港身份证", models: [item10]) let section2 = YHSectionItemModel(title: "香港身份证", models: [item10])
...@@ -134,7 +155,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -134,7 +155,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
if mainModel.has_hk_id == 1 { if mainModel.has_hk_id == 1 {
section222 = section22 section222 = section22
} }
return [section, section1, section222] return [section, section222]
} }
func getIDCardDataSource(_ isShowPrompt: Bool) -> [YHSectionItemModel] { func getIDCardDataSource(_ isShowPrompt: Bool) -> [YHSectionItemModel] {
...@@ -142,11 +163,22 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -142,11 +163,22 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item]) let section = YHSectionItemModel(title: "中国身份证(选填)", models: [item])
let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt) let item1 = YHItemModel(id: .id6, isNeed: true, title: "港澳通行证(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1]) let section1 = YHSectionItemModel(title: "中国身份证(选填)", models: [item1])
let item2 = YHItemModel(id: .id7, isNeed: true, title: "护照(选填)", isUserKeyBoard: false, prompts: "请输入", message: nil, isShowPrompts: isShowPrompt)
let section2 = YHSectionItemModel(title: "护照(选填)", models: [item2])
let addressCountry = mainModel.address.country
let nationality = mainModel.nationality
let is_live_oversea_year = mainModel.is_live_oversea_year
if (nationality.contains("中国") && addressCountry.contains("中国")) || (nationality.contains("中国") && is_live_oversea_year == 0) {
if mainModel.is_handled == 1 { if mainModel.is_handled == 1 {
return [section, section1] return [section, section1]
} else { } else {
return [section] return [section]
} }
} else if nationality.contains("中国") && is_live_oversea_year == 1 {
return [section, section2]
} else {
return [section2]
}
} }
func updateModel(_ item: YHItemModel) { func updateModel(_ item: YHItemModel) {
...@@ -303,7 +335,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -303,7 +335,7 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
case .id25: case .id25:
mainModel.birth_place_aboard = item.value?.first?.int ?? 0 mainModel.birth_place_aboard = item.value?.first?.int ?? 0
case .id26: case .id26:
mainModel.birth_place.area = item.value ?? [] mainModel.birth_place.details = item.message ?? ""
case .id27: case .id27:
mainModel.sex = item.value?.first?.int ?? 0 mainModel.sex = item.value?.first?.int ?? 0
case .id28: case .id28:
...@@ -349,6 +381,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -349,6 +381,8 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
} else { } else {
mainModel.certificates.hk_macao_pass.img_back = url mainModel.certificates.hk_macao_pass.img_back = url
} }
case .other:
mainModel.certificates.passport.img_front = url
} }
} }
...@@ -589,27 +623,25 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -589,27 +623,25 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let hk_macao_pass_issue_at = mainModel.certificates.hk_macao_pass.issue_at let hk_macao_pass_issue_at = mainModel.certificates.hk_macao_pass.issue_at
let hk_macao_pass_issue_date_start_at = mainModel.certificates.hk_macao_pass.issue_date_start_at let hk_macao_pass_issue_date_start_at = mainModel.certificates.hk_macao_pass.issue_date_start_at
let hk_macao_pass_issue_date_end_at = mainModel.certificates.hk_macao_pass.issue_date_end_at let hk_macao_pass_issue_date_end_at = mainModel.certificates.hk_macao_pass.issue_date_end_at
let passport_type = mainModel.certificates.passport.passport_type
let passport_number = mainModel.certificates.passport.number let passport_number = mainModel.certificates.passport.number
let passport_issue_at = mainModel.certificates.passport.issue_at let passport_issue_at = mainModel.certificates.passport.issue_at
let passport_issue_date_start_at = mainModel.certificates.passport.issue_date_start_at let passport_issue_date_start_at = mainModel.certificates.passport.issue_date_start_at
let passport_issue_date_end_at = mainModel.certificates.passport.issue_date_end_at let passport_issue_date_end_at = mainModel.certificates.passport.issue_date_end_at
let nationality = mainModel.nationality let nationality = mainModel.nationality
let is_live_oversea_year = mainModel.is_live_oversea_year
if nationality.contains("中国-China") {
guard cn_identity_card_number.count == 18 else { return false }
guard cn_identity_card_issue_at.count > 0 else { return false }
guard cn_identity_card_issue_date_start_at.count > 0 else { return false }
guard cn_identity_card_issue_date_end_at.count > 0 else { return false }
}
if self.mainModel.is_handled == 1 { if self.mainModel.is_handled == 1 {
guard hk_macao_pass_number.count > 0 else { return false } guard hk_macao_pass_number.count > 0 else { return false }
guard hk_macao_pass_issue_at.count > 0 else { return false } guard hk_macao_pass_issue_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_start_at.count > 0 else { return false } guard hk_macao_pass_issue_date_start_at.count > 0 else { return false }
guard hk_macao_pass_issue_date_end_at.count > 0 else { return false } guard hk_macao_pass_issue_date_end_at.count > 0 else { return false }
} }
if nationality.contains("China") { if is_live_oversea_year == 1 || !nationality.contains("中国") {
guard cn_identity_card_number.count == 18 else { return false }
guard cn_identity_card_issue_at.count > 0 else { return false }
guard cn_identity_card_issue_date_start_at.count > 0 else { return false }
guard cn_identity_card_issue_date_end_at.count > 0 else { return false }
} else {
guard passport_type > 0 else { return false }
guard passport_number.count > 0 else { return false } guard passport_number.count > 0 else { return false }
guard passport_issue_at.count > 0 else { return false } guard passport_issue_at.count > 0 else { return false }
guard passport_issue_date_start_at.count > 0 else { return false } guard passport_issue_date_start_at.count > 0 else { return false }
...@@ -620,17 +652,15 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel { ...@@ -620,17 +652,15 @@ class YHMainApplicantInformationViewModel: YHBaseViewModel {
let username = mainModel.username let username = mainModel.username
let birthday = mainModel.birthday let birthday = mainModel.birthday
let birth_place_aboard = mainModel.birth_place_aboard let birth_place_aboard = mainModel.birth_place_aboard
let birth_place_area = mainModel.birth_place.area let birth_place_area = mainModel.birth_place.details
let birth_place_foreign = mainModel.birth_place.foreign let birth_place_foreign = mainModel.birth_place.foreign
let sex = mainModel.sex let sex = mainModel.sex
_ = mainModel.married _ = mainModel.married
let mobile = mainModel.mobile
let has_hk_id = mainModel.has_hk_id let has_hk_id = mainModel.has_hk_id
let hk_id_numbe = mainModel.hk_id_number let hk_id_numbe = mainModel.hk_id_number
guard username.count > 0 else { return false } guard username.count > 0 else { return false }
guard birthday.count > 0 else { return false } guard birthday.count > 0 else { return false }
guard sex > 0 else { return false } guard sex > 0 else { return false }
guard mobile.count > 0 else { return false }
if birth_place_aboard == 1 { if birth_place_aboard == 1 {
guard birth_place_foreign.count > 0 else { return false } guard birth_place_foreign.count > 0 else { return false }
} else { } else {
......
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