Commit 7ac846d3 authored by pete谢兆麟's avatar pete谢兆麟

部分新增受养人接口逻辑

parent 4e5e705c
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
0430E6822C75E068000511E2 /* YHAdopterCardOtherGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6812C75E067000511E2 /* YHAdopterCardOtherGuideView.swift */; }; 0430E6822C75E068000511E2 /* YHAdopterCardOtherGuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6812C75E067000511E2 /* YHAdopterCardOtherGuideView.swift */; };
0430E6842C76D702000511E2 /* YHAddpterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6832C76D702000511E2 /* YHAddpterViewModel.swift */; }; 0430E6842C76D702000511E2 /* YHAddpterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6832C76D702000511E2 /* YHAddpterViewModel.swift */; };
0430E6862C76DF6A000511E2 /* YHAdopterMainModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6852C76DF6A000511E2 /* YHAdopterMainModel.swift */; }; 0430E6862C76DF6A000511E2 /* YHAdopterMainModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6852C76DF6A000511E2 /* YHAdopterMainModel.swift */; };
0430E6882C771B06000511E2 /* YHAdopterItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0430E6872C771B06000511E2 /* YHAdopterItemView.swift */; };
0435FA7F2BA178C100024EAE /* YHCommonAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA7E2BA178C100024EAE /* YHCommonAlertView.swift */; }; 0435FA7F2BA178C100024EAE /* YHCommonAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA7E2BA178C100024EAE /* YHCommonAlertView.swift */; };
0435FA812BA186D600024EAE /* YHMyFileMethodTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA802BA186D600024EAE /* YHMyFileMethodTableViewCell.swift */; }; 0435FA812BA186D600024EAE /* YHMyFileMethodTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA802BA186D600024EAE /* YHMyFileMethodTableViewCell.swift */; };
0435FA832BA2DEB100024EAE /* YHCardButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA822BA2DEB100024EAE /* YHCardButton.swift */; }; 0435FA832BA2DEB100024EAE /* YHCardButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0435FA822BA2DEB100024EAE /* YHCardButton.swift */; };
...@@ -852,6 +853,7 @@ ...@@ -852,6 +853,7 @@
0430E6812C75E067000511E2 /* YHAdopterCardOtherGuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterCardOtherGuideView.swift; sourceTree = "<group>"; }; 0430E6812C75E067000511E2 /* YHAdopterCardOtherGuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterCardOtherGuideView.swift; sourceTree = "<group>"; };
0430E6832C76D702000511E2 /* YHAddpterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddpterViewModel.swift; sourceTree = "<group>"; }; 0430E6832C76D702000511E2 /* YHAddpterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAddpterViewModel.swift; sourceTree = "<group>"; };
0430E6852C76DF6A000511E2 /* YHAdopterMainModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainModel.swift; sourceTree = "<group>"; }; 0430E6852C76DF6A000511E2 /* YHAdopterMainModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterMainModel.swift; sourceTree = "<group>"; };
0430E6872C771B06000511E2 /* YHAdopterItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAdopterItemView.swift; sourceTree = "<group>"; };
0435FA7E2BA178C100024EAE /* YHCommonAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCommonAlertView.swift; sourceTree = "<group>"; }; 0435FA7E2BA178C100024EAE /* YHCommonAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCommonAlertView.swift; sourceTree = "<group>"; };
0435FA802BA186D600024EAE /* YHMyFileMethodTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileMethodTableViewCell.swift; sourceTree = "<group>"; }; 0435FA802BA186D600024EAE /* YHMyFileMethodTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMyFileMethodTableViewCell.swift; sourceTree = "<group>"; };
0435FA822BA2DEB100024EAE /* YHCardButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardButton.swift; sourceTree = "<group>"; }; 0435FA822BA2DEB100024EAE /* YHCardButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCardButton.swift; sourceTree = "<group>"; };
...@@ -1748,6 +1750,7 @@ ...@@ -1748,6 +1750,7 @@
0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */, 0430E6432C72E6A1000511E2 /* YHAdopterMainTableViewCell.swift */,
0430E6452C73171E000511E2 /* YHAdopterStepTableViewCell.swift */, 0430E6452C73171E000511E2 /* YHAdopterStepTableViewCell.swift */,
0430E6472C731B0A000511E2 /* YHAdopterAddNewTableViewCell.swift */, 0430E6472C731B0A000511E2 /* YHAdopterAddNewTableViewCell.swift */,
0430E6872C771B06000511E2 /* YHAdopterItemView.swift */,
0430E6492C731E02000511E2 /* YHAdopterIncomeTableViewCell.swift */, 0430E6492C731E02000511E2 /* YHAdopterIncomeTableViewCell.swift */,
0430E64B2C732821000511E2 /* YHNoAdopterAlertView.swift */, 0430E64B2C732821000511E2 /* YHNoAdopterAlertView.swift */,
0430E64F2C733769000511E2 /* YHAdopterIncomeTitleTableViewCell.swift */, 0430E64F2C733769000511E2 /* YHAdopterIncomeTitleTableViewCell.swift */,
...@@ -4185,6 +4188,7 @@ ...@@ -4185,6 +4188,7 @@
A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */, A5CA3F542C744CAB00EB22F5 /* YHUploadCertificateDetailCell.swift in Sources */,
04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */, 04A7BD172BA43A0F00BD35A2 /* YHMyDocumentsDetailViewModel.swift in Sources */,
04256DF82C73726C00A37BA4 /* YHCerAppointViewModel.swift in Sources */, 04256DF82C73726C00A37BA4 /* YHCerAppointViewModel.swift in Sources */,
0430E6882C771B06000511E2 /* YHAdopterItemView.swift in Sources */,
045EEEB32B9F171A0022A143 /* YHWorkFileSyncTableViewCell.swift in Sources */, 045EEEB32B9F171A0022A143 /* YHWorkFileSyncTableViewCell.swift in Sources */,
045EEEF12B9F171A0022A143 /* YHChildInfoContainerVC.swift in Sources */, 045EEEF12B9F171A0022A143 /* YHChildInfoContainerVC.swift in Sources */,
045EEF0B2B9F171A0022A143 /* YHBasicInfoFillViewController.swift in Sources */, 045EEF0B2B9F171A0022A143 /* YHBasicInfoFillViewController.swift in Sources */,
......
...@@ -254,13 +254,16 @@ extension YHServiceCenterMainViewController { ...@@ -254,13 +254,16 @@ extension YHServiceCenterMainViewController {
} }
@objc func pushOrderView() { @objc func pushOrderView() {
let vc = YHOrderDetailViewController() // let vc = YHOrderDetailViewController()
vc.model = oldModel // vc.model = oldModel
vc.backDate = { [weak self] model in // vc.backDate = { [weak self] model in
guard let self = self else { return } // guard let self = self else { return }
self.model = model // self.model = model
} // }
self.navigationController?.pushViewController(vc) // self.navigationController?.pushViewController(vc)
let vc = YHAddAdoptersViewController()
vc.orderId = orderId
navigationController?.pushViewController(vc)
} }
} }
......
...@@ -11,7 +11,7 @@ import UIKit ...@@ -11,7 +11,7 @@ import UIKit
class YHAddAdoptersViewController: YHBaseViewController { class YHAddAdoptersViewController: YHBaseViewController {
var tableView: UITableView! var tableView: UITableView!
var nextButton: UIButton! var nextButton: UIButton!
var clickIndex = -1 var clickIndex = 2
let viewModel = YHAddpterViewModel() let viewModel = YHAddpterViewModel()
var orderId: Int = 0 var orderId: Int = 0
...@@ -27,11 +27,9 @@ class YHAddAdoptersViewController: YHBaseViewController { ...@@ -27,11 +27,9 @@ class YHAddAdoptersViewController: YHBaseViewController {
func getData() { func getData() {
viewModel.getAddpterMainData(orderId: orderId) {[weak self] success, error in viewModel.getAddpterMainData(orderId: orderId) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.clickIndex = self.viewModel.model?.has_dependent ?? 2
tableView.reloadData()
} }
tableView.reloadData()
let view = YHNoAdopterAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
} }
func setView() { func setView() {
...@@ -94,11 +92,11 @@ class YHAddAdoptersViewController: YHBaseViewController { ...@@ -94,11 +92,11 @@ class YHAddAdoptersViewController: YHBaseViewController {
extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSource { extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if clickIndex == -1 || clickIndex == 1 { // if clickIndex == 1 {
return 4 return 4
} else { // } else {
return 1 // return 1
} // }
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -107,11 +105,14 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc ...@@ -107,11 +105,14 @@ extension YHAddAdoptersViewController: UITableViewDelegate, UITableViewDataSourc
cell.clickBlock = { [weak self] index in cell.clickBlock = { [weak self] index in
guard let self = self else { return } guard let self = self else { return }
self.clickIndex = index self.clickIndex = index
self.tableView.reloadData() self.viewModel.postDependentAdd(dependent: index) {[weak self] success, error in
if self.clickIndex == 0 { guard let self = self else { return }
let view = YHNoAdopterAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) if self.clickIndex == 0 {
let window = UIApplication.shared.yhKeyWindow() let view = YHNoAdopterAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
window?.addSubview(view) let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
self.getData()
} }
} }
cell.clickIndex = clickIndex cell.clickIndex = clickIndex
......
...@@ -11,7 +11,7 @@ import SmartCodable ...@@ -11,7 +11,7 @@ import SmartCodable
class YHAdopterMainModel: SmartCodable { class YHAdopterMainModel: SmartCodable {
var order_id : Int = 0 var order_id : Int = 0
var has_dependent : Int = 0 //是否有受养人 var has_dependent : Int = 2 //是否有受养人
var spouse_name : String = "" //配偶姓名 var spouse_name : String = "" //配偶姓名
var spouse_used_name : String = "" //配偶曾用名 var spouse_used_name : String = "" //配偶曾用名
var spouse_id : Int = 0 var spouse_id : Int = 0
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import UIKit import UIKit
class YHAdopterAddNewTableViewCell: UITableViewCell { class YHAdopterAddNewTableViewCell: UITableViewCell {
typealias ExperienceListBlock = (_ model: YHWorkItemListModel) -> () typealias ExperienceListBlock = (_ model: YHAdopterDependentModel) -> ()
typealias IsMoreBlock = (_ isMore: Bool) -> () typealias IsMoreBlock = (_ isMore: Bool) -> ()
typealias NewAdopterBlock = () -> () typealias NewAdopterBlock = () -> ()
var clickBlock: ExperienceListBlock? var clickBlock: ExperienceListBlock?
...@@ -24,7 +24,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell { ...@@ -24,7 +24,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
var lineView: UIView! var lineView: UIView!
var bottomView: YHWorkItemAddView! var bottomView: YHWorkItemAddView!
var showPrompt: Bool = false var showPrompt: Bool = false
var dataSource: [YHWorkItemListModel]?{ var dataSource: [YHAdopterDependentModel]?{
didSet { didSet {
updateAllViews() updateAllViews()
} }
...@@ -174,7 +174,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell { ...@@ -174,7 +174,7 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
make.right.equalTo(-18) make.right.equalTo(-18)
} }
total = total + 1 total = total + 1
let itemView = YHWorkItemView() let itemView = YHAdopterItemView()
itemView.clickBlock = {[weak self] model in itemView.clickBlock = {[weak self] model in
guard let self = self else { return } guard let self = self else { return }
if let block = self.clickBlock { if let block = self.clickBlock {
...@@ -196,10 +196,10 @@ class YHAdopterAddNewTableViewCell: UITableViewCell { ...@@ -196,10 +196,10 @@ class YHAdopterAddNewTableViewCell: UITableViewCell {
itemView.snp.makeConstraints { make in itemView.snp.makeConstraints { make in
make.left.equalTo(18) make.left.equalTo(18)
make.top.equalTo(total) make.top.equalTo(total)
make.height.equalTo(75) make.height.equalTo(51)
make.right.equalTo(-18) make.right.equalTo(-18)
} }
total = total + 75 total = total + 51
} }
} }
......
//
// YHAdopterItemView.swift
// galaxy
//
// Created by EDY on 2024/8/22.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHAdopterItemView: UIView {
typealias ItemBlock = (_ model: YHAdopterDependentModel) -> ()
var clickBlock: ItemBlock?
var deleteBlock: ItemBlock?
var titleLabel: UILabel!
var explainLabel: UILabel!
var nextStepImageView: UIImageView!
var deleteButton: UIButton!
var centerButton: UIButton!
var showPrompt: Bool = false
var dataSource: YHAdopterDependentModel? {
didSet {
updateAllViews()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = .white
setUpView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpView() {
titleLabel = {
let label = UILabel()
label.font = UIFont.PFSC_B(ofSize: 14)
label.textAlignment = .left
label.numberOfLines = 2
label.textColor = UIColor.mainTextColor
return label
}()
addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.top.bottom.equalToSuperview()
make.width.equalTo(143)
}
explainLabel = {
let label = UILabel()
label.font = UIFont.PFSC_R(ofSize: 14)
label.textAlignment = .right
label.textColor = UIColor.labelTextColor2
return label
}()
addSubview(explainLabel)
explainLabel.snp.makeConstraints { make in
make.right.equalTo(-24)
make.left.equalTo(titleLabel.snp.right)
make.height.equalTo(20)
make.centerY.equalToSuperview()
}
nextStepImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "form_right_arrow")
return imageView
}()
addSubview(nextStepImageView)
nextStepImageView.snp.makeConstraints { make in
make.right.equalToSuperview()
make.centerY.equalTo(explainLabel.snp.centerY)
make.height.width.equalTo(20)
}
centerButton = {
let button = UIButton(type: .custom)
button.addTarget(self, action: #selector(centerClick), for: .touchUpInside)
return button
}()
addSubview(centerButton)
centerButton.snp.makeConstraints { make in
make.right.top.bottom.equalToSuperview()
make.left.equalTo(112)
}
deleteButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_R(ofSize: 14)
button.contentHorizontalAlignment = .center
button.setTitle("删除", for: .normal)
button.contentHorizontalAlignment = .right
button.setTitleColor(UIColor.failColor, for: .normal)
button.addTarget(self, action: #selector(deleteClick), for: .touchUpInside)
button.isHidden = true
return button
}()
addSubview(deleteButton)
deleteButton.snp.makeConstraints { make in
make.right.equalToSuperview()
make.height.equalTo(20)
make.width.equalTo(35)
make.centerY.equalTo(titleLabel.snp.centerY)
}
}
func updateAllViews() {
guard let dataSource = dataSource else { return }
titleLabel.text = dataSource.applicant_name
if dataSource.status == 0 {
explainLabel.text = "待上传"
explainLabel.textColor = UIColor.brandMainColor
nextStepImageView.image = UIImage(named: "service_adopter_income_start")
}
if dataSource.status == 1 {
explainLabel.text = "审核中"
explainLabel.textColor = UIColor(hex: 0xff8000)
nextStepImageView.image = UIImage(named: "service_adopter_income_wait")
}
if dataSource.status == 2 {
explainLabel.text = "已驳回"
explainLabel.textColor = UIColor.failColor
nextStepImageView.image = UIImage(named: "service_adopter_income_fail")
}
if dataSource.status == 3 {
explainLabel.text = "已完成"
explainLabel.textColor = UIColor(hex: 0x3cc694)
nextStepImageView.image = UIImage(named: "service_adopter_income_success")
}
}
@objc func centerClick() {
if let block = clickBlock {
block(self.dataSource ?? YHAdopterDependentModel())
}
}
@objc func deleteClick() {
if let block = deleteBlock {
block(self.dataSource ?? YHAdopterDependentModel())
}
}
func isShowDelete(_ index: Int, isShow: Bool) {
if isShow {
explainLabel.isHidden = true
nextStepImageView.isHidden = true
deleteButton.isHidden = false
} else {
explainLabel.isHidden = false
nextStepImageView.isHidden = false
deleteButton.isHidden = true
}
}
}
...@@ -41,4 +41,23 @@ class YHAddpterViewModel: YHBaseViewModel { ...@@ -41,4 +41,23 @@ class YHAddpterViewModel: YHBaseViewModel {
} }
} }
func postDependentAdd(dependent: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params: [String: Any] = ["has_dependent": dependent]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Adopter.add
let _ = YHNetRequest.postRequest(url: strUrl, params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
if json.code == 200 {
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
} }
...@@ -96,8 +96,11 @@ extension YHServiceCenterMainViewModel { ...@@ -96,8 +96,11 @@ extension YHServiceCenterMainViewModel {
for item in result { for item in result {
if item?.type == orderType { if item?.type == orderType {
resultItem = item ?? YHServiceProgressModel() resultItem = item ?? YHServiceProgressModel()
} else {
if orderType == 2 && (item?.type == 2 || item?.type == 3) {
resultItem = item ?? YHServiceProgressModel()
}
} }
} }
self.arrDataForSeviceCenterProgress = resultItem.list self.arrDataForSeviceCenterProgress = resultItem.list
// self.arrDataForSeviceCenterProgress = result as! [YHServiceCenterProgressModel] // self.arrDataForSeviceCenterProgress = result as! [YHServiceCenterProgressModel]
......
...@@ -450,7 +450,8 @@ class YHAllApiName { ...@@ -450,7 +450,8 @@ class YHAllApiName {
struct Adopter { struct Adopter {
// 新增受养人首页 // 新增受养人首页
static let main = "super-app/order/information/getDepList" static let main = "super-app/order/information/getDepList"
// 点击新增受养人
static let add = "super-app/order/information/dependent/add"
} }
} }
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "service_adopter_income_wait@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "service_adopter_income_wait@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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