Przeglądaj źródła

fix:添加挽回支付弹窗。

“HeShaoZe” 4 miesięcy temu
rodzic
commit
753ad3d65a

+ 4 - 0
QuickSearchLocation.xcodeproj/project.pbxproj

@@ -129,6 +129,7 @@
 		FED298D22E3B0EDD00F1E0F0 /* QSLGuideusersToCommentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FED298D12E3B0EDD00F1E0F0 /* QSLGuideusersToCommentManager.swift */; };
 		FED298D42E3B176500F1E0F0 /* QSLGuideIsTriggeredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FED298D32E3B176500F1E0F0 /* QSLGuideIsTriggeredModel.swift */; };
 		FED298D62E3B28D800F1E0F0 /* QSLGoodKeysModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FED298D52E3B28D800F1E0F0 /* QSLGoodKeysModel.swift */; };
+		FED298DD2E3C682600F1E0F0 /* QSLRetainPopUpAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FED298DC2E3C682600F1E0F0 /* QSLRetainPopUpAlertView.swift */; };
 		FEEB37CA2E28CC8F00BFFD7D /* QSAppleAdHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEB37C92E28CC8F00BFFD7D /* QSAppleAdHandle.swift */; };
 		FEEB37CD2E28CD7A00BFFD7D /* QSWikiHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEB37CC2E28CD7A00BFFD7D /* QSWikiHandle.swift */; };
 /* End PBXBuildFile section */
@@ -262,6 +263,7 @@
 		FED298D12E3B0EDD00F1E0F0 /* QSLGuideusersToCommentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSLGuideusersToCommentManager.swift; sourceTree = "<group>"; };
 		FED298D32E3B176500F1E0F0 /* QSLGuideIsTriggeredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSLGuideIsTriggeredModel.swift; sourceTree = "<group>"; };
 		FED298D52E3B28D800F1E0F0 /* QSLGoodKeysModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSLGoodKeysModel.swift; sourceTree = "<group>"; };
+		FED298DC2E3C682600F1E0F0 /* QSLRetainPopUpAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSLRetainPopUpAlertView.swift; sourceTree = "<group>"; };
 		FEEB37C92E28CC8F00BFFD7D /* QSAppleAdHandle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSAppleAdHandle.swift; sourceTree = "<group>"; };
 		FEEB37CC2E28CD7A00BFFD7D /* QSWikiHandle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QSWikiHandle.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -794,6 +796,7 @@
 				FED298C32E37267100F1E0F0 /* QSLVipAlertView.swift */,
 				FED298C52E38AB5500F1E0F0 /* QSLVipResultsAlertView.swift */,
 				FED298C72E38B51400F1E0F0 /* QSLVipResultsNoMemberAlertView.swift */,
+				FED298DC2E3C682600F1E0F0 /* QSLRetainPopUpAlertView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -1042,6 +1045,7 @@
 				FE638AB72D0ADD5700858121 /* QSLContactFailCell.swift in Sources */,
 				FE638ABB2D19631900858121 /* QSLGravityManager.swift in Sources */,
 				FE638AA02D082FC400858121 /* QSLLoading.swift in Sources */,
+				FED298DD2E3C682600F1E0F0 /* QSLRetainPopUpAlertView.swift in Sources */,
 				FE638ADA2D23E31B00858121 /* PhotoClassifier.swift in Sources */,
 				04B6B5262BCE196000777EB4 /* QSLMineFuncView.swift in Sources */,
 				FE8360692CF5B06700978E03 /* QSLLoginViewController.swift in Sources */,

+ 10 - 0
QuickSearchLocation/Classes/Pages/QSLVip/Controller/QSLVipController.swift

@@ -667,9 +667,11 @@ extension QSLVipController {
                     
                 } else if status == .cancel {
                     QSLLoading.error(text: "支付取消")
+                    payFailAlertTip()
                 } else if status == .fail {
                     gravityInstance?.track(QSLGravityConst.vip_fail)
                     QSLLoading.error(text: "支付失败")
+                    payFailAlertTip()
                 } else if status == .searchFail {
                     QSLLoading.error(text: "查询订单失败,请稍后重试")
                 }
@@ -677,6 +679,14 @@ extension QSLVipController {
         }
     }
     
+    func payFailAlertTip() {
+        if let currentWindow = UIApplication.keyWindow {
+            QSLRetainPopUpAlertView.alert(view: currentWindow, isOneBtn: true, oneBtnText: "继续支付", oneBtnClosure:  { [weak self] in
+                self?.unlockBtnAction()
+            })
+        }
+    }
+    
     @objc func firstCellClickAction() {
         
         for i in 0..<self.goodList.count {

+ 223 - 0
QuickSearchLocation/Classes/Pages/QSLVip/View/QSLRetainPopUpAlertView.swift

@@ -0,0 +1,223 @@
+//
+//  QSLRetainPopUpAlertView.swift
+//  QuickSearchLocation
+//
+//  Created by Destiny on 2025/8/1.
+//
+
+import UIKit
+
+class QSLRetainPopUpAlertView: UIView {
+        
+    lazy var contentView: UIView = {
+        
+        let contentViewW = QSLConst.qsl_kScreenW - 60.rpx
+        let contentViewH =  152.0.rpx
+        let contentView = UIView(frame: CGRect(x: 0, y: 0, width: contentViewW, height: contentViewH))
+        contentView.backgroundColor = .clear
+        return contentView
+    }()
+    
+    
+    lazy var closeButton: UIButton = {
+        let btn = UIButton()
+        btn.setBackgroundImage(UIImage(named: "vip_pay_failure_close"), for: .normal)
+        btn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside)
+        return btn
+    }()
+
+    lazy var popBgImageView : UIImageView = {
+        let popBgImageView = UIImageView()
+        popBgImageView.contentMode = .scaleAspectFit
+        popBgImageView.image = UIImage(named: "vip_pay_failure_back_ground")
+        return popBgImageView
+    }()
+    
+
+    ///中间描述区域
+    lazy var middleView : UIView = {
+        let middleView = UIView()
+        middleView.backgroundColor = .clear
+        return middleView
+    }()
+    
+    lazy var oneButton: UIButton = {
+      
+        let btn = UIButton()
+        btn.addRadius(radius: 20.rpx)
+        btn.title("去登录")
+        btn.textColor(.white)
+        btn.mediumFont(14)
+        btn.gradientBackgroundColor(color1: .hexStringColor(hexString: "#7F5737"), color2: .hexStringColor(hexString: "#562B0E"), width: 200.rpx, height: 40.rpx, direction: .horizontal)
+        btn.addTarget(self, action: #selector(oneBtnAction), for: .touchUpInside)
+        return btn
+    }()
+    
+    lazy var firstButton: UIButton = {
+        
+        let btn = UIButton()
+        btn.isHidden = true
+        btn.backgroundColor = .hexStringColor(hexString: "#F8F8F8")
+        btn.addRadius(radius: 20.rpx)
+        btn.title("取消")
+        btn.textColor(.hexStringColor(hexString: "#A7A7A7"))
+        btn.mediumFont(16)
+        btn.addTarget(self, action: #selector(firstBtnAction), for: .touchUpInside)
+        return btn
+    }()
+    
+    lazy var secondButton: UIButton = {
+        
+        let btn = UIButton()
+        btn.isHidden = true
+        btn.addRadius(radius: 20.rpx)
+        btn.title("确认")
+        btn.textColor(.white)
+        btn.mediumFont(16)
+        btn.gradientBackgroundColor(color1: .hexStringColor(hexString: "#15CBA1"), color2: .hexStringColor(hexString: "#1FE0BA"), width: 118.rpx, height: 40.rpx, direction: .horizontal)
+        btn.addTarget(self, action: #selector(secondBtnAction), for: .touchUpInside)
+        return btn
+    }()
+    
+
+    var oneBtnClosure: (() -> ())?
+    
+    var firstBtnClosure: (() -> ())?
+    
+    var secondBtnClosure: (() -> ())?
+    
+    var closeBtnClosure: (() -> ())?
+    
+    
+    class func alert(view: UIView,
+                     isOneBtn: Bool = false,
+                     oneBtnText: String = "去登录",
+                     oneBtnClosure: @escaping () -> () = {},
+                     firstBtnClosure: @escaping () -> () = {},
+                     secondBtnClosure: @escaping () -> () = {},
+                     closeBtnClosure: @escaping () -> () = {}) {
+        
+        let window = QSLRetainPopUpAlertView(frame: CGRect(x: 0, y: 0, width: QSLConst.qsl_kScreenW, height: QSLConst.qsl_kScreenH))
+
+        window.oneButton.title(oneBtnText)
+        window.oneButton.isHidden = !isOneBtn
+        window.firstButton.isHidden = isOneBtn
+        window.secondButton.isHidden = isOneBtn
+        window.oneBtnClosure = oneBtnClosure
+        window.firstBtnClosure = firstBtnClosure
+        window.secondBtnClosure = secondBtnClosure
+        window.closeBtnClosure = closeBtnClosure
+        
+        window.contentView.snp.remakeConstraints { make in
+            make.size.equalTo(CGSize(width: QSLConst.qsl_kScreenW - 60.rpx, height: 310.rpx))
+            make.center.equalToSuperview()
+        }
+        view.addSubview(window)
+        
+        UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.95, initialSpringVelocity: 0.05) {
+            window.backgroundColor = .hexStringColor(hexString: "#000000", alpha: 0.7)
+            window.contentView.isHidden = false
+        }
+    }
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        
+        initView()
+    }
+    
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    
+    // 单按钮点击事件
+    @objc func oneBtnAction() {
+        if let oneBtnClosure = self.oneBtnClosure {
+            oneBtnClosure()
+        }
+        removeView()
+    }
+    
+    // 取消按钮点击事件
+    @objc func firstBtnAction() {
+        if let firstBtnClosure = self.firstBtnClosure {
+            firstBtnClosure()
+        }
+        removeView()
+    }
+    
+    // 确认按钮点击事件
+    @objc func secondBtnAction() {
+        if let secondBtnClosure = self.secondBtnClosure {
+            secondBtnClosure()
+        }
+        removeView()
+    }
+    
+    // 关闭按钮点击事件
+    @objc func closeBtnAction() {
+        if let closeBtnClosure = self.closeBtnClosure {
+            closeBtnClosure()
+        }
+        removeView()
+    }
+    
+    // 移除
+    @objc func removeView() {
+        
+        UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.95, initialSpringVelocity: 0.05) { [weak self] in
+            self?.backgroundColor = UIColor.init(white: 0, alpha: 0)
+            self?.contentView.isHidden = true
+            self?.closeButton.isHidden = true
+        } completion: { [weak self] finished in
+            self?.removeFromSuperview()
+        }
+    }
+}
+
+extension QSLRetainPopUpAlertView {
+    
+    func initView() {
+        
+        addSubview(contentView)
+        contentView.snp.makeConstraints { make in
+            make.size.equalTo(CGSize(width: QSLConst.qsl_kScreenW - 60.rpx, height: 152.0.rpx))
+            make.center.equalToSuperview()
+        }
+        
+        addSubview(closeButton)
+        closeButton.snp.makeConstraints { make in
+            make.bottom.equalTo(contentView.snp.top).offset(30.hpx)
+            make.right.equalTo(contentView.snp.right).offset(-10.rpx)
+            make.size.equalTo(CGSizeMake(24.rpx, 24.rpx))
+        }
+        
+        contentView.addSubview(popBgImageView)
+        popBgImageView.snp.makeConstraints { make in
+            make.edges.equalToSuperview()
+        }
+        
+        contentView.addSubview(oneButton)
+        oneButton.snp.makeConstraints { make in
+            //make.top.equalTo(contentLabel.snp.bottom).offset(24.5.rpx)
+            make.size.equalTo(CGSize(width: 150.rpx, height: 40.rpx))
+            make.centerX.equalToSuperview()
+            make.bottom.equalTo(-38.rpx)
+        }
+        
+        contentView.addSubview(firstButton)
+        firstButton.snp.makeConstraints { make in
+            make.size.equalTo(CGSize(width: 118.rpx, height: 40.rpx))
+            make.left.equalTo(24.rpx)
+            make.bottom.equalTo(-24.rpx)
+        }
+        
+        contentView.addSubview(secondButton)
+        secondButton.snp.makeConstraints { make in
+            make.size.equalTo(CGSize(width: 118.rpx, height: 40.rpx))
+            make.right.equalTo(-24.rpx)
+            make.bottom.equalTo(-24.rpx)
+        }
+    }
+}

+ 22 - 0
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_back_ground.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "vip_pay_failure_back_ground@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "vip_pay_failure_back_ground@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_back_ground.imageset/vip_pay_failure_back_ground@2x.png


BIN
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_back_ground.imageset/vip_pay_failure_back_ground@3x.png


+ 22 - 0
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_close.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "vip_pay_failure_close@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "vip_pay_failure_close@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_close.imageset/vip_pay_failure_close@2x.png


BIN
QuickSearchLocation/Resources/Assets.xcassets/Vip/vip_pay_failure_close.imageset/vip_pay_failure_close@3x.png