Commit 4c61eb17 authored by Steven杜宇's avatar Steven杜宇

// 风险弹窗

parent 467f1796
......@@ -14,6 +14,7 @@ class YHFamilyInfoConfirmViewController: YHBaseViewController {
var sectionItems:[String] = ["", "", "", ""]
var familyArr: [YHApplicantInfoModel] = []
let viewModel = YHFamilyInfoConfirmViewModel()
let princleVM = YHPrincleViewModel()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -72,6 +73,7 @@ class YHFamilyInfoConfirmViewController: YHBaseViewController {
make.left.right.bottom.equalToSuperview()
make.height.equalTo(98)
}
requetRiskAlert()
}
override func viewWillAppear(_ animated: Bool) {
......@@ -81,6 +83,42 @@ class YHFamilyInfoConfirmViewController: YHBaseViewController {
@objc func didBottomBtnClicked() {
for member in self.familyArr {
if member.confirmStatus == 0 {
YHHUD.flash(message: "存在未确认信息,此信息涉及后续【香港身份证办理】,辛苦核对")
return
}
}
viewModel.submitFaimiyInfoWithOrderId(orderId) {
[weak self] success, error in
guard let self = self else { return }
if success {
YHHUD.flash(message: "确认修改成功")
return
}
let msg = error?.errorMsg ?? "确认修改失败"
YHHUD.flash(message: msg)
self.navigationController?.popViewController()
}
}
func requetRiskAlert() {
viewModel.requetRiskAlertShow {
[weak self] isHaveShow in
guard let self = self else { return }
if isHaveShow {
return
}
let alert = YHFamilyMemberRiskWarningAlertView.alertView()
alert.confirmBlock = {
[weak self] in
guard let self = self else { return }
self.princleVM.postAlertStatus(3) { success, error in
}
}
alert.show()
}
}
}
......
......@@ -76,8 +76,8 @@ class YHFamilyMemberInfoModel: SmartCodable {
var givenNameHistory: String = ""
var married: String = ""
var marriedHistory: String = ""
var birthPlaceAboard: Int = -1
var birthPlaceAboardHistory: Int = -1
var birthPlaceAboard: String = "0"
var birthPlaceAboardHistory: String = ""
var birthPlace: YHApplicantBirthPlaceModel = YHApplicantBirthPlaceModel()
var birthPlaceHistory: YHApplicantBirthPlaceModel = YHApplicantBirthPlaceModel()
var nationalityType: Int = -1
......@@ -118,20 +118,20 @@ class YHFamilyMemberInfoModel: SmartCodable {
}
func getBirthNation() -> String {
if self.birthPlaceAboard == 0 {
if self.birthPlaceAboard == "0" {
return "国内"
} else if self.birthPlaceAboard == 1 {
} else if self.birthPlaceAboard == "1" {
return "国外"
}
return "未知"
return ""
}
func getHistoryBirthNation() -> String {
if self.birthPlaceAboardHistory == 0 {
if self.birthPlaceAboardHistory == "0" {
return "国内"
} else if self.birthPlaceAboardHistory == 1 {
} else if self.birthPlaceAboardHistory == "1" {
return "国外"
}
return "未知"
......@@ -176,7 +176,7 @@ class YHFamilyMemberInfoModel: SmartCodable {
case occupationNameHistory = "occupation_name_history"
}
init(id: Int, name: String, nameHistory: String, familyName: String, familyNameHistory: String, givenName: String, givenNameHistory: String, married: String, marriedHistory: String, birthPlaceAboard: Int, birthPlaceAboardHistory: Int, birthPlace: YHApplicantBirthPlaceModel, birthPlaceHistory: YHApplicantBirthPlaceModel, nationalityType: Int, nationalityTypeHistory: Int, nationality: String, nationalityHistory: String, hkIdentityid: String, hkIdentityidHistory: String, identity: YHApplicantIdentityModel, occupationName: String, occupationNameHistory: String) {
init(id: Int, name: String, nameHistory: String, familyName: String, familyNameHistory: String, givenName: String, givenNameHistory: String, married: String, marriedHistory: String, birthPlaceAboard: String, birthPlaceAboardHistory: String, birthPlace: YHApplicantBirthPlaceModel, birthPlaceHistory: YHApplicantBirthPlaceModel, nationalityType: Int, nationalityTypeHistory: Int, nationality: String, nationalityHistory: String, hkIdentityid: String, hkIdentityidHistory: String, identity: YHApplicantIdentityModel, occupationName: String, occupationNameHistory: String) {
self.id = id
self.name = name
......
......@@ -11,6 +11,8 @@ import AttributedString
class YHFamilyMemberRiskWarningAlertView: UIView {
var confirmBlock:(()->())?
lazy var blackMaskView: UIView = {
let view = UIView()
view.backgroundColor = .alertMaskColor
......@@ -76,6 +78,7 @@ class YHFamilyMemberRiskWarningAlertView: UIView {
}
@objc func didConfirmBtnClicked() {
confirmBlock?()
self.dismiss()
}
......
......@@ -98,6 +98,8 @@ class YHIFamilyInfoListCell: UITableViewCell {
// 姓名更改
var updateName:((String)->())?
var items: [YHFamilyInfoItem] = []
lazy var whiteView: UIView = {
let view = UIView()
view.backgroundColor = .white
......@@ -177,6 +179,7 @@ class YHIFamilyInfoListCell: UITableViewCell {
}
func updateItems(_ items:[YHFamilyInfoItem]) {
self.items = items
itemsContentView.removeSubviews()
var lastItemView:UIView? = nil
......@@ -191,7 +194,21 @@ class YHIFamilyInfoListCell: UITableViewCell {
itemView.updateName = {
[weak self] text in
guard let self = self else { return }
self.updateName?(text)
// self.updateName?(text)
for subView in self.itemsContentView.subviews {
if subView is YHInfoItemView {
let targetView = subView as! YHInfoItemView
if targetView.item.id == .firstName {
targetView.item.value = self.familyInfo.familyName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
}
if targetView.item.id == .lastName {
targetView.item.value = self.familyInfo.givenName
targetView.updateItem(targetView.item, familyInfo: self.familyInfo)
}
}
}
}
} else if let itemView = itemView as? YHInfoOptionView {
......@@ -199,8 +216,8 @@ class YHIFamilyInfoListCell: UITableViewCell {
[weak self] selectItem in
guard let self = self else { return }
if item.id == .birthNation {
familyInfo.birthPlaceAboard = selectItem.index
self.selectBirthNation?(familyInfo.birthPlaceAboard == 0)
familyInfo.birthPlaceAboard = "\(selectItem.index)"
self.selectBirthNation?(familyInfo.birthPlaceAboard == "0")
}
}
itemsContentView.addSubview(itemView)
......
......@@ -12,6 +12,7 @@ class YHFamilyInfoConfirmViewModel: NSObject {
var familyInfo: YHFamilyGroupModel = YHFamilyGroupModel()
var pinyinInfo: YHFamilyNamePinYin = YHFamilyNamePinYin()
var isHaveShowRiskAlert: Bool = false
func getFamilyInfo(param:[String : Any], callback:((_ success: Bool,_ error:YHErrorModel?)->())?) {
......@@ -99,6 +100,56 @@ class YHFamilyInfoConfirmViewModel: NSObject {
callback?(false, err)
}
}
func submitFaimiyInfoWithOrderId(_ orderId: Int, callback:((_ success: Bool,_ error:YHErrorModel?)->())?) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.FamilyInfoConfirm.familyNext
let _ = YHNetRequest.postRequest(url: strUrl,params: ["orderId": orderId]) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
callback?(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(false, err)
}
} failBlock: { err in
callback?(false, err)
}
}
// 家庭确认信息风险弹窗
func requetRiskAlertShow(callback:((_ isHaveShow: Bool)->())?) {
let param = ["identify":3]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Principle.getOfficialCheckStatusApi
let _ = YHNetRequest.getRequest(url: strUrl,params: param) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
if let flag = json.data as? Bool {
self.isHaveShowRiskAlert = flag
} else {
self.isHaveShowRiskAlert = false
}
callback?(self.isHaveShowRiskAlert)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(false)
}
} failBlock: { err in
callback?(false)
}
}
}
......@@ -186,8 +237,9 @@ extension YHFamilyInfoConfirmViewModel {
// 出生国家/地区
let birthNation = model.info.getBirthNation()
let historyBirthNation = model.info.getHistoryBirthNation()
let options = [YHFamilyInfoOption(index: 0, value: "国内", isSelect: model.info.birthPlaceAboard == 0),
YHFamilyInfoOption(index: 1, value: "国外", isSelect: model.info.birthPlaceAboard != 0)]
let options = [YHFamilyInfoOption(index: 0, value: "国内", isSelect: model.info.birthPlaceAboard == "0"),
YHFamilyInfoOption(index: 1, value: "国外", isSelect: model.info.birthPlaceAboard != "0")]
let birthNationInfo = YHFamilyInfoItem(id: .birthNation,
action: .choice,
isMust: true,
......@@ -201,7 +253,7 @@ extension YHFamilyInfoConfirmViewModel {
resultArr.append(birthNationInfo)
// 出生地
if model.info.birthPlaceAboard == 0 { // 国内
if model.info.birthPlaceAboard == "0" { // 国内
let birthPlace = model.info.birthPlace.area.joined(separator: "")
let birthPlaceHistory = model.info.birthPlaceHistory.area.joined(separator: "")
let birthPlaceInfo = YHFamilyInfoItem(id: .birthPlaceInChina,
......
......@@ -80,6 +80,12 @@ extension YHPrincleViewModel {
} else if type == 2 {
//identify = 2 // 香港身份获批操作指引
params = ["identify":2]
} else if type == 3 {
//identify = 3 // 家庭信息确认风险弹窗
params = ["identify":3]
} else if type == 15 {
//identify = 2 // 首页正式批弹窗
params = ["identify":15]
......
......@@ -208,8 +208,6 @@ class YHSheetPickerView: UIView {
YHSheetPickerViewItem(title:"离婚".local, index:3),
YHSheetPickerViewItem(title:"分居".local, index:4),
YHSheetPickerViewItem(title:"丧偶".local, index:5),
YHSheetPickerViewItem(title:"事实婚姻".local, index:6),
YHSheetPickerViewItem(title:"鳏寡".local, index:7),
],
......
......@@ -417,6 +417,9 @@ class YHAllApiName {
static let pinyinInfo = "super-app/order/information/pinyin"
// 家庭信息-提交修改
static let submitFamilyUpdate = "super-app/order/family/information/check"
// 获批者家庭信息确认后下一步
static let familyNext = "super-app/order/family/information/next"
}
}
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