Browse Source

地址选择封装完成(需完善)

南鑫林 6 years ago
parent
commit
540cdc7889
39 changed files with 1722 additions and 166 deletions
  1. 83 24
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 2 28
      RainbowPlanet/RainbowPlanet/Base/BaseViewController/BaseViewController.swift
  3. 2 0
      RainbowPlanet/RainbowPlanet/Macro/ColorMacro.swift
  4. 8 2
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/View/SelfRecommendationCollectionViewCell.swift
  5. 9 2
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/View/SelfRecommendationView.swift
  6. 40 22
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/ViewController/SelfRecommendationViewController.swift
  7. 205 0
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/Model/ProvinceCityAreaModel.swift
  8. 85 0
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/View/ProvinceCityAreaTableViewCell.swift
  9. 382 0
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/View/ProvinceCityAreaView.swift
  10. 34 5
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerExpressTableViewCell.swift
  11. 42 7
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerView.swift
  12. 77 3
      RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/ViewController/AddressManagerViewController.swift
  13. 31 4
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditExpressAddress/View/EditExpressAddressView.swift
  14. 50 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditExpressAddress/ViewController/EditExpressAddressViewController.swift
  15. 9 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressFooterView.swift
  16. 22 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressTableViewCell.swift
  17. 2 3
      RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/ViewController/EditSelfMentionAddressViewController.swift
  18. 15 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/View/ExpressAddressListTableViewCell.swift
  19. 17 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/View/ExpressAddressListView.swift
  20. 39 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/ViewController/ExpressAddressListViewController.swift
  21. 3 4
      RainbowPlanet/RainbowPlanet/Modules/MineModule/Mine/ViewController/MineViewController.swift
  22. 8 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionAddressList/View/SelfMentionAddressListView.swift
  23. 15 0
      RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionAddressList/ViewController/SelfMentionAddressListViewController.swift
  24. 1 1
      RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/PhoneCountryArea/ViewController/PhoneCountryAreaViewController.swift
  25. 6 6
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift
  26. 1 1
      RainbowPlanet/RainbowPlanet/Service/Model/RootModel/RootModel.swift
  27. 147 3
      RainbowPlanet/RainbowPlanet/Service/Model/UserModel/AddressManagerListModel.swift
  28. 178 0
      RainbowPlanet/RainbowPlanet/Service/Model/UserModel/SelfMentionAddressListModel.swift
  29. 1 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift
  30. 5 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift
  31. 68 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift
  32. 47 7
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift
  33. 1 0
      RainbowPlanet/RainbowPlanet/Src/baidu_cityid_rel.json
  34. 1 0
      RainbowPlanet/RainbowPlanet/Src/province_city_area.json
  35. 22 1
      RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift
  36. 22 0
      RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+String.swift
  37. 11 2
      RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.h
  38. 19 10
      RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m
  39. 12 15
      RainbowPlanet/RainbowPlanet/Tools/SwiftProgressHUD/SwiftProgressHUD.swift

+ 83 - 24
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -9,6 +9,9 @@
 /* Begin PBXBuildFile section */
 		0A110C4CD931995B8E8BF7C5 /* Pods_RainbowPlanet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D469F6C3768252BCB7001EDD /* Pods_RainbowPlanet.framework */; };
 		A70EBBC022561179000AD74F /* Extension+UITableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70EBBBF22561179000AD74F /* Extension+UITableView.swift */; };
+		A7190167227543DB00104A50 /* baidu_cityid_rel.json in Resources */ = {isa = PBXBuildFile; fileRef = A7190166227543DB00104A50 /* baidu_cityid_rel.json */; };
+		A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71901682275464000104A50 /* ProvinceCityAreaView.swift */; };
+		A719016B22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A719016A22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift */; };
 		A71AA50C2272126A008FF1A5 /* EditAddressFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA50B2272126A008FF1A5 /* EditAddressFooterView.swift */; };
 		A71AA5102272156A008FF1A5 /* ExpressAddressListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA50F2272156A008FF1A5 /* ExpressAddressListViewController.swift */; };
 		A71AA513227215B5008FF1A5 /* ExpressAddressListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA512227215B5008FF1A5 /* ExpressAddressListView.swift */; };
@@ -17,7 +20,6 @@
 		A71AA51C227219EF008FF1A5 /* EditExpressAddressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA51B227219EF008FF1A5 /* EditExpressAddressView.swift */; };
 		A71AA51F22729F35008FF1A5 /* AuthorizationSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA51E22729F35008FF1A5 /* AuthorizationSwift.swift */; };
 		A71AA5212272E527008FF1A5 /* Extension+UINavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA5202272E527008FF1A5 /* Extension+UINavigationController.swift */; };
-		A71AA52322731CFB008FF1A5 /* AddressManagerListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA52222731CFB008FF1A5 /* AddressManagerListModel.swift */; };
 		A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA52522732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift */; };
 		A71AA52822732173008FF1A5 /* SwiftMoyaNetWorkServiceConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AA52722732173008FF1A5 /* SwiftMoyaNetWorkServiceConfig.swift */; };
 		A71AF0A6226EDDC8001730FE /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A71AF0A5226EDDC8001730FE /* SearchViewController.swift */; };
@@ -97,6 +99,8 @@
 		A72A733522325A4B00B21995 /* AppDelegate+HandleOpen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72A733422325A4B00B21995 /* AppDelegate+HandleOpen.swift */; };
 		A72A7386223396CB00B21995 /* SwiftMoyaNetWorkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72A7382223396CB00B21995 /* SwiftMoyaNetWorkManager.swift */; };
 		A72A7388223396CB00B21995 /* ApiMacro.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72A7384223396CB00B21995 /* ApiMacro.swift */; };
+		A72C01222275404A0065E0C3 /* ProvinceCityAreaModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A72C01202275404A0065E0C3 /* ProvinceCityAreaModel.swift */; };
+		A72C01232275404A0065E0C3 /* province_city_area.json in Resources */ = {isa = PBXBuildFile; fileRef = A72C01212275404A0065E0C3 /* province_city_area.json */; };
 		A738D202225AD6AD00EEE860 /* Extension+UICollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A738D201225AD6AD00EEE860 /* Extension+UICollectionView.swift */; };
 		A738D205225AF90D00EEE860 /* WeChatpayOrderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A738D204225AF90D00EEE860 /* WeChatpayOrderModel.swift */; };
 		A738D66F225D9BD900EEE860 /* UMLoginModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A738D66E225D9BD900EEE860 /* UMLoginModel.swift */; };
@@ -104,7 +108,9 @@
 		A75414FD224B5F28002480B5 /* MobileLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */; };
 		A7541502224C5ECB002480B5 /* BaiduMapManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7541501224C5ECA002480B5 /* BaiduMapManager.swift */; };
 		A754150F224CACF9002480B5 /* SwiftSign.swift in Sources */ = {isa = PBXBuildFile; fileRef = A754150B224CACF9002480B5 /* SwiftSign.swift */; };
-		A757C92C2274058800226355 /* UIScrollView+MJRefreshEX.m in Sources */ = {isa = PBXBuildFile; fileRef = A757C92A2274058800226355 /* UIScrollView+MJRefreshEX.m */; };
+		A757C92E22744ACE00226355 /* AddressManagerListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A757C92D22744ACE00226355 /* AddressManagerListModel.swift */; };
+		A757C9302274839900226355 /* SelfMentionAddressListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A757C92F2274839900226355 /* SelfMentionAddressListModel.swift */; };
+		A757C9342274882E00226355 /* UIScrollView+MJRefreshEX.m in Sources */ = {isa = PBXBuildFile; fileRef = A757C9322274882E00226355 /* UIScrollView+MJRefreshEX.m */; };
 		A7636AC52268139C00374F9E /* LocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7636AC42268139C00374F9E /* LocationViewController.swift */; };
 		A7636AC822682BAF00374F9E /* LocationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7636AC722682BAF00374F9E /* LocationView.swift */; };
 		A76390EB2248E27A0067EEE0 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A76390EA2248E27A0067EEE0 /* UserNotifications.framework */; };
@@ -218,6 +224,9 @@
 		57C497E128081597F165C771 /* Pods-RainbowPlanet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RainbowPlanet.release.xcconfig"; path = "Pods/Target Support Files/Pods-RainbowPlanet/Pods-RainbowPlanet.release.xcconfig"; sourceTree = "<group>"; };
 		88DF1EFD2E202DA7C627E8A7 /* Pods_RainbowPlanetUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RainbowPlanetUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		A70EBBBF22561179000AD74F /* Extension+UITableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UITableView.swift"; sourceTree = "<group>"; };
+		A7190166227543DB00104A50 /* baidu_cityid_rel.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = baidu_cityid_rel.json; sourceTree = "<group>"; };
+		A71901682275464000104A50 /* ProvinceCityAreaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProvinceCityAreaView.swift; sourceTree = "<group>"; };
+		A719016A22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProvinceCityAreaTableViewCell.swift; sourceTree = "<group>"; };
 		A71AA50B2272126A008FF1A5 /* EditAddressFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditAddressFooterView.swift; sourceTree = "<group>"; };
 		A71AA50F2272156A008FF1A5 /* ExpressAddressListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpressAddressListViewController.swift; sourceTree = "<group>"; };
 		A71AA512227215B5008FF1A5 /* ExpressAddressListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpressAddressListView.swift; sourceTree = "<group>"; };
@@ -226,7 +235,6 @@
 		A71AA51B227219EF008FF1A5 /* EditExpressAddressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditExpressAddressView.swift; sourceTree = "<group>"; };
 		A71AA51E22729F35008FF1A5 /* AuthorizationSwift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthorizationSwift.swift; sourceTree = "<group>"; };
 		A71AA5202272E527008FF1A5 /* Extension+UINavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UINavigationController.swift"; sourceTree = "<group>"; };
-		A71AA52222731CFB008FF1A5 /* AddressManagerListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddressManagerListModel.swift; sourceTree = "<group>"; };
 		A71AA52522732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceConfigApi.swift; sourceTree = "<group>"; };
 		A71AA52722732173008FF1A5 /* SwiftMoyaNetWorkServiceConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceConfig.swift; sourceTree = "<group>"; };
 		A71AF0A5226EDDC8001730FE /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
@@ -308,6 +316,8 @@
 		A72A73592233577000B21995 /* libc++.1.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.1.tbd"; path = "usr/lib/libc++.1.tbd"; sourceTree = SDKROOT; };
 		A72A7382223396CB00B21995 /* SwiftMoyaNetWorkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkManager.swift; sourceTree = "<group>"; };
 		A72A7384223396CB00B21995 /* ApiMacro.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiMacro.swift; sourceTree = "<group>"; };
+		A72C01202275404A0065E0C3 /* ProvinceCityAreaModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProvinceCityAreaModel.swift; sourceTree = "<group>"; };
+		A72C01212275404A0065E0C3 /* province_city_area.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = province_city_area.json; sourceTree = "<group>"; };
 		A738D201225AD6AD00EEE860 /* Extension+UICollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UICollectionView.swift"; sourceTree = "<group>"; };
 		A738D204225AF90D00EEE860 /* WeChatpayOrderModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WeChatpayOrderModel.swift; sourceTree = "<group>"; };
 		A738D66E225D9BD900EEE860 /* UMLoginModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UMLoginModel.swift; sourceTree = "<group>"; };
@@ -315,8 +325,10 @@
 		A75414FB224B5F28002480B5 /* MobileLoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileLoginViewController.swift; sourceTree = "<group>"; };
 		A7541501224C5ECA002480B5 /* BaiduMapManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaiduMapManager.swift; sourceTree = "<group>"; };
 		A754150B224CACF9002480B5 /* SwiftSign.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSign.swift; sourceTree = "<group>"; };
-		A757C92A2274058800226355 /* UIScrollView+MJRefreshEX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefreshEX.m"; sourceTree = "<group>"; };
-		A757C92B2274058800226355 /* UIScrollView+MJRefreshEX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+MJRefreshEX.h"; sourceTree = "<group>"; };
+		A757C92D22744ACE00226355 /* AddressManagerListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddressManagerListModel.swift; sourceTree = "<group>"; };
+		A757C92F2274839900226355 /* SelfMentionAddressListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelfMentionAddressListModel.swift; sourceTree = "<group>"; };
+		A757C9322274882E00226355 /* UIScrollView+MJRefreshEX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefreshEX.m"; sourceTree = "<group>"; };
+		A757C9332274882E00226355 /* UIScrollView+MJRefreshEX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+MJRefreshEX.h"; sourceTree = "<group>"; };
 		A7636AC42268139C00374F9E /* LocationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationViewController.swift; sourceTree = "<group>"; };
 		A7636AC722682BAF00374F9E /* LocationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationView.swift; sourceTree = "<group>"; };
 		A76390EA2248E27A0067EEE0 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
@@ -471,6 +483,32 @@
 			name = Pods;
 			sourceTree = "<group>";
 		};
+		A71901622275411C00104A50 /* ProvinceCityArea */ = {
+			isa = PBXGroup;
+			children = (
+				A71901652275417400104A50 /* Model */,
+				A71901632275413100104A50 /* View */,
+			);
+			path = ProvinceCityArea;
+			sourceTree = "<group>";
+		};
+		A71901632275413100104A50 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				A71901682275464000104A50 /* ProvinceCityAreaView.swift */,
+				A719016A22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		A71901652275417400104A50 /* Model */ = {
+			isa = PBXGroup;
+			children = (
+				A72C01202275404A0065E0C3 /* ProvinceCityAreaModel.swift */,
+			);
+			path = Model;
+			sourceTree = "<group>";
+		};
 		A71AA50D22721537008FF1A5 /* ExpressAddressList */ = {
 			isa = PBXGroup;
 			children = (
@@ -622,14 +660,6 @@
 			path = SwiftMoyaServiceApi;
 			sourceTree = "<group>";
 		};
-		A71D2A6222657D5900A55D16 /* MJRefreshEX */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			name = MJRefreshEX;
-			path = "../../../../../信用付/信用付用户版swift/CreaditPayment/CreaditPayment/Tools/MJRefreshEX";
-			sourceTree = "<group>";
-		};
 		A72843FD224DB79400F82F30 /* SwiftMoyaServiceUser */ = {
 			isa = PBXGroup;
 			children = (
@@ -644,7 +674,8 @@
 			children = (
 				A7284403224DBFBD00F82F30 /* UserModel.swift */,
 				A7CC74E52270628B003C4F38 /* DeliveryMethodTypeModel.swift */,
-				A71AA52222731CFB008FF1A5 /* AddressManagerListModel.swift */,
+				A757C92D22744ACE00226355 /* AddressManagerListModel.swift */,
+				A757C92F2274839900226355 /* SelfMentionAddressListModel.swift */,
 			);
 			path = UserModel;
 			sourceTree = "<group>";
@@ -693,6 +724,7 @@
 		A729B5A52266DBC9004AE098 /* CommonModules */ = {
 			isa = PBXGroup;
 			children = (
+				A72C011F2275399D0065E0C3 /* ProvinceCityAreaModules */,
 				A7636ABD2268123B00374F9E /* LocationModule */,
 				A71AF0A3226E9D8A001730FE /* SearchModule */,
 			);
@@ -959,6 +991,23 @@
 			path = SwiftMoyaService;
 			sourceTree = "<group>";
 		};
+		A72C011E227539800065E0C3 /* Src */ = {
+			isa = PBXGroup;
+			children = (
+				A7190166227543DB00104A50 /* baidu_cityid_rel.json */,
+				A72C01212275404A0065E0C3 /* province_city_area.json */,
+			);
+			path = Src;
+			sourceTree = "<group>";
+		};
+		A72C011F2275399D0065E0C3 /* ProvinceCityAreaModules */ = {
+			isa = PBXGroup;
+			children = (
+				A71901622275411C00104A50 /* ProvinceCityArea */,
+			);
+			path = ProvinceCityAreaModules;
+			sourceTree = "<group>";
+		};
 		A738D203225AEAD000EEE860 /* Model */ = {
 			isa = PBXGroup;
 			children = (
@@ -1001,11 +1050,11 @@
 			path = SwiftSign;
 			sourceTree = "<group>";
 		};
-		A757C9292274058800226355 /* MJRefreshEX */ = {
+		A757C9312274882E00226355 /* MJRefreshEX */ = {
 			isa = PBXGroup;
 			children = (
-				A757C92A2274058800226355 /* UIScrollView+MJRefreshEX.m */,
-				A757C92B2274058800226355 /* UIScrollView+MJRefreshEX.h */,
+				A757C9322274882E00226355 /* UIScrollView+MJRefreshEX.m */,
+				A757C9332274882E00226355 /* UIScrollView+MJRefreshEX.h */,
 			);
 			path = MJRefreshEX;
 			sourceTree = "<group>";
@@ -1199,6 +1248,7 @@
 				A77F2CBC2232022A001BD3F6 /* Tools */,
 				A72A725322321A6900B21995 /* Lib */,
 				A72A7252223219BD00B21995 /* Service */,
+				A72C011E227539800065E0C3 /* Src */,
 				A77F2CBB223201DC001BD3F6 /* Supporting Files */,
 			);
 			path = RainbowPlanet;
@@ -1324,11 +1374,11 @@
 		A77F2CA92232010F001BD3F6 /* MineModule */ = {
 			isa = PBXGroup;
 			children = (
-				A71AA51622721980008FF1A5 /* EditExpressAddress */,
+				A7CC75302271AB6C003C4F38 /* AddressManager */,
 				A71AA50D22721537008FF1A5 /* ExpressAddressList */,
-				A7824AFE2271F0C500ABA381 /* EditSelfMentionAddress */,
+				A71AA51622721980008FF1A5 /* EditExpressAddress */,
 				A7CC753F2271DFF3003C4F38 /* SelfMentionAddressList */,
-				A7CC75302271AB6C003C4F38 /* AddressManager */,
+				A7824AFE2271F0C500ABA381 /* EditSelfMentionAddress */,
 				A7CC75292271A169003C4F38 /* SetPassword */,
 				A7CC751D22719091003C4F38 /* AccountSecurity */,
 				A7CC751222716194003C4F38 /* Set */,
@@ -1409,11 +1459,10 @@
 		A77F2CBC2232022A001BD3F6 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
-				A757C9292274058800226355 /* MJRefreshEX */,
+				A757C9312274882E00226355 /* MJRefreshEX */,
 				A71AA51D22729F0B008FF1A5 /* AuthorizationSwift */,
 				A73D7C662268A032002A4CE3 /* SwiftyStarRatingView */,
 				A729B5A62266DBFA004AE098 /* AlertSheetView */,
-				A71D2A6222657D5900A55D16 /* MJRefreshEX */,
 				A72A727322321DDE00B21995 /* Log */,
 				A72A727D22321DDF00B21995 /* AppInfo */,
 				A72A727B22321DDF00B21995 /* Countdown */,
@@ -1876,7 +1925,9 @@
 				A77F2CB82232010F001BD3F6 /* ShoppingCartViewController.xib in Resources */,
 				A71AF0BE226F1792001730FE /* ShoppingMallModule.xcassets in Resources */,
 				A7778C9722438F5D00C7C47A /* AlipaySDK.bundle in Resources */,
+				A7190167227543DB00104A50 /* baidu_cityid_rel.json in Resources */,
 				A77F2C682231FB4A001BD3F6 /* Assets.xcassets in Resources */,
+				A72C01232275404A0065E0C3 /* province_city_area.json in Resources */,
 				A7778C9922438F5D00C7C47A /* README.txt in Resources */,
 				A729B5AA2266F6FD004AE098 /* Launch Screen.storyboard in Resources */,
 			);
@@ -2047,6 +2098,7 @@
 				A71AA5102272156A008FF1A5 /* ExpressAddressListViewController.swift in Sources */,
 				A71AF0AE226EF0A3001730FE /* SearchHeaderCollectionReusableView.swift in Sources */,
 				A7636AC52268139C00374F9E /* LocationViewController.swift in Sources */,
+				A72C01222275404A0065E0C3 /* ProvinceCityAreaModel.swift in Sources */,
 				A7C3DD1C226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift in Sources */,
 				A7A97FDC2238FBAD0070F84D /* VerticalListCellCollectionViewCell.swift in Sources */,
 				A72A7386223396CB00B21995 /* SwiftMoyaNetWorkManager.swift in Sources */,
@@ -2066,6 +2118,7 @@
 				A7CC74DA22702E41003C4F38 /* MineOrderTableViewCell.swift in Sources */,
 				A77F2CB92232010F001BD3F6 /* ShoppingCartViewController.swift in Sources */,
 				A72A72B822321DE000B21995 /* Extension+UserDefaults.swift in Sources */,
+				A719016B22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift in Sources */,
 				A729B5B72267270B004AE098 /* PasswordLoginView.swift in Sources */,
 				A7778CB82244E97A00C7C47A /* BindPhoneNumberViewController.swift in Sources */,
 				A754150F224CACF9002480B5 /* SwiftSign.swift in Sources */,
@@ -2081,7 +2134,7 @@
 				A72A73142232475E00B21995 /* AlipayManager.swift in Sources */,
 				A7824B042271F10300ABA381 /* EditSelfMentionAddressView.swift in Sources */,
 				A71AF0B6226EF99A001730FE /* SearchResultViewController.swift in Sources */,
-				A71AA52322731CFB008FF1A5 /* AddressManagerListModel.swift in Sources */,
+				A757C9302274839900226355 /* SelfMentionAddressListModel.swift in Sources */,
 				A72A72D522321E2700B21995 /* ColorMacro.swift in Sources */,
 				A72A7333223256E100B21995 /* PayManager.swift in Sources */,
 				A775CC00223774A300EBDCF8 /* ShoppingMallView.swift in Sources */,
@@ -2145,7 +2198,6 @@
 				A7CC74D6226FF421003C4F38 /* MineNavigationBarView.swift in Sources */,
 				A71AF0BC226F099B001730FE /* SearchResultTableViewCell.swift in Sources */,
 				A71AF0AA226EDDF5001730FE /* SearchView.swift in Sources */,
-				A757C92C2274058800226355 /* UIScrollView+MJRefreshEX.m in Sources */,
 				A7284A542252FB5C000BAEC4 /* PaginationModel.swift in Sources */,
 				A72A72D022321E2700B21995 /* FontMacro.swift in Sources */,
 				A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */,
@@ -2169,11 +2221,14 @@
 				A7CC751F227190C5003C4F38 /* AccountSecurityViewController.swift in Sources */,
 				A7284440224DFACD00F82F30 /* InfoModel.swift in Sources */,
 				A72A72B522321DE000B21995 /* Extension+UITextView.swift in Sources */,
+				A757C92E22744ACE00226355 /* AddressManagerListModel.swift in Sources */,
 				A7541502224C5ECB002480B5 /* BaiduMapManager.swift in Sources */,
+				A757C9342274882E00226355 /* UIScrollView+MJRefreshEX.m in Sources */,
 				A77F2C9C2231FDCF001BD3F6 /* BaseView.swift in Sources */,
 				A7284A522252EE9A000BAEC4 /* RootModel.swift in Sources */,
 				A72A7388223396CB00B21995 /* ApiMacro.swift in Sources */,
 				A72A72B922321DE000B21995 /* Extension+Array.swift in Sources */,
+				A71901692275464000104A50 /* ProvinceCityAreaView.swift in Sources */,
 				A7CC753E2271C4C2003C4F38 /* AddressManagerExpressTableViewCell.swift in Sources */,
 				A7778CDD2246121500C7C47A /* PhoneCountryAreaListMdoel.swift in Sources */,
 				A72A733522325A4B00B21995 /* AppDelegate+HandleOpen.swift in Sources */,
@@ -2341,6 +2396,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = RainbowPlanet/RainbowPlanet.entitlements;
 				CODE_SIGN_STYLE = Automatic;
+				DEFINES_MODULE = YES;
 				DEVELOPMENT_TEAM = B4UG6NNMLL;
 				ENABLE_BITCODE = YES;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2441,6 +2497,7 @@
 					"\"UserNotifications\"",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.chxq.rainbowplanet;
+				PRODUCT_MODULE_NAME = RainbowPlanet;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -2457,6 +2514,7 @@
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_ENTITLEMENTS = RainbowPlanet/RainbowPlanet.entitlements;
 				CODE_SIGN_STYLE = Automatic;
+				DEFINES_MODULE = YES;
 				DEVELOPMENT_TEAM = B4UG6NNMLL;
 				ENABLE_BITCODE = YES;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2557,6 +2615,7 @@
 					"\"UserNotifications\"",
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.chxq.rainbowplanet;
+				PRODUCT_MODULE_NAME = RainbowPlanet;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h";
 				SWIFT_VERSION = 5.0;

+ 2 - 28
RainbowPlanet/RainbowPlanet/Base/BaseViewController/BaseViewController.swift

@@ -12,9 +12,6 @@ import RxSwift
 class BaseViewController: UIViewController {
 
     let disposeBag = DisposeBag()
-    
-//    typealias PanClosure = () -> Void
-//    var panClosure : PanClosure?
 
     lazy var navigationBar = WRCustomNavigationBar.CustomNavigationBar()
 
@@ -30,18 +27,9 @@ class BaseViewController: UIViewController {
                 self.automaticallyAdjustsScrollViewInsets = true
             }
         }
-//        let target = self.navigationController?.interactivePopGestureRecognizer!.delegate
-//        let pan = UIPanGestureRecognizer(target:target,
-//                                         action:Selector(("handleNavigationTransition:")))
-//        pan.delegate = self
-//        self.view.addGestureRecognizer(pan)
-//        //同时禁用系统原先的侧滑返回功能
-//        self.navigationController?.interactivePopGestureRecognizer!.isEnabled = false
         setupNavigationBar()
     }
     
-    
-
     fileprivate func setupNavigationBar()
     {
         navigationBar.wr_setBottomLineHidden(hidden: true)
@@ -74,21 +62,7 @@ class BaseViewController: UIViewController {
     func setupViews() {}
 
     func setupLayouts() {}
+    
+    func setupData() {}
 
 }
-
-//extension BaseViewController: UIGestureRecognizerDelegate {
-//    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
-//                           shouldRecognizeSimultaneouslyWith otherGestureRecognizer:
-//        UIGestureRecognizer) -> Bool {
-//        if self.children.count == 1 {
-//            return false
-//        }
-//        if self.panClosure != nil {
-//            self.panClosure!()
-//            return false
-//        }
-//        return true
-//
-//    }
-//}

+ 2 - 0
RainbowPlanet/RainbowPlanet/Macro/ColorMacro.swift

@@ -103,3 +103,5 @@ let kFFAA20Color = UIColor(hexString: "FFAA20")
 let kFE5706Color = UIColor(hexString: "FE5706")
 
 let kFFF1EBColor = UIColor(hexString: "FFF1EB")
+
+let kD2D3D5Color = UIColor(hexString: "D2D3D5")

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

@@ -73,7 +73,6 @@ class SelfRecommendationCollectionViewCell: UICollectionViewCell {
     
     private lazy var titleLable: UILabel = {
         let titleLable = UILabel()
-        titleLable.text = "瓦胡同小区"
         titleLable.textColor = k333333Color
         titleLable.font = kScaleBoldFont13
         titleLable.textAlignment = .left
@@ -83,7 +82,6 @@ class SelfRecommendationCollectionViewCell: UICollectionViewCell {
     
     private lazy var distanceLable: UILabel = {
         let distanceLable = UILabel()
-        distanceLable.text = "200m"
         distanceLable.textColor = kFE352BColor
         distanceLable.font = kScaleRegularFont14
         return distanceLable
@@ -105,4 +103,12 @@ class SelfRecommendationCollectionViewCell: UICollectionViewCell {
         return addressLable
     }()
     
+    var selfMentionAddressModel : SelfMentionAddressModel? {
+        didSet {
+            titleLable.text = selfMentionAddressModel?.name
+            distanceLable.text = String(describing: selfMentionAddressModel?.distance ?? 0)
+            addressLable.text = "自提地址:" + String(describing: selfMentionAddressModel?.address ?? "")
+        }
+    }
+    
 }

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

@@ -26,6 +26,12 @@ class SelfRecommendationView: BaseView {
         }
     }
     
+    var selfMentionAddressArray : Array<SelfMentionAddressModel>?{
+        didSet {
+            collectionView.reloadData()
+        }
+    }
+    
     override func setupViews() {
         backgroundColor = kf7f8faColor
         addSubview(locationBgImageView)
@@ -143,13 +149,13 @@ class SelfRecommendationView: BaseView {
 
 extension SelfRecommendationView : UICollectionViewDelegateFlowLayout,UICollectionViewDataSource {
     func numberOfSections(in collectionView: UICollectionView) -> Int {
-        return 1
+        return selfMentionAddressArray?.isEmpty ?? true ? 0 : 1
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
         switch section {
         case 0:
-            return 6
+            return selfMentionAddressArray?.isEmpty ?? true ? 0 : selfMentionAddressArray?.count ?? 0
         default:
             return 0
         }
@@ -159,6 +165,7 @@ extension SelfRecommendationView : UICollectionViewDelegateFlowLayout,UICollecti
         switch indexPath.section {
         case 0:
             let cell = SelfRecommendationCollectionViewCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+            cell.selfMentionAddressModel = selfMentionAddressArray![indexPath.row]
             return cell
         default:
             return UICollectionViewCell()

+ 40 - 22
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/ViewController/SelfRecommendationViewController.swift

@@ -9,34 +9,27 @@
 import UIKit
 
 class SelfRecommendationViewController: BaseViewController {
-    
+
     /// 纬度
-    var latitude : String = "34.20840377740726"
+    var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
     /// 经度
-    var longitude : String = "108.96265686107972"
+    var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
+    
+    var selfMentionAddressListModel : SelfMentionAddressListModel?
+    
+    var selfMentionAddressArray = Array<SelfMentionAddressModel>()
+    
     
     override func viewDidLoad() {
         super.viewDidLoad()
         navigationBar.title = "自提点推荐"
         setupViews()
         setupLayouts()
-        let loacationModel = LocationModel.shared().getLocationModel()
-        longitude = loacationModel!.longitude
-        latitude = loacationModel!.latitude
-        setupData(longitude: longitude , latitude: latitude, page: 1)
+        setupData()
     }
     
     override func setupViews() {
         view.addSubview(selfRecommendationView)
-        selfRecommendationView.collectionView.addHeaderWithHeader(withBeginRefresh: false, animation: true) {
-            [weak self] (pageIndex) in
-            self?.setupData(longitude: (self?.longitude)!, latitude: (self?.latitude)!, page: pageIndex)
-
-        }
-        selfRecommendationView.collectionView.addFooterWithWithHeader(withAutomaticallyRefresh: true) {
-            [weak self] (pageIndex) in
-            self?.setupData(longitude: (self?.longitude)!, latitude: (self?.latitude)!, page: pageIndex)
-        }
     }
     
     override func setupLayouts() {
@@ -46,10 +39,14 @@ class SelfRecommendationViewController: BaseViewController {
         }
     }
     
-    func setupData(longitude:String,latitude:String,page:Int) {
-        SwiftMoyaNetWorkServiceConfig.shared().configPickupNodeIndexApi(longitude: longitude, latitude: latitude,page: page) {
-            [weak self] (data) -> (Void) in
-            self?.selfRecommendationView.collectionView.reloadData()
+    override func setupData() {
+        self.selfRecommendationView.collectionView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
+            [weak self] (page) in
+            self?.configPickupNodeIndexApi( page: page)
+        }
+        self.selfRecommendationView.collectionView.addFooterWithWithHeader(withAutomaticallyRefresh: true) {
+             [weak self] (page) in
+            self?.configPickupNodeIndexApi(page:page)
         }
     }
     
@@ -85,12 +82,33 @@ class SelfRecommendationViewController: BaseViewController {
             vc.didSelectBlock = {
                 [weak self] (latitude:String,longitude:String,address:String) in
                 selfRecommendationView.locationAddress = address
-                
-                self?.setupData(longitude: longitude, latitude: latitude, page: 1)
+                self?.latitude = latitude
+                self?.longitude = longitude
+                self?.configPickupNodeIndexApi(page:1)
             }
             self?.navigationController?.pushViewController(vc, animated: true)
             
         }
         return selfRecommendationView
     }()
+    
+    
+    /// 加载数据
+    ///
+    /// - Parameter page: 分页
+    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{
+                    self?.selfMentionAddressArray.removeAll()
+                }
+                self?.selfMentionAddressArray = (self?.selfMentionAddressArray)! + (self?.selfMentionAddressListModel?.data!)!
+                self?.selfRecommendationView.selfMentionAddressArray = self?.selfMentionAddressArray
+            }else {
+                self?.selfRecommendationView.collectionView.endFooterNoMoreData()
+            }
+        }
+    }
 }

+ 205 - 0
RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/Model/ProvinceCityAreaModel.swift

@@ -0,0 +1,205 @@
+//
+//	ProvinceCityAreaModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class ProvinceCityAreaModel : NSObject, NSCoding, Mappable{
+
+	var province : [Province]?
+
+	class func newInstance(map: Map) -> Mappable?{
+		return ProvinceCityAreaModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		province <- map["province"]
+		
+	}
+
+    /**
+    * NSCoding required initializer.
+    * Fills the data from the passed decoder
+    */
+    @objc required init(coder aDecoder: NSCoder)
+	{
+         province = aDecoder.decodeObject(forKey: "province") as? [Province]
+
+	}
+
+    /**
+    * NSCoding required method.
+    * Encodes mode properties into the decoder
+    */
+    @objc func encode(with aCoder: NSCoder)
+	{
+		if province != nil{
+			aCoder.encode(province, forKey: "province")
+		}
+
+	}
+
+}
+
+class Province : NSObject, NSCoding, Mappable{
+    
+    var areaCode : String?
+    var areaName : String?
+    var isSelected : String?
+    var city : [City]?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return Province()
+    }
+    required init?(map: Map){}
+    override init(){}
+    
+    func mapping(map: Map)
+    {
+        areaCode <- map["area_code"]
+        areaName <- map["area_name"]
+        city <- map["city"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        areaCode = aDecoder.decodeObject(forKey: "area_code") as? String
+        areaName = aDecoder.decodeObject(forKey: "area_name") as? String
+        city = aDecoder.decodeObject(forKey: "city") as? [City]
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if areaCode != nil{
+            aCoder.encode(areaCode, forKey: "area_code")
+        }
+        if areaName != nil{
+            aCoder.encode(areaName, forKey: "area_name")
+        }
+        if city != nil{
+            aCoder.encode(city, forKey: "city")
+        }
+        
+    }
+    
+}
+
+
+class City : NSObject, NSCoding, Mappable{
+    
+    var area : [Area]?
+    var areaCode : String?
+    var areaName : String?
+    var isSelected : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return City()
+    }
+    required init?(map: Map){}
+    override init(){}
+    
+    func mapping(map: Map)
+    {
+        area <- map["area"]
+        areaCode <- map["area_code"]
+        areaName <- map["area_name"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        area = aDecoder.decodeObject(forKey: "area") as? [Area]
+        areaCode = aDecoder.decodeObject(forKey: "area_code") as? String
+        areaName = aDecoder.decodeObject(forKey: "area_name") as? String
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if area != nil{
+            aCoder.encode(area, forKey: "area")
+        }
+        if areaCode != nil{
+            aCoder.encode(areaCode, forKey: "area_code")
+        }
+        if areaName != nil{
+            aCoder.encode(areaName, forKey: "area_name")
+        }
+        
+    }
+    
+}
+
+class Area : NSObject, NSCoding, Mappable{
+    
+    var areaCode : String?
+    var areaName : String?
+    var isSelected : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return Area()
+    }
+    required init?(map: Map){}
+    override init(){}
+    
+    func mapping(map: Map)
+    {
+        areaCode <- map["area_code"]
+        areaName <- map["area_name"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        areaCode = aDecoder.decodeObject(forKey: "area_code") as? String
+        areaName = aDecoder.decodeObject(forKey: "area_name") as? String
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if areaCode != nil{
+            aCoder.encode(areaCode, forKey: "area_code")
+        }
+        if areaName != nil{
+            aCoder.encode(areaName, forKey: "area_name")
+        }
+        
+    }
+    
+}
+

+ 85 - 0
RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/View/ProvinceCityAreaTableViewCell.swift

@@ -0,0 +1,85 @@
+//
+//  ProvinceCityAreaTableViewCell.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/4/28.
+//  Copyright © 2019 南鑫林. All rights reserved.
+//
+
+import UIKit
+
+class ProvinceCityAreaTableViewCell: UITableViewCell {
+    
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ProvinceCityAreaTableViewCell {
+        let ID = "ProvinceCityAreaTableViewCell"
+        tableView.register(ProvinceCityAreaTableViewCell.self, forCellReuseIdentifier: ID)
+        let cell : ProvinceCityAreaTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ProvinceCityAreaTableViewCell
+        cell.indexPath = indexPath
+        return cell
+    }
+    
+    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+        super.init(style: style, reuseIdentifier: reuseIdentifier)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    var indexPath: IndexPath? {
+        didSet {
+            
+        }
+    }
+    //MRAK: - 设置View
+    private func setupViews() {
+        self.selectionStyle = .none
+        addSubview(titleLable)
+    }
+    
+    private func setupLayouts() {
+        titleLable.snp.makeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.left.equalTo(14)
+        }
+    }
+    
+    private lazy var titleLable: UILabel = {
+        let titleLable = UILabel()
+        titleLable.textColor = k333333Color
+        titleLable.font = kRegularFont16
+        return titleLable
+    }()
+    
+    var province : Province? {
+        didSet {
+            titleLable.text = province?.areaName
+        }
+    }
+    
+    var city : City? {
+        didSet {
+            titleLable.text = city?.areaName
+        }
+    }
+    
+    var area : Area? {
+        didSet {
+            titleLable.text = area?.areaName
+        }
+    }
+    
+    var selectedIndexPath : IndexPath? {
+        didSet {
+            if selectedIndexPath == indexPath {
+                titleLable.textColor = kFFA42FColor
+            }else {
+                titleLable.textColor = k333333Color
+            }
+        }
+    }
+    
+
+}

+ 382 - 0
RainbowPlanet/RainbowPlanet/Modules/CommonModules/ProvinceCityAreaModules/ProvinceCityArea/View/ProvinceCityAreaView.swift

@@ -0,0 +1,382 @@
+//
+//  ProvinceCityAreaView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/4/28.
+//  Copyright © 2019 南鑫林. All rights reserved.
+//
+
+import UIKit
+import FWPopupView
+import RxSwift
+import RxCocoa
+
+class ProvinceCityAreaView: FWPopupView {
+
+    typealias SureClosure = (_ province :Province ,_ city : City ,_ area :Area) -> Void
+    var sureClosure : SureClosure?
+    
+    let disposeBag = DisposeBag()
+    //判断是滚动还是点击
+    var isClick: Bool = false
+    var provinceCityAreaModel : ProvinceCityAreaModel?
+    //tableViewArray
+    var tableViewArray : NSMutableArray = NSMutableArray()
+    // button数组
+    var titleBtns : NSMutableArray = NSMutableArray()
+    // 标题数组
+    var titleMarr : NSMutableArray = NSMutableArray()
+    //这个属性如果是新增地址的时候设置成false
+    var isChangeAddress :Bool = true
+    //确定在更改地址的时候能滚到对应的位置请求到下一级
+    var scroolToRow = 0
+    
+    var province :Province?
+    var city :City?
+    var area :Area?
+    
+    var oneTableViewSelectedindexPath : IndexPath?
+    
+    var twoTableViewSelectedindexPath : IndexPath?
+    
+    var threeTableViewSelectedindexPath : IndexPath?
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        
+        self.backgroundColor = UIColor.white
+        setupData()
+        setupViews()
+        setupLayouts()
+        addTableViewAndTitle(tableViewTag: 0)
+        setupAllTitle(selectId: 0)
+    }
+    
+    required public init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupData() {
+        let jsonStr = String.jsonFileToJsonStr(resource: "province_city_area", type: "json")
+        provinceCityAreaModel = ProvinceCityAreaModel.init(JSONString: jsonStr)
+    }
+    
+    func setupViews() {
+        
+        addSubview(topBgView)
+        topBgView.addSubview(topLineView)
+        topBgView.addSubview(sureButton)
+        topBgView.addSubview(titleScrollView)
+        addSubview(contentScrollView)
+
+    }
+    
+    func setupLayouts() {
+        topBgView.snp.makeConstraints { (make) in
+            make.top.left.right.equalToSuperview()
+            make.height.equalTo(50)
+        }
+        topLineView.snp.makeConstraints { (make) in
+            make.bottom.left.right.equalToSuperview()
+            make.height.equalTo(0.5)
+        }
+        sureButton.snp.makeConstraints { (make) in
+            make.top.bottom.right.equalToSuperview()
+            make.width.equalTo(50)
+        }
+        titleScrollView.snp.makeConstraints { (make) in
+            make.top.left.equalToSuperview()
+            make.bottom.equalTo(topLineView.snp.top)
+            make.right.equalTo(sureButton.snp.left)
+        }
+        contentScrollView.snp.makeConstraints { (make) in
+            make.top.equalTo(topBgView.snp.bottom)
+            make.left.right.bottom.equalToSuperview()
+        }
+    }
+    
+    private lazy var topBgView : UIView = {
+        let topBgView = UIView()
+        return topBgView
+    }()
+    private lazy var topLineView : UILabel = {
+        let topLineView = UILabel()
+        topLineView.backgroundColor = kD2D3D5Color
+        return topLineView
+    }()
+    
+    private lazy var sureButton : UIButton = {
+        let sureButton = UIButton(type: UIButton.ButtonType.custom)
+        sureButton.setTitle( "确定", for: UIControl.State.normal)
+        sureButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+        sureButton.titleLabel?.font = kRegularFont15
+        sureButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+            if let sureClosure = self?.sureClosure {
+                sureClosure(self?.province ?? Province(),self?.city ?? City(),self!.area ?? Area())
+            }
+        }).disposed(by: disposeBag)
+        return sureButton
+    }()
+    
+    private lazy var titleScrollView :UIScrollView =  {
+        let titleScrollView = UIScrollView()
+        return titleScrollView
+    }()
+    
+    private lazy var contentScrollView :UIScrollView =  {
+        let contentScrollView = UIScrollView()
+        contentScrollView.delegate = self
+        contentScrollView.isPagingEnabled = true
+        contentScrollView.bounces = false
+        return contentScrollView
+    }()
+    
+    private lazy var lineLabel: UILabel = {
+        let lineLabel = UILabel()
+        return lineLabel
+    }()
+    
+    private lazy var radioBtn : UIButton = {
+        let radioBtn = UIButton(type: UIButton.ButtonType.custom)
+        return radioBtn
+    }()
+}
+
+extension ProvinceCityAreaView {
+    
+    
+    //添加tableView和title
+    func addTableViewAndTitle(tableViewTag: NSInteger){
+        let tableView:UITableView = UITableView.init(frame: CGRect.init(x: 0, y: 0, width: kScreenWidth, height: 290 + kSafeTabBarHeight), style: UITableView.Style.plain)
+        tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+        tableView.tag = tableViewTag
+        self.tableViewArray.add(tableView)
+        self.titleMarr.add("请选择")
+    }
+    
+    //设置所有title
+    func setupAllTitle(selectId: Int) {
+        for view in titleScrollView.subviews {
+            view.removeFromSuperview()
+        }
+        self.titleBtns.removeAllObjects()
+        lineLabel.backgroundColor = kFFA42FColor
+        titleScrollView.addSubview(lineLabel)
+        let btnH :CGFloat = 50
+        var x : CGFloat = 10
+        
+        for i in 0 ..< self.titleMarr.count {
+            let title : String = (titleMarr[i] as? String)!
+            let titlelenth : CGFloat = CGFloat(title.count * 15)
+            let titleBtn :UIButton = UIButton.init(type:.custom)
+            titleBtn.setTitle(title, for: UIControlState.normal)
+            titleBtn.tag = i
+            titleBtn.setTitleColor(k333333Color, for: UIControlState.normal)
+            titleBtn.setTitleColor(kFFA42FColor, for: UIControlState.selected)
+            titleBtn.isSelected = false
+            titleBtn.titleLabel?.font = kRegularFont15
+            titleBtn.frame = CGRect.init(x: x, y: 0, width: titlelenth, height: btnH)
+            x  = (titlelenth + 10) + x
+            titleBtn.addTarget(self, action: #selector(titleBtnClick), for: UIControlEvents.touchUpInside)
+            self.titleBtns.add(titleBtn)
+            if i == selectId {
+                titleBtnClick(titleBtn: titleBtn)
+            }
+            titleScrollView.addSubview(titleBtn)
+            titleScrollView.contentSize = CGSize.init(width: x, height: 0)
+            titleScrollView.showsHorizontalScrollIndicator = false;
+            contentScrollView.contentSize = CGSize.init(width: CGFloat(self.titleMarr.count) * kScreenWidth, height: 0)
+            contentScrollView.showsHorizontalScrollIndicator = false;
+        }
+    }
+    
+    @objc func titleBtnClick(titleBtn: UIButton)  {
+        radioBtn.isSelected = false
+        titleBtn.isSelected = true
+        setupOneTableView(btnTag :titleBtn.tag)
+        let x :CGFloat  = CGFloat(titleBtn.tag) * kScreenWidth
+        lineLabel.frame = CGRect.init(x: titleBtn.frame.minX, y: 50 - 3, width: titleBtn.frame.size.width, height: 3)
+        UIView.animate(withDuration: 0.25) {
+            self.contentScrollView.contentOffset = CGPoint.init(x: x, y: 0)
+        }
+        radioBtn = titleBtn
+        isClick = true
+    }
+    
+    
+    func setupOneTableView(btnTag: Int){
+        let contentView : UITableView = self.tableViewArray[btnTag] as! UITableView
+        if btnTag == 0 {
+            self.getAddressMessageData(addressID: 1, provinceIdOrCityId: 0)
+        }
+        if (contentView.superview != nil) {
+            return
+        }
+        let x : CGFloat = CGFloat(btnTag) * kScreenWidth
+        contentView.frame = CGRect.init(x: x, y: 0, width: kScreenWidth, height: 290+kSafeTabBarHeight)
+        contentView.delegate = self
+        contentView.dataSource = self
+        self.contentScrollView.addSubview(contentView)
+    }
+    
+    func getAddressMessageData(addressID: NSInteger, provinceIdOrCityId: NSInteger){
+        
+        if self.tableViewArray.count >= addressID{
+            let tableView1: UITableView  = self.tableViewArray[addressID - 1] as! UITableView
+            tableView1.reloadData()
+            if self.isChangeAddress == true{
+                //保证列表刷新之后才进行滚动处理
+                DispatchQueue.main.async {
+                    tableView1.scrollToRow(at: NSIndexPath.init(row: self.scroolToRow, section: 0) as IndexPath, at: UITableView.ScrollPosition.bottom, animated: false)
+                }
+            }
+        }
+    }
+    
+    func changeRefreshTitle(titleTag: NSInteger){
+        if (self.tableViewArray.count >= titleTag + 1){
+            self.changeTitle(replaceTitleMarrIndex: titleTag)
+        }
+        else{
+            self.addTableViewAndTitle(tableViewTag: titleTag)
+        }
+        self.setupAllTitle(selectId: titleTag)
+    }
+    
+    //改变title
+    func changeTitle(replaceTitleMarrIndex:NSInteger){
+        self.titleMarr.replaceObject(at: replaceTitleMarrIndex, with: "请选择")
+        let index :NSInteger = self.titleMarr.index(of: "请选择")
+        let count:NSInteger = self.titleMarr.count
+        let loc: NSInteger = index + 1
+        let range:NSInteger = count - index
+        self.titleMarr.removeObjects(in: NSRange.init(location: loc, length: range - 1))
+        self.tableViewArray.removeObjects(in: NSRange.init(location: loc, length: range - 1))
+    }
+    
+    //移除多余的title和tableView,收回选择器
+    func removeTitleAndTableViewCancel(index:NSInteger){
+        let indexsubOne:NSInteger = index - 1
+        if (self.tableViewArray.count >= index){
+            self.titleMarr.removeObjects(in: NSRange.init(location: index, length: self.titleMarr.count - index))
+            self.tableViewArray.removeObjects(in: NSRange.init(location: index, length: self.tableViewArray.count - index))
+        }
+        self.setupAllTitle(selectId: indexsubOne)
+        if isChangeAddress == false{
+//            self.tapBtnAndcancelBtnClick()
+        }
+        else{
+            isChangeAddress = false
+        }
+    }
+}
+
+extension ProvinceCityAreaView : UIScrollViewDelegate {
+    
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        let leftI :NSInteger  = NSInteger(scrollView.contentOffset.x / kScreenWidth);
+        if CGFloat(scrollView.contentOffset.x / kScreenWidth) != CGFloat(leftI){
+            isClick = false
+        }
+        if isClick == false {
+            if CGFloat(scrollView.contentOffset.x / kScreenWidth) == CGFloat(leftI)  {
+                let titleBtn :UIButton  = titleBtns[leftI] as! UIButton
+                titleBtnClick(titleBtn: titleBtn)
+            }
+        }
+    }
+}
+
+extension ProvinceCityAreaView:UITableViewDelegate,UITableViewDataSource{
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 1
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        if tableView.tag == 0 {
+            return self.provinceCityAreaModel?.province?.isEmpty ?? true ? 0 : self.provinceCityAreaModel?.province?.count ?? 0
+        } else if tableView.tag == 1 {
+            return  self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city?.isEmpty ?? true ? 0 : self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city?.count ?? 0
+        } else if tableView.tag == 2{
+            return self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city?[(twoTableViewSelectedindexPath?.row)!].area?.isEmpty ?? true ? 0 : self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city?[(twoTableViewSelectedindexPath?.row)!].area?.count ?? 0
+        }else{
+            return 0
+        }
+    }
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+
+        let cell = ProvinceCityAreaTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+        if tableView.tag == 0 {
+            cell.province = self.provinceCityAreaModel?.province![indexPath.row]
+            cell.selectedIndexPath = self.oneTableViewSelectedindexPath
+        } else if tableView.tag == 1 {
+            cell.city = self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city![indexPath.row]
+            cell.selectedIndexPath = self.twoTableViewSelectedindexPath
+        } else if tableView.tag == 2{
+            cell.area = self.provinceCityAreaModel?.province?[(oneTableViewSelectedindexPath?.row)!].city?[(twoTableViewSelectedindexPath?.row)!].area![indexPath.row]
+            cell.selectedIndexPath = self.threeTableViewSelectedindexPath
+
+        }
+        return cell
+    }
+    
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        let cell = tableView.cellForRow(at: indexPath) as! ProvinceCityAreaTableViewCell
+        if tableView.tag == 0 {
+            self.oneTableViewSelectedindexPath = indexPath
+            self.twoTableViewSelectedindexPath  = nil
+            self.threeTableViewSelectedindexPath  = nil
+            //2.修改标题
+            self.titleMarr.replaceObject(at: tableView.tag, with: cell.province?.areaName ?? "")
+            self.province = cell.province
+            self.city = nil
+            self.area = nil
+            
+            if !(cell.province?.city?.isEmpty ?? true) {
+                //添加市区
+                changeRefreshTitle(titleTag: 1)
+                self.getAddressMessageData(addressID: 2 ,provinceIdOrCityId: 0)
+            }else {
+                if self.tableViewArray.count == 3 {
+                    self.removeTitleAndTableViewCancel(index: 2)
+                    self.removeTitleAndTableViewCancel(index: 1)
+                }else if self.tableViewArray.count == 2 {
+                    self.removeTitleAndTableViewCancel(index: 1)
+                }
+                self.setupAllTitle(selectId: 0)
+            }
+            
+        } else if tableView.tag == 1 {
+            self.twoTableViewSelectedindexPath = indexPath
+            self.threeTableViewSelectedindexPath  = nil
+            //2.修改标题
+            self.titleMarr.replaceObject(at: tableView.tag, with: cell.city?.areaName ?? "")
+            self.city = cell.city
+            self.area = nil
+            
+            if !(cell.city?.area?.isEmpty ?? true) {
+                //添加县
+                 changeRefreshTitle(titleTag: 2)
+                self.getAddressMessageData(addressID: 3 ,provinceIdOrCityId: 0)
+            }else {
+                self.setupAllTitle(selectId: 1)
+            }
+            
+        } else if tableView.tag == 2{
+            self.threeTableViewSelectedindexPath = indexPath
+            //2.修改标题
+            self.titleMarr.replaceObject(at: tableView.tag, with: cell.area?.areaName ?? "")
+            self.area = cell.area
+            setupAllTitle(selectId: tableView.tag)
+        }
+        
+        //先刷新当前选中的tableView
+        let tableView: UITableView  = self.tableViewArray[tableView.tag] as! UITableView
+        tableView.reloadData()
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return 44
+    }
+    
+}

+ 34 - 5
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerExpressTableViewCell.swift

@@ -57,7 +57,7 @@ class AddressManagerExpressTableViewCell: UITableViewCell {
             make.height.equalTo(20)
         }
         
-        addressLabel.snp.makeConstraints { (make) in
+        addressLabel.snp.remakeConstraints { (make) in
             make.top.equalTo(nameLabel.snp.bottom).offset(5)
             make.left.equalTo(92)
             make.right.equalTo(-14)
@@ -66,7 +66,7 @@ class AddressManagerExpressTableViewCell: UITableViewCell {
         
         defalutLabel.snp.makeConstraints { (make) in
             make.left.equalTo(nameLabel)
-            make.top.equalTo(addressLabel)
+            make.top.equalTo(addressLabel).offset(2)
             make.width.equalTo(36)
             make.height.equalTo(17)
         }
@@ -86,7 +86,6 @@ class AddressManagerExpressTableViewCell: UITableViewCell {
     
     private lazy var nameLabel: UILabel = {
         let nameLabel = UILabel()
-        nameLabel.text = "姓名"
         nameLabel.textColor = k333333Color
         nameLabel.font = kMediumFont16
         return nameLabel
@@ -94,7 +93,6 @@ class AddressManagerExpressTableViewCell: UITableViewCell {
     
     private lazy var moblieLabel: UILabel = {
         let moblieLabel = UILabel()
-        moblieLabel.text = "18392056542"
         moblieLabel.textColor = k999999Color
         moblieLabel.font = kRegularFont14
         return moblieLabel
@@ -134,6 +132,37 @@ class AddressManagerExpressTableViewCell: UITableViewCell {
         return lineLabel
     }()
     
+    var expressAddresModel: ExpressAddresModel? {
+        didSet {
+            nameLabel.text = expressAddresModel?.contactName 
+            moblieLabel.text = expressAddresModel?.contactMobile
+            let provinceName = expressAddresModel!.provinceName
+            let cityName = expressAddresModel!.cityName
+            let areaName = expressAddresModel!.areaName
+            let address = expressAddresModel!.address
+            
+            addressLabel.text = "\(String(describing: provinceName ??  ""))\(String(describing: cityName ?? ""))\(String(describing: areaName ?? ""))\(String(describing: address ?? ""))"
+            if expressAddresModel!.isDefault == 1 {
+                selectedButton.isSelected = true
+                defalutLabel.isHidden = false
+                addressLabel.snp.remakeConstraints { (make) in
+                    make.top.equalTo(nameLabel.snp.bottom).offset(5)
+                    make.left.equalTo(92)
+                    make.right.equalTo(-14)
+                    make.bottom.equalTo(-15)
+                }
+            }else {
+                selectedButton.isSelected = false
+                defalutLabel.isHidden = true
+                addressLabel.snp.remakeConstraints { (make) in
+                    make.top.equalTo(nameLabel.snp.bottom).offset(5)
+                    make.left.equalTo(52)
+                    make.right.equalTo(-14)
+                    make.bottom.equalTo(-15)
+                }
+            }
+            
+        }
+    }
     
-
 }

+ 42 - 7
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/View/AddressManagerView.swift

@@ -18,7 +18,7 @@ class AddressManagerView: BaseView {
     
     var addressManagerListModel : AddressManagerListModel? {
         didSet {
-            
+            tableView.reloadData()
         }
     }
     
@@ -38,7 +38,7 @@ class AddressManagerView: BaseView {
         }
     }
     
-    private lazy var tableView: UITableView = {
+    lazy var tableView: UITableView = {
         let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
         tableView.backgroundColor = kf7f8faColor
         tableView.delegate = self
@@ -59,14 +59,49 @@ extension AddressManagerView: UITableViewDelegate,UITableViewDataSource {
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return 1
+        switch section {
+        case 0:
+            if addressManagerListModel?.selfAddress?.isEmpty ?? true {
+                 return 1
+            }else {
+                return (addressManagerListModel?.selfAddress!.count)!
+            }
+           
+        case 1:
+            if addressManagerListModel?.expressAddress?.isEmpty ?? true {
+                return 1
+            }else {
+                return (addressManagerListModel?.expressAddress!.count)!
+            }
+        default:
+            return 0
+        }
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        let cell = AddressManagerExpressTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-//        cell.addAddresses = addAddresses[indexPath.section]
-        return cell
-        
+        switch indexPath.section {
+        case 0:
+            if addressManagerListModel?.selfAddress?.isEmpty ?? true {
+                let cell = AddressManagerAddTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                    cell.addAddresses = addAddresses[indexPath.section]
+                return cell
+            }else {
+                let cell = AddressManagerSelfMentionTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                return cell
+            }
+        case 1:
+            if addressManagerListModel?.expressAddress?.isEmpty ?? true {
+                let cell = AddressManagerAddTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.addAddresses = addAddresses[indexPath.section]
+                return cell
+            }else {
+                let cell = AddressManagerExpressTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.expressAddresModel = addressManagerListModel?.expressAddress![indexPath.row]
+                return cell
+            }
+        default:
+            return UITableViewCell()
+        }
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

+ 77 - 3
RainbowPlanet/RainbowPlanet/Modules/MineModule/AddressManager/ViewController/AddressManagerViewController.swift

@@ -8,8 +8,15 @@
 
 import UIKit
 
+enum AddressManagerVCType {
+    case mine
+}
+
 class AddressManagerViewController: BaseViewController {
     
+    var addressManagerVCType : AddressManagerVCType = .mine
+    var addressManagerListModel : AddressManagerListModel?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -29,9 +36,11 @@ class AddressManagerViewController: BaseViewController {
         }
     }
     
-    func setupData() {
-        SwiftMoyaNetWorkServiceUser.shared().userSelfAndExpressAddressListApi(type: 0) { (addressManagerListModel) -> (Void) in
-            
+    override func setupData() {
+        self.userSelfAndExpressAddressListApi()
+        addressManagerView.tableView.addHeaderWithHeader(withBeginRefresh: false, animation: true) {
+            [weak self](page) in
+            self?.userSelfAndExpressAddressListApi()
         }
     }
     
@@ -51,7 +60,72 @@ class AddressManagerViewController: BaseViewController {
                 break
             }
         }
+        addressManagerView.didSelectRowClosure = {
+            [weak self] indexPath in
+            switch indexPath.section {
+            case 0:
+                self?.didSelectSelfMentionAddress()
+                break
+            case 1:
+                self?.didSelectExpressAddress()
+                break
+            default:
+                break
+            }
+        }
         return addressManagerView
     }()
+    
+    
+    /// 选择自提地址
+    func didSelectSelfMentionAddress() {
+        if self.addressManagerListModel?.selfAddress?.isEmpty ?? true {
+           let vc = EditSelfMentionAddressViewController()
+           self.navigationController?.pushViewController(vc, animated: true)
+        }else {
+            if self.addressManagerVCType == .mine {
+                let vc = EditSelfMentionAddressViewController()
+                self.navigationController?.pushViewController(vc, animated: true)
+            }else {
+                self.userAddressIsDefaultApi()
+            }
+        }
+    }
+    
+    
+    /// 选择快递地址
+    func didSelectExpressAddress() {
+        if self.addressManagerListModel?.expressAddress?.isEmpty ?? true {
+            let vc = EditExpressAddressViewController()
+            self.navigationController?.pushViewController(vc, animated: true)
+        }else {
+            if self.addressManagerVCType == .mine {
+                let vc = EditExpressAddressViewController()
+                self.navigationController?.pushViewController(vc, animated: true)
+            }else {
+                self.userAddressIsDefaultApi()
+            }
+        }
+    }
+    
+    
+    /// 获取地址列表
+    func userSelfAndExpressAddressListApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userSelfAndExpressAddressListApi(type: 0) {
+            
+            [weak self] (addressManagerListModel) -> (Void) in
+            self?.addressManagerListModel = (addressManagerListModel as! AddressManagerListModel)
+            self?.addressManagerView.addressManagerListModel = self?.addressManagerListModel
+            
+        }
+    }
+    
+    
+    /// 设置默认跳转
+    func userAddressIsDefaultApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userAddressIsDefaultApi(id: "") { (data) -> (Void) in
+            
+        }
+    }
 
 }

+ 31 - 4
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditExpressAddress/View/EditExpressAddressView.swift

@@ -10,13 +10,33 @@ import UIKit
 
 class EditExpressAddressView: BaseView {
 
-    let titles = [["收货人","联系电话","所在地区","详细地址"],["设置为自提收货人"]]
+    let titles = [["收货人","联系电话","所在地区","详细地址"]]
     
     let placeholderTitles = ["姓名","收件人电话号码","省份、城市、区县","如道路、门牌号、小区、楼栋号等"]
     
+    var expressAddresModel: ExpressAddresModel? {
+        didSet {
+            tableView.reloadData()
+        }
+    }
+    
+    var editExpressAddressVCType :EditExpressAddressVCType? {
+        didSet {
+            if editExpressAddressVCType == .new {
+                tableView.tableFooterView = nil
+            }else if editExpressAddressVCType == .update {
+                tableView.tableFooterView = editAddressFooterView
+            }
+            tableView.reloadData()
+        }
+    }
+    
     typealias DidSelectRowClosure = (_ indexPath: IndexPath) -> Void
     var didSelectRowClosure : DidSelectRowClosure?
     
+    typealias DeleteClosure = () -> Void
+    var deleteClosure : DeleteClosure?
+    
     override func setupViews() {
         addSubview(tableView)
     }
@@ -34,13 +54,18 @@ class EditExpressAddressView: BaseView {
         tableView.dataSource = self
         tableView.separatorStyle = .none
         tableView.rowHeight = 48
-        tableView.tableFooterView = editAddressFooterView
+       
         return tableView
     }()
     private lazy var editAddressFooterView: EditAddressFooterView = {
         let editAddressFooterView = EditAddressFooterView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 44))
         editAddressFooterView.title = "删除该地址"
-
+        editAddressFooterView.deleteClosure = {
+            [weak self] in
+            if let deleteClosure = self?.deleteClosure {
+                deleteClosure()
+            }
+        }
         return editAddressFooterView
     }()
 }
@@ -64,6 +89,9 @@ extension EditExpressAddressView: UITableViewDelegate,UITableViewDataSource {
             let cell = EditAddressTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             cell.titles = titles[indexPath.section]
             cell.placeholderTitles = placeholderTitles
+            if let expressAddresModel = expressAddresModel {
+                 cell.expressAddresModel = expressAddresModel
+            }
             return cell
         default:
             let cell = EditSetDefaultTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
@@ -71,7 +99,6 @@ extension EditExpressAddressView: UITableViewDelegate,UITableViewDataSource {
             return cell
         }
         
-        
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

+ 50 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditExpressAddress/ViewController/EditExpressAddressViewController.swift

@@ -8,8 +8,25 @@
 
 import UIKit
 
+
+/// 控制器类型
+///
+/// - new: 新建
+/// - change: 修改
+enum EditExpressAddressVCType {
+    case new
+    case update
+}
+
 class EditExpressAddressViewController: BaseViewController {
 
+    
+    typealias UpAddressListClosure = () -> Void
+    var upAddressListClosure : UpAddressListClosure?
+    
+    var expressAddresModel: ExpressAddresModel?
+    var editExpressAddressVCType :EditExpressAddressVCType? = .new
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -20,7 +37,8 @@ class EditExpressAddressViewController: BaseViewController {
         navigationBar.title = "编辑收货地址"
         navigationBar.wr_setRightButton(title: "保存", titleColor: k333333Color)
         navigationBar.onClickRightButton = {
-            
+            [weak self] in
+            self?.userAddExpressAddress()
         }
         view.addSubview(editExpressAddressView)
     }
@@ -34,7 +52,37 @@ class EditExpressAddressViewController: BaseViewController {
     
     private lazy var editExpressAddressView: EditExpressAddressView = {
         let editExpressAddressView = EditExpressAddressView()
+        editExpressAddressView.expressAddresModel = expressAddresModel
+        editExpressAddressView.editExpressAddressVCType = editExpressAddressVCType
+        editExpressAddressView.deleteClosure = {
+            [weak self] in
+            self?.userAddressDelete()
+        }
         return editExpressAddressView
     }()
-
+    
+     /// 添加保存地址
+    func userAddExpressAddress() {
+        
+        var id : Int = 0
+        if let expressAddresModel = expressAddresModel {
+            id = expressAddresModel.pickupNodeId ?? 0
+        }
+        
+        SwiftMoyaNetWorkServiceUser.shared().userAddExpressAddressApi( id:id,contactName: "南鑫林", contactMobile: "18392056542", provinceId: "86610000", provinceName: "陕西省", cityId: "86610100", cityName: "西安市", areaId: "86610113", areaName: "雁塔区", address: "abcedfghrijhtuvwxyz打飞机撒;") { (data) -> (Void) in
+            
+        }
+    }
+    
+    
+    /// 删除地址
+    func userAddressDelete() {
+        SwiftMoyaNetWorkServiceUser.shared().userAddressDeleteApi(id: expressAddresModel?.id ?? 0) {
+            [weak self] (data) -> (Void) in
+            if let upAddressListClosure = self?.upAddressListClosure {
+                upAddressListClosure()
+            }
+            self?.navigationController?.popViewController(animated: true)
+        }
+    }
 }

+ 9 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressFooterView.swift

@@ -10,6 +10,9 @@ import UIKit
 
 class EditAddressFooterView: BaseView {
     
+    typealias DeleteClosure = () -> Void
+    var deleteClosure: DeleteClosure?
+    
     override func setupViews() {
         addSubview(deleteButton)
     }
@@ -28,6 +31,12 @@ class EditAddressFooterView: BaseView {
         deleteButton.setImage(kImage(name: "my_address_delete"), for: UIControl.State.normal)
         deleteButton.setTitleColor(k999999Color, for: UIControl.State.normal)
         deleteButton.titleLabel?.font = kRegularFont14
+        deleteButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            if let deleteClosure = self?.deleteClosure {
+                deleteClosure()
+            }
+        }).disposed(by: disposeBag)
         return deleteButton
     }()
     

+ 22 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/View/EditAddressTableViewCell.swift

@@ -92,6 +92,26 @@ class EditAddressTableViewCell: UITableViewCell {
         }
     }
     
-    
-
+    var expressAddresModel: ExpressAddresModel? {
+        didSet {
+            switch indexPath?.row {
+            case 0:
+                editTextField.text = expressAddresModel?.contactName
+                break
+            case 1:
+                editTextField.text = expressAddresModel?.contactMobile
+                break
+            case 2:
+                let provinceName = expressAddresModel!.provinceName
+                let cityName = expressAddresModel!.cityName
+                let areaName = expressAddresModel!.areaName
+                editTextField.text = "\(String(describing: provinceName ??  ""))\(String(describing: cityName ?? ""))\(String(describing: areaName ?? ""))"
+            case 3:
+                editTextField.text = expressAddresModel?.address
+                break
+            default:
+                break
+            }
+        }
+    }
 }

+ 2 - 3
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionAddress/ViewController/EditSelfMentionAddressViewController.swift

@@ -10,6 +10,8 @@ import UIKit
 
 class EditSelfMentionAddressViewController: BaseViewController {
     
+    
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -36,7 +38,4 @@ class EditSelfMentionAddressViewController: BaseViewController {
         let editSelfMentionAddressView = EditSelfMentionAddressView()
         return editSelfMentionAddressView
     }()
-    
-    
-
 }

+ 15 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/View/ExpressAddressListTableViewCell.swift

@@ -7,10 +7,12 @@
 //
 
 import UIKit
+import RxSwift
+import RxCocoa
 
 class ExpressAddressListTableViewCell: UITableViewCell {
     
-    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> UITableViewCell {
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ExpressAddressListTableViewCell {
         let ID = "ExpressAddressListTableViewCell"
         tableView.register(ExpressAddressListTableViewCell.self, forCellReuseIdentifier: ID)
         let cell : ExpressAddressListTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ExpressAddressListTableViewCell
@@ -33,6 +35,12 @@ class ExpressAddressListTableViewCell: UITableViewCell {
             
         }
     }
+    
+    let disposeBag = DisposeBag()
+    
+    typealias EditClosure = (_ indexPath: IndexPath) -> Void
+    var editClosure: EditClosure?
+    
     //MRAK: - 设置View
     private func setupViews() {
         self.selectionStyle = .none
@@ -147,6 +155,12 @@ class ExpressAddressListTableViewCell: UITableViewCell {
         editButton.setTitle("编辑", for: UIControl.State.normal)
         editButton.setTitleColor(k999999Color, for: UIControl.State.normal)
         editButton.titleLabel?.font = kRegularFont14
+        editButton.rx.tap.subscribe(onNext: {
+            [weak self] in
+            if let editClosure = self?.editClosure {
+                editClosure((self?.indexPath!)!)
+            }
+        }).disposed(by: disposeBag)
         return editButton
     }()
 

+ 17 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/View/ExpressAddressListView.swift

@@ -13,6 +13,15 @@ class ExpressAddressListView: BaseView {
     typealias DidSelectRowClosure = (_ indexPath: IndexPath) -> Void
     var didSelectRowClosure : DidSelectRowClosure?
     
+    typealias EditClosure = (_ indexPath: IndexPath) -> Void
+    var editClosure: EditClosure?
+    
+    var addressManagerListModel : AddressManagerListModel? {
+        didSet {
+            tableView.reloadData()
+        }
+    }
+    
     override func setupViews() {
         addSubview(tableView)
     }
@@ -23,7 +32,7 @@ class ExpressAddressListView: BaseView {
         }
     }
     
-    private lazy var tableView: UITableView = {
+    lazy var tableView: UITableView = {
         let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
         tableView.backgroundColor = kf7f8faColor
         tableView.delegate = self
@@ -42,11 +51,17 @@ extension ExpressAddressListView: UITableViewDelegate,UITableViewDataSource {
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return 2
+        return addressManagerListModel?.expressAddress?.isEmpty ?? true ? 0 : (addressManagerListModel?.expressAddress!.count)!
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let cell = ExpressAddressListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+        cell.editClosure = {
+            [weak self] indexPath in
+            if let editClosure = self?.editClosure {
+                editClosure(indexPath)
+            }
+        }
         return cell
         
     }

+ 39 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/ExpressAddressList/ViewController/ExpressAddressListViewController.swift

@@ -10,10 +10,14 @@ import UIKit
 
 class ExpressAddressListViewController: BaseViewController {
 
+    var addressManagerListModel : AddressManagerListModel?
+
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
         setupLayouts()
+        setupData()
     }
     
     override func setupViews() {
@@ -22,7 +26,12 @@ class ExpressAddressListViewController: BaseViewController {
         navigationBar.rightButton.titleLabel!.font = kRegularFont14
         navigationBar.onClickRightButton = {
             [weak self] in
-            self?.navigationController?.pushViewController(EditExpressAddressViewController(), animated: true)
+           let vc = EditExpressAddressViewController()
+            vc.editExpressAddressVCType = .new
+            vc.upAddressListClosure = {
+                
+            }
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         view.addSubview(expressAddressListView)
     }
@@ -34,8 +43,37 @@ class ExpressAddressListViewController: BaseViewController {
         }
     }
     
+    override func setupData() {
+        userExpressAddressListApi()
+        self.expressAddressListView.tableView.addHeaderWithHeader(withBeginRefresh: false, animation: true) {
+            [weak self](page) in
+            self?.userExpressAddressListApi()
+        }
+    }
+    
     private lazy var expressAddressListView: ExpressAddressListView = {
         let expressAddressListView = ExpressAddressListView()
+        expressAddressListView.editClosure = {
+            [weak self] indexPath in
+            let vc = EditExpressAddressViewController()
+            vc.expressAddresModel = self?.addressManagerListModel?.expressAddress![indexPath.row]
+            vc.editExpressAddressVCType = .update
+            vc.upAddressListClosure = {
+                [weak self] in
+                self?.userExpressAddressListApi()
+            }
+            self?.navigationController?.pushViewController(vc, animated: true)
+        }
         return expressAddressListView
     }()
+    
+    /// 获取地址列表
+    func userExpressAddressListApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userSelfAndExpressAddressListApi(type: 2) {
+            
+            [weak self] (addressManagerListModel) -> (Void) in
+           self?.addressManagerListModel = (addressManagerListModel as! AddressManagerListModel)
+            self?.expressAddressListView.addressManagerListModel = self?.addressManagerListModel
+        }
+    }
 }

+ 3 - 4
RainbowPlanet/RainbowPlanet/Modules/MineModule/Mine/ViewController/MineViewController.swift

@@ -66,12 +66,11 @@ class MineViewController: BaseViewController {
         }
         mineView.addressClosure = {
             [weak self] in
-            self?.navigationController?.pushViewController(AddressManagerViewController(), animated: true)
+            let vc = AddressManagerViewController()
+            vc.addressManagerVCType = .mine
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         return mineView
     }()
     
 }
-
-
-

+ 8 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionAddressList/View/SelfMentionAddressListView.swift

@@ -13,6 +13,12 @@ class SelfMentionAddressListView: BaseView {
     typealias DidSelectRowClosure = (_ indexPath: IndexPath) -> Void
     var didSelectRowClosure : DidSelectRowClosure?
     
+    var addressManagerListModel : AddressManagerListModel? {
+        didSet {
+            tableView.reloadData()
+        }
+    }
+    
     override func setupViews() {
         addSubview(tableView)
     }
@@ -42,7 +48,8 @@ extension SelfMentionAddressListView: UITableViewDelegate,UITableViewDataSource
     }
     
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return 2
+        return addressManagerListModel?.selfAddress?.isEmpty ?? true ? 0 : (addressManagerListModel?.selfAddress!.count)!
+        
     }
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

+ 15 - 0
RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionAddressList/ViewController/SelfMentionAddressListViewController.swift

@@ -14,6 +14,11 @@ class SelfMentionAddressListViewController: BaseViewController {
         super.viewDidLoad()
         setupViews()
         setupLayouts()
+        setupData()
+    }
+    
+    override func setupData() {
+        userSelfAddressListApi()
     }
     
     override func setupViews() {
@@ -38,5 +43,15 @@ class SelfMentionAddressListViewController: BaseViewController {
         let selfMentionAddressListView = SelfMentionAddressListView()
         return selfMentionAddressListView
     }()
+    
+    /// 获取自提地址列表
+    func userSelfAddressListApi() {
+        SwiftMoyaNetWorkServiceUser.shared().userSelfAndExpressAddressListApi(type: 1) {
+            
+            [weak self] (addressManagerListModel) -> (Void) in
+            self?.selfMentionAddressListView.addressManagerListModel = (addressManagerListModel as! AddressManagerListModel)
+            
+        }
+    }
 
 }

File diff suppressed because it is too large
+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/RegisterLoginModule/PhoneCountryArea/ViewController/PhoneCountryAreaViewController.swift


+ 6 - 6
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift

@@ -36,11 +36,11 @@ class ShoppingMallViewController: BaseViewController {
         let navigationBarView = ShoppingMallNavigationBarView()
         navigationBarView.searchBlock = {
             [weak self] in
-            let vc = SearchViewController()
-            let nav = BaseNavigationViewController.init(rootViewController: vc)
-            self?.present(nav, animated: true, completion: {
-                
-            })
+//            let vc = SearchViewController()
+//            let nav = BaseNavigationViewController.init(rootViewController: vc)
+//            self?.present(nav, animated: true, completion: {
+//
+//            })
         }
         return navigationBarView
     }()
@@ -49,7 +49,7 @@ class ShoppingMallViewController: BaseViewController {
          let shoppingMallView = ShoppingMallView()
         /// 分类
         shoppingMallView.categoryActionBlock = {
-
+            
         }
         return shoppingMallView
     }()

+ 1 - 1
RainbowPlanet/RainbowPlanet/Service/Model/RootModel/RootModel.swift

@@ -11,7 +11,7 @@ class RootModel : NSObject, NSCoding, Mappable{
 
     // 0成功,1失败
     var code : Int?
-    /// #数据载体,单条数据,直接获取。
+    /// 数据载体,单条数据,直接获取。
     var data : String?
     /// 提示信息
     var msg : String?

+ 147 - 3
RainbowPlanet/RainbowPlanet/Service/Model/UserModel/AddressManagerListModel.swift

@@ -8,7 +8,7 @@ import ObjectMapper
 
 class AddressManagerListModel : NSObject, NSCoding, Mappable{
 
-	var expressAddress : [AnyObject]?
+	var expressAddress : [ExpressAddresModel]?
 	var selfAddress : [AnyObject]?
 
 
@@ -31,7 +31,7 @@ class AddressManagerListModel : NSObject, NSCoding, Mappable{
     */
     @objc required init(coder aDecoder: NSCoder)
 	{
-         expressAddress = aDecoder.decodeObject(forKey: "expressAddress") as? [AnyObject]
+         expressAddress = aDecoder.decodeObject(forKey: "expressAddress") as? [ExpressAddresModel]
          selfAddress = aDecoder.decodeObject(forKey: "selfAddress") as? [AnyObject]
 
 	}
@@ -51,4 +51,148 @@ class AddressManagerListModel : NSObject, NSCoding, Mappable{
 
 	}
 
-}
+}
+
+class ExpressAddresModel : NSObject, NSCoding, 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 : String?
+    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 ExpressAddresModel()
+    }
+    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"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        address = aDecoder.decodeObject(forKey: "address") as? String
+        addressType = aDecoder.decodeObject(forKey: "address_type") as? Int
+        areaId = aDecoder.decodeObject(forKey: "area_id") as? Int
+        areaName = aDecoder.decodeObject(forKey: "area_name") as? String
+        cityId = aDecoder.decodeObject(forKey: "city_id") as? Int
+        cityName = aDecoder.decodeObject(forKey: "city_name") as? String
+        contactMobile = aDecoder.decodeObject(forKey: "contact_mobile") as? String
+        contactName = aDecoder.decodeObject(forKey: "contact_name") as? String
+        createdAt = aDecoder.decodeObject(forKey: "created_at") as? String
+        deletedAt = aDecoder.decodeObject(forKey: "deleted_at") as? String
+        id = aDecoder.decodeObject(forKey: "id") as? Int
+        isDefault = aDecoder.decodeObject(forKey: "is_default") as? Int
+        pickupNodeId = aDecoder.decodeObject(forKey: "pickup_node_id") as? Int
+        provinceId = aDecoder.decodeObject(forKey: "province_id") as? Int
+        provinceName = aDecoder.decodeObject(forKey: "province_name") as? String
+        uid = aDecoder.decodeObject(forKey: "uid") as? Int
+        updatedAt = aDecoder.decodeObject(forKey: "updated_at") as? String
+        zipcode = aDecoder.decodeObject(forKey: "zipcode") as? Int
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if address != nil{
+            aCoder.encode(address, forKey: "address")
+        }
+        if addressType != nil{
+            aCoder.encode(addressType, forKey: "address_type")
+        }
+        if areaId != nil{
+            aCoder.encode(areaId, forKey: "area_id")
+        }
+        if areaName != nil{
+            aCoder.encode(areaName, forKey: "area_name")
+        }
+        if cityId != nil{
+            aCoder.encode(cityId, forKey: "city_id")
+        }
+        if cityName != nil{
+            aCoder.encode(cityName, forKey: "city_name")
+        }
+        if contactMobile != nil{
+            aCoder.encode(contactMobile, forKey: "contact_mobile")
+        }
+        if contactName != nil{
+            aCoder.encode(contactName, forKey: "contact_name")
+        }
+        if createdAt != nil{
+            aCoder.encode(createdAt, forKey: "created_at")
+        }
+        if deletedAt != nil{
+            aCoder.encode(deletedAt, forKey: "deleted_at")
+        }
+        if id != nil{
+            aCoder.encode(id, forKey: "id")
+        }
+        if isDefault != nil{
+            aCoder.encode(isDefault, forKey: "is_default")
+        }
+        if pickupNodeId != nil{
+            aCoder.encode(pickupNodeId, forKey: "pickup_node_id")
+        }
+        if provinceId != nil{
+            aCoder.encode(provinceId, forKey: "province_id")
+        }
+        if provinceName != nil{
+            aCoder.encode(provinceName, forKey: "province_name")
+        }
+        if uid != nil{
+            aCoder.encode(uid, forKey: "uid")
+        }
+        if updatedAt != nil{
+            aCoder.encode(updatedAt, forKey: "updated_at")
+        }
+        if zipcode != nil{
+            aCoder.encode(zipcode, forKey: "zipcode")
+        }
+        
+    }
+    
+}
+

+ 178 - 0
RainbowPlanet/RainbowPlanet/Service/Model/UserModel/SelfMentionAddressListModel.swift

@@ -0,0 +1,178 @@
+//
+//	SelfMentionAddressModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+class SelfMentionAddressListModel : NSObject, NSCoding, Mappable{
+
+	var data : [SelfMentionAddressModel]?
+	var pagination : PaginationModel?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return SelfMentionAddressListModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		data <- map["data"]
+		pagination <- map["pagination"]
+		
+	}
+
+    /**
+    * NSCoding required initializer.
+    * Fills the data from the passed decoder
+    */
+    @objc required init(coder aDecoder: NSCoder)
+	{
+         data = aDecoder.decodeObject(forKey: "data") as? [SelfMentionAddressModel]
+         pagination = aDecoder.decodeObject(forKey: "pagination") as? PaginationModel
+
+	}
+
+    /**
+    * NSCoding required method.
+    * Encodes mode properties into the decoder
+    */
+    @objc func encode(with aCoder: NSCoder)
+	{
+		if data != nil{
+			aCoder.encode(data, forKey: "data")
+		}
+		if pagination != nil{
+			aCoder.encode(pagination, forKey: "pagination")
+		}
+
+	}
+
+}
+
+class SelfMentionAddressModel : NSObject, NSCoding, Mappable{
+    
+    var address : String?
+    var cityId : Int?
+    var cityName : String?
+    var distance : Int?
+    var id : Int?
+    var latitude : String?
+    var longitude : String?
+    var managerMobile : String?
+    var managerName : String?
+    var name : String?
+    var pickupGroupId : String?
+    var receiveType : String?
+    var status : String?
+    var storeIds : String?
+    var workTime : String?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return SelfMentionAddressModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        address <- map["address"]
+        cityId <- map["city_id"]
+        cityName <- map["city_name"]
+        distance <- map["distance"]
+        id <- map["id"]
+        latitude <- map["latitude"]
+        longitude <- map["longitude"]
+        managerMobile <- map["manager_mobile"]
+        managerName <- map["manager_name"]
+        name <- map["name"]
+        pickupGroupId <- map["pickup_group_id"]
+        receiveType <- map["receive_type"]
+        status <- map["status"]
+        storeIds <- map["store_ids"]
+        workTime <- map["work_time"]
+        
+    }
+    
+    /**
+     * NSCoding required initializer.
+     * Fills the data from the passed decoder
+     */
+    @objc required init(coder aDecoder: NSCoder)
+    {
+        address = aDecoder.decodeObject(forKey: "address") as? String
+        cityId = aDecoder.decodeObject(forKey: "city_id") as? Int
+        cityName = aDecoder.decodeObject(forKey: "city_name") as? String
+        distance = aDecoder.decodeObject(forKey: "distance") as? Int
+        id = aDecoder.decodeObject(forKey: "id") as? Int
+        latitude = aDecoder.decodeObject(forKey: "latitude") as? String
+        longitude = aDecoder.decodeObject(forKey: "longitude") as? String
+        managerMobile = aDecoder.decodeObject(forKey: "manager_mobile") as? String
+        managerName = aDecoder.decodeObject(forKey: "manager_name") as? String
+        name = aDecoder.decodeObject(forKey: "name") as? String
+        pickupGroupId = aDecoder.decodeObject(forKey: "pickup_group_id") as? String
+        receiveType = aDecoder.decodeObject(forKey: "receive_type") as? String
+        status = aDecoder.decodeObject(forKey: "status") as? String
+        storeIds = aDecoder.decodeObject(forKey: "store_ids") as? String
+        workTime = aDecoder.decodeObject(forKey: "work_time") as? String
+        
+    }
+    
+    /**
+     * NSCoding required method.
+     * Encodes mode properties into the decoder
+     */
+    @objc func encode(with aCoder: NSCoder)
+    {
+        if address != nil{
+            aCoder.encode(address, forKey: "address")
+        }
+        if cityId != nil{
+            aCoder.encode(cityId, forKey: "city_id")
+        }
+        if cityName != nil{
+            aCoder.encode(cityName, forKey: "city_name")
+        }
+        if distance != nil{
+            aCoder.encode(distance, forKey: "distance")
+        }
+        if id != nil{
+            aCoder.encode(id, forKey: "id")
+        }
+        if latitude != nil{
+            aCoder.encode(latitude, forKey: "latitude")
+        }
+        if longitude != nil{
+            aCoder.encode(longitude, forKey: "longitude")
+        }
+        if managerMobile != nil{
+            aCoder.encode(managerMobile, forKey: "manager_mobile")
+        }
+        if managerName != nil{
+            aCoder.encode(managerName, forKey: "manager_name")
+        }
+        if name != nil{
+            aCoder.encode(name, forKey: "name")
+        }
+        if pickupGroupId != nil{
+            aCoder.encode(pickupGroupId, forKey: "pickup_group_id")
+        }
+        if receiveType != nil{
+            aCoder.encode(receiveType, forKey: "receive_type")
+        }
+        if status != nil{
+            aCoder.encode(status, forKey: "status")
+        }
+        if storeIds != nil{
+            aCoder.encode(storeIds, forKey: "store_ids")
+        }
+        if workTime != nil{
+            aCoder.encode(workTime, forKey: "work_time")
+        }
+        
+    }
+    
+}

+ 1 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaNetWorkManager/SwiftMoyaNetWorkManager.swift

@@ -13,7 +13,6 @@ import SwiftyJSON
 import ObjectMapper
 import RxSwift
 import RxCocoa
-//import MoyaMapper
 import Result
 
 /// 超时时长
@@ -118,7 +117,7 @@ public class SwiftMoyaNetWorkManager: NSObject {
     ///   - type: 模型
     ///   - target: 请求地址加参数
     ///   - isCache: 是否缓存
-    ///   - completion: <#completion description#>
+    ///   - completion: 回调
     func request<T: BaseMappable>(_ type: T.Type ,target: MultiTarget,isCustomAlert:Bool = false,completion: @escaping successCallTBack) -> Void {
         //判断是否链接网络
         if !isNetworkConnect{

+ 5 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift

@@ -31,17 +31,17 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     ///   - completion: 完成
     func configPickupNodeIndexApi(longitude:String,latitude:String, page:Int = 1,completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
-        let loacationModel = LocationModel.shared().getLocationModel()
-        parameters.updateValue(loacationModel!.cityCode, forKey: "city_id")
-//        parameters.updateValue("1", forKey: "city_id")
+//        let loacationModel = LocationModel.shared().getLocationModel()
+//        parameters.updateValue(loacationModel!.cityCode, forKey: "city_id")
+        parameters.updateValue("1", forKey: "city_id")
         parameters.updateValue(longitude, forKey: "longitude")
         parameters.updateValue(latitude, forKey: "latitude")
         parameters.updateValue(page, forKey: "page")
         
         SwiftProgressHUD.shared().showWait()
-        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceConfigApi.configPickupNodeIndex(parameters: parameters))) {(data) in
+        SwiftMoyaNetWorkManager.shared().request(SelfMentionAddressListModel.self,target: MultiTarget(SwiftMoyaServiceConfigApi.configPickupNodeIndex(parameters: parameters))) {(selfMentionAddressListModel) in
             SwiftProgressHUD.shared().hide()
-            completion("")
+            completion(selfMentionAddressListModel)
         }
     }
 }

+ 68 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaNetWorkServiceUser.swift

@@ -279,5 +279,73 @@ public class SwiftMoyaNetWorkServiceUser: NSObject {
             completion(addressManagerListModel)
         }
     }
+    
+    /// 新增、编辑)快递地址
+    ///
+    /// - Parameters:
+    ///   - id: 表id 修改适合传
+    ///   - contactName: 收货人
+    ///   - contactMobile: 联系电话
+    ///   - provinceId: 省id
+    ///   - provinceName: 省份名称
+    ///   - cityId: 城市id
+    ///   - cityName: 城市名称
+    ///   - areaId: 区id
+    ///   - areaName: 区名称
+    ///   - address: 详细地址
+    ///   - zipcode: 邮政编码 710110
+    ///   - completion: 回调
+    func userAddExpressAddressApi(id:Int = 0,contactName:String = "",contactMobile:String = "",provinceId:String = "",provinceName:String = "",cityId:String = "",cityName:String = "",areaId:String = "",areaName:String = "",address:String = "",completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(id, forKey: "id")
+        parameters.updateValue(contactName, forKey: "contact_name")
+        parameters.updateValue(contactMobile, forKey: "contact_mobile")
+        parameters.updateValue(provinceId, forKey: "province_id")
+        parameters.updateValue(provinceName, forKey: "province_name")
+        parameters.updateValue(cityId, forKey: "city_id")
+        parameters.updateValue(cityName, forKey: "city_name")
+        parameters.updateValue(areaId, forKey: "area_id")
+        parameters.updateValue(areaName, forKey: "area_name")
+        parameters.updateValue(address, forKey: "address")
+
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userAddExpressAddress(parameters: parameters))) {(rootModel) in
+            let rootModel = rootModel as! RootModel
+            SwiftProgressHUD.shared().showText(rootModel.msg!)
+            completion("")
+        }
+    }
+    
+    /// 设置(自提/快递)默认地址
+    ///
+    /// - Parameters:
+    ///   - id: 表id 修改适合传
+    func userAddressIsDefaultApi(id:String = "",completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(id, forKey: "id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userAddressIsDefault(parameters: parameters))) {
+            (rootModel) in
+            let rootModel = rootModel as! RootModel
+            SwiftProgressHUD.shared().showText(rootModel.msg!)
+            completion("")
+        }
+    }
+    
+    /// 删除(自提/快递)地址
+    ///
+    /// - Parameters:
+    ///   - id: 地址Id
+    func userAddressDeleteApi(id:Int = 0,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(id, forKey: "id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceUserApi.userAddressDelete(parameters: parameters))) {
+            (rootModel) in
+            let rootModel = rootModel as! RootModel
+            SwiftProgressHUD.shared().showText(rootModel.msg!)
+            completion("")
+        }
+    }
 
 }

+ 47 - 7
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceUser/SwiftMoyaServiceUserApi.swift

@@ -53,6 +53,18 @@ public let kUserIsBindWeixinApi = "/user/isBindWeixin"
 /// 用户自提点,快递地址列表
 public let kUserSelfAddressListApi = "/user/selfAddressList"
 
+// MARK: - (新增、编辑)快递地址
+/// (新增、编辑)快递地址
+public let kUserAddExpressAddressApi = "/user/addExpressAddress"
+
+// MARK: - 设置默认(自提/快递)地址
+/// 设置默认(自提/快递)地址
+public let kUserAddressIsDefaultApi = "/user/addressIsDefault"
+
+// MARK: - 删除(自提/快递)地址
+/// 删除(自提/快递)地址
+public let kUserAddressDeleteApi = "/user/addressDelete"
+
 /// 用户
 ///
 /// - userLogout: 登出
@@ -66,6 +78,9 @@ public let kUserSelfAddressListApi = "/user/selfAddressList"
 /// - userUnbindWeixin: 解绑微信
 /// - userIsBindWeixin: 检查是否绑定微信
 /// - UserSelfAddressList: 用户自提点,快递地址列表
+/// - userAddExpressAddress: (新增、编辑)快递地址
+/// - userAddressIsDefault: 设置默认(自提/快递)地址
+/// - userAddressDelete: 删除(自提/快递)地址
 public enum SwiftMoyaServiceUserApi {
     case userLogout(parameters:Dictionary<String, Any>)
     case userRefresh(parameters:Dictionary<String, Any>)
@@ -78,6 +93,10 @@ public enum SwiftMoyaServiceUserApi {
     case userUnbindWeixin(parameters:Dictionary<String, Any>)
     case userIsBindWeixin(parameters:Dictionary<String, Any>)
     case userSelfAddressList(parameters:Dictionary<String, Any>)
+    case userAddExpressAddress(parameters:Dictionary<String, Any>)
+    case userAddressIsDefault(parameters:Dictionary<String, Any>)
+    case userAddressDelete(parameters:Dictionary<String, Any>)
+    
 }
 
 extension SwiftMoyaServiceUserApi: TargetType {
@@ -94,7 +113,10 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userSetPassword,
              .userUnbindWeixin,
              .userIsBindWeixin,
-             .userSelfAddressList
+             .userSelfAddressList,
+             .userAddExpressAddress,
+             .userAddressIsDefault,
+             .userAddressDelete
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -124,6 +146,13 @@ extension SwiftMoyaServiceUserApi: TargetType {
             return kUserIsBindWeixinApi
         case .userSelfAddressList:
             return kUserSelfAddressListApi
+        case .userAddExpressAddress:
+            return kUserAddExpressAddressApi
+        case .userAddressIsDefault:
+            return kUserAddressIsDefaultApi
+        case .userAddressDelete:
+            return kUserAddressDeleteApi
+            
         }
     }
 
@@ -139,7 +168,10 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userSetPassword,
              .userUnbindWeixin,
              .userIsBindWeixin,
-             .userSelfAddressList
+             .userSelfAddressList,
+             .userAddExpressAddress,
+             .userAddressIsDefault,
+             .userAddressDelete
             :
             return .post
         }
@@ -160,7 +192,10 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userSetPassword(var parameters),
              .userUnbindWeixin(var parameters),
              .userIsBindWeixin(var parameters),
-             .userSelfAddressList(var parameters)
+             .userSelfAddressList(var parameters),
+             .userAddExpressAddress(var parameters),
+             .userAddressIsDefault(var parameters),
+             .userAddressDelete(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -188,16 +223,21 @@ extension SwiftMoyaServiceUserApi: TargetType {
              .userMobileLogin
             :
             return (headerParameters(headerType: .moreHeader) as! [String : String])
-        case .userLogout,
-             .userRefresh,
-             .userBindWeixin,
+        case .userBindWeixin,
              .userBindMobile,
              .userSetPassword,
              .userUnbindWeixin,
              .userIsBindWeixin,
-             .userSelfAddressList
+             .userSelfAddressList,
+             .userAddExpressAddress,
+             .userAddressIsDefault,
+             .userAddressDelete
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
+        case .userLogout,
+             .userRefresh
+            :
+            return (headerParameters(headerType: .tokenMoreHeader) as! [String : String])
         }
     }
 

File diff suppressed because it is too large
+ 1 - 0
RainbowPlanet/RainbowPlanet/Src/baidu_cityid_rel.json


File diff suppressed because it is too large
+ 1 - 0
RainbowPlanet/RainbowPlanet/Src/province_city_area.json


+ 22 - 1
RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

@@ -11,7 +11,6 @@ import FWPopupView
 
 class AlertSheetView: NSObject {
 
-
     /// 自定义Alert弹框样式
     ///
     /// - Parameters:
@@ -68,5 +67,27 @@ class AlertSheetView: NSObject {
         alertView.show()
     }
     
+    typealias SureClosure = (_ province :Province ,_ city : City ,_ area :Area) -> Void
+    
+    /// 自定义sheet省市区
+    class func sheetProvinceCityAreaView(sureClosure:@escaping (Province ,City ,Area) -> Void) {
+        let provinceCityAreaView = ProvinceCityAreaView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 340))
+        
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "1"
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.animationDuration = 0.5
+        provinceCityAreaView.vProperty = vProperty
+        provinceCityAreaView.show()
+        provinceCityAreaView.sureClosure = {
+            (province :Province , city : City , area :Area) in
+            provinceCityAreaView.hide(popupDidDisappearBlock: { (popupView) in
+                 sureClosure(province, city,area)
+            })
+        }
+    }
     
 }

+ 22 - 0
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+String.swift

@@ -153,6 +153,10 @@ extension String {
         return nil
     }
 
+    
+    /// md5加密
+    ///
+    /// - Returns: md5字符串
     func md5() -> String {
         let str = self.cString(using: String.Encoding.utf8)
         let strLen = CUnsignedInt(self.lengthOfBytes(using: String.Encoding.utf8))
@@ -166,4 +170,22 @@ extension String {
         free(result)
         return String(format: hash as String)
     }
+    
+    
+    /// json文件转换json字符串
+    ///
+    /// - Parameters:
+    ///   - resource: 文件名
+    ///   - type: 文件格式
+    /// - Returns: jsonStr
+    static func jsonFileToJsonStr(resource:String = "",type:String = "") -> String {
+        //初始化本地数据
+        let jsonPath: String = Bundle.main.path(forResource: resource, ofType: type)!
+        var jsonStr : String = String()
+        do {
+            let string: String  = try String.init(contentsOfFile: jsonPath, encoding: String.Encoding.utf8)
+            jsonStr = string
+        }catch { }
+        return jsonStr
+    }
 }

+ 11 - 2
RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.h

@@ -12,7 +12,7 @@
 
 /**
  下拉刷新
-
+ 
  @param beginRefresh 是否自动刷新
  @param animation 是否需要动画
  @param refreshBlock 刷新回调
@@ -22,12 +22,21 @@
 
 /**
  上啦加载
-
+ 
  @param automaticallyRefresh 是否自动加载
  @param loadMoreBlock 加载回调
  */
 - (void)addFooterWithWithHeaderWithAutomaticallyRefresh:(BOOL)automaticallyRefresh loadMoreBlock:(void(^)(NSInteger pageIndex))loadMoreBlock;
 
+/**
+ 普通请求结束刷新
+ */
+- (void)endFooterRefresh;
 
 
+/**
+ 没有数据结束刷新
+ */
+- (void)endFooterNoMoreData;
+
 @end

+ 19 - 10
RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m

@@ -1,6 +1,6 @@
 //
 //  UIScrollView+MJRefreshEX.h
-//  RainbowPlanet
+//  CreaditPayment
 //
 //  Created by 南鑫林 on 2018/12/28.
 //  Copyright © 2018 南鑫林. All rights reserved.
@@ -27,13 +27,13 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
 @implementation UIScrollView (MJRefreshEX)
 
 - (void)addHeaderWithHeaderWithBeginRefresh:(BOOL)beginRefresh animation:(BOOL)animation refreshBlock:(void(^)(NSInteger pageIndex))refreshBlock{
-
+    
     __weak typeof(self) weakSelf = self;
     self.refreshBlock = refreshBlock;
     
     MJRefreshNormalHeader * header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
         [weakSelf resetPageNum];
-    
+        
         if (weakSelf.refreshBlock) {
             weakSelf.refreshBlock(weakSelf.pageIndex);
         }
@@ -42,10 +42,11 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
     
     if (beginRefresh && animation) {
         //有动画的刷新
-        [self beginHeaderRefresh];
+        [self resetPageNum];
+        [header beginRefreshing];
     }else if (beginRefresh && !animation){
         //刷新,但是没有动画
-        [self.mj_header executeRefreshingCallback];
+        [header executeRefreshingCallback];
     }
     
     header.mj_h = 70.0;
@@ -58,7 +59,7 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
     
     if (automaticallyRefresh) {
         MJRefreshAutoNormalFooter * footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
-             self.pageIndex += 1;
+            self.pageIndex += 1;
             if (self.loadMoreBlock) {
                 self.loadMoreBlock(self.pageIndex);
             }
@@ -66,6 +67,8 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
         }];
         
         footer.automaticallyRefresh = automaticallyRefresh;
+        footer.triggerAutomaticallyRefreshPercent = 1;
+        footer.onlyRefreshPerDrag = YES;
         
         footer.stateLabel.font = [UIFont systemFontOfSize:13.0];
         footer.stateLabel.textColor = [UIColor colorWithWhite:0.400 alpha:1.000];
@@ -76,7 +79,7 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
     }
     else{
         MJRefreshBackNormalFooter * footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
-             self.pageIndex += 1;
+            self.pageIndex += 1;
             if (self.loadMoreBlock) {
                 self.loadMoreBlock(self.pageIndex);
             }
@@ -90,7 +93,7 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
         
         self.mj_footer = footer;
     }
-   
+    
 }
 
 -(void)beginHeaderRefresh {
@@ -108,16 +111,22 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
     [self.mj_footer resetNoMoreData];
 }
 
--(void)endHeaderRefresh {
+- (void)endHeaderRefresh {
     
     [self.mj_header endRefreshing];
     [self resetNoMoreData];
 }
 
--(void)endFooterRefresh {
+- (void)endFooterRefresh {
     [self.mj_footer endRefreshing];
 }
 
+- (void)endFooterNoMoreData {
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [self.mj_footer endRefreshingWithNoMoreData];
+    });
+}
+
 
 static void *pagaIndexKey = &pagaIndexKey;
 - (void)setPageIndex:(NSInteger)pageIndex{

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

@@ -45,13 +45,12 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 加载提示语
     func showWait(_ title: String = "") {
-        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 = true
-        self.hud = hud
+        hud.removeFromSuperViewOnHide = false
     }
 
 
@@ -59,8 +58,7 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 显示的标题
     func showText(_ title: String = "",textAlignment :NSTextAlignment = .center) {
-        hide()
-        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
+        hud.show(animated: true)
         hud.mode = .text
         hud.detailsLabel.text = title
         hud.detailsLabel.textAlignment = textAlignment
@@ -69,7 +67,7 @@ class SwiftProgressHUD: NSObject {
         hud.bezelView.style = .solidColor
         hud.bezelView.backgroundColor = UIColor.init(white: 0, alpha: 0.7)
         hud.animationType = .zoom
-        hud.removeFromSuperViewOnHide = true
+        hud.removeFromSuperViewOnHide = false
         hud.margin = 10
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
@@ -80,12 +78,11 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 成功的提示语
     func showSuccess(_ title: String = "",_ imageName: String = "success") {
-        hide()
-        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
+        hud.show(animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = true
+        hud.removeFromSuperViewOnHide = false
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
     }
@@ -94,12 +91,12 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 警告的提示语
     func showWarning(_ title: String = "",_ imageName: String = "warning") {
-        hide()
-        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
+
+        hud.show(animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = true
+        hud.removeFromSuperViewOnHide = false
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
     }
@@ -109,12 +106,12 @@ class SwiftProgressHUD: NSObject {
     ///
     /// - Parameter title: 加载提示语
     func showError(_ title: String = "", _ imageName: String = "error") {
-        hide()
-        let hud = MBProgressHUD.showAdded(to: viewToShow(), animated: true)
+
+        hud.show(animated: true)
         hud.mode = .customView //模式设置为自定义视图
         hud.customView = UIImageView(image: UIImage(named: imageName)) //自定义视图显示图片
         hud.detailsLabel.text = title
-        hud.removeFromSuperViewOnHide = true
+        hud.removeFromSuperViewOnHide = false
         //HUD窗口显示1秒后自动隐藏
         hud.hide(animated: true, afterDelay: TimeInterval(afterDelay))
     }