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

// 原则批

parent 9c8e14ab
......@@ -26,6 +26,8 @@ class YHPrincipleWaitResultViewController: YHBaseViewController {
var orderId: Int = -1
var status: Int = -1
var items: [YHPrincipleWaitResultModel] = []
var isQuerying: Bool = false
let viewModel = YHPrincleViewModel()
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
......@@ -143,8 +145,6 @@ extension YHPrincipleWaitResultViewController {
model3.isUnfold = false
}
self.items.append(model3)
self.tableView.reloadData()
}
}
......@@ -162,6 +162,7 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD
let model = items[indexPath.row]
if model.type == .photo {
let cell = tableView.dequeueReusableCell(withIdentifier: YHPrinciplePhotoListCell.cellReuseIdentifier, for: indexPath) as! YHPrinciplePhotoListCell
model.isQuerying = self.isQuerying
cell.updateModel(model)
cell.expandClick = {
[weak self] isUnfold in
......@@ -169,6 +170,21 @@ extension YHPrincipleWaitResultViewController: UITableViewDelegate, UITableViewD
model.isUnfold = isUnfold
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
}
}
......
......@@ -41,6 +41,7 @@ class YHPrincipleWaitResultModel: SmartCodable {
var type: YHPrincipleWaitItemType = .none
var title: String = ""
var subTitle: String = ""
var isQuerying: Bool = false
enum CodingKeys: String, CodingKey {
case lastQueryAt = "last_query_at"
......
......@@ -15,6 +15,7 @@ class YHPrinciplePhotoListCell: UITableViewCell {
var itemModel:YHPrincipleWaitResultModel?
var items: [YHResultImageList] = []
var expandClick:((Bool)->())?
var queryClick:(()->())?
lazy var iconImgView:UIImageView = {
let view = UIImageView(image: UIImage(named: "custom_service_icon_right"))
......@@ -74,7 +75,7 @@ class YHPrinciplePhotoListCell: UITableViewCell {
label.numberOfLines = 0
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 {
self.queryClick?()
})
label.attributed.text = a+b
return label
......@@ -149,6 +150,16 @@ class YHPrinciplePhotoListCell: UITableViewCell {
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
clickQueryLabel.snp.remakeConstraints { make in
make.left.equalTo(16.0)
......@@ -251,7 +262,6 @@ extension YHPrinciplePhotoListCell: UICollectionViewDelegateFlowLayout, UICollec
cell.clickBlock = {
[weak self] in
guard let self = self else { return }
let model = items[indexPath.item]
var imgUrlArr:[String] = []
for item in items {
imgUrlArr.append(item.image)
......
......@@ -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 {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "YYYY.MM.dd"
......
......@@ -446,6 +446,8 @@ class YHAllApiName {
static let uploadFiles = "super-app/order/approval/upload/save"
// 原则批发送邮件
static let sendMail = "infoflow/file/send-mail"
// 获批点击查询
static let queryApproval = "super-app/approval/approval-query-now"
}
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