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

// 旅行

parent b852b82d
......@@ -147,14 +147,20 @@ class YHTravelDocsPreparationDetailVC: YHBaseViewController {
} else { // 没有上传过证件
let item = YHTravelCerSectionItem(type: .certificate, tipsArr: [])
if self.type == .HK {
if self.type == .HK || self.type == .chinesePassPort {
var userId = 0
if let uid = YHLoginManager.shared.userModel?.id {
userId = Int(uid) ?? 0
}
let cerModel1 = YHTravelDocsPreparationDetailItemModel(type: 3, order_id: self.orderId, order_sn: "", img_back: "", img_front: "", status: 0, issue_start: "", issue_end: "", user_id:userId , user_type: dataModel.type, remark: "", nationality: "\(dataModel.nationality)")
// 证件类型 1-护照 2-中国旅行证 3-港澳通行证 4-存款证明 5-其他
var type = -1
if self.type == .chinesePassPort {
type = 1
} else if self.type == .HK {
type = 3
}
let cerModel1 = YHTravelDocsPreparationDetailItemModel(type: type, order_id: self.orderId, order_sn: "", img_back: "", img_front: "", status: 0, issue_start: "", issue_end: "", user_id:userId , user_type: dataModel.type, remark: "", nationality: "\(dataModel.nationality)")
cerModel1.latest_validaty_date = self.viewModel.travelDetailModel?.latest_validaty_date ?? ""
item.cerDetailModel = cerModel1
sectionItems.append(item)
}
......@@ -173,15 +179,23 @@ class YHTravelDocsPreparationDetailVC: YHBaseViewController {
var hasError = false
for item in sectionItems {
if item.type == .certificate {
item.cerDetailModel.isNeedCheckCer = false
if item.cerDetailModel.img_front.isEmpty || item.cerDetailModel.img_back.isEmpty {
hasError = true
item.cerDetailModel.isNeedCheckCer = true
if item.cerDetailModel.type == 3 {
if item.cerDetailModel.type == 3 { // 港澳通行证
item.cerDetailModel.checkTips = item.cerDetailModel.img_front.isEmpty ? "请上传港澳通行证正面" : "请上传港澳通行证反面"
} else if item.cerDetailModel.type == 1 { // 中国护照
item.cerDetailModel.checkTips = "请上传护照"
} else if item.cerDetailModel.type == 2 { // 中国居留许可签证
item.cerDetailModel.checkTips = "请上传中国居留许可签证"
}
} else {
item.cerDetailModel.isNeedCheckDate = false
if item.cerDetailModel.issue_start.isEmpty || item.cerDetailModel.issue_end.isEmpty {
hasError = true
item.cerDetailModel.isNeedCheckDate = true
......@@ -305,6 +319,7 @@ extension YHTravelDocsPreparationDetailVC: UITableViewDelegate, UITableViewDataS
if item.type == .tips {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHTravelCertificateTipsCell.cellReuseIdentifier, for: indexPath) as! YHTravelCertificateTipsCell
cell.userName = self.dataModel.name
cell.tipsArr = item.tipsArr
return cell
}
......
......@@ -13,6 +13,12 @@ class YHTravelCertificateTipsCell: UITableViewCell {
static let cellReuseIdentifier = "YHTravelCertificateTipsCell"
var userName: String = "" {
didSet {
titleLabel.text = "\(userName) 需准备证件清单"
}
}
var tipsArr: [ASAttributedString] = [] {
didSet {
grayView.removeSubviews()
......
......@@ -108,13 +108,25 @@ class YHTravelCertificateUploadCell: UITableViewCell {
view.urlBlock = {
[weak self] url, index in
guard let self = self else { return }
self.dataModel.img_front = url
self.getOCR(url: url, isBack: 0)
if self.dataModel.type == 3 { // 港澳通行证
self.dataModel.img_front = url
self.getOCR(url: url, isBack: 0)
} else {
self.dataModel.img_front = url
self.dataModel.img_back = url
self.updateBlock?()
}
}
view.deleteBlock = {
[weak self] url, index in
guard let self = self else { return }
self.dataModel.img_front = ""
if self.dataModel.type == 3 { // 港澳通行证
self.dataModel.img_front = ""
} else {
self.dataModel.img_front = ""
self.dataModel.img_back = ""
}
self.updateBlock?()
}
return view
......@@ -206,12 +218,29 @@ class YHTravelCertificateUploadCell: UITableViewCell {
var frontTitle = ""
var backTitle = ""
if model.type == 3 {
title = "港澳通行证 (逗留D签注)"
frontTitle = "港澳通行证正面"
backTitle = "港澳通行证反面"
if model.nationality == "1" { // 国籍为中国
if model.type == 1 { // 护照
title = "护照信息"
frontTitle = "护照资料页"
} else if model.type == 3 { // 港澳通行证
title = "港澳通行证 (逗留D签注)"
frontTitle = "港澳通行证正面"
backTitle = "港澳通行证反面"
}
} else { // 国籍为外国
if model.type == 1 { // 护照
title = "护照信息"
frontTitle = "护照资料页"
} else if model.type == 3 { // 中国居留许可签证
title = "中国居留许可签证"
frontTitle = "中国居留许可签证"
}
}
// 标题设置
var titleStr: ASAttributedString = .init(string: title, .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
......@@ -230,9 +259,13 @@ class YHTravelCertificateUploadCell: UITableViewCell {
// 证件正反面标题
certificateFrontView.frontLabel.text = frontTitle
certificateBackView.frontLabel.text = backTitle
// 证件正反面图片
certificateFrontView.url = model.img_front
certificateBackView.url = model.img_back
// 除了港澳通行证需要上传正反面 其他都是上传正面
certificateBackView.isHidden = model.type != 3
// 是否有证件
let hasNoCertiInfo = model.img_front.isEmpty && model.img_back.isEmpty
// 需要显示被拒原因
......@@ -378,12 +411,17 @@ class YHTravelCertificateUploadCell: UITableViewCell {
extension YHTravelCertificateUploadCell {
func getOCR(url: String, isBack:Int) {
if self.dataModel.type != 3 { // 非港澳通行证 不用进行OCR识别
return
}
self.viewModel.getPublicImageUrl(url) {
[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
//进行ocr识别
YHHUD.show(.progress(message: "识别中..."))
......@@ -391,9 +429,9 @@ extension YHTravelCertificateUploadCell {
self.viewModel.getHKCardBackInfoByOcr(url, isBack: isBack) { success, result in
YHHUD.hide()
if success, let result = result {
self.dataModel.issue_start = result.term_begins
self.dataModel.issue_end = result.end_of_term
self.updateBlock?()
self.dataModel.issue_start = result.term_begins
self.dataModel.issue_end = result.end_of_term
self.updateBlock?()
} else {
self.updateBlock?()
}
......@@ -404,9 +442,9 @@ extension YHTravelCertificateUploadCell {
self.viewModel.getHKCardInfoByOcr(url, isBack: isBack) { success, result in
YHHUD.hide()
if success, let result = result {
self.dataModel.issue_start = result.term_begins
self.dataModel.issue_end = result.end_of_term
self.updateBlock?()
self.dataModel.issue_start = result.term_begins
self.dataModel.issue_end = result.end_of_term
self.updateBlock?()
} else {
self.updateBlock?()
}
......
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