Commit b135bcdd authored by pete谢兆麟's avatar pete谢兆麟

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents a27b73bf 6e841715
......@@ -530,6 +530,7 @@
A517A4E12BB573EB000DEECD /* YHDocListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E02BB573EB000DEECD /* YHDocListCell.swift */; };
A517A4E42BB6C4BB000DEECD /* YHDocumentUploadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E22BB6C4BB000DEECD /* YHDocumentUploadView.swift */; };
A517A4E52BB6C4BB000DEECD /* YHDocumentFileItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A517A4E32BB6C4BB000DEECD /* YHDocumentFileItemView.swift */; };
A51D14EB2C75E98500E2820C /* UINavigationController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51D14EA2C75E98500E2820C /* UINavigationController+Extension.swift */; };
A520124F2BABCE05008655EA /* YHFileListContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A520124E2BABCE05008655EA /* YHFileListContentView.swift */; };
A537126F2C64EA0800FF1844 /* officalsuccess.gif in Resources */ = {isa = PBXBuildFile; fileRef = A537126E2C64EA0800FF1844 /* officalsuccess.gif */; };
A53B61122BB128AF0010B573 /* YHFileListItemsView2.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */; };
......@@ -1266,6 +1267,7 @@
A517A4E02BB573EB000DEECD /* YHDocListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocListCell.swift; sourceTree = "<group>"; };
A517A4E22BB6C4BB000DEECD /* YHDocumentUploadView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDocumentUploadView.swift; sourceTree = "<group>"; };
A517A4E32BB6C4BB000DEECD /* YHDocumentFileItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHDocumentFileItemView.swift; sourceTree = "<group>"; };
A51D14EA2C75E98500E2820C /* UINavigationController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extension.swift"; sourceTree = "<group>"; };
A520124E2BABCE05008655EA /* YHFileListContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHFileListContentView.swift; sourceTree = "<group>"; };
A537126E2C64EA0800FF1844 /* officalsuccess.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = officalsuccess.gif; sourceTree = "<group>"; };
A53B61112BB128AF0010B573 /* YHFileListItemsView2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHFileListItemsView2.swift; sourceTree = "<group>"; };
......@@ -3500,6 +3502,7 @@
04754A942B96FF3D00F8ADCA /* UITextField+Extension.swift */,
A5B6ED772C27FC0B001B6732 /* Int+Extension.swift */,
0430E63A2C6DA106000511E2 /* CGFloat+Extention.swift */,
A51D14EA2C75E98500E2820C /* UINavigationController+Extension.swift */,
);
path = Extention;
sourceTree = "<group>";
......@@ -4600,6 +4603,7 @@
A5CA3F5C2C74C4C200EB22F5 /* YHHKCardTemplateView.swift in Sources */,
044D0C022C216AAF00C5CF5E /* YHInformationAuthorizeViewModel.swift in Sources */,
A5ACE9572B4564F7002C94D2 /* YHBasicContentView.swift in Sources */,
A51D14EB2C75E98500E2820C /* UINavigationController+Extension.swift in Sources */,
A59B43CB2C4A151200B28379 /* YHStatusAdvantageVC.swift in Sources */,
047AA3D52C4A3643009C4554 /* YHInvitationWithGiftsDetailView.swift in Sources */,
A5DF3D462BF72BA1003D5F03 /* YHTestViewController.swift in Sources */,
......
......@@ -47,12 +47,13 @@ class YHVisaPaymentVC: YHBaseViewController {
button.clipsToBounds = true
button.addTarget(self, action: #selector(clickNextBtn), for: .touchUpInside)
button.backgroundColor = UIColor.brandMainColor
button.isHidden = true
return button
}()
lazy var bottomView: UIView = {
let view = UIView()
view.backgroundColor = .clear
view.backgroundColor = .white
view.addSubview(self.rewardBtn)
self.rewardBtn.snp.makeConstraints { make in
make.top.equalToSuperview().offset(10)
......@@ -73,7 +74,10 @@ class YHVisaPaymentVC: YHBaseViewController {
private extension YHVisaPaymentVC {
func loadData() {
let params: [String : Any] = ["order_id": 133874]
// if let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") {} //for test hjl
let params: [String : Any] = ["order_id": 133874] //for test hjl
viewModel.getVisaPaymentList(params) { success, error in
if success {
......@@ -81,6 +85,33 @@ private extension YHVisaPaymentVC {
}
self.tableView.reloadData()
self.getPayUpdateStatus()
}
}
func postPaymentResult() {
let params: [String : Any] = ["order_id": 133874]//for test hjl
viewModel.postPaymentResult(params) { success, error in
if success {
YHHUD.flash(message: "预计会在1个工作日内更新缴费结果")
} else {
}
self.getPayUpdateStatus()
}
}
func getPayUpdateStatus() {
let params: [String : Any] = ["order_id": 133874]//for test hjl
viewModel.getPaymentUpdateStatus(params) { success, error in
if success {
} else {
}
self.setButtonRightStatus()
}
}
......@@ -104,17 +135,51 @@ private extension YHVisaPaymentVC {
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalTo(bottomView.snp.top)
}
disableSureButton()
}
@objc func clickNextBtn() {
YHHUD.flash(message: "预计会在1个工作日内更新缴费结果")
disableSureButton()
if self.viewModel.isAllMemberPay() {
//跳转
let vc = YHUploadCertificateVC()
self.navigationController?.push(vc, removeClass: YHVisaPaymentVC.self)
} else {
postPaymentResult()
}
}
func disableSureButton(_ flag : Bool = true) {
if flag {
rewardBtn.isHidden = false
rewardBtn.isEnabled = false
rewardBtn.backgroundColor = UIColor.brandMainColor30
} else {
rewardBtn.isHidden = false
rewardBtn.isEnabled = true
rewardBtn.backgroundColor = UIColor.brandMainColor
}
}
func disableSureButton() {
rewardBtn.isEnabled = false
rewardBtn.backgroundColor = UIColor.brandMainColor30
func setButtonRightStatus() {
if viewModel.updateStatusModel.status == 1 {
if self.viewModel.isAllMemberPay() {
disableSureButton(false)
rewardBtn.setTitle("我已全部缴费,下一步", for: .normal)
} else {
disableSureButton()
}
} else {
disableSureButton(false)
if self.viewModel.isAllMemberPay() {
rewardBtn.setTitle("我已全部缴费,下一步", for: .normal)
} else {
rewardBtn.setTitle("我已全部缴费,更新缴费结果", for: .normal)
}
}
}
}
......@@ -122,7 +187,7 @@ private extension YHVisaPaymentVC {
extension YHVisaPaymentVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 3
return items.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......
......@@ -37,3 +37,10 @@ class YHVisaPaymentModel : SmartCodable {
required init() {
}
}
class YHVisaPaymentUpdateStatusModel: SmartCodable {
var status : Int = 0 //查询状态:1更新中,0未更新
required init() {
}
}
......@@ -41,6 +41,7 @@ class YHPayMemberContentItem: UIView {
label.text = ""
label.textColor = UIColor.mainTextColor
label.textAlignment = .right
label.lineBreakMode = .byTruncatingMiddle
return label
}()
......@@ -120,7 +121,13 @@ extension YHPayMemberContentItem {
addSubview(detailLabel)
addSubview(fakeView)
titleLabel.text = title
detailLabel.text = detail
let arr = detail.split(separator: "/")
if arr.count > 0 {
if let txt = arr.last {
detailLabel.text = String(txt)
}
}
if oneLine {
copyBtn.setTitle("复制", for: .normal)
......
......@@ -118,9 +118,6 @@ private extension YHPayMembersCell {
private extension YHPayMembersCell {
func updataUI() {
guard let model = dataModel,model.list.count > 0 else { return }
......
......@@ -214,8 +214,6 @@ private extension YHVisaPayTypeCell {
make.height.equalTo(1)
}
whiteContentView.addSubview(qrCodeImageView)
qrCodeImageView.snp.makeConstraints { make in
make.top.equalTo(line2.snp.bottom).offset(18)
......@@ -224,8 +222,6 @@ private extension YHVisaPayTypeCell {
make.bottom.equalToSuperview().offset(-kMargin)
}
let label3 = UILabel()
label3.textColor = UIColor.mainTextColor
label3.font = UIFont.PFSC_M(ofSize:14)
......@@ -254,5 +250,17 @@ private extension YHVisaPayTypeCell {
make.right.equalTo(qrCodeImageView.snp.left).offset(-kMargin)
}
let linkTxt : String = "https://www.gov.hk/tc/residents/immigration/nonpermanent/onlinepaymentforevisa.htm"
let aa: ASAttributedString = .init(NSAttributedString(string: linkTxt), .font(UIFont.PFSC_R(ofSize: 12)),.foreground(UIColor.brandMainColor),.underline([.single], color: UIColor.brandMainColor),.action {
if let url = URL(string: linkTxt) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
// 显示一个提示,告知用户无法打开链接
print("无法打开链接")
}
}
})
linkLabel.attributed.text = aa
}
}
......@@ -7,13 +7,31 @@
//
import UIKit
class YHVisaPaymentViewModel: YHBaseViewModel {
//电子签字列表
var visaPaymentData : YHVisaPaymentListModel?
//更新状态
var updateStatusModel : YHVisaPaymentUpdateStatusModel = YHVisaPaymentUpdateStatusModel()
}
//请求接口
extension YHVisaPaymentViewModel {
//判断全部用户 都已经支付
func isAllMemberPay() -> Bool {
var flag = true
guard let model = visaPaymentData else { return flag }
for(index,item) in model.list.enumerated() {
if item.pay_status == 7 {
flag = false
}
}
return flag
}
//电子签字缴费列表
func getVisaPaymentList(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.VisaPayment.paymentListApi
......@@ -38,4 +56,48 @@ extension YHVisaPaymentViewModel {
callBackBlock(false,err)
}
}
//发送 支付结果查询
func postPaymentResult(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.VisaPayment.paymentResultApi
let _ = YHNetRequest.postRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//查询更新状态
func getPaymentUpdateStatus(_ params: [String : Any],callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.VisaPayment.paymentUpdateApi
let _ = YHNetRequest.getRequest(url: strUrl,params: params) { [weak self] json, code in
//1. json字符串 转 对象
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
let dic = json.data
guard let resultModel = YHVisaPaymentUpdateStatusModel.deserialize(dict: dic as? [AnyHashable : Any]) else {
callBackBlock(false,nil)
return
}
self.updateStatusModel = resultModel
callBackBlock(true,nil)
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callBackBlock(false,err)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
}
//
// UINavigationController+Extension.swift
// galaxy
//
// Created by davidhuangA on 2024/8/21.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
extension UINavigationController {
/// remove spacial UIViewController
///
/// - Parameter aClass: UIViewController Class
func removeViewController(_ aClass: AnyClass) {
viewControllers.removeAll(where: { $0.isKind(of: aClass) })
}
/// Push a UIViewController and remove a UIViewController class in the current stack when the push animation finished
/// - Parameters:
/// - controller: A UIViewController instance that will be pushed
/// - removeClass: The UIViewController class that needs to be removed, default is nil
func push(_ controller: UIViewController, removeClass: AnyClass? = nil) {
CATransaction.setCompletionBlock { [unowned self] in
// 移除栈中的当前Controller
if let removeClass = removeClass {
self.navigationController?.removeViewController(removeClass)
}
}
CATransaction.begin()
pushViewController(controller, animated: true)
CATransaction.commit()
}
}
......@@ -12,6 +12,13 @@ class YHAllApiName {
struct VisaPayment {
//GetUserPaymentList 电子签证缴费列表
static let paymentListApi = "super-app/order/customer/service/payment"
//PushToResultQueryQueue 推送到结果查询队列
static let paymentResultApi = "super-app/order/customer/service/payment/query"
//获取影刀查询状态
static let paymentUpdateApi = "super-app/order/customer/service/payment/query"
}
//灰度功能接口
......
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