Handy_Cao пре 4 година
родитељ
комит
9c350542ea

+ 4 - 3
MTP_iOS/MTP2_iOS/BusinessCore/Global/MTP2BusinessCore.swift

@@ -158,11 +158,12 @@ class MTP2BusinessCore {
     /// 登录后查询相关配置信息接口
     ///
     /// - Parameter callback: 回调块
-    func requestAppAdress(callback: @escaping (_ isCompleted: Bool,
+    /// - Parameter needUpdate: 是否需要更新
+    func requestAppAdress(_ needUpdate: Bool = false,
+                          callback: @escaping (_ isCompleted: Bool,
                                                _ error: ErrorInfo?) -> Void) {
-
         /// 如果当前已有地址信息存储 则不在获取
-        if let add = UserDefaultsUtils.addressInfo() {
+        if let add = UserDefaultsUtils.addressInfo(), !needUpdate {
             /// 数据存储
             self.address = add
             /// 执行回调

+ 1 - 1
MTP_iOS/MTP2_iOS/Resource/PlistFiles/Address/LYB_171.plist

@@ -179,7 +179,7 @@
 			<key>bankUrl</key>
 			<string>http://192.168.31.178:20031/bank_scancode</string>
 			<key>areaUrl</key>
-			<string>http://192.168.31.183:8080/cfg?key=test_183</string>
+			<string>http://192.168.31.171:8080/cfg?key=test_171</string>
 		</dict>
 	</array>
 </dict>

+ 21 - 8
MTP_iOS/MTP2_iOS/Resource/Storyboard/Mine/Mine.storyboard

@@ -34,7 +34,7 @@
         <!--我的-->
         <scene sceneID="0rt-GC-EDf">
             <objects>
-                <viewController title="我的" id="bMB-Qg-PSa" customClass="MineViewController" customModule="LYB" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController title="我的" interfaceStyle="dark" id="bMB-Qg-PSa" customClass="MineViewController" customModule="LYB" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Ncl-0p-bHk">
                         <rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -44,7 +44,7 @@
                                 <subviews>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PwO-in-1eT">
                                         <rect key="frame" x="0.0" y="0.0" width="428" height="0.0"/>
-                                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
                                             <constraint firstAttribute="height" id="xxY-Ve-hqW"/>
                                         </constraints>
@@ -283,7 +283,7 @@
                                                                                         </connections>
                                                                                     </button>
                                                                                 </subviews>
-                                                                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                                                 <constraints>
                                                                                     <constraint firstItem="7Xw-OY-NY1" firstAttribute="top" secondItem="jrE-aO-j1p" secondAttribute="top" constant="4" id="3eD-XK-VBg"/>
                                                                                     <constraint firstAttribute="trailing" secondItem="7Xw-OY-NY1" secondAttribute="trailing" id="JhO-FC-VR9"/>
@@ -323,7 +323,7 @@
                                                                                         </connections>
                                                                                     </button>
                                                                                 </subviews>
-                                                                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                                                 <constraints>
                                                                                     <constraint firstAttribute="bottom" secondItem="Gpe-lY-mfj" secondAttribute="bottom" constant="5" id="0ee-YA-EAc"/>
                                                                                     <constraint firstItem="sU9-G2-xEF" firstAttribute="bottom" secondItem="Gpe-lY-mfj" secondAttribute="bottom" id="3dc-6S-ke0"/>
@@ -363,7 +363,7 @@
                                                                         </userDefinedRuntimeAttributes>
                                                                     </label>
                                                                 </subviews>
-                                                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                                 <constraints>
                                                                     <constraint firstAttribute="trailing" secondItem="DD7-vo-gto" secondAttribute="trailing" constant="15" id="AEy-JK-3IC"/>
                                                                     <constraint firstItem="8Af-SX-MMd" firstAttribute="trailing" secondItem="7Xw-OY-NY1" secondAttribute="trailing" constant="5" id="Fkz-Jh-BMm"/>
@@ -820,7 +820,7 @@
                                                         </subviews>
                                                     </stackView>
                                                 </subviews>
-                                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                 <constraints>
                                                     <constraint firstAttribute="bottom" secondItem="vHw-rJ-xRf" secondAttribute="bottom" constant="10" id="2rB-Wp-1HK"/>
                                                     <constraint firstItem="vHw-rJ-xRf" firstAttribute="top" secondItem="ngA-WF-Jrr" secondAttribute="top" constant="10" id="4eR-nW-gAD"/>
@@ -849,6 +849,7 @@
                                                 </constraints>
                                             </imageView>
                                         </subviews>
+                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
                                             <constraint firstItem="TP0-mA-eor" firstAttribute="top" secondItem="9V8-i0-O79" secondAttribute="top" id="2ZY-6o-TCE"/>
                                             <constraint firstAttribute="trailing" secondItem="TP0-mA-eor" secondAttribute="trailing" id="4Gw-Us-eHe"/>
@@ -874,7 +875,7 @@
                                 </subviews>
                             </stackView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="02p-vT-nxL">
-                                <rect key="frame" x="164" y="790" width="100" height="100"/>
+                                <rect key="frame" x="164" y="635" width="100" height="100"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="100" id="7uY-s2-v9z"/>
                                     <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="Ib4-UD-xIR"/>
@@ -885,7 +886,7 @@
                             </button>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="AXh-4g-vOe"/>
-                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstItem="AXh-4g-vOe" firstAttribute="bottom" secondItem="rHC-XC-QIf" secondAttribute="bottom" id="Jtz-Go-P7L"/>
                             <constraint firstAttribute="trailing" secondItem="rHC-XC-QIf" secondAttribute="trailing" id="MU0-U9-vv3"/>
@@ -1074,6 +1075,18 @@
         <designable name="7Xw-OY-NY1">
             <size key="intrinsicContentSize" width="76.333333333333329" height="27.333333333333332"/>
         </designable>
+        <designable name="8Af-SX-MMd">
+            <size key="intrinsicContentSize" width="6.666666666666667" height="12"/>
+        </designable>
+        <designable name="Hfn-H8-45e">
+            <size key="intrinsicContentSize" width="70" height="63.333333333333336"/>
+        </designable>
+        <designable name="WZZ-CR-rT1">
+            <size key="intrinsicContentSize" width="70" height="63.333333333333336"/>
+        </designable>
+        <designable name="fg9-vw-bIE">
+            <size key="intrinsicContentSize" width="178.33333333333334" height="26.333333333333332"/>
+        </designable>
     </designables>
     <resources>
         <image name="coupon" width="27.333333969116211" height="27.333333969116211"/>

+ 2 - 2
MTP_iOS/MTP2_iOS/UserInterface/Coupon/ChooseCouponViewController.swift

@@ -189,6 +189,7 @@ extension ChooseCouponViewController: UITableViewDelegate, UITableViewDataSource
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = tableView.dequeueReusableCell(withIdentifier: CellIdentifier, for: indexPath) as! CouponCell
+        cell.rowNum = indexPath.row
         if self.segmentedView.selectedIndex == 0 {
             cell.chooseBlock = { (_ coupon: MoMyCouponHold?, _ rowRum: Int?) in
                 DispatchQueue.main.async {
@@ -202,7 +203,6 @@ extension ChooseCouponViewController: UITableViewDelegate, UITableViewDataSource
                 }
             }
         }
-        cell.rowNum = indexPath.row
         cell.model = coupons[indexPath.row]
         return cell
     }
@@ -220,7 +220,7 @@ extension ChooseCouponViewController: UITableViewDelegate, UITableViewDataSource
             DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+0.2) {
                 if let block = cell.chooseBlock,
                    let obj = cell.model {
-                    block(obj, !cell.choosed ? nil : cell.rowNum)
+                    block(obj, cell.rowNum)
                 }
             }
             

+ 47 - 41
MTP_iOS/MTP2_iOS/UserInterface/Login/LoginViewController.swift

@@ -237,7 +237,6 @@ class LoginViewController: BaseTableViewController<LsLoginUserModel>, UITextFiel
     
     /// 登录方法
     func startLogin()  {
-        
         /// 异常
         guard checkValue(),
               let accountManager = MTP2BusinessCore.shared.accountManager,
@@ -271,48 +270,54 @@ class LoginViewController: BaseTableViewController<LsLoginUserModel>, UITextFiel
         guard let trade_address = MTP2BusinessCore.shared.address?.tradeHost,
               let trade_port = MTP2BusinessCore.shared.address?.tradePort,
               let intPort = UInt16(trade_port) else { return }
-        
-        /// 获取登录ID
-        accountManager.getUserLoginID(account) { (isSuccess, err, loginId) in
-            if !isSuccess {
-                faidBlock(err)
+        /// 每次登录前重新请求地址信息
+        MTP2BusinessCore.shared.requestAppAdress(true) { (isAddress, er) in
+            if !isAddress {
+                faidBlock(er)
                 return
             }
-            DispatchQueue.main.async {
-                accountManager.login(address: trade_address, port: intPort, userName: loginId!, password: password, deviceID: NSUUID().uuidString, version: app_Version) { isCompleted, error in
-                    if isCompleted {
-                        /// 用户与商品信息统一查询
-                        accountManager.queryAccountAndGoods(callback: { (isCompleted, error) in
-                            if isCompleted {
-                                DispatchQueue.main.async {
-                                    /// 如果有 先删除
-                                    if let _ = try? DatabaseHelper.getUser(userID: MTP2BusinessCore.shared.getUserID(), type: Int16(0)) {
-                                        try? DatabaseHelper.deleteUser(userID: MTP2BusinessCore.shared.getUserID())
-                                    }
-                                    DispatchQueue.global().asyncAfter(deadline: DispatchTime.now()+0.5, execute: {
-                                        /// 记录本地用户信息
-                                        try? DatabaseHelper.addUser(userID: MTP2BusinessCore.shared.getUserID(), loginID: account, loginDate: Date(), type: Int16(0))
-                                    })
-                                    if self.savePwd.isOn {
-                                        /// 记住密码和时间
-                                        UserDefaultsUtils.setSavePwd(password)
-                                        UserDefaultsUtils.setSavePwdTime(Date())
-                                    }
-                                    self._anim?.stopAnimating()
-                                    self.view.isUserInteractionEnabled = true
-                                    self.loginButton.isEnabled = true
-                                    /// 进入主界面
-                                    if let mainTabBarController: UITabBarController = self.storyboard?.instantiateViewController(withIdentifier: "MainTabBarController") as? UITabBarController {
-                                        /// 设置根视图
-                                        (UIApplication.shared.delegate as? AppDelegate)?.window?.rootViewController = mainTabBarController
+            /// 获取登录ID
+            accountManager.getUserLoginID(account) { (isSuccess, err, loginId) in
+                if !isSuccess {
+                    faidBlock(err)
+                    return
+                }
+                DispatchQueue.main.async {
+                    accountManager.login(address: trade_address, port: intPort, userName: loginId!, password: password, deviceID: NSUUID().uuidString, version: app_Version) { isCompleted, error in
+                        if isCompleted {
+                            /// 用户与商品信息统一查询
+                            accountManager.queryAccountAndGoods(callback: { (isCompleted, error) in
+                                if isCompleted {
+                                    DispatchQueue.main.async {
+                                        /// 如果有 先删除
+                                        if let _ = try? DatabaseHelper.getUser(userID: MTP2BusinessCore.shared.getUserID(), type: Int16(0)) {
+                                            try? DatabaseHelper.deleteUser(userID: MTP2BusinessCore.shared.getUserID())
+                                        }
+                                        DispatchQueue.global().asyncAfter(deadline: DispatchTime.now()+0.5, execute: {
+                                            /// 记录本地用户信息
+                                            try? DatabaseHelper.addUser(userID: MTP2BusinessCore.shared.getUserID(), loginID: account, loginDate: Date(), type: Int16(0))
+                                        })
+                                        if self.savePwd.isOn {
+                                            /// 记住密码和时间
+                                            UserDefaultsUtils.setSavePwd(password)
+                                            UserDefaultsUtils.setSavePwdTime(Date())
+                                        }
+                                        self._anim?.stopAnimating()
+                                        self.view.isUserInteractionEnabled = true
+                                        self.loginButton.isEnabled = true
+                                        /// 进入主界面
+                                        if let mainTabBarController: UITabBarController = self.storyboard?.instantiateViewController(withIdentifier: "MainTabBarController") as? UITabBarController {
+                                            /// 设置根视图
+                                            (UIApplication.shared.delegate as? AppDelegate)?.window?.rootViewController = mainTabBarController
+                                        }
                                     }
+                                } else {
+                                    faidBlock(error)
                                 }
-                            } else {
-                                faidBlock(error)
-                            }
-                        })
-                    } else {
-                        faidBlock(error)
+                            })
+                        } else {
+                            faidBlock(error)
+                        }
                     }
                 }
             }
@@ -406,11 +411,12 @@ class LoginViewController: BaseTableViewController<LsLoginUserModel>, UITextFiel
     
     // MARK: - UITableViewDelegate
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        
         super.tableView(tableView, didSelectRowAt: indexPath)
-        
+        /// 显示选中的账户信息
         usernameTextField.text = tableCellModels[indexPath.row].loginID
         userTableView.isHidden = true
+        /// 清空密码输入框
+        passwordTextField.text = ""
     }
 }
 

+ 1 - 1
MTP_iOS/MTP2_iOS/UserInterface/Mine/Settings/Feedback/FeedbackViewController.swift

@@ -156,7 +156,7 @@ class FeedbackViewController: BaseViewController {
         }
         
         /// 请输入正确的电话号码
-        guard mobile.count < 12 else {
+        guard mobile.count < 13 else {
             WHToast.showError(withMessage: "请输入正确的电话号码!", duration: 1.5, finishHandler: {})
             return false
         }

+ 2 - 2
MTP_iOS/MTP2_iOS/UserInterface/Trade/PaymentOrderViewController.swift

@@ -194,8 +194,8 @@ class PaymentOrderViewController: BaseViewController {
             }
             let chooseCoupon = viewController(name: "Coupon", identifier: "ChooseCoupon") as! ChooseCouponViewController
             chooseCoupon.usedBlock = { (_ obj: MoMyCouponHold?, _ rowNum: Int?) in
-                /// 优惠券
-                self.couponHold = rowNum == nil ? nil : obj
+                /// 优惠券 如果选中的是相同的 则删除
+                self.couponHold = obj?.couponholdid == self.couponHold?.couponholdid ? nil : obj
                 self.rowNum = rowNum
             }
             chooseCoupon.modalTransitionStyle = .crossDissolve