Commit 749ff8b5 authored by Steven杜宇's avatar Steven杜宇

// 原则批

parent 9c8e14ab
...@@ -26,6 +26,8 @@ class YHPrincipleWaitResultViewController: YHBaseViewController { ...@@ -26,6 +26,8 @@ class YHPrincipleWaitResultViewController: YHBaseViewController {
var orderId: Int = -1 var orderId: Int = -1
var status: Int = -1 var status: Int = -1
var items: [YHPrincipleWaitResultModel] = [] var items: [YHPrincipleWaitResultModel] = []
var isQuerying: Bool = false
let viewModel = YHPrincleViewModel() let viewModel = YHPrincleViewModel()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
...@@ -143,8 +145,6 @@ extension YHPrincipleWaitResultViewController { ...@@ -143,8 +145,6 @@ extension YHPrincipleWaitResultViewController {
model3.isUnfold = false model3.isUnfold = false
} }
self.items.append(model3) self.items.append(model3)
self.tableView.reloadData() self.tableView.reloadData()
} }
} }
...@@ -162,6 +162,7 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD ...@@ -162,6 +162,7 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD
let model = items[indexPath.row] let model = items[indexPath.row]
if model.type == .photo { if model.type == .photo {
let cell = tableView.dequeueReusableCell(withIdentifier: YHPrinciplePhotoListCell.cellReuseIdentifier, for: indexPath) as! YHPrinciplePhotoListCell let cell = tableView.dequeueReusableCell(withIdentifier: YHPrinciplePhotoListCell.cellReuseIdentifier, for: indexPath) as! YHPrinciplePhotoListCell
model.isQuerying = self.isQuerying
cell.updateModel(model) cell.updateModel(model)
cell.expandClick = { cell.expandClick = {
[weak self] isUnfold in [weak self] isUnfold in
...@@ -169,6 +170,21 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD ...@@ -169,6 +170,21 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD
model.isUnfold = isUnfold model.isUnfold = isUnfold
self.tableView.reloadData() self.tableView.reloadData()
} }
cell.queryClick = {
[weak self] in
guard let self = self else { return }
YHHUD.show(.progress(message: "查询中..."))
self.viewModel.queryApproval(orderId: self.orderId) {
[weak self] success, error in
YHHUD.hide()
guard let self = self else { return }
if success {
YHHUD.flash(message: "查询成功")
self.isQuerying = true
self.tableView.reloadData()
}
}
}
return cell return cell
} }
} }
......
...@@ -41,6 +41,7 @@ class YHPrincipleWaitResultModel: SmartCodable { ...@@ -41,6 +41,7 @@ class YHPrincipleWaitResultModel: SmartCodable {
var type: YHPrincipleWaitItemType = .none var type: YHPrincipleWaitItemType = .none
var title: String = "" var title: String = ""
var subTitle: String = "" var subTitle: String = ""
var isQuerying: Bool = false
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case lastQueryAt = "last_query_at" case lastQueryAt = "last_query_at"
......
...@@ -15,6 +15,7 @@ class YHPrinciplePhotoListCell: UITableViewCell { ...@@ -15,6 +15,7 @@ class YHPrinciplePhotoListCell: UITableViewCell {
var itemModel:YHPrincipleWaitResultModel? var itemModel:YHPrincipleWaitResultModel?
var items: [YHResultImageList] = [] var items: [YHResultImageList] = []
var expandClick:((Bool)->())? var expandClick:((Bool)->())?
var queryClick:(()->())?
lazy var iconImgView:UIImageView = { lazy var iconImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: "custom_service_icon_right")) let view = UIImageView(image: UIImage(named: "custom_service_icon_right"))
...@@ -74,7 +75,7 @@ class YHPrinciplePhotoListCell: UITableViewCell { ...@@ -74,7 +75,7 @@ class YHPrinciplePhotoListCell: UITableViewCell {
label.numberOfLines = 0 label.numberOfLines = 0
let a: ASAttributedString = .init(NSAttributedString(string: "进度更新延迟? "), .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor)) let a: ASAttributedString = .init(NSAttributedString(string: "进度更新延迟? "), .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
let b: ASAttributedString = .init(NSAttributedString(string: "点击查询"), .font(UIFont.PFSC_M(ofSize: 13)),.foreground(UIColor.brandMainColor),.underline([.single], color: UIColor.brandMainColor),.action { let b: ASAttributedString = .init(NSAttributedString(string: "点击查询"), .font(UIFont.PFSC_M(ofSize: 13)),.foreground(UIColor.brandMainColor),.underline([.single], color: UIColor.brandMainColor),.action {
self.queryClick?()
}) })
label.attributed.text = a+b label.attributed.text = a+b
return label return label
...@@ -149,6 +150,16 @@ class YHPrinciplePhotoListCell: UITableViewCell { ...@@ -149,6 +150,16 @@ class YHPrinciplePhotoListCell: UITableViewCell {
make.top.equalTo(collectView.snp.bottom).offset(-10.0) make.top.equalTo(collectView.snp.bottom).offset(-10.0)
} }
let a: ASAttributedString = .init(NSAttributedString(string: "进度更新延迟? "), .font(UIFont.PFSC_R(ofSize: 13)),.foreground(UIColor.mainTextColor))
var b: ASAttributedString = .init(NSAttributedString(string: "点击查询"), .font(UIFont.PFSC_M(ofSize: 13)),.foreground(UIColor.brandMainColor),.underline([.single], color: UIColor.brandMainColor),.action {
self.queryClick?()
})
if model.isQuerying {
b = .init(NSAttributedString(string: "查询中,请等待"), .font(UIFont.PFSC_M(ofSize: 13)),.foreground(UIColor.mainTextColor(alpha: 0.3)))
}
clickQueryLabel.attributed.text = a+b
let isShowClickQuery = true let isShowClickQuery = true
clickQueryLabel.snp.remakeConstraints { make in clickQueryLabel.snp.remakeConstraints { make in
make.left.equalTo(16.0) make.left.equalTo(16.0)
...@@ -251,7 +262,6 @@ extension YHPrinciplePhotoListCell: UICollectionViewDelegateFlowLayout, UICollec ...@@ -251,7 +262,6 @@ extension YHPrinciplePhotoListCell: UICollectionViewDelegateFlowLayout, UICollec
cell.clickBlock = { cell.clickBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
let model = items[indexPath.item]
var imgUrlArr:[String] = [] var imgUrlArr:[String] = []
for item in items { for item in items {
imgUrlArr.append(item.image) imgUrlArr.append(item.image)
......
...@@ -422,6 +422,28 @@ extension YHPrincleViewModel { ...@@ -422,6 +422,28 @@ extension YHPrincleViewModel {
} }
} }
func queryApproval(orderId: Int, callback:((_ success: Bool, _ error:YHErrorModel?)->())?) {
let params: [String : Any] = ["order_id": orderId,
"search_type": "1"]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Principle.queryApproval
let _ = YHNetRequest.postRequest(url: strUrl, params: params) {
json, code in
if json.code == 200 {
callback?(true, nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(false, err)
}
} failBlock: { err in
callback?(false, err)
}
}
func getUploadTimeFormat() -> DateFormatter { func getUploadTimeFormat() -> DateFormatter {
let dateFormatter = DateFormatter() let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "YYYY.MM.dd" dateFormatter.dateFormat = "YYYY.MM.dd"
......
...@@ -446,6 +446,8 @@ class YHAllApiName { ...@@ -446,6 +446,8 @@ class YHAllApiName {
static let uploadFiles = "super-app/order/approval/upload/save" static let uploadFiles = "super-app/order/approval/upload/save"
// 原则批发送邮件 // 原则批发送邮件
static let sendMail = "infoflow/file/send-mail" static let sendMail = "infoflow/file/send-mail"
// 获批点击查询
static let queryApproval = "super-app/approval/approval-query-now"
} }
struct MakeCertificate { struct MakeCertificate {
......
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