Commit c4f530ff authored by Steven杜宇's avatar Steven杜宇

// 原则批

parent 8e07e0e9
......@@ -8,20 +8,7 @@
import UIKit
import SmartCodable
enum YHPrincipleUploadStatus : Int {
// 全部
case all = -1
// 审核中
case review = 0
// 已完成
case finish = 1
// 已驳回
case rejected = 2
// 待上传
case preUpload = 3
}
import AttributedString
class YHPrincipleReviewListVC: YHBaseViewController {
......@@ -58,6 +45,17 @@ class YHPrincipleReviewListVC: YHBaseViewController {
return view
}()
lazy var uploadBtn:UIButton = {
let btn = UIButton()
btn.setTitle("确认上传".local, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 16)
btn.setTitleColor(.white, for: .normal)
btn.backgroundColor = UIColor.brandMainColor
btn.layer.cornerRadius = kCornerRadius3
btn.addTarget(self, action: #selector(didUploadBtnClicked), for: .touchUpInside)
return btn
}()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
......@@ -71,14 +69,24 @@ class YHPrincipleReviewListVC: YHBaseViewController {
func createUI() {
view.addSubview(bgView)
view.addSubview(tableView)
view.addSubview(uploadBtn)
bgView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.bottom.equalToSuperview()
}
tableView.snp.makeConstraints { make in
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.left.right.bottom.equalToSuperview()
make.left.right.equalToSuperview()
make.bottom.equalTo(uploadBtn.snp.top).offset(-8)
}
uploadBtn.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.bottom.equalTo(-42)
make.height.equalTo(48.0)
}
}
......@@ -88,7 +96,7 @@ class YHPrincipleReviewListVC: YHBaseViewController {
group.enter()
// 请求上传信息(《赴港居留同意书》、申请人意见访问、其他证明材料)
viewModel.getPrincipleUploadDetail(orderId: orderId) { success, error in
// self.viewModel.uploadDetailModel
// self.viewModel.uploadDetailModel
group.leave()
}
......@@ -115,21 +123,23 @@ class YHPrincipleReviewListVC: YHBaseViewController {
// 赴港居留同意书
let agreementModel = self.viewModel.uploadDetailModel.file_data.agreement
agreementModel.customType = YHPrincipleAgreementType.agreement.rawValue
agreementModel.title = "《赴港居留同意书》"
agreementModel.isMust = true
agreementModel.isNeedTemplate = true
self.items.append(agreementModel)
// 申请人意见访问
let opinionModel = self.viewModel.uploadDetailModel.file_data.agreement
opinionModel.customType = YHPrincipleAgreementType.agreement.rawValue
opinionModel.title = "申请人意见访问"
let opinionModel = self.viewModel.uploadDetailModel.file_data.opinion
opinionModel.customType = YHPrincipleAgreementType.opinion.rawValue
opinionModel.isMust = true
opinionModel.isNeedTemplate = true
self.items.append(self.viewModel.uploadDetailModel.file_data.opinion)
self.items.append(opinionModel)
// 其他证明条件
self.items.append(self.viewModel.uploadDetailModel.file_data.other)
let otherModel = self.viewModel.uploadDetailModel.file_data.other
otherModel.customType = YHPrincipleAgreementType.other.rawValue
otherModel.isMust = false
otherModel.isNeedTemplate = false
self.items.append(otherModel)
// 已获得港府甄选名额
self.items.append(self.viewModel.envelopModel)
......@@ -157,7 +167,9 @@ class YHPrincipleReviewListVC: YHBaseViewController {
extension YHPrincipleReviewListVC {
@objc func didUploadBtnClicked() {
}
}
extension YHPrincipleReviewListVC: UITableViewDelegate, UITableViewDataSource {
......@@ -237,11 +249,11 @@ extension YHPrincipleReviewListVC: UITableViewDelegate, UITableViewDataSource {
}
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
return 24.0
return UITableView.automaticDimension
}
private func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> CGFloat {
return 1.0
return 0.01
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -251,6 +263,43 @@ extension YHPrincipleReviewListVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
return self.getHeaderView()
}
func getHeaderView() -> UIView {
let view = UIView()
let titleLabel = UILabel()
titleLabel.numberOfLines = 0
let title: ASAttributedString = .init("祝贺您,\(self.viewModel.waitResultModel.applicant.userName)先生!", .font(UIFont.PFSC_M(ofSize: 24)),.foreground(UIColor.mainTextColor))
titleLabel.attributed.text = title
view.addSubview(titleLabel)
let detailLabel = UILabel()
detailLabel.numberOfLines = 0
let str1: ASAttributedString = .init("您【与家人】申请的【优秀人才入境计划】,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor(alpha: 0.7)))
let str2: ASAttributedString = .init("已获得港府的甄选名额", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.brandMainColor))
let str3: ASAttributedString = .init(",请您于", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor(alpha: 0.7)))
let time: ASAttributedString = .init("\(self.viewModel.envelopModel.date)", .font(UIFont.PFSC_B(ofSize: 14)),.foreground(UIColor.brandMainColor))
let str4: ASAttributedString = .init("前补充更多文件,即可等待获得港府的正式批准!", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor(alpha: 0.7)))
detailLabel.attributed.text = str1 + str2 + str3 + time + str4
view.addSubview(detailLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalTo(12)
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(34)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(titleLabel.snp.bottom).offset(12)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalTo(-36)
}
return view
}
}
......@@ -104,7 +104,7 @@ class YHPrincipleAgreementModel: SmartCodable {
var is_check: Int = 0
var upload_requirement: Int = 0
var submit_time: String = ""
var check_status: Int = 0
var check_status: Int = YHPrincipleUploadStatus.preUpload.rawValue
var audit_content: String = ""
var audit_content_crm: String = ""
var sort: Int = 0
......@@ -157,9 +157,15 @@ class YHPrincipleAgreementModel: SmartCodable {
// 自定义属性
var customType: Int = YHPrincipleAgreementType.none.rawValue
var isMust: Bool = false // 是否必须
var title: String = ""
var isNeedTemplate: Bool = true
var isNeedUploadBtn: Bool = true
var isNeedTemplate: Bool = false
var isNeedUploadBtn: Bool {
return self.check_status == YHPrincipleUploadStatus.preUpload.rawValue ||
self.check_status == YHPrincipleUploadStatus.rejected.rawValue
}
// 是否展示上传状态
var isNeedUploadStatus: Bool {
return self.check_status != YHPrincipleUploadStatus.preUpload.rawValue
}
// 灰色或红色提示语
var tips: String = ""
......@@ -171,15 +177,6 @@ class YHPrincipleAgreementModel: SmartCodable {
var isUnfold: Bool = false
//
var fileList:[String] = []
// static func getTips() -> ASAttributedString {
// let a: ASAttributedString = .init("请【下载模板】,填写信息,贵单位", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.mainTextColor))
// let b: ASAttributedString = .init("签字盖章", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.init(hex: 0x3570DC)))
// let c: ASAttributedString = .init("后,拍照or扫描上传", .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.mainTextColor))
// return a + b + c
// }
required init() {
......
......@@ -33,6 +33,7 @@ class YHPrincipleUploadFileCell: UITableViewCell {
func setupUI() {
self.selectionStyle = .none
iconImgV = UIImageView(image: UIImage(named: "my_cer_type_pdf"))
self.addSubview(iconImgV)
......
......@@ -9,14 +9,17 @@
import UIKit
import AttributedString
enum YHPrincipleStatus: Int {
case preSubmit = 0 // 待提交
case review = 1 // 审核中
case rejected = 2 // 已驳回
case pass = 3 // 已通过
case mail = 4 // 已邮件港府
enum YHPrincipleUploadStatus : Int {
// 审核中
case review = 0
// 已通过
case pass = 1
// 已驳回
case rejected = 2
// 待上传
case preUpload = 3
// // 已邮件港府
case mail = 4
}
class YHPrincipleUploadStatusCell: UITableViewCell {
......@@ -27,7 +30,7 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
var items: [String] = []
var expandClick:((Bool)->())?
var status: YHPrincipleStatus = .review
var status: YHPrincipleUploadStatus = .preUpload
lazy var whiteView: UIView = {
let view = UIView()
......@@ -44,10 +47,6 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
label.isScrollEnabled = false
label.isEditable = false
label.isSelectable = false
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor))
let title: ASAttributedString = .init("《赴港居留同意书》", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
let status: ASAttributedString = " \(.view(self.statusLabel, .original(.center)))"
label.attributed.text = mustTag + title + status
return label
}()
......@@ -57,9 +56,6 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
statusLabel.font = UIFont.PFSC_M(ofSize:10)
statusLabel.layer.cornerRadius = kCornerRadius3
statusLabel.clipsToBounds = true
statusLabel.text = "审核中"
statusLabel.backgroundColor = self.getUploadBgColor(status: .review)
statusLabel.textColor = self.getUploadTitleColor(status: .review)
statusLabel.frame = CGRectMake(0, 0, 38, 16)
return statusLabel
}()
......@@ -164,6 +160,7 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
}
func setupUI() {
self.selectionStyle = .none
self.contentView.backgroundColor = .clear
self.backgroundColor = .clear
}
......@@ -187,19 +184,46 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
whiteView.addSubview(uploadBtn)
whiteView.addSubview(redTipsLabel)
grayLabel.text = model.tips
// detailLabel.attributed.text = model.tips1
// 标题
var titleStr: ASAttributedString = .init("\(self.getTitle(type: model.customType))", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.mainTextColor))
// 是否必填
if model.isMust {
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 17)),.foreground(UIColor.failColor))
titleStr = mustTag + titleStr
}
// 审核状态
if model.isNeedUploadStatus {
self.statusLabel.text = self.getUploadStatusText(status: model.check_status)
self.statusLabel.textColor = self.getUploadTitleColor(status: model.check_status)
self.statusLabel.backgroundColor = self.getUploadBgColor(status: model.check_status)
let status: ASAttributedString = " \(.view(self.statusLabel, .original(.center)))"
titleStr = titleStr + status
}
titleLabel.attributed.text = titleStr
// 模版显示
templateButton.isHidden = !model.isNeedTemplate
// 灰色或红色提示
model.tips = self.getTips(type: model.customType)
grayLabel.text = model.tips
// 富文本
let detail = self.getDetailText(type: model.customType)
detailLabel.attributed.text = detail
// 上传按钮显示
uploadBtn.isHidden = !model.isNeedUploadBtn
if model.isNeedUploadBtn {
uploadBtn.layer.addSublayer(self.dotLineLayer)
}
// 底部红色提示
redTipsLabel.text = self.getTips(type: model.customType)
whiteView.snp.remakeConstraints { make in
make.top.equalTo(0)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalTo(0)
make.bottom.equalTo(-20)
}
titleLabel.snp.remakeConstraints { make in
......@@ -236,10 +260,10 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
}
detailLabel.snp.remakeConstraints { make in
make.top.equalTo(grayLabel.snp.bottom).offset(model.tips1.isEmpty ? 0 : 16)
make.top.equalTo(grayLabel.snp.bottom).offset(detail.length <= 0 ? 0 : 16)
make.left.equalTo(16)
make.right.equalTo(-16)
if model.tips1.isEmpty {
if detail.length <= 0 {
make.height.equalTo(0)
}
}
......@@ -277,39 +301,117 @@ class YHPrincipleUploadStatusCell: UITableViewCell {
}
}
func getUploadBgColor(status: YHPrincipleStatus) -> UIColor {
func getUploadBgColor(status: Int) -> UIColor {
var color = UIColor.black
if status == .review {
if status == YHPrincipleUploadStatus.review.rawValue {
color = UIColor(hex: 0xFFF5EB)
} else if status == .rejected {
} else if status == YHPrincipleUploadStatus.rejected.rawValue {
color = UIColor(hex: 0xFFF2F2)
} else if status == .pass {
} else if status == YHPrincipleUploadStatus.pass.rawValue {
color = UIColor(hex: 0xF0FBF7)
} else if status == .mail {
} else if status == YHPrincipleUploadStatus.mail.rawValue {
color = UIColor(hex: 0xF0F4FB)
}
return color
}
func getUploadTitleColor(status: YHPrincipleStatus) -> UIColor {
func getUploadTitleColor(status: Int) -> UIColor {
var color = UIColor.black
if status == .review {
if status == YHPrincipleUploadStatus.review.rawValue {
color = UIColor(hex: 0xFF8000)
} else if status == .rejected {
} else if status == YHPrincipleUploadStatus.rejected.rawValue {
color = UIColor(hex: 0xF81D22)
} else if status == .pass {
} else if status == YHPrincipleUploadStatus.pass.rawValue {
color = UIColor(hex: 0x3CC694)
} else if status == .mail {
} else if status == YHPrincipleUploadStatus.mail.rawValue {
color = UIColor.brandMainColor
}
return color
}
func getTitle(type: Int) -> String {
if type == YHPrincipleAgreementType.agreement.rawValue {
return "《赴港居留同意书》"
}
if type == YHPrincipleAgreementType.opinion.rawValue {
return "申请人意见访问"
}
if type == YHPrincipleAgreementType.other.rawValue {
return "其他证明材料"
}
return ""
}
func getUploadStatusText(status: Int) -> String {
var statusText = ""
if status == YHPrincipleUploadStatus.review.rawValue {
statusText = "审核中"
} else if status == YHPrincipleUploadStatus.rejected.rawValue {
statusText = "已驳回"
} else if status == YHPrincipleUploadStatus.pass.rawValue {
statusText = "已通过"
} else if status == YHPrincipleUploadStatus.mail.rawValue {
statusText = "已邮件港府"
}
return statusText
}
func getDetailText(type: Int) -> ASAttributedString {
if type == YHPrincipleAgreementType.agreement.rawValue {
let a: ASAttributedString = .init("请【下载模板】,填写信息,贵单位", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let b: ASAttributedString = .init("签字盖章", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init("后,拍照or扫描上传", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
return a+b+c
}
if type == YHPrincipleAgreementType.opinion.rawValue {
let a: ASAttributedString = .init("请【下载模板】,填写信息,拍照or扫描上传", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
return a
}
if type == YHPrincipleAgreementType.other.rawValue {
let a: ASAttributedString = .init("", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
return a
}
let a: ASAttributedString = .init("", .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
return a
}
func getTips(type: Int) -> String {
if type == YHPrincipleAgreementType.agreement.rawValue {
return "由你现時所属內地工作单位或负责储存你的记录的內地有关当局所发出的赴港居留同意书。"
}
if type == YHPrincipleAgreementType.opinion.rawValue {
return ""
}
if type == YHPrincipleAgreementType.other.rawValue {
return "1.新公司在职证明(在申请期间更换了工作时必传)\n2.主申人的曾用名证明文件,例如户口本副本\n3.主申请人的中国无刑事罪行记录证明书副本(由公安局开具)"
}
return ""
}
func getCheckTips(type: Int) -> String {
if type == YHPrincipleAgreementType.agreement.rawValue {
return "请上传《赴港居留同意书》"
}
if type == YHPrincipleAgreementType.opinion.rawValue {
return "请上传申请人意见访问"
}
if type == YHPrincipleAgreementType.other.rawValue {
return ""
}
return ""
}
}
extension YHPrincipleUploadStatusCell: UITableViewDataSource, UITableViewDelegate {
......
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