Bladeren bron

自提处理

Chris 5 jaren geleden
bovenliggende
commit
6a8695d941

+ 9 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/EditSelfMentionContacts/ViewController/EditSelfMentionContactsViewController.swift

@@ -19,6 +19,9 @@ class EditSelfMentionContactsViewController: BaseViewController {
     // 是否由支付订单页面进入
     var isFromOrderPay: Bool = false
     
+    // 联系人个数
+    var listCount: Int?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -59,7 +62,12 @@ class EditSelfMentionContactsViewController: BaseViewController {
         editSelfMentionContactsView.deleteClosure = { //删除
             [weak self] in
             if let selfMentionContactsModel = self?.selfMentionContactsModel {
-                AlertSheetView.alert(title: "是否删除该地址", cancelTitle: "取消", sureTitle: "确定", cancelBlock: { (popupView, int, string) in
+                if self!.listCount ?? 0 == 1 {
+                    SwiftProgressHUD.shared().showText("至少需保留一位联系人")
+                    return
+                }
+                
+                AlertSheetView.alert(title: "是否删除该联系人", cancelTitle: "取消", sureTitle: "确定", cancelBlock: { (popupView, int, string) in
                     
                 }, confirmBlock: { (FWPopupView, int, String) in
                     self?.userDelExpreesContactsApi()

+ 4 - 4
RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionContactsList/View/SelfMentionContactsListView.swift

@@ -13,8 +13,8 @@ class SelfMentionContactsListView: BaseView {
     typealias DidSelectRowClosure = (_ indexPath: IndexPath) -> Void
     var didSelectRowClosure : DidSelectRowClosure?
     
-    typealias EditClosure = (_ selfMentionContactsModel:SelfMentionContactsModel) -> Void
-    var editClosure : EditClosure?
+    typealias EditTransClosure = (_ selfMentionContactsModel:SelfMentionContactsModel, _ listCount: Int) -> Void
+    var editTransClosure: EditTransClosure?
     
     var selfMentionContactsModels: Array<SelfMentionContactsModel>? {
         didSet {
@@ -64,8 +64,8 @@ extension SelfMentionContactsListView: UITableViewDelegate,UITableViewDataSource
         cell.selfMentionContactsModel = selfMentionContactsModels?[indexPath.row]
         cell.editClosure = {
             [weak self] selfMentionContactsModel in
-            if let editClosure = self?.editClosure {
-                editClosure(selfMentionContactsModel)
+            if let editTransClosure = self?.editTransClosure {
+                editTransClosure(selfMentionContactsModel,  self?.selfMentionContactsModels?.count ?? 0)
             }
         }
         return cell

+ 10 - 3
RainbowPlanet/RainbowPlanet/Modules/MineModule/SelfMentionContactsList/ViewController/SelfMentionContactsListViewController.swift

@@ -54,9 +54,16 @@ class SelfMentionContactsListViewController: BaseViewController {
     
     private lazy var selfMentionContactsListView: SelfMentionContactsListView = {
         let selfMentionContactsListView = SelfMentionContactsListView()
-        selfMentionContactsListView.editClosure = { //编辑,新增
-            [weak self] selfMentionContactsModel in
-            self?.pushEditSelfMention(selfMentionContactsModel: selfMentionContactsModel)
+        selfMentionContactsListView.editTransClosure = { //编辑,新增
+            [weak self] (selfMentionContactsModel, listCount) in
+            let vc = EditSelfMentionContactsViewController()
+            vc.saveClosure = {
+                [weak self] in
+                self?.userExpreesContactsListApi()
+            }
+            vc.selfMentionContactsModel = selfMentionContactsModel
+            vc.listCount = listCount
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         selfMentionContactsListView.didSelectRowClosure = {
             [weak self] indexPath in

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderPayOrder/View/ShoppingCartOrderPayView.swift

@@ -42,8 +42,7 @@ class ShoppingCartOrderPayView: BaseView {
     var deliverType: String? {
         didSet {
             if self.deliverType == "1" {
-                let addr: SelfMentionAddressModel = SelfMentionAddressModel.getModel()!
-                selfAddressLabel.text = "\(addr.address ?? "")"
+                selfAddressLabel.text = "\(selfAddrMdl?.address ?? "")"
             } else {
                 selfAddressView.isHidden = true
                 tableView.snp.remakeConstraints { (make) in
@@ -76,6 +75,7 @@ class ShoppingCartOrderPayView: BaseView {
     var selfAddrMdl: SelfAddresModel? {
         didSet {
             if selfAddrMdl != nil {
+                selfAddressLabel.text = "\(selfAddrMdl?.address ?? "")"
                 tableView.reloadData()
             }
         }