南鑫林 6 роки тому
батько
коміт
8264c24a42

+ 12 - 2
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/AddressPOI/View/AddressPOITableViewCell.swift

@@ -40,8 +40,6 @@ class AddressPOITableViewCell: UITableViewCell {
         didSet {
             switch indexPath?.section {
             case 0:
-                let locationModel = LocationModel.shared().getLocationModel()
-                titleLabel.text = locationModel?.toString()
                 self.refreshButton.isHidden = false
             default:
                 self.refreshButton.isHidden = true
@@ -60,6 +58,18 @@ class AddressPOITableViewCell: UITableViewCell {
         }
     }
     
+    var locationAddress: String? {
+        didSet {
+            
+            if locationAddress != "" || locationAddress != nil {
+                titleLabel.text = locationAddress
+            }else {
+                let locationModel = LocationModel.shared().getLocationModel()
+                titleLabel.text = locationModel?.toString()
+            }
+        }
+    }
+    
     //MARK: - 设置view
     private func setupViews() {
         self.selectionStyle = .none

+ 18 - 3
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/AddressPOI/View/AddressPOIView.swift

@@ -17,6 +17,18 @@ class AddressPOIView: BaseView {
     
     var suggestionList : Array<BMKSuggestionInfo>?
     
+    var locationAddress: String? {
+        didSet {
+            tableView.reloadSections([0], with: UITableView.RowAnimation.fade)
+        }
+    }
+    /// 纬度
+    var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
+    /// 经度
+    var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
+    
+    
+    
     override func setupViews() {
         
         addSubview(searchBgView)
@@ -177,10 +189,13 @@ extension AddressPOIView:UITableViewDataSource,UITableViewDelegate {
         let cell = AddressPOITableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
         switch indexPath.section {
         case 0:
+            cell.locationAddress = locationAddress
             cell.refreshButtonBlock = {
                 BaiduMapManager.shared.startLocation()
                 BaiduMapManager.shared.locationSuccessBlock = {
-                     tableView.reloadSections([0], with: UITableView.RowAnimation.fade)
+                    [weak self] in
+                    let locationModel = LocationModel.shared().getLocationModel()
+                    self?.locationAddress = locationModel?.toString()
                 }
                 BaiduMapManager.shared.locationFalseBlock = {
                     SwiftProgressHUD.shared().showText("定位失败\n重新定位", textAlignment: NSTextAlignment.center)
@@ -195,14 +210,14 @@ extension AddressPOIView:UITableViewDataSource,UITableViewDelegate {
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        let locationModel = LocationModel.shared().getLocationModel()
 
         if let didSelectBlock = self.didSelectBlock {
             switch indexPath.section {
             case 0:
-                didSelectBlock(locationModel?.latitude ?? "",locationModel?.longitude ?? "",locationModel?.toString() ?? "")
+                didSelectBlock(self.latitude,self.longitude,self.locationAddress ?? "")
                 break
             default:
+                let locationModel = LocationModel.shared().getLocationModel()
                 let suggestionList = self.suggestionList?[indexPath.row]
                 let city = suggestionList?.city ?? ""
                 let district = suggestionList?.district ?? ""

+ 9 - 0
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/AddressPOI/ViewController/AddressPOIViewController.swift

@@ -12,6 +12,11 @@ class AddressPOIViewController: BaseViewController {
     
     typealias DidSelectBlock = (_ latitude:String,_ longitude:String,_ address:String) -> Void
     var didSelectBlock : DidSelectBlock?
+    var locationAddress: String?
+    /// 纬度
+    var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
+    /// 经度
+    var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
     
     override func viewDidLoad() {
         super.viewDidLoad()
@@ -23,6 +28,10 @@ class AddressPOIViewController: BaseViewController {
     override func setupViews() {
         navigationBar.title = "选择默认地址"
         view.addSubview(addressPOIView)
+        addressPOIView.locationAddress = locationAddress
+        addressPOIView.longitude = longitude
+        addressPOIView.latitude = latitude
+
     }
     
     override func setupLayouts() {

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

@@ -17,7 +17,7 @@ class SelfRecommendationView: BaseView {
     typealias DidSelectGoShoppingBlock = (_ indexPath: IndexPath) -> Void
     var didSelectGoShoppingBlock : DidSelectGoShoppingBlock?
     
-    typealias ChangeLocationBlock = () ->Void
+    typealias ChangeLocationBlock = (_ locationAddress: String) ->Void
     var changeLocationBlock : ChangeLocationBlock?
     
     var locationAddress: String? {
@@ -130,7 +130,7 @@ class SelfRecommendationView: BaseView {
             [weak self] in
             
             if let changeLocationBlock = self?.changeLocationBlock {
-                changeLocationBlock()
+                changeLocationBlock(self?.locationAddressLable.text ?? "")
             }
             
         }).disposed(by: disposeBag)

+ 4 - 1
RainbowPlanet/RainbowPlanet/Modules/CommonModules/LocationModule/SelfRecommendation/ViewController/SelfRecommendationViewController.swift

@@ -74,8 +74,11 @@ class SelfRecommendationViewController: BaseViewController {
             
         }
         selfRecommendationView.changeLocationBlock = {
-            [weak self] in
+            [weak self] locationAddress in
             let vc = AddressPOIViewController()
+            vc.locationAddress = locationAddress
+            vc.latitude = self?.latitude ?? ""
+            vc.longitude = self?.longitude ?? ""
             vc.didSelectBlock = {
                 [weak self] (latitude:String,longitude:String,address:String) in
                 selfRecommendationView.locationAddress = address

+ 18 - 21
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift

@@ -81,28 +81,25 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
     ///   - completion: 回调
     func orderPurchaseOrderListApi(page:Int = 1,status:Int = -1,completion: @escaping apiCallBack) {
         var parameters = Dictionary<String,Any>()
-        if status != -1 {
-            parameters.updateValue(status, forKey: "search_status")
-        }
         
-//        if status == -1 {
-//            parameters.updateValue("", forKey: "search_status")
-//        }
-//        if status == 0 {
-//            parameters.updateValue("dfk", forKey: "search_status")
-//        }
-//        if status == 1 {
-//            parameters.updateValue("dfh", forKey: "search_status")
-//        }
-//        if status == 2 {
-//            parameters.updateValue("dsh", forKey: "search_status")
-//        }
-//        if status == 3 {
-//            parameters.updateValue("dpj", forKey: "search_status")
-//        }
-//        if status == 4 {
-//            parameters.updateValue("tk", forKey: "search_status")
-//        }
+        if status == -1 {
+            parameters.updateValue("", forKey: "search_status")
+        }
+        if status == 0 {
+            parameters.updateValue("dfk", forKey: "search_status")
+        }
+        if status == 1 {
+            parameters.updateValue("dfh", forKey: "search_status")
+        }
+        if status == 2 {
+            parameters.updateValue("dsh", forKey: "search_status")
+        }
+        if status == 3 {
+            parameters.updateValue("dpj", forKey: "search_status")
+        }
+        if status == 4 {
+            parameters.updateValue("tk", forKey: "search_status")
+        }
 
         parameters.updateValue(page, forKey: "page")
         SwiftProgressHUD.shared().showWait()