Ver código fonte

自提地址完成

南鑫林 6 anos atrás
pai
commit
9f9e10abe1
17 arquivos alterados com 256 adições e 92 exclusões
  1. 11 11
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 14 6
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/Location/ViewController/LocationViewController.swift
  3. 2 2
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/View/SelfRecommendationView.swift
  4. 41 10
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/ViewController/SelfRecommendationViewController.swift
  5. 6 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerSelfMentionTableViewCell.swift
  6. 6 5
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerView.swift
  7. 23 16
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/ViewController/AddressManagerViewController.swift
  8. 0 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditAddressFooterView.swift
  9. 0 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditAddressTableViewCell.swift
  10. 3 3
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditSelfMentionAddressView.swift
  11. 0 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditSetDefaultTableViewCell.swift
  12. 11 11
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/ViewController/EditSelfMentionAddressViewController.swift
  13. 1 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionContactsList/ViewController/SelfMentionContactsListViewController.swift
  14. 55 2
      RainbowPlanet/RainbowPlanet/Service/Model/UserModel/AddressManagerListModel.swift
  15. 45 7
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift
  16. 18 6
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift
  17. 20 12
      RainbowPlanet/RainbowPlanet/Tools/SwiftProgressHUD/SwiftProgressHUD.swift

+ 11 - 11
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -152,8 +152,8 @@
 		A77F2CCA223209F2001BD3F6 /* BaseTabbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A77F2CC9223209F2001BD3F6 /* BaseTabbarViewController.swift */; };
 		A7824AFB2271EA2600ABA381 /* SelfMentionContactsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824AFA2271EA2600ABA381 /* SelfMentionContactsListView.swift */; };
 		A7824AFD2271EAC900ABA381 /* SelfMentionContactsListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824AFC2271EAC900ABA381 /* SelfMentionContactsListTableViewCell.swift */; };
-		A7824B002271F0DD00ABA381 /* EditSelfMentionAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824AFF2271F0DD00ABA381 /* EditSelfMentionAddressViewController.swift */; };
-		A7824B042271F10300ABA381 /* EditSelfMentionAddressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824B032271F10300ABA381 /* EditSelfMentionAddressView.swift */; };
+		A7824B002271F0DD00ABA381 /* EditSelfMentionContactsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824AFF2271F0DD00ABA381 /* EditSelfMentionContactsViewController.swift */; };
+		A7824B042271F10300ABA381 /* EditSelfMentionContactsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824B032271F10300ABA381 /* EditSelfMentionContactsView.swift */; };
 		A7824B062271F25400ABA381 /* EditAddressTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824B052271F25400ABA381 /* EditAddressTableViewCell.swift */; };
 		A7824B082271F53A00ABA381 /* EditSetDefaultTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7824B072271F53A00ABA381 /* EditSetDefaultTableViewCell.swift */; };
 		A79057022276C9770037F823 /* SetPasswordModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A79057012276C9770037F823 /* SetPasswordModel.swift */; };
@@ -388,8 +388,8 @@
 		A77F2CC9223209F2001BD3F6 /* BaseTabbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTabbarViewController.swift; sourceTree = "<group>"; };
 		A7824AFA2271EA2600ABA381 /* SelfMentionContactsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfMentionContactsListView.swift; sourceTree = "<group>"; };
 		A7824AFC2271EAC900ABA381 /* SelfMentionContactsListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelfMentionContactsListTableViewCell.swift; sourceTree = "<group>"; };
-		A7824AFF2271F0DD00ABA381 /* EditSelfMentionAddressViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditSelfMentionAddressViewController.swift; sourceTree = "<group>"; };
-		A7824B032271F10300ABA381 /* EditSelfMentionAddressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditSelfMentionAddressView.swift; sourceTree = "<group>"; };
+		A7824AFF2271F0DD00ABA381 /* EditSelfMentionContactsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditSelfMentionContactsViewController.swift; sourceTree = "<group>"; };
+		A7824B032271F10300ABA381 /* EditSelfMentionContactsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditSelfMentionContactsView.swift; sourceTree = "<group>"; };
 		A7824B052271F25400ABA381 /* EditAddressTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditAddressTableViewCell.swift; sourceTree = "<group>"; };
 		A7824B072271F53A00ABA381 /* EditSetDefaultTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditSetDefaultTableViewCell.swift; sourceTree = "<group>"; };
 		A79057012276C9770037F823 /* SetPasswordModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetPasswordModel.swift; sourceTree = "<group>"; };
@@ -1416,7 +1416,7 @@
 				A71AA50D22721537008FF1A5 /* ExpressAddressList */,
 				A71AA51622721980008FF1A5 /* EditExpressAddress */,
 				A7CC753F2271DFF3003C4F38 /* SelfMentionContactsList */,
-				A7824AFE2271F0C500ABA381 /* EditSelfMentionAddress */,
+				A7824AFE2271F0C500ABA381 /* EditSelfMentionContacts */,
 				A7CC75292271A169003C4F38 /* SetPassword */,
 				A7CC751D22719091003C4F38 /* AccountSecurity */,
 				A7CC751222716194003C4F38 /* Set */,
@@ -1527,19 +1527,19 @@
 			path = WRNavigationBar;
 			sourceTree = "<group>";
 		};
-		A7824AFE2271F0C500ABA381 /* EditSelfMentionAddress */ = {
+		A7824AFE2271F0C500ABA381 /* EditSelfMentionContacts */ = {
 			isa = PBXGroup;
 			children = (
 				A7824B022271F0E900ABA381 /* View */,
 				A7824B012271F0E000ABA381 /* ViewController */,
 			);
-			path = EditSelfMentionAddress;
+			path = EditSelfMentionContacts;
 			sourceTree = "<group>";
 		};
 		A7824B012271F0E000ABA381 /* ViewController */ = {
 			isa = PBXGroup;
 			children = (
-				A7824AFF2271F0DD00ABA381 /* EditSelfMentionAddressViewController.swift */,
+				A7824AFF2271F0DD00ABA381 /* EditSelfMentionContactsViewController.swift */,
 			);
 			path = ViewController;
 			sourceTree = "<group>";
@@ -1547,7 +1547,7 @@
 		A7824B022271F0E900ABA381 /* View */ = {
 			isa = PBXGroup;
 			children = (
-				A7824B032271F10300ABA381 /* EditSelfMentionAddressView.swift */,
+				A7824B032271F10300ABA381 /* EditSelfMentionContactsView.swift */,
 				A7824B052271F25400ABA381 /* EditAddressTableViewCell.swift */,
 				A7824B072271F53A00ABA381 /* EditSetDefaultTableViewCell.swift */,
 				A71AA50B2272126A008FF1A5 /* EditAddressFooterView.swift */,
@@ -2207,7 +2207,7 @@
 				A70EBBC022561179000AD74F /* Extension+UITableView.swift in Sources */,
 				A72A72B022321DE000B21995 /* CGView.swift in Sources */,
 				A72A73142232475E00B21995 /* AlipayManager.swift in Sources */,
-				A7824B042271F10300ABA381 /* EditSelfMentionAddressView.swift in Sources */,
+				A7824B042271F10300ABA381 /* EditSelfMentionContactsView.swift in Sources */,
 				A71AF0B6226EF99A001730FE /* SearchResultViewController.swift in Sources */,
 				A757C9302274839900226355 /* SelfMentionAddressListModel.swift in Sources */,
 				A72A72D522321E2700B21995 /* ColorMacro.swift in Sources */,
@@ -2298,7 +2298,7 @@
 				A72A72D222321E2700B21995 /* Common.swift in Sources */,
 				A71AF0A6226EDDC8001730FE /* SearchViewController.swift in Sources */,
 				A79057062276EA3D0037F823 /* OpenCityListModel.swift in Sources */,
-				A7824B002271F0DD00ABA381 /* EditSelfMentionAddressViewController.swift in Sources */,
+				A7824B002271F0DD00ABA381 /* EditSelfMentionContactsViewController.swift in Sources */,
 				A7CC751F227190C5003C4F38 /* AccountSecurityViewController.swift in Sources */,
 				A7284440224DFACD00F82F30 /* InfoModel.swift in Sources */,
 				A72A72B522321DE000B21995 /* Extension+UITextView.swift in Sources */,

+ 14 - 6
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/Location/ViewController/LocationViewController.swift

@@ -17,9 +17,6 @@ class LocationViewController: BaseViewController {
         BaiduMapManager.shared().startLocation()
         BaiduMapManager.shared().locationSuccessBlock =  {
             [weak self] in
-            self?.navigationBar.title = "选择您的配送方式"
-            self?.locationView.isHidden = false
-            self?.view.ly_hideEmpty()
             self!.configCityManagementIndexApi()
             
         }
@@ -28,7 +25,6 @@ class LocationViewController: BaseViewController {
             self?.navigationBar.title = "未获取地理位置授权"
             self?.locationView.isHidden = true
             self?.view.ly_showEmpty()
-
         }
     }
 
@@ -76,10 +72,22 @@ class LocationViewController: BaseViewController {
         }
     }
     
-    func configCityManagementIndexApi()  {
+    private func configCityManagementIndexApi()  {
         SwiftMoyaNetWorkServiceConfig.shared().configCityManagementIndexApi {
             [weak self] (openCityListModel) -> (Void) in
-            self?.locationView.openCityListModel = openCityListModel as? OpenCityListModel
+            let openCityListModel = openCityListModel as? OpenCityListModel
+            //隐藏
+//            self?.locationView.openCityListModel = openCityListModel
+            //直接跳转
+            if openCityListModel?.data?.isEmpty ?? true {
+                self?.locationView.isHidden = true
+                self?.view.ly_hideEmpty()
+                self?.setDeliveryMethodType()
+            }else {
+                self?.navigationBar.title = "选择您的配送方式"
+                self?.locationView.isHidden = false
+                self?.view.ly_hideEmpty()
+            }
         }
     }
 }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/View/SelfRecommendationView.swift

@@ -14,7 +14,7 @@ class SelfRecommendationView: BaseView {
     typealias GoShoppingBlock = () -> Void
     var goShoppingBlock : GoShoppingBlock?
     
-    typealias DidSelectGoShoppingBlock = () -> Void
+    typealias DidSelectGoShoppingBlock = (_ indexPath: IndexPath) -> Void
     var didSelectGoShoppingBlock : DidSelectGoShoppingBlock?
     
     typealias ChangeLocationBlock = () ->Void
@@ -180,7 +180,7 @@ extension SelfRecommendationView : UICollectionViewDelegateFlowLayout,UICollecti
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         if let didSelectGoShoppingBlock = self.didSelectGoShoppingBlock {
-            didSelectGoShoppingBlock()
+            didSelectGoShoppingBlock(indexPath)
         }
         
     }

+ 41 - 10
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/ViewController/SelfRecommendationViewController.swift

@@ -15,10 +15,11 @@ class SelfRecommendationViewController: BaseViewController {
     /// 经度
     var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
     
-    var selfMentionAddressListModel : SelfMentionAddressListModel?
-    
     var selfMentionAddressArray = Array<SelfMentionAddressModel>()
     
+    typealias DidSelectClosure = () -> Void
+    var didSelectClosure : DidSelectClosure?
+    
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -55,11 +56,18 @@ class SelfRecommendationViewController: BaseViewController {
         let selfRecommendationView = SelfRecommendationView()
         selfRecommendationView.goShoppingBlock = { //去首页快递
             [weak self] in
-            self?.tabbarController(deliveryMethodType: "0")
+            let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared().getModel()
+            if deliveryMethodTypeModel?.deliveryMethodType?.isEmpty ?? true {
+                 self?.tabbarController(deliveryMethodType: "0")
+            }else {
+                self?.tabbarController(deliveryMethodType: deliveryMethodTypeModel?.deliveryMethodType ?? "0")
+            }
         }
         selfRecommendationView.didSelectGoShoppingBlock = { //去首页自提
-            [weak self] in
-            self?.tabbarController(deliveryMethodType: "1")
+            [weak self] indexPath in
+            let selfMentionAddressModel = self?.selfMentionAddressArray[indexPath.row]
+            self?.userAddSelfAddressApi(cityId:selfMentionAddressModel?.cityId ?? 0,cityName: selfMentionAddressModel?.cityName ?? "",pickupNodeId:selfMentionAddressModel?.id ?? 0, address: selfMentionAddressModel?.address ?? "")
+            
         }
         selfRecommendationView.changeLocationBlock = {
             [weak self] in
@@ -80,7 +88,7 @@ class SelfRecommendationViewController: BaseViewController {
     
     private func tabbarController(deliveryMethodType:String) {
         let model = DeliveryMethodTypeModel.shared().getModel()
-        model?.deliveryMethodType = "1"
+        model?.deliveryMethodType = deliveryMethodType
         DeliveryMethodTypeModel.shared().setModel(model: model!)
         if self.presentingViewController != nil {
             self.dismiss(animated: false, completion: {
@@ -98,16 +106,39 @@ class SelfRecommendationViewController: BaseViewController {
     func configPickupNodeIndexApi(page:Int) {
         SwiftMoyaNetWorkServiceConfig.shared().configPickupNodeIndexApi(longitude: longitude, latitude: latitude,page: page) {
             [weak self] (selfMentionAddressListModel) -> (Void) in
-            self?.selfMentionAddressListModel = selfMentionAddressListModel as? SelfMentionAddressListModel
-            if self?.selfMentionAddressListModel?.pagination?.currentPage ?? 1  <= self?.selfMentionAddressListModel?.pagination?.totalPages ?? 1 {
-                if self?.selfMentionAddressListModel?.pagination?.currentPage == 1{
+            let selfMentionAddressListModel = selfMentionAddressListModel as? SelfMentionAddressListModel
+            if selfMentionAddressListModel?.pagination?.currentPage ?? 1  <= selfMentionAddressListModel?.pagination?.totalPages ?? 1 {
+                if selfMentionAddressListModel?.pagination?.currentPage == 1{
                     self?.selfMentionAddressArray.removeAll()
                 }
-                self?.selfMentionAddressArray = (self?.selfMentionAddressArray)! + (self?.selfMentionAddressListModel?.data!)!
+                self?.selfMentionAddressArray = (self?.selfMentionAddressArray)! + (selfMentionAddressListModel?.data!)!
                 self?.selfRecommendationView.selfMentionAddressArray = self?.selfMentionAddressArray
             }else {
                 self?.selfRecommendationView.collectionView.endFooterNoMoreData()
             }
         }
     }
+    
+    
+    /// 新增自提地址
+    ///
+    /// - Parameters:
+    ///   - pickupNodeId: 自提点id
+    ///   - address: 详细地址
+    func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String) {
+        SwiftMoyaNetWorkServiceUser.shared().userAddSelfAddressApi(cityId: cityId, cityName: cityName, pickupNodeId: pickupNodeId, address: address) {
+            [weak self] (data) -> (Void) in
+            let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared().getModel()
+            if deliveryMethodTypeModel?.deliveryMethodType?.isEmpty ?? true {
+                self?.tabbarController(deliveryMethodType: "1")
+            }else {
+                if let didSelectClosure = self?.didSelectClosure {
+                    didSelectClosure()
+                }
+                self?.navigationController?.popViewController(animated: true)
+            }
+        }
+    }
+    
+    
 }

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerSelfMentionTableViewCell.swift

@@ -80,5 +80,11 @@ class AddressManagerSelfMentionTableViewCell: UITableViewCell {
         lineLabel.backgroundColor = kf5f5f5Color
         return lineLabel
     }()
+    
+    var selfAddresModel : SelfAddresModel? {
+        didSet {
+            addressLabel.text = selfAddresModel?.address
+        }
+    }
 
 }

+ 6 - 5
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerView.swift

@@ -61,7 +61,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
     
     func numberOfSections(in tableView: UITableView) -> Int {
         
-        if isOpenCity ?? true {
+        if isOpenCity ?? false {
             return headerTitls.count
         }else {
             return headerOneTitls.count
@@ -71,7 +71,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         
-        if isOpenCity ?? true {
+        if isOpenCity ?? false {
             switch section {
             case 0:
                 if addressManagerListModel?.selfAddress?.isEmpty ?? true {
@@ -103,7 +103,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         
-        if isOpenCity ?? true {
+        if isOpenCity ?? false {
             switch indexPath.section {
             case 0:
                 if addressManagerListModel?.selfAddress?.isEmpty ?? true {
@@ -112,6 +112,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
                     return cell
                 }else {
                     let cell = AddressManagerSelfMentionTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                    cell.selfAddresModel = addressManagerListModel?.selfAddress?[indexPath.row]
                     return cell
                 }
             case 1:
@@ -136,7 +137,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
             return cell
         }else {
             let cell = AddressManagerExpressTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-            cell.expressAddresModel = addressManagerListModel?.expressAddress![indexPath.row]
+            cell.expressAddresModel = addressManagerListModel?.expressAddress?[indexPath.row]
             return cell
         }
     }
@@ -154,7 +155,7 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
     func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
         let heaerView = AddressManagerSelfMentionExpressHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: section == 0 ? 58 : 72))
         heaerView.section = section
-        if isOpenCity ?? true {
+        if isOpenCity ?? false {
             heaerView.headerTitls = headerTitls
         }else {
             heaerView.headerTitls = headerOneTitls

+ 23 - 16
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/ViewController/AddressManagerViewController.swift

@@ -16,7 +16,7 @@ class AddressManagerViewController: BaseViewController {
     
     var addressManagerVCType : AddressManagerVCType = .mine
     var addressManagerListModel : AddressManagerListModel?
-    var isOpenCity : Bool = true
+    var isOpenCity : Bool = false
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -38,7 +38,7 @@ class AddressManagerViewController: BaseViewController {
     }
     
     override func setupData() {
-        addressManagerView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: true) {
+        addressManagerView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
             [weak self](page) in
             self?.configCityManagementIndexApi()
         }
@@ -70,16 +70,16 @@ class AddressManagerViewController: BaseViewController {
             if self?.isOpenCity ?? true {
                 switch indexPath.section {
                 case 0:
-                    self?.didSelectSelfMentionAddress()
+                    self?.didSelectSelfMentionAddress(indexPath: indexPath)
                     break
                 case 1:
-                    self?.didSelectExpressAddress()
+                    self?.didSelectExpressAddress(indexPath: indexPath)
                     break
                 default:
                     break
                 }
             }else {
-                self?.didSelectExpressAddress()
+                self?.didSelectExpressAddress(indexPath: indexPath)
             }
             
         }
@@ -89,34 +89,40 @@ class AddressManagerViewController: BaseViewController {
     
     /// 管理快递跳转页面
     private func managerExpressAddressPushVC() {
-        self.navigationController?.pushViewController(ExpressAddressListViewController(), animated: true)
+        let vc = ExpressAddressListViewController()
+        self.navigationController?.pushViewController(vc, animated: true)
     }
     
     
     /// 管理自提跳转页面
     private func managerSelfMentionAddressPushVC() {
-        self.navigationController?.pushViewController(SelfMentionContactsListViewController(), animated: true)
+        let vc = SelfRecommendationViewController()
+        vc.didSelectClosure = {
+            [weak self] in
+            self?.configCityManagementIndexApi()
+        }
+        self.navigationController?.pushViewController(vc, animated: true)
     }
     
     
     /// 选择自提地址
-    func didSelectSelfMentionAddress() {
+    func didSelectSelfMentionAddress(indexPath:IndexPath) {
         if self.addressManagerListModel?.selfAddress?.isEmpty ?? true {
-           let vc = EditSelfMentionAddressViewController()
+           let vc = EditSelfMentionContactsViewController()
            self.navigationController?.pushViewController(vc, animated: true)
         }else {
             if self.addressManagerVCType == .mine {
-                let vc = EditSelfMentionAddressViewController()
-                self.navigationController?.pushViewController(vc, animated: true)
+                managerSelfMentionAddressPushVC()
             }else {
-                self.userAddressIsDefaultApi()
+                let selfAddressModel = self.addressManagerListModel?.selfAddress?[indexPath.row]
+                self.userAddressIsDefaultApi(id:selfAddressModel?.id ?? 0)
             }
         }
     }
     
     
     /// 选择快递地址
-    func didSelectExpressAddress() {
+    func didSelectExpressAddress(indexPath:IndexPath) {
         if self.addressManagerListModel?.expressAddress?.isEmpty ?? true {
             let vc = EditExpressAddressViewController()
             self.navigationController?.pushViewController(vc, animated: true)
@@ -125,7 +131,8 @@ class AddressManagerViewController: BaseViewController {
                 let vc = EditExpressAddressViewController()
                 self.navigationController?.pushViewController(vc, animated: true)
             }else {
-                self.userAddressIsDefaultApi()
+                let expressAddressModel = self.addressManagerListModel?.expressAddress?[indexPath.row]
+                self.userAddressIsDefaultApi(id:expressAddressModel?.id ?? 0)
             }
         }
     }
@@ -164,8 +171,8 @@ class AddressManagerViewController: BaseViewController {
     }
     
     /// 设置默认跳转
-    func userAddressIsDefaultApi() {
-        SwiftMoyaNetWorkServiceUser.shared().userAddressIsDefaultApi(id: "") { (data) -> (Void) in
+    func userAddressIsDefaultApi(id:Int = 0) {
+        SwiftMoyaNetWorkServiceUser.shared().userAddressIsDefaultApi(id:id) { (data) -> (Void) in
             
         }
     }

RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressFooterView.swift → RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditAddressFooterView.swift


RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressTableViewCell.swift → RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditAddressTableViewCell.swift


+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditSelfMentionAddressView.swift

@@ -1,5 +1,5 @@
 //
-//  EditSelfMentionAddressView.swift
+//  EditSelfMentionContactsView.swift
 //  RainbowPlanet
 //
 //  Created by 南鑫林 on 2019/4/25.
@@ -8,7 +8,7 @@
 
 import UIKit
 
-class EditSelfMentionAddressView: BaseView {
+class EditSelfMentionContactsView: BaseView {
     
     
     typealias DeleteClosure = () -> Void
@@ -67,7 +67,7 @@ class EditSelfMentionAddressView: BaseView {
     }()
 }
 
-extension EditSelfMentionAddressView: UITableViewDelegate,UITableViewDataSource {
+extension EditSelfMentionContactsView: UITableViewDelegate,UITableViewDataSource {
     
     
     func numberOfSections(in tableView: UITableView) -> Int {

RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditSetDefaultTableViewCell.swift → RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/View/EditSetDefaultTableViewCell.swift


+ 11 - 11
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/ViewController/EditSelfMentionAddressViewController.swift

@@ -1,5 +1,5 @@
 //
-//  EditSelfMentionAddressViewController.swift
+//  EditSelfMentionContactsViewController.swift
 //  RainbowPlanet
 //
 //  Created by 南鑫林 on 2019/4/25.
@@ -8,7 +8,7 @@
 
 import UIKit
 
-class EditSelfMentionAddressViewController: BaseViewController {
+class EditSelfMentionContactsViewController: BaseViewController {
     
     typealias SaveClosure = () -> Void
     var saveClosure : SaveClosure?
@@ -28,35 +28,35 @@ class EditSelfMentionAddressViewController: BaseViewController {
             [weak self] in
             self?.userSaveExpreesContactsApi()
         }
-        view.addSubview(editSelfMentionAddressView)
+        view.addSubview(editSelfMentionContactsView)
     }
     
     override func setupLayouts() {
-        editSelfMentionAddressView.snp.makeConstraints { (make) in
+        editSelfMentionContactsView.snp.makeConstraints { (make) in
             make.top.equalTo(kNavBarTotalHeight)
             make.left.right.bottom.equalToSuperview()
         }
     }
     
-    private lazy var editSelfMentionAddressView: EditSelfMentionAddressView = {
-        let editSelfMentionAddressView = EditSelfMentionAddressView()
-        editSelfMentionAddressView.selfMentionContactsModel = selfMentionContactsModel
-        editSelfMentionAddressView.selfMentionContactsClosure = { //赋值
+    private lazy var editSelfMentionContactsView: EditSelfMentionContactsView = {
+        let editSelfMentionContactsView = EditSelfMentionContactsView()
+        editSelfMentionContactsView.selfMentionContactsModel = selfMentionContactsModel
+        editSelfMentionContactsView.selfMentionContactsClosure = { //赋值
             [weak self] (moblie,name) in
             self?.selfMentionContactsModel?.mobile = moblie
             self?.selfMentionContactsModel?.name = name
         }
-        editSelfMentionAddressView.didSelectRowClosure = { //选中
+        editSelfMentionContactsView.didSelectRowClosure = { //选中
             [weak self] indexPath in
             
         }
-        editSelfMentionAddressView.deleteClosure = { //删除
+        editSelfMentionContactsView.deleteClosure = { //删除
             [weak self] in
             if let selfMentionContactsModel = self?.selfMentionContactsModel {
                 self?.userDelExpreesContactsApi()
             }
         }
-        return editSelfMentionAddressView
+        return editSelfMentionContactsView
     }()
     
     

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionContactsList/ViewController/SelfMentionContactsListViewController.swift

@@ -65,7 +65,7 @@ class SelfMentionContactsListViewController: BaseViewController {
     ///
     /// - Parameter selfMentionContactsModel: 修改个人信息
     func pushEditSelfMention(selfMentionContactsModel:SelfMentionContactsModel? = nil) -> Void {
-        let vc = EditSelfMentionAddressViewController()
+        let vc = EditSelfMentionContactsViewController()
         vc.saveClosure = {
             [weak self] in
             self?.userExpreesContactsListApi()

+ 55 - 2
RainbowPlanet/RainbowPlanet/Service/Model/UserModel/AddressManagerListModel.swift

@@ -9,7 +9,7 @@ import ObjectMapper
 class AddressManagerListModel : NSObject, NSCoding, Mappable{
 
 	var expressAddress : [ExpressAddresModel]?
-	var selfAddress : [AnyObject]?
+	var selfAddress : [SelfAddresModel]?
 
 
 	class func newInstance(map: Map) -> Mappable?{
@@ -32,7 +32,7 @@ class AddressManagerListModel : NSObject, NSCoding, Mappable{
     @objc required init(coder aDecoder: NSCoder)
 	{
          expressAddress = aDecoder.decodeObject(forKey: "expressAddress") as? [ExpressAddresModel]
-         selfAddress = aDecoder.decodeObject(forKey: "selfAddress") as? [AnyObject]
+         selfAddress = aDecoder.decodeObject(forKey: "selfAddress") as? [SelfAddresModel]
 
 	}
 
@@ -196,3 +196,56 @@ class ExpressAddresModel : NSObject, NSCoding, Mappable{
     
 }
 
+class SelfAddresModel : NSObject, Mappable{
+    
+    var address : String?
+    var addressType : Int?
+    var areaId : Int?
+    var areaName : String?
+    var cityId : Int?
+    var cityName : String?
+    var contactMobile : String?
+    var contactName : String?
+    var createdAt : String?
+    var deletedAt : AnyObject?
+    var id : Int?
+    var isDefault : Int?
+    var pickupNodeId : Int?
+    var provinceId : Int?
+    var provinceName : String?
+    var uid : Int?
+    var updatedAt : String?
+    var zipcode : Int?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return SelfAddresModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        address <- map["address"]
+        addressType <- map["address_type"]
+        areaId <- map["area_id"]
+        areaName <- map["area_name"]
+        cityId <- map["city_id"]
+        cityName <- map["city_name"]
+        contactMobile <- map["contact_mobile"]
+        contactName <- map["contact_name"]
+        createdAt <- map["created_at"]
+        deletedAt <- map["deleted_at"]
+        id <- map["id"]
+        isDefault <- map["is_default"]
+        pickupNodeId <- map["pickup_node_id"]
+        provinceId <- map["province_id"]
+        provinceName <- map["province_name"]
+        uid <- map["uid"]
+        updatedAt <- map["updated_at"]
+        zipcode <- map["zipcode"]
+        
+    }
+    
+}
+

+ 45 - 7
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -24,6 +24,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
     /// 数据回调
     typealias apiCallBack = (Any) -> (Void)
 
+    // MARK: - 微信注册/登录
     /// 微信注册/登录
     ///
     /// - Parameters:
@@ -48,7 +49,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
 
-
+    // MARK: - 手机注册/登录
     /// 手机注册/登录
     ///
     /// - Parameters:
@@ -67,7 +68,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
 
-
+    // MARK: - 手机密码登录
     /// 手机密码登录
     ///
     /// - Parameters:
@@ -86,6 +87,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 刷新令牌
     /// 刷新令牌
     ///
     /// - Parameters:
@@ -100,6 +102,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 登出
     /// 登出
     ///
     /// - Parameters:
@@ -113,6 +116,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
 
+    // MARK: - 绑定手机号
     /// 绑定手机号
     ///
     /// - Parameters:
@@ -136,6 +140,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 检查是否绑定微信 解绑
     /// 检查是否绑定微信 解绑
     ///
     /// - Parameters:
@@ -161,6 +166,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         
     }
     
+    // MARK: - 检查是否绑定微信 绑定
     /// 检查是否绑定微信 绑定
     ///
     /// - Parameters:
@@ -195,6 +201,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 绑定微信
     /// 绑定微信
     ///
     /// - Parameters:
@@ -218,6 +225,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 解绑微信
     /// 解绑微信
     ///
     /// - Parameters:
@@ -238,6 +246,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
 
+    // MARK: - 设置密码
     /// 设置密码
     ///
     /// - Parameters:
@@ -265,6 +274,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 用户自提点,快递地址列表
     /// 用户自提点,快递地址列表
     ///
     /// - Parameters:
@@ -284,6 +294,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - (新增、编辑)快递地址
     /// 新增、编辑)快递地址
     ///
     /// - Parameters:
@@ -320,11 +331,12 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 设置(自提/快递)默认地址
     /// 设置(自提/快递)默认地址
     ///
     /// - Parameters:
     ///   - id: 表id 修改适合传
-    func userAddressIsDefaultApi(id:String = "",completion: @escaping apiCallBack) {
+    func userAddressIsDefaultApi(id:Int = 0,completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
         parameters.updateValue(id, forKey: "id")
         SwiftProgressHUD.shared().showWait()
@@ -336,6 +348,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 删除(自提/快递)地址
     /// 删除(自提/快递)地址
     ///
     /// - Parameters:
@@ -351,7 +364,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
             completion("")
         }
     }
-    
+    // MARK: - 自提点收货人列表
     /// 自提点收货人列表
     ///
     /// - Parameter completion: 成功回调
@@ -368,10 +381,8 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
-    /// 新增、编辑 自提地址收货人信息
-    ///
-    /// - Parameter completion: 成功回调
     
+    // MARK: - 新增、编辑 自提地址收货人信息
     /// 新增、编辑 自提地址收货人信息
     ///
     /// - Parameters:
@@ -402,6 +413,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 删除自提点收货人信息
     /// 删除自提点收货人信息
     ///
     /// - Parameters:
@@ -419,6 +431,7 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
         }
     }
     
+    // MARK: - 自提点收货人信息,设置默认
     /// 自提点收货人信息,设置默认
     ///
     /// - Parameters:
@@ -435,5 +448,30 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
             completion("")
         }
     }
+    
+    // MARK: - 新增自提地址
+    /// 新增自提地址
+    ///
+    /// - Parameters:
+    ///   - pickupNodeId: 地址类型1快递地址,自提地址
+    ///   - address: 详细地址
+    ///   - completion: 完成
+    func userAddSelfAddressApi(cityId:Int = 0,cityName:String = "",pickupNodeId:Int = 0,address:String,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared().getModel()
+        
+        parameters.updateValue(deliveryMethodTypeModel?.deliveryMethodType! as Any, forKey: "address_type")
+        parameters.updateValue(cityId, forKey: "city_id")
+        parameters.updateValue(cityName, forKey: "city_name")
+        parameters.updateValue(pickupNodeId, forKey: "pickup_node_id")
+        parameters.updateValue(address, forKey: "address")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userAddSelfAddress(parameters: parameters))) {
+            (rootModel) in
+            let rootModel = rootModel as! RootModel
+            SwiftProgressHUD.shared().showText(rootModel.msg!)
+            completion("")
+        }
+    }
 
 }

+ 18 - 6
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift

@@ -61,8 +61,8 @@ public let kUserAddExpressAddressApi = "/user/addExpressAddress"
 /// 设置默认(自提/快递)地址
 public let kUserAddressIsDefaultApi = "/user/addressIsDefault"
 
-// MARK: - 删除(自提/快递)地址
-/// 删除(自提/快递)地址
+// MARK: - 删除(快递)地址
+/// 删除(快递)地址
 public let kUserAddressDeleteApi = "/user/addressDelete"
 
 // MARK: - 自提点收货人列表
@@ -81,6 +81,10 @@ public let kUserDelExpreesContactsApi = "/user/delExpreesContacts"
 /// 自提点收货人信息,设置默认
 public let kUserSetExpreesContactsDefaultApi = "/user/setExpreesContactsDefault"
 
+// MARK: - 新增自提地址
+/// 新增自提地址
+public let kUserAddSelfAddressApi = "/user/addSelfAddress"
+
 /// 用户
 ///
 /// - userLogout: 登出
@@ -101,6 +105,7 @@ public let kUserSetExpreesContactsDefaultApi = "/user/setExpreesContactsDefault"
 /// - userSaveExpreesContacts: 新增、编辑 自提地址收货人信息
 /// - userDelExpreesContacts: 删除自提点收货人信息
 /// - userSetExpreesContactsDefault: 自提点收货人信息,设置默认
+/// - userSetExpreesContactsDefault: 新增自提地址
 public enum SwiftMoyaServiceUserApi {
     case userLogout(parameters:Dictionary<String, Any>)
     case userRefresh(parameters:Dictionary<String, Any>)
@@ -120,6 +125,7 @@ public enum SwiftMoyaServiceUserApi {
     case userSaveExpreesContacts(parameters:Dictionary<String, Any>)
     case userDelExpreesContacts(parameters:Dictionary<String, Any>)
     case userSetExpreesContactsDefault(parameters:Dictionary<String, Any>)
+    case userAddSelfAddress(parameters:Dictionary<String, Any>)
     
 }
 
@@ -144,7 +150,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userExpreesContactsList,
              .userSaveExpreesContacts,
              .userDelExpreesContacts,
-             .userSetExpreesContactsDefault
+             .userSetExpreesContactsDefault,
+             .userAddSelfAddress
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -188,6 +195,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
             return kUserDelExpreesContactsApi
         case .userSetExpreesContactsDefault:
             return kUserSetExpreesContactsDefaultApi
+        case .userAddSelfAddress:
+            return kUserAddSelfAddressApi
         }
     }
 
@@ -210,7 +219,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userExpreesContactsList,
              .userSaveExpreesContacts,
              .userDelExpreesContacts,
-             .userSetExpreesContactsDefault
+             .userSetExpreesContactsDefault,
+             .userAddSelfAddress
             :
             return .post
         }
@@ -238,7 +248,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userExpreesContactsList(var parameters),
              .userSaveExpreesContacts(var parameters),
              .userDelExpreesContacts(var parameters),
-             .userSetExpreesContactsDefault(var parameters)
+             .userSetExpreesContactsDefault(var parameters),
+             .userAddSelfAddress(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -278,7 +289,8 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userExpreesContactsList,
              .userSaveExpreesContacts,
              .userDelExpreesContacts,
-             .userSetExpreesContactsDefault
+             .userSetExpreesContactsDefault,
+             .userAddSelfAddress
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
         case .userLogout,

+ 20 - 12
RainbowPlanet/RainbowPlanet/Tools/SwiftProgressHUD/SwiftProgressHUD.swift

@@ -40,17 +40,19 @@ class SwiftProgressHUD: NSObject {
         return _sharedInstance
     }
 
-
     /// 显示等待消息
     ///
     /// - Parameter title: 加载提示语
     func showWait(_ title: String = "") {
+        hide()
+        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
         hud.show(animated: true)
         hud.detailsLabel.text = title
         hud.bezelView.style = .solidColor
         hud.bezelView.backgroundColor = UIColor.clear
         hud.mode = MBProgressHUDMode.indeterminate
-        hud.removeFromSuperViewOnHide = false
+        hud.removeFromSuperViewOnHide = true
+        self.hud = hud
     }
 
 
@@ -58,7 +60,8 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 显示的标题
     func showText(_ title: String = "",textAlignment :NSTextAlignment = .center) {
-        hud.show(animated: true)
+        hide()
+        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
         hud.mode = .text
         hud.detailsLabel.text = title
         hud.detailsLabel.textAlignment = textAlignment
@@ -67,10 +70,11 @@ class SwiftProgressHUD: NSObject {
         hud.bezelView.style = .solidColor
         hud.bezelView.backgroundColor = UIColor.init(white: 0, alpha: 0.7)
         hud.animationType = .zoom
-        hud.removeFromSuperViewOnHide = false
+        hud.removeFromSuperViewOnHide = true
         hud.margin = 10
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
+        self.hud = hud
 
     }
 
@@ -78,27 +82,30 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 成功的提示语
     func showSuccess(_ title: String = "",_ imageName: String = "success") {
-        hud.show(animated: true)
+        hide()
+        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = false
+        hud.removeFromSuperViewOnHide = true
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
+        self.hud = hud
     }
 
     /// 显示警告消息
     ///
     /// - Parameter title: 警告的提示语
     func showWarning(_ title: String = "",_ imageName: String = "warning") {
-
-        hud.show(animated: true)
+        hide()
+        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = false
+        hud.removeFromSuperViewOnHide = true
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
+        self.hud = hud
     }
 
 
@@ -106,14 +113,15 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 加载提示语
     func showError(_ title: String = "", _ imageName: String = "error") {
-
-        hud.show(animated: true)
+        hide()
+        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = false
+        hud.removeFromSuperViewOnHide = true
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
+        self.hud = hud
     }
 
     /// 隐藏