Browse Source

下单需知

吴彦祖 4 months ago
parent
commit
7d7e8ad788

+ 20 - 0
ADHTuanCan.xcodeproj/project.pbxproj

@@ -202,6 +202,8 @@
 		C470B5A72AF0C719009046B4 /* CheckOrderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C470B5A52AF0C719009046B4 /* CheckOrderViewController.swift */; };
 		C470B5AC2AF0D8C8009046B4 /* AddressManagerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C470B5AA2AF0D8C8009046B4 /* AddressManagerVC.swift */; };
 		C470B5B32AF0DCBA009046B4 /* AddresViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C470B5B12AF0DCBA009046B4 /* AddresViewCell.swift */; };
+		C47F82772BF1A989006C4B6E /* OrderNeedToKnow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C47F82762BF1A989006C4B6E /* OrderNeedToKnow.swift */; };
+		C47F82812BF1B305006C4B6E /* OrderNeedToKnow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C47F82832BF1B305006C4B6E /* OrderNeedToKnow.xib */; };
 		C48363AF2AC3D96400E3FA1B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C48363AE2AC3D96400E3FA1B /* AppDelegate.swift */; };
 		C48363B62AC3D96400E3FA1B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C48363B42AC3D96400E3FA1B /* Main.storyboard */; };
 		C48363B92AC3D96400E3FA1B /* ADHTuanCan.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C48363B72AC3D96400E3FA1B /* ADHTuanCan.xcdatamodeld */; };
@@ -700,6 +702,10 @@
 		C470B5A52AF0C719009046B4 /* CheckOrderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckOrderViewController.swift; sourceTree = "<group>"; };
 		C470B5AA2AF0D8C8009046B4 /* AddressManagerVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressManagerVC.swift; sourceTree = "<group>"; };
 		C470B5B12AF0DCBA009046B4 /* AddresViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddresViewCell.swift; sourceTree = "<group>"; };
+		C47F82762BF1A989006C4B6E /* OrderNeedToKnow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderNeedToKnow.swift; sourceTree = "<group>"; };
+		C47F82822BF1B305006C4B6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/OrderNeedToKnow.xib; sourceTree = "<group>"; };
+		C47F82852BF1B307006C4B6E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/OrderNeedToKnow.strings; sourceTree = "<group>"; };
+		C47F82872BF1B308006C4B6E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/OrderNeedToKnow.strings"; sourceTree = "<group>"; };
 		C48363AB2AC3D96400E3FA1B /* ADHTuanCan.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ADHTuanCan.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		C48363AE2AC3D96400E3FA1B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		C48363B52AC3D96400E3FA1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -1941,6 +1947,8 @@
 				C450016E2AD67CF000F96CFA /* OrderReadyCell.xib */,
 				C44301F42AF5DC830098C854 /* selectAddressView.swift */,
 				C44302172AF5F5370098C854 /* selectAddressView.xib */,
+				C47F82762BF1A989006C4B6E /* OrderNeedToKnow.swift */,
+				C47F82832BF1B305006C4B6E /* OrderNeedToKnow.xib */,
 			);
 			path = view;
 			sourceTree = "<group>";
@@ -2569,6 +2577,7 @@
 				C4EDDA062AF28B0D00BE8EFF /* DZNEmptyLoadView.xib in Resources */,
 				C44302152AF5F5370098C854 /* selectAddressView.xib in Resources */,
 				C45001702AD67CF000F96CFA /* OrderReadyCell.xib in Resources */,
+				C47F82812BF1B305006C4B6E /* OrderNeedToKnow.xib in Resources */,
 				C406915F2B08BEF6002688FD /* PhoneLoginViewController.xib in Resources */,
 				C40691582B08BEB7002688FD /* CodeViewController.xib in Resources */,
 				C45B67E12B19DCE400EA1725 /* ADHAlertView.xib in Resources */,
@@ -2814,6 +2823,7 @@
 				C44CFA602AFB5CAD000D592D /* MyViewModel.swift in Sources */,
 				C4EDD9DC2AF2879100BE8EFF /* MJRefreshBackStateFooter.m in Sources */,
 				C4836A702AC516FC00E3FA1B /* MCHttpUtil.swift in Sources */,
+				C47F82772BF1A989006C4B6E /* OrderNeedToKnow.swift in Sources */,
 				C4E333142B91891C004DD994 /* TwoSeparateMealsView.swift in Sources */,
 				C448CD022AFE3DE200B3B068 /* AddEvaluateCell.swift in Sources */,
 				C4EDD97A2AF2849300BE8EFF /* MCDZNEmptyDelegate.swift in Sources */,
@@ -3524,6 +3534,16 @@
 			name = DeliveryTimeSetView.xib;
 			sourceTree = "<group>";
 		};
+		C47F82832BF1B305006C4B6E /* OrderNeedToKnow.xib */ = {
+			isa = PBXVariantGroup;
+			children = (
+				C47F82822BF1B305006C4B6E /* Base */,
+				C47F82852BF1B307006C4B6E /* en */,
+				C47F82872BF1B308006C4B6E /* zh-Hans */,
+			);
+			name = OrderNeedToKnow.xib;
+			sourceTree = "<group>";
+		};
 		C48363B42AC3D96400E3FA1B /* Main.storyboard */ = {
 			isa = PBXVariantGroup;
 			children = (

BIN
ADHTuanCan.xcworkspace/xcuserdata/aodeheng.xcuserdatad/UserInterfaceState.xcuserstate


+ 10 - 1
ADHTuanCan/Class/购物车/确认订单/CheckOrderViewController.swift

@@ -80,7 +80,8 @@ class CheckOrderViewController: ADHBaseVC {
         
         
         if self.paySetModel != nil{
-            self.userPayTypeView?.show()
+//            self.userPayTypeView?.show()
+            self.orderNeedToKnow?.show()
         }else{
             self.hud.showFailure(LanguagesUtil.createTextBy(Ctext: "请先选择结算方式", Etext: "Please select the payment method first"))
         }
@@ -101,6 +102,10 @@ class CheckOrderViewController: ADHBaseVC {
     ///结算方式
     let paymentsSheetView = Bundle.main.loadNibNamed("PayMentSelectView", owner: nil, options: nil)?.last as? PayMentSelectView
     
+    
+    /// 下单需知
+    let orderNeedToKnow = Bundle.main.loadNibNamed("OrderNeedToKnow", owner: nil, options: nil)?.last as? OrderNeedToKnow
+    
     ///支付方式
     let userPayTypeView = Bundle.main.loadNibNamed("UserPayMentSheet", owner: nil, options: nil)?.last as? UserPayMentSheet
     
@@ -180,6 +185,10 @@ class CheckOrderViewController: ADHBaseVC {
             self.getPayMent()
         }
         
+        self.orderNeedToKnow?.nextBlock = {[unowned self] in
+            self.userPayTypeView?.show()
+        }
+        
         //去支付
         self.userPayTypeView?.payTypeBlock = {[unowned self] model in
             self.payMentModel = model

+ 100 - 0
ADHTuanCan/Class/购物车/确认订单/view/Base.lproj/OrderNeedToKnow.xib

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="42B-1U-reb" customClass="OrderNeedToKnow" customModule="ADHTuanCan" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <subviews>
+                <view alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ehv-M9-Rmz">
+                    <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+                    <subviews>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="N2j-hA-7mG">
+                            <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="hidden:" destination="42B-1U-reb" eventType="touchUpInside" id="jvQ-kU-wPj"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstItem="N2j-hA-7mG" firstAttribute="top" secondItem="ehv-M9-Rmz" secondAttribute="top" id="2af-k3-uON"/>
+                        <constraint firstAttribute="trailing" secondItem="N2j-hA-7mG" secondAttribute="trailing" id="d48-OC-MrG"/>
+                        <constraint firstItem="N2j-hA-7mG" firstAttribute="leading" secondItem="ehv-M9-Rmz" secondAttribute="leading" id="w0c-AP-5QJ"/>
+                        <constraint firstAttribute="bottom" secondItem="N2j-hA-7mG" secondAttribute="bottom" id="yCo-p6-36L"/>
+                    </constraints>
+                </view>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HJK-Rx-yh5">
+                    <rect key="frame" x="0.0" y="452" width="393" height="400"/>
+                    <subviews>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1Tl-19-yNp">
+                            <rect key="frame" x="24" y="330" width="344" height="45"/>
+                            <color key="backgroundColor" red="0.77647058820000003" green="0.1333333333" blue="0.13725490200000001" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="45" id="6Zm-KE-oLn"/>
+                            </constraints>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <state key="normal" title="确定">
+                                <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            </state>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="4"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                            <connections>
+                                <action selector="nextAction:" destination="42B-1U-reb" eventType="touchUpInside" id="Mkv-4Q-ksC"/>
+                            </connections>
+                        </button>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="下单需知" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O7M-pM-MIw">
+                            <rect key="frame" x="159.66666666666666" y="20" width="73.666666666666657" height="21"/>
+                            <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
+                            <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="bottom" secondItem="1Tl-19-yNp" secondAttribute="bottom" constant="25" id="7ad-CB-b3I"/>
+                        <constraint firstItem="O7M-pM-MIw" firstAttribute="top" secondItem="HJK-Rx-yh5" secondAttribute="top" constant="20" id="JEi-gB-6Nz"/>
+                        <constraint firstAttribute="trailing" secondItem="1Tl-19-yNp" secondAttribute="trailing" constant="25" id="QWT-bd-Hy3"/>
+                        <constraint firstItem="1Tl-19-yNp" firstAttribute="leading" secondItem="HJK-Rx-yh5" secondAttribute="leading" constant="24" id="Rr8-6f-3Lu"/>
+                        <constraint firstItem="O7M-pM-MIw" firstAttribute="centerX" secondItem="HJK-Rx-yh5" secondAttribute="centerX" id="SpQ-Yf-pGZ"/>
+                        <constraint firstAttribute="height" constant="400" id="mx8-Vt-Sc1"/>
+                    </constraints>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="25"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
+            </subviews>
+            <viewLayoutGuide key="safeArea" id="Pu1-Ww-TOJ"/>
+            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+            <constraints>
+                <constraint firstItem="Pu1-Ww-TOJ" firstAttribute="trailing" secondItem="HJK-Rx-yh5" secondAttribute="trailing" id="Orp-YQ-yvy"/>
+                <constraint firstAttribute="bottom" secondItem="ehv-M9-Rmz" secondAttribute="bottom" id="Yzf-1t-9Zg"/>
+                <constraint firstItem="HJK-Rx-yh5" firstAttribute="leading" secondItem="Pu1-Ww-TOJ" secondAttribute="leading" id="gxD-zU-YTb"/>
+                <constraint firstItem="ehv-M9-Rmz" firstAttribute="leading" secondItem="Pu1-Ww-TOJ" secondAttribute="leading" id="jOo-p8-I2Z"/>
+                <constraint firstAttribute="bottom" secondItem="HJK-Rx-yh5" secondAttribute="bottom" id="n4i-LP-JRo"/>
+                <constraint firstItem="Pu1-Ww-TOJ" firstAttribute="trailing" secondItem="ehv-M9-Rmz" secondAttribute="trailing" id="nkw-GN-prX"/>
+                <constraint firstItem="ehv-M9-Rmz" firstAttribute="top" secondItem="42B-1U-reb" secondAttribute="top" id="tYL-Jk-rQY"/>
+            </constraints>
+            <connections>
+                <outlet property="blackView" destination="ehv-M9-Rmz" id="47L-sS-LcB"/>
+                <outlet property="contentView" destination="HJK-Rx-yh5" id="6C9-Rd-7TB"/>
+                <outlet property="titleLab" destination="O7M-pM-MIw" id="MZI-2l-uGs"/>
+            </connections>
+            <point key="canvasLocation" x="131" y="-14"/>
+        </view>
+    </objects>
+</document>

+ 133 - 0
ADHTuanCan/Class/购物车/确认订单/view/OrderNeedToKnow.swift

@@ -0,0 +1,133 @@
+//
+//  OrderNeedToKnow.swift
+//  ADHTuanCan
+//
+//  Created by 敖德亨 on 2024/5/13.
+//
+
+import UIKit
+import RxCocoa
+import RxSwift
+import RichTextView
+
+class OrderNeedToKnow: UIView {
+
+    @IBOutlet weak var blackView: UIView!
+ 
+    @IBAction func hidden(_ sender: UIButton) {
+        self.hidden()
+    }
+    
+    @IBAction func nextAction(_ sender: UIButton) {
+        if self.nextBlock != nil{
+            self.nextBlock!()
+        }
+        self.hidden()
+    }
+    
+    @IBOutlet weak var contentView: UIView!
+    
+    @IBOutlet weak var titleLab: UILabel!
+    
+    /// hud 提示
+    lazy var hud : MCHud! = {
+        return MCHud()
+    }()
+    
+    var nextBlock : (()->Void)?
+    
+    /// 富文本内容
+    var richText: String?
+    
+    var richTextView : RichTextView?
+    
+    let viewModel : MyViewModel = MyViewModel.init()
+    let diposableBag = DisposeBag()
+
+    var isAdd : Bool = false
+    
+    func setContent(){
+
+//        self.contentView.removeAllSubviews()
+        self.richTextView = RichTextView(
+            input: "\(self.viewModel.ruleDetailModel?.content ?? "")",
+            latexParser: LatexParser(),
+            font: UIFont.systemFont(ofSize: UIFont.systemFontSize),
+            textColor: kThemeOfTextDarkColor,
+            isSelectable: true,
+            isEditable: false,
+            latexTextBaselineOffset: 0,
+            interactiveTextColor: UIColor.blue,
+            textViewDelegate: nil,
+            frame: CGRect.zero,
+            completion: nil
+        )
+//        NSLog("sdfsdfsdf\(richTextView.snp.height)")
+//        if isAdd
+//        {
+//            
+//        }else{
+//            self.isAdd = true
+            self.contentView.addSubview(self.richTextView!)
+//        }
+        
+        self.richTextView?.mas_makeConstraints { make in
+            make?.top.mas_equalTo()(self.contentView)?.offset()(75)
+            make?.left.mas_equalTo()(self.contentView)?.offset()(20)
+            make?.right.mas_equalTo()(self.contentView)?.offset()(-20)
+            make?.bottom.mas_equalTo()(self.contentView)?.offset()(-75)
+        }
+    }
+    
+    
+    
+    func getDataSource(){
+        self.hud.showLoading()
+        self.viewModel.getRuleDetailModel.type = "6"
+        self.viewModel.signalGetRuleDetail()?.on(success: { dd in
+
+//            self.titleLab.text = "\(self.viewModel.ruleDetailModel?.title ?? "")"
+            self.setContent()
+            self.hud.hidden()
+        }, error: { error in
+
+            self.hud.showFailure(error.msg ?? LanguagesUtil.createTextBy(Ctext: "网络错误", Etext: "network error"))
+        })
+    }
+    
+    
+    public func show(){
+        
+        if isAdd
+        {
+
+        }else{
+            self.isAdd = true
+            
+            self .getDataSource()
+        }
+        
+        kAppDelegateWindow.addSubview(self)
+        self.blackView.alpha = 0
+        self.frame = CGRect.init(x: 0, y: kSCREEN_HEIGHT, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
+        UIView.animate(withDuration: 0.5) {
+            self.frame = CGRect.init(x: 0, y: 0, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
+            self.layoutIfNeeded()
+        }
+        DELAY(0.5) {
+            self.blackView.alpha = 0.3
+        }
+    }
+    
+    /// 隐藏
+    public func hidden(){
+        self.blackView.alpha = 0
+        UIView.animate(withDuration: 0.5) {
+            self.frame = CGRect.init(x: 0, y: kSCREEN_HEIGHT, width: kSCREEN_WIDTH, height: kSCREEN_HEIGHT)
+            self.layoutIfNeeded()
+        }
+        DELAY(0.5) {
+            self.removeFromSuperview()
+        }
+    }
+}

+ 6 - 0
ADHTuanCan/Class/购物车/确认订单/view/en.lproj/OrderNeedToKnow.strings

@@ -0,0 +1,6 @@
+
+/* Class = "UIButton"; normalTitle = "确定"; ObjectID = "1Tl-19-yNp"; */
+"1Tl-19-yNp.normalTitle" = "Confirm";
+
+/* Class = "UILabel"; text = "下单需知"; ObjectID = "O7M-pM-MIw"; */
+"O7M-pM-MIw.text" = "Order Notice";

+ 6 - 0
ADHTuanCan/Class/购物车/确认订单/view/zh-Hans.lproj/OrderNeedToKnow.strings

@@ -0,0 +1,6 @@
+
+/* Class = "UIButton"; normalTitle = "确定"; ObjectID = "1Tl-19-yNp"; */
+"1Tl-19-yNp.normalTitle" = "确定";
+
+/* Class = "UILabel"; text = "下单需知"; ObjectID = "O7M-pM-MIw"; */
+"O7M-pM-MIw.text" = "下单需知";