Commit 5124b1c1 authored by Alex朱枝文's avatar Alex朱枝文

收入记录接口调试

parent e6d2080f
......@@ -634,6 +634,11 @@
04B401EA2CE848E6005C61A9 /* YHIncomeTypeSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401E92CE848E6005C61A9 /* YHIncomeTypeSelectViewController.swift */; };
04B401EC2CE84CBD005C61A9 /* YHIncomeTypePopViewSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401EB2CE84CBD005C61A9 /* YHIncomeTypePopViewSelectCell.swift */; };
04B401EE2CE8709A005C61A9 /* YHIncomeTypeSelectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401ED2CE8709A005C61A9 /* YHIncomeTypeSelectModel.swift */; };
04B401F02CEB0C78005C61A9 /* YHIncomeRecordViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401EF2CEB0C78005C61A9 /* YHIncomeRecordViewModel.swift */; };
04B401F22CEB19C1005C61A9 /* YHIncomeRecordCompleteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401F12CEB19C1005C61A9 /* YHIncomeRecordCompleteModel.swift */; };
04B401F42CEB1C51005C61A9 /* YHIncomeCompanyDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401F32CEB1C51005C61A9 /* YHIncomeCompanyDetailModel.swift */; };
04B401F62CEB239C005C61A9 /* YHIncomeRecordUtilType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401F52CEB239C005C61A9 /* YHIncomeRecordUtilType.swift */; };
04B401F82CEB3E2B005C61A9 /* YHIncomeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B401F72CEB3E2A005C61A9 /* YHIncomeType.swift */; };
04B4B8D52C89CE5E00ED82BC /* YHButlerServiceMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B4B8D42C89CE5E00ED82BC /* YHButlerServiceMessage.swift */; };
04B4B8D72C8AE77C00ED82BC /* YHButlerServiceMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B4B8D62C8AE77C00ED82BC /* YHButlerServiceMessageHandler.swift */; };
04B4B8DC2C90696E00ED82BC /* YHResignDocumentManagementVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B4B8DB2C90696E00ED82BC /* YHResignDocumentManagementVC.swift */; };
......@@ -1651,6 +1656,11 @@
04B401E92CE848E6005C61A9 /* YHIncomeTypeSelectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeTypeSelectViewController.swift; sourceTree = "<group>"; };
04B401EB2CE84CBD005C61A9 /* YHIncomeTypePopViewSelectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeTypePopViewSelectCell.swift; sourceTree = "<group>"; };
04B401ED2CE8709A005C61A9 /* YHIncomeTypeSelectModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeTypeSelectModel.swift; sourceTree = "<group>"; };
04B401EF2CEB0C78005C61A9 /* YHIncomeRecordViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeRecordViewModel.swift; sourceTree = "<group>"; };
04B401F12CEB19C1005C61A9 /* YHIncomeRecordCompleteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeRecordCompleteModel.swift; sourceTree = "<group>"; };
04B401F32CEB1C51005C61A9 /* YHIncomeCompanyDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeCompanyDetailModel.swift; sourceTree = "<group>"; };
04B401F52CEB239C005C61A9 /* YHIncomeRecordUtilType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeRecordUtilType.swift; sourceTree = "<group>"; };
04B401F72CEB3E2A005C61A9 /* YHIncomeType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeType.swift; sourceTree = "<group>"; };
04B4B8D42C89CE5E00ED82BC /* YHButlerServiceMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceMessage.swift; sourceTree = "<group>"; };
04B4B8D62C8AE77C00ED82BC /* YHButlerServiceMessageHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHButlerServiceMessageHandler.swift; sourceTree = "<group>"; };
04B4B8DB2C90696E00ED82BC /* YHResignDocumentManagementVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignDocumentManagementVC.swift; sourceTree = "<group>"; };
......@@ -3988,6 +3998,10 @@
isa = PBXGroup;
children = (
04B401ED2CE8709A005C61A9 /* YHIncomeTypeSelectModel.swift */,
04B401F72CEB3E2A005C61A9 /* YHIncomeType.swift */,
04B401F12CEB19C1005C61A9 /* YHIncomeRecordCompleteModel.swift */,
04B401F32CEB1C51005C61A9 /* YHIncomeCompanyDetailModel.swift */,
04B401F52CEB239C005C61A9 /* YHIncomeRecordUtilType.swift */,
);
path = M;
sourceTree = "<group>";
......@@ -4018,6 +4032,7 @@
04B401CF2CE6E6C8005C61A9 /* VM */ = {
isa = PBXGroup;
children = (
04B401EF2CEB0C78005C61A9 /* YHIncomeRecordViewModel.swift */,
);
path = VM;
sourceTree = "<group>";
......@@ -5898,6 +5913,7 @@
0457921B2CBE0C3F00EBD99B /* YHLookResignResultModel.swift in Sources */,
045EEEB92B9F171A0022A143 /* YHWorkMessageSelectTableViewCell.swift in Sources */,
04FA8B302C0874CA00ABE43F /* YHOneKeyLoginViewModel.swift in Sources */,
04B401F82CEB3E2B005C61A9 /* YHIncomeType.swift in Sources */,
04256E112C75BD2700A37BA4 /* YHVisaPaymentListModel.swift in Sources */,
04A7BD0F2BA41C9800BD35A2 /* YHMyDocumentsModel.swift in Sources */,
044EE24A2C9434D400A2FE3A /* YHResignCertificateDetailPassPortViewController.swift in Sources */,
......@@ -6162,6 +6178,7 @@
048787D92BCF68530036E221 /* YHProgressView.swift in Sources */,
04256DEE2C73338200A37BA4 /* YHGrabingNumberListCell.swift in Sources */,
047F3DF02CE88380001B2A6D /* YHMaterialListCell.swift in Sources */,
04B401F02CEB0C78005C61A9 /* YHIncomeRecordViewModel.swift in Sources */,
04B401E62CE83C74005C61A9 /* YHIncomeRemarkCell.swift in Sources */,
045EEEEC2B9F171A0022A143 /* YHBrotherInfoVC.swift in Sources */,
0477E17A2BA41C7E00436346 /* YHCertificateModel.swift in Sources */,
......@@ -6266,6 +6283,7 @@
045EEE882B9F171A0022A143 /* YHPreviewAcademicAndProfessionalQualificationViewController.swift in Sources */,
0435FA7F2BA178C100024EAE /* YHCommonAlertView.swift in Sources */,
A5ACE9382B4564F7002C94D2 /* UIApplication+Extension.swift in Sources */,
04B401F22CEB19C1005C61A9 /* YHIncomeRecordCompleteModel.swift in Sources */,
0468D42B2B55019900CFB916 /* YHAnalytics.swift in Sources */,
04912F842CB7D14D00CC3105 /* YHResignScheduleLineCollectCell.swift in Sources */,
0445E6B12BE9E15C003C52F9 /* YHFindAppNewVersionView.swift in Sources */,
......@@ -6450,6 +6468,7 @@
A554A5122B99715000EA5973 /* YHConstantArrayData.swift in Sources */,
045EEE962B9F171A0022A143 /* YHPreviewInfoCertificatePictureItemsView.swift in Sources */,
044EE2362C92916600A2FE3A /* YHResignCertificateListViewController.swift in Sources */,
04B401F62CEB239C005C61A9 /* YHIncomeRecordUtilType.swift in Sources */,
04F243412C9AFBAB00DF2C74 /* YHHKRecordItemDetailType.swift in Sources */,
04256DDE2C72DA3B00A37BA4 /* YHCertificateAppointViewController.swift in Sources */,
A592FE912BA6CC010062FACA /* YHCertificateEntryHeadView.swift in Sources */,
......@@ -6504,6 +6523,7 @@
04912F942CB921C300CC3105 /* YHResignAppointContainerViewController.swift in Sources */,
045EEE972B9F171A0022A143 /* YHPreviewInfoWorkExpView.swift in Sources */,
04B401EC2CE84CBD005C61A9 /* YHIncomeTypePopViewSelectCell.swift in Sources */,
04B401F42CEB1C51005C61A9 /* YHIncomeCompanyDetailModel.swift in Sources */,
044BACC72BCFA58E00184C64 /* YHNoDataTipsView.swift in Sources */,
04D5C5662B8ED92600190021 /* YHBaseModel.swift in Sources */,
A5F8AC082B9F414000A21EFA /* YHCustomTextView.swift in Sources */,
......
......@@ -13,13 +13,16 @@ import UIKit
class YHIncomeRecordViewController: YHBaseViewController {
enum TableRow {
case incomeSummary(_ isEditing: Bool = false, _ isEditEnable: Bool = false)
case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String)
case incomeItem(_ isEditState: Bool = false, _ company: String, _ money: String, _ timeStr: String, _ incomeId: Int)
case totalIncome(_ money: ASAttributedString)
case consentForHKTravel(_ title: String, _ detail: ASAttributedString, _ question: String, _ isSelectSureBtn: Bool = true)
}
private lazy var datas: [[TableRow]] = []
private lazy var viewModel = YHIncomeRecordViewModel()
private var incomeModel = YHIncomeRecordCompleteModel()
private lazy var saveButton: UIButton = {
let button = UIButton(type: .custom)
button.titleLabel?.font = UIFont.PFSC_M(ofSize: 15)
......@@ -76,11 +79,21 @@ class YHIncomeRecordViewController: YHBaseViewController {
view.keyboardDismissMode = .onDrag
return view
}()
private let orderId: Int
init(orderId: Int) {
self.orderId = orderId
super.init(nibName: nil, bundle: nil)
}
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
setupData()
requestData(isNeedLoading: true)
}
override func viewWillAppear(_ animated: Bool) {
......@@ -96,11 +109,11 @@ class YHIncomeRecordViewController: YHBaseViewController {
extension YHIncomeRecordViewController {
@objc private func clickSaveButton() {
//
updateIncome(.save)
}
@objc private func clickSubmitButton() {
//
updateIncome(.submit)
}
private func setupUI() {
......@@ -145,12 +158,36 @@ extension YHIncomeRecordViewController {
private func setupData() {
let detail: ASAttributedString = .init(string: "备注:全年收入是指应课税(应纳所得税)的就业或业务收入,包括工资薪金、津贴、股票期权及从其拥有的公司所得的利润。由个人投资所产生的收入不会计算在内。", .font(UIFont.PFSC_R(ofSize: 13)), .foreground(UIColor(hexString: "#8993A2") ?? .gray))
let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上", true)]
let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: "1,351,517", .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14)))
let secondSection: [TableRow] = [.incomeSummary(false, false), .incomeItem(false, "华为有限公司", "约1,234,234港币", "已填写"), .incomeItem(false, "腾讯有限公司", "约1,234,234港币", "有5项未填写"), .totalIncome(totalMoney)]
let firstSection: [TableRow] = [.consentForHKTravel("收入情况", detail, "您在前一年,全年收入是否达港币100万元或以上", incomeModel.income_over_100 == YHIncomeOver100.true.rawValue)]
guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else {
datas = [firstSection]
tableView.reloadData()
return
}
let hkdFormatter = currencyFormat("")
var money: Double = 0
var secondSection: [TableRow] = [.incomeSummary(false, false)]
incomeModel.list.forEach { companyModel in
money += companyModel.income_money
let moneyStr = "约" + (hkdFormatter.string(from: NSNumber(value: companyModel.income_money)) ?? "0") + "港币"
let timeStr: String = companyModel.fill_status ? "已填写" : "有\(companyModel.unfilled_count)项未填写"
let incomeItem: TableRow = .incomeItem(false, companyModel.company_name, moneyStr, timeStr, companyModel.income_id)
secondSection.append(incomeItem)
}
let totalNum = hkdFormatter.string(from: NSNumber(value: money)) ?? "0"
let totalMoney: ASAttributedString = .init(string: "约 ", .font(.PFSC_R(ofSize: 14))) + .init(string: totalNum, .font(UIFont(name: "DINAlternate-Bold", size: 20) ?? UIFont.systemFont(ofSize: 20))) + .init(string: " 港币", .font(.PFSC_R(ofSize: 14)))
secondSection.append(.totalIncome(totalMoney))
datas = [firstSection, secondSection]
tableView.reloadData()
}
private func currencyFormat(_ currencySymbol: String) -> NumberFormatter {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.currencySymbol = currencySymbol
formatter.maximumFractionDigits = 0
return formatter
}
}
extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSource {
......@@ -182,7 +219,7 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
cell.setupCellInfo(isEditState, isEditEnable, showRightButton: false)
return cell
}
case let .incomeItem(isEditState, company, money, timeStr):
case let .incomeItem(isEditState, company, money, timeStr, _):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeRecordItemCell.cellReuseIdentifier) as? YHIncomeRecordItemCell {
cell.setupCellInfo(title: company, detail: money, rightText: timeStr, isEditing: isEditState, showBottomLine: false)
return cell
......@@ -190,16 +227,24 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
case let .totalIncome(money):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHTotalIncomeCell.cellReuseIdentifier) as? YHTotalIncomeCell {
cell.setupCellInfo(detail: money)
cell.didClickInfoButton = {
YHHUD.flash(message: "注:按1港币≈0.92人民币计算,实际金额按递交时入境处给出的汇率为准")
cell.didClickInfoButton = { [weak self] in
guard let self = self else {
return
}
let rate = self.incomeModel.rate > 0 ? self.incomeModel.rate : 0.92
YHHUD.flash(message: "注:按1港币≈\(rate)人民币计算,实际金额按递交时入境处给出的汇率为准")
}
return cell
}
case let .consentForHKTravel(title, detail, question, isSelectSureBtn):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHInfoConsentForHKTravelCell.cellReuseIdentifier) as? YHInfoConsentForHKTravelCell {
cell.setupCellInfo(title: title, detail: detail, question: question)
cell.didSelectSureButton = { _ in
//
cell.didSelectSureButton = { [weak self] selected in
guard let self = self else {
return
}
self.incomeModel.income_over_100 = selected ? YHIncomeOver100.true.rawValue : YHIncomeOver100.false.rawValue
self.setupData()
}
cell.selectedSureButton = isSelectSureBtn
return cell
......@@ -231,9 +276,61 @@ extension YHIncomeRecordViewController: UITableViewDelegate, UITableViewDataSour
return
}
let tableRow = sectionArr[indexPath.row]
if case .incomeItem = tableRow {
let ctl = YHIncomeRecordWorkExperienceViewController()
if case let .incomeItem(_, _, _, _, incomeId) = tableRow {
let ctl = YHIncomeRecordWorkExperienceViewController(incomeId: incomeId)
ctl.submitSuccess = { [weak self] in
self?.requestData(isNeedLoading: true)
}
navigationController?.pushViewController(ctl, animated: true)
}
}
}
extension YHIncomeRecordViewController {
private func requestData(isNeedLoading: Bool = false) {
if isNeedLoading {
YHHUD.show(.progress(message: "加载中..."))
}
viewModel.getIncomeList(orderId: orderId) { [weak self] incomeModel, error in
guard let self = self else {
return
}
if isNeedLoading {
YHHUD.hide()
}
guard let incomeModel = incomeModel else {
printLog("YHIncomeRecordViewController: 请求失败")
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg)
}
self.datas = []
self.tableView.reloadData()
return
}
self.incomeModel = incomeModel
self.setupData()
}
}
private func updateIncome(_ type: YHIncomeRecordUpdateType) {
let incomeOver100: YHIncomeOver100 = YHIncomeOver100(rawValue: incomeModel.income_over_100) ?? .true
let msg = type == .save ? "保存中..." : "提交中..."
YHHUD.show(.progress(message: msg))
viewModel.incomeUpdate(orderId: orderId, incomeOver100: incomeOver100, type: type) { [weak self] success, error in
guard let self = self else {
return
}
YHHUD.hide()
if success {
let msg = type == .save ? "保存成功" : "提交成功"
YHHUD.flash(message: msg)
if type == .submit {
self.navigationController?.popViewController(animated: true)
}
} else if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg)
}
}
}
}
......@@ -66,23 +66,15 @@ class YHIncomeTypeSelectViewController: YHBaseViewController {
}()
private lazy var datas: [YHIncomeTypeSelectModel] = {
["工资薪金所得及全年一次性奖金",
"上市公司股票期权或股权收入",
"持股公司分红收入",
"个体工商户/合伙企业/独资企业经营所得收入",
"股权转让收入",
"内地公司收入(持股50%及以上)",
"香港公司收入(持股50%及以上)",
"澳门公司收入(持股50%及以上)",
"其他境外公司收入(持股50%及以上)"].map {
YHIncomeTypeSelectModel(title: $0, isSelected: false)
YHIncomeType.allCases.map {
YHIncomeTypeSelectModel(type: $0, isSelected: false)
}
}()
var sureButtonEvent: (([String]) -> Void)?
var sureButtonEvent: (([YHIncomeType]) -> Void)?
private var selectedTypes: [String] = []
init(selectedTypes: [String]) {
private var selectedTypes: [YHIncomeType] = []
init(selectedTypes: [YHIncomeType]) {
self.selectedTypes = selectedTypes
super.init(nibName: nil, bundle: nil)
}
......@@ -98,7 +90,7 @@ class YHIncomeTypeSelectViewController: YHBaseViewController {
}
@objc private func clickSureButton() {
sureButtonEvent?(selectedTypes)
sureButtonEvent?(selectedTypes.sorted(by: { $0.rawValue < $1.rawValue }))
dismiss(animated: true)
}
......@@ -162,7 +154,7 @@ class YHIncomeTypeSelectViewController: YHBaseViewController {
guard let self = self else {
return
}
if self.selectedTypes.contains(model.title) {
if self.selectedTypes.contains(model.type) {
model.isSelected = true
}
}
......@@ -187,7 +179,7 @@ extension YHIncomeTypeSelectViewController: UITableViewDelegate, UITableViewData
}
let model = datas[indexPath.section]
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeTypePopViewSelectCell.cellReuseIdentifier) as? YHIncomeTypePopViewSelectCell {
cell.setupCellInfo(title: model.title, isSelected: model.isSelected)
cell.setupCellInfo(title: model.type.nameString(), isSelected: model.isSelected)
return cell
}
return UITableViewCell()
......@@ -221,12 +213,12 @@ extension YHIncomeTypeSelectViewController: UITableViewDelegate, UITableViewData
let model = datas[indexPath.section]
model.isSelected.toggle()
if model.isSelected {
if !selectedTypes.contains(model.title) {
selectedTypes.append(model.title)
if !selectedTypes.contains(model.type) {
selectedTypes.append(model.type)
}
} else {
if let index = selectedTypes.firstIndex(where: { title in
title == model.title
if let index = selectedTypes.firstIndex(where: { type in
type == model.type
}) {
selectedTypes.remove(at: index)
}
......
//
// YHIncomeCompanyDetailModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
import SmartCodable
class YHIncomeCompanyDetailModel: SmartCodable {
var company_name: String = ""
var income_money: Double = 0
var corporate_turnover: Double = 0
var income_type: [Int] = []
var template_id: [Int] = []
var has_all_file: Int = 0
var rate: Double = 0
required init() {
}
}
//
// YHIncomeRecordCompleteModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
import SmartCodable
class YHIncomeRecordCompleteModel: SmartCodable {
var income_over_100: Int = -1
var rate: Double = 0
var list: [YHIncomeRecordListModel] = []
required init() {
}
}
class YHIncomeRecordListModel: SmartCodable {
var income_id: Int = 0
var company_name: String = ""
var income_money: Double = 0
var fill_status: Bool = false
var unfilled_count: Int = 0
required init() {
}
}
//
// YHIncomeRecordUtilType.swift
// galaxy
//
// Created by alexzzw on 2024/11/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
enum YHIncomeRecordHasAllFile: Int {
case unknown = 0
case `true` = 1
case `false` = 2
}
enum YHIncomeOver100: Int {
case `true` = 1
case `false` = 2
}
enum YHIncomeRecordUpdateType: Int {
case save = 1
case submit = 2
}
//
// YHIncomeType.swift
// galaxy
//
// Created by alexzzw on 2024/11/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHIncomeType: Int, CaseIterable {
case incomeOfMainland = 1
case incomeOfHKCompanies = 2
case incomeOfMacauCompanies = 3
case stockOrEquityIncome = 4
case salaryIncomeAndBonus = 5
case dividendIncome = 6
case equityTransferIncome = 7
case businessIncome = 8
case incomeOfOtherOverseasCompanies = 9
static func defaultDocs() -> [String] {
return ["纳税记录",
"纳税清单",
"工作证明"]
}
func nameString() -> String {
switch self {
case .incomeOfMainland:
return "内地公司收入(持股50%及以上)"
case .incomeOfHKCompanies:
return "香港公司收入(持股50%及以上)"
case .incomeOfMacauCompanies:
return "澳门公司收入(持股50%及以上)"
case .stockOrEquityIncome:
return "上市公司股票期权或股权收入"
case .salaryIncomeAndBonus:
return "工资薪金所得及全年一次性奖金"
case .dividendIncome:
return "持股公司分红收入"
case .equityTransferIncome:
return "股权转让收入"
case .businessIncome:
return "个体工商户/合伙企业/独资企业经营所得收入"
case .incomeOfOtherOverseasCompanies:
return "其他境外公司收入(持股50%及以上"
}
}
func docsArray() -> [String] {
switch self {
case .incomeOfMainland:
return ["验资报告",
"审计报告",
"绝对实益拥有人声明书",
"企业所得税月(季)度预缴纳税申报表(A类)(前4个季度/前12个月)",
"企业所得税完税证明(表格式)",
"企业所得税年度纳税申报表(A类)(近一年度)"]
case .incomeOfHKCompanies:
return ["周年申报表",
"审计报告",
"利得税申请表",
"利得税缴纳通知书",
"缴税凭证",
"绝对实益拥有人声明书",
"工作签证",
"工作证明"]
case .incomeOfMacauCompanies:
return ["商业登记证明",
"审计报告",
"所得补充税B组──收益申报书(M1)",
"所得补充税—收益评定通知书(M5)",
"缴税凭证",
"绝对实益拥有人声明书",
"工作签证",
"工作证明"]
case .stockOrEquityIncome:
return ["纳税记录",
"纳税清单",
"股票或期权的发放证明(能看到个人的发放股数和每股价值)",
"工作证明"]
case .salaryIncomeAndBonus:
return ["纳税记录",
"纳税清单",
"工作证明"]
case .dividendIncome:
return ["纳税记录",
"纳税清单",
"持股证明",
"股东分红决议",
"分红入账记录(银行回单)",
"工作证明(持股公司开具)"]
case .equityTransferIncome:
return ["纳税记录",
"纳税清单",
"股权转让相关入账记录(银行回单)",
"股权转让协议",
"股权交割证明&股权变更登记表(显示公司股权占比更改)",
"完税证明(表格式)",
"工作证明"]
case .businessIncome:
return ["纳税记录",
"纳税清单",
"个人所得税经营所得纳税申报表(A表)(前4个季度/前12个月)",
"个人所得税经营所得纳税申报表(A表&B表)(最新年度)",
"个人所得税经营所得纳税申报表(C表)",
"工作证明"]
case .incomeOfOtherOverseasCompanies:
return ["财务报表",
"合法纳税及完税证明",
"公司所有权官方证明文件"]
}
}
}
......@@ -9,11 +9,11 @@
import UIKit
class YHIncomeTypeSelectModel: NSObject {
var title: String = ""
var isSelected: Bool = false
var type: YHIncomeType = .businessIncome
init(title: String, isSelected: Bool) {
self.title = title
init(type: YHIncomeType, isSelected: Bool) {
self.type = type
self.isSelected = isSelected
}
......
......@@ -50,7 +50,8 @@ class YHIncomeRecordSummaryCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(_ isEditing: Bool, _ isEditEnable: Bool, showRightButton: Bool) {
func setupCellInfo(_ isEditing: Bool, _ isEditEnable: Bool, showRightButton: Bool, showBottomLine: Bool = true) {
bottomLineView.isHidden = !showBottomLine
rightButton.isHidden = !showRightButton
rightButton.isEnabled = isEditEnable
updateRightButtonState(isEditing)
......@@ -100,8 +101,8 @@ extension YHIncomeRecordSummaryCell {
bottomLineView.snp.makeConstraints { make in
make.bottom.equalToSuperview()
make.left.equalToSuperview().offset(18)
make.right.equalToSuperview().offset(-18)
make.left.equalToSuperview()
make.right.equalToSuperview()
make.height.equalTo(0.5)
make.top.equalTo(infoDetailLabel.snp.bottom).offset(16)
}
......
......@@ -51,6 +51,8 @@ class YHIncomeTypesCell: YHResignDocumentCell {
return
}
let typeView = YHIncomeTypeView()
typeView.clipsToBounds = true
typeView.layer.cornerRadius = 3
typeView.setupInfo(title)
typeView.closeButtonEvent = { [weak self] in
guard let self = self else {
......
......@@ -95,7 +95,8 @@ class YHInfoConsentForHKTravelCell: YHResignDocumentCell {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String, detail: ASAttributedString, question: String) {
func setupCellInfo(title: String, detail: ASAttributedString, question: String, showBottomLine: Bool = false) {
bottomLineView.isHidden = !showBottomLine
infoTitleLabel.text = title
infoDetailLabel.attributed.text = detail
infoQuestionLabel.text = question
......
//
// YHIncomeRecordViewModel.swift
// galaxy
//
// Created by alexzzw on 2024/11/18.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHIncomeRecordViewModel: YHBaseViewModel {
func getIncomeList(orderId: Int, callback: @escaping (_ incomeModel: YHIncomeRecordCompleteModel?, _ error: YHErrorModel?) -> Void) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeList
_ = YHNetRequest.getRequest(url: strUrl, params: ["order_id": orderId]) { json, _ in
// 1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let resultModel = YHIncomeRecordCompleteModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callback(nil, err)
return
}
callback(resultModel, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback(nil, err)
}
} failBlock: { err in
callback(nil, err)
}
}
func getIncomeDetail(incomeId: Int, callback: @escaping (_ companyDetail: YHIncomeCompanyDetailModel?, _ error: YHErrorModel?) -> Void) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeDetail
_ = YHNetRequest.getRequest(url: strUrl, params: ["income_id": incomeId]) { json, _ in
// 1. json字符串 转 对象
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [String: Any], let resultModel = YHIncomeCompanyDetailModel.deserialize(from: dic) else {
let err = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callback(nil, err)
return
}
callback(resultModel, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback(nil, err)
}
} failBlock: { err in
callback(nil, err)
}
}
func updateDetail(incomeId: Int, incomeMoney: Double, corporateTurnover: Double, incomeType: [Int], hasAllFile: YHIncomeRecordHasAllFile, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["income_id": incomeId,
"income_money": incomeMoney,
"corporate_turnover": corporateTurnover,
"income_type": incomeType,
"has_all_file": hasAllFile.rawValue]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.updateDetail
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
// 1. json字符串 转 对象
printLog("model 是 ==> \(json)")
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)
}
}
func incomeUpdate(orderId: Int, incomeOver100: YHIncomeOver100, type: YHIncomeRecordUpdateType, callBackBlock: @escaping (_ success: Bool, _ error: YHErrorModel?) -> Void) {
let params: [String: Any] = ["order_id": orderId,
"income_over_100": incomeOver100.rawValue,
"type": type.rawValue]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.IncomeRecord.incomeUpdate
_ = YHNetRequest.postRequest(url: strUrl, params: params) { json, _ in
// 1. json字符串 转 对象
printLog("model 是 ==> \(json)")
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)
}
}
}
......@@ -628,4 +628,15 @@ class YHAllApiName {
static let result = "super-app/renewal/renewal-result"
}
struct IncomeRecord {
// 收入信息
static let incomeList = "infoflow/order/income/get-income-work-company-list"
// 公司收入详情
static let incomeDetail = "infoflow/order/income/detail"
// 收入信息编辑
static let updateDetail = "infoflow/order/income/update-detail"
// 收入情况保存和提交
static let incomeUpdate = "infoflow/order/income/update"
}
}
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