Commit 6f5990b4 authored by pete谢兆麟's avatar pete谢兆麟

续期证件管理通行证接口逻辑

parent 3e6a60c5
......@@ -86,6 +86,7 @@ class YHResignCertificateDetailEVisaViewController: YHBaseViewController {
@objc func nextStep() {
if file.count != 0 {
let eVisa: [String: Any] = ["name": "电子签证",
"file_name": file.first?.fileName ?? "",
"e_visa_url": file.first?.fileUrl ?? "",
"upload_at": file.first?.uploadedAt ?? ""]
let params : [String : Any] = [
......
......@@ -43,6 +43,7 @@ class YHResignCertificateModel: SmartCodable {
}
class YHResignCertificateInfoModel: SmartCodable {
var file_name: String = ""
var e_visa_url: String = "" //电子签证的url
var name: String = "" //电子签证名称
var upload_at: String = ""
......@@ -59,6 +60,8 @@ class YHResignCertificateInfoModel: SmartCodable {
var img_front: String = ""
var issue_end: String = ""
var issue_start: String = ""
var validate_start: String = ""
var validate_end: String = ""
required init() {
}
......
......@@ -38,6 +38,12 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
var viewModel: YHBaseViewModel = YHBaseViewModel()
var firstUrl: String = ""
var lastUrl: String = ""
var dataModel: YHResignCertificateModel = YHResignCertificateModel()
var failString: String = "" {
didSet {
showMessageLabel.text = failString
}
}
var firstImageName: String = "" {
didSet {
frontImageButton.setBackgroundImage(UIImage(named: firstImageName), for: .normal)
......@@ -412,6 +418,11 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
guard let self = self else { return }
if let block = self.block {
block(model)
if self.compareDates(dateString1: model.message ?? "", dateString2: self.dataModel.valid_date) {
} else {
failString = "有效期不足,需要为\(self.dataModel.valid_date)或以后"
}
}
}
centerView.addSubview(cardEndView)
......@@ -549,4 +560,19 @@ class YHResignCertificateHKTableViewCell: UITableViewCell {
block("", 1)
}
}
func compareDates(dateString1: String, dateString2: String) -> Bool {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
guard let date1 = dateFormatter.date(from: dateString1),
let date2 = dateFormatter.date(from: dateString2) else {
return false
}
if date1 < date2 {
return false
}
return true
}
}
......@@ -32,8 +32,8 @@ class YHResignCertificateDetailViewModel: YHBaseViewModel {
func getBaseDataSource(_ isShowPrompt: Bool) -> [YHItemModel] {
let item1 = YHItemModel(id: .id1, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item2 = YHItemModel(id: .id2, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
let item3 = YHItemModel(id: .id3, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item4 = YHItemModel(id: .id4, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.issue_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
let item3 = YHItemModel(id: .id3, isNeed: true, title: "开始时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.validate_start, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择开始时间")
let item4 = YHItemModel(id: .id4, isNeed: true, title: "到期时间", isUserKeyBoard: false, prompts: "请选择", message: dataModel.cert_info.validate_end, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择到期时间")
return [item1, item2, item3, item4]
}
......
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