Browse Source

Merge branch 'feature/liuxuqing' into develop

Chris 6 years ago
parent
commit
5140a6b1df

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundNoteInfoCell.swift

@@ -56,6 +56,7 @@ class OrderApplyRefundNoteInfoCell: UITableViewCell {
             make.top.equalTo(14)
             make.left.equalTo(titleLabel.snp_right).offset(20)
             make.bottom.right.equalTo(-14)
+            make.height.greaterThanOrEqualTo(20)
         }
     }
     

+ 1 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundReasonCell.swift

@@ -21,6 +21,7 @@ class OrderApplyRefundReasonCell: UITableViewCell {
         didSet {
             if self.selRefundReason?.count ?? 0 > 0 {
                 chooseBtn.setTitle(self.selRefundReason, for: UIControl.State.normal)
+                chooseBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 4)
             }
         }
     }

+ 28 - 12
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -17,12 +17,7 @@ class ShoppingCartView: BaseView {
             self.judgeAllSelectedStatus()
             self.refreshAccountView()
             
-            // FIXME: to be deal
-            if cartListModelArr?.isEmpty ?? true {
-                accountView.isHidden = true
-            } else {
-                accountView.isHidden = false
-            }
+            self.updateAccountViewCondition()
         }
     }
     
@@ -58,14 +53,10 @@ class ShoppingCartView: BaseView {
         tableView.ly_emptyView = emptyView
         tableView.ly_startLoading()
         
-        // FIXME: to be deal
-        if cartListModelArr?.isEmpty ?? true {
-            accountView.isHidden = true
-        } else {
-            accountView.isHidden = false
-        }
+        self.updateAccountViewCondition()
     }
     
+    
     override func setupLayouts() {
         accountView.snp.makeConstraints { (make) in
             make.left.right.bottom.equalToSuperview()
@@ -77,6 +68,25 @@ class ShoppingCartView: BaseView {
         }
     }
     
+    // 处理购物车结算是否显示
+    func updateAccountViewCondition() {
+        if cartListModelArr?.isEmpty ?? true {
+            accountView.isHidden = true
+            accountView.snp_updateConstraints { (make) in
+                accountView.snp_updateConstraints { (make) in
+                    make.height.equalTo(0)
+                }
+            }
+        } else {
+            accountView.isHidden = false
+            accountView.snp_updateConstraints { (make) in
+                accountView.snp_updateConstraints { (make) in
+                    make.height.equalTo(48)
+                }
+            }
+        }
+    }
+    
     lazy var accountView: ShoppingCartAccountView = {
         let accountView = ShoppingCartAccountView()
         
@@ -258,6 +268,12 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             SwiftMoyaNetWorkServiceProduct.shared().productCartDeleteApi(id: productId ?? 0) { [weak self] (data) -> (Void) in
                 self?.cartListModelArr![indexPath.section].productList?.remove(at: indexPath.row)
                 tableView.deleteRows(at: [indexPath], with: .none)
+                
+                // 删除后商店为空,刷新table
+                if self?.cartListModelArr![indexPath.section].productList?.isEmpty ?? true {
+                    self?.cartListModelArr?.remove(at: indexPath.section)
+                    tableView.reloadData()
+                }
             }
         }
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/ViewController/ShoppingCartViewController.swift

@@ -39,7 +39,7 @@ class ShoppingCartViewController: BaseViewController {
     }
     
     override func setupLayouts() {
-        self.tabBarController?.selectedIndex = 0
+        
     }
     
     override func setupData() {

+ 4 - 1
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartFinishPay/View/ShoppingCartPaySuccessCell.swift

@@ -148,9 +148,12 @@ class ShoppingCartPaySuccessCell: UITableViewCell {
     }()
     
     private lazy var orderButton: UIButton = {
+        let attributeString = NSMutableAttributedString(string:"查看订单")
+        attributeString.changeUnderline(atAllStyle: NSUnderlineStyle(rawValue: NSUnderlineStyle.single.rawValue), color: kbbbbbbColor)
+        
         let orderButton = UIButton(type: UIButton.ButtonType.custom)
         orderButton.backgroundColor = kffffffColor
-        orderButton.setTitle("查看订单", for: UIControl.State.normal)
+        orderButton.setAttributedTitle(attributeString, for: UIControl.State.normal)
         orderButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         orderButton.setImage(UIImage.imageWithColor(color: k333333Color), for: UIControl.State.normal)
         orderButton.titleLabel?.font = kRegularFont14

+ 16 - 4
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCartFinishPay/ViewController/ShoppingCartFinishPayController.swift

@@ -11,7 +11,15 @@ import RxSwift
 
 class ShoppingCartFinishPayController: BaseViewController {
     
-    var payStatus: Bool? = true
+    var payStatus: Bool? = true {
+        didSet {
+            if (payStatus == true) {
+                navigationBar.title = "支付成功"
+            } else {
+                navigationBar.title = "支付失败"
+            }
+        }
+    }
     
     var productSearchModelArray = Array<ProductSearchModel>()
     
@@ -55,8 +63,10 @@ class ShoppingCartFinishPayController: BaseViewController {
         let finishPayView = ShoppingCartFinishPayView()
         finishPayView.payStatus = payStatus
         finishPayView.repayTransBlock = {
-            [weak self] in
-            print("点击了----重新支付")
+            [weak self] in            
+            let vc = OrderViewController()
+            vc.orderVCType = .pendingPayment
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         finishPayView.jumpTransBlock = {
             [weak self] (jType) in
@@ -65,7 +75,9 @@ class ShoppingCartFinishPayController: BaseViewController {
                 self?.tabBarController?.selectedIndex = 0
                 self?.navigationController?.popToRootViewController(animated: false)
             case PayJumpDes.checkOrder:
-                print("点击了----\(jType) --查看订单")
+                let vc = OrderViewController()
+                vc.orderVCType = .toBeReceived
+                self?.navigationController?.pushViewController(vc, animated: true)
             }
         }
         

+ 1 - 18
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/OrderCommentParameterModel.swift

@@ -17,22 +17,5 @@ class OrderCommentParameterModel : NSObject{
     var shop_id : Int?
     var shop_name : String?
     
-    var cmtProductArr : Array<CommentProductModel>?
-}
-
-
-class CommentProductModel : NSObject{
-    
-    var purchase_detail_id : Int?
-    var imgs : Array<String>?
-    var content : String?
-    var star : Int?
-    var sku_id : Int?
-    var sku_name : String?
-    var product_id : Int?
-    var product_name : String?
-    var sale_name : String?
-    var category_name1 : Int?
-    var category_name2 : Int?
-    var category_name3 : Int?        
+    var cmtProductArr : Array<OrderModelDetailModel>?
 }

+ 42 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift

@@ -408,6 +408,48 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
         }
     }
     
+    // MARK: - 新增商品评价
+    /// 新增商品评价
+    ///
+    /// - Parameters:
+    ///   - completion: 回调
+    func productAddCommentApi(paraMdl:OrderCommentParameterModel, completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(paraMdl.purchase_id ?? 0, forKey: "purchase_id")
+        parameters.updateValue(paraMdl.username ?? "", forKey: "username")
+        parameters.updateValue(paraMdl.avatar ?? "", forKey: "avatar")
+        parameters.updateValue(paraMdl.purchase_no ?? "", forKey: "purchase_no")
+        parameters.updateValue(paraMdl.shop_id ?? 0, forKey: "shop_id")
+        parameters.updateValue(paraMdl.shop_name ?? "", forKey: "shop_name")
+        
+        // 处理Json字符串
+        var detailDicArr = Array<Any>()
+        for orderDetailMdl: OrderModelDetailModel in paraMdl.cmtProductArr! {
+            var shopDic = Dictionary<String,Any>()
+            shopDic.updateValue(orderDetailMdl.id ?? 0, forKey: "purchase_detail_id")
+            shopDic.updateValue(orderDetailMdl.imageArrUrlStr, forKey: "imgs")
+            shopDic.updateValue(orderDetailMdl.comment, forKey: "content")
+            shopDic.updateValue(orderDetailMdl.starValue, forKey: "star")
+            shopDic.updateValue(orderDetailMdl.skuId ?? 0, forKey: "sku_id")
+            shopDic.updateValue(orderDetailMdl.skuName ?? "", forKey: "sku_name")
+            shopDic.updateValue(orderDetailMdl.productId ?? 0, forKey: "product_id")
+            shopDic.updateValue(orderDetailMdl.productName ?? "", forKey: "product_name")
+            shopDic.updateValue(orderDetailMdl.productName ?? "", forKey: "sale_name")
+            shopDic.updateValue(orderDetailMdl.categoryName1 ?? "", forKey: "category_name1")
+            shopDic.updateValue(orderDetailMdl.categoryName2 ?? "", forKey: "category_name2")
+            shopDic.updateValue(orderDetailMdl.categoryName3 ?? "", forKey: "category_name3")
+            detailDicArr.append(shopDic)
+        }
+        let jsonStr = JSON(detailDicArr).description
+        parameters.updateValue(jsonStr, forKey: "content")
+                
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().requestArray(target: MultiTarget(SwiftMoyaServiceProductApi.productAddComment(parameters: parameters))) { (dataArr) in
+            SwiftProgressHUD.shared().hide()
+            completion(dataArr)
+        }
+    }
+    
     // MARK: - 获取购物车商品个数
     /// 获取购物车商品个数
     ///

+ 5 - 5
RainbowPlanet/RainbowPlanet/Tools/Extension/Extension+UIAlertController.swift

@@ -66,15 +66,15 @@ extension UIAlertController {
     static func showConfirmActionSheet(camera: ((UIAlertAction)->Void)?,album: ((UIAlertAction)->Void)?) {
         let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
         let cancelAction = UIAlertAction(title: "取消", style: .cancel)
-        cancelAction.setValue(UIColor(hexString: "333333"), forKey: "titleTextColor")
+        cancelAction.setValue(UIColor(hexString: "ffa42f"), forKey: "titleTextColor")
         alert.addAction(cancelAction)
 
-        let cameraAction = UIAlertAction(title: "拍", style: .default, handler: camera)
-        cameraAction.setValue(UIColor(hexString: "333333"), forKey: "titleTextColor")
+        let cameraAction = UIAlertAction(title: "拍", style: .default, handler: camera)
+        cameraAction.setValue(UIColor(hexString: "ffa42f"), forKey: "titleTextColor")
         alert.addAction(cameraAction)
 
-        let albumAction = UIAlertAction(title: "从手机相册选择", style: .default, handler: album)
-        albumAction.setValue(UIColor(hexString: "333333"), forKey: "titleTextColor")
+        let albumAction = UIAlertAction(title: "从相册选择", style: .default, handler: album)
+        albumAction.setValue(UIColor(hexString: "ffa42f"), forKey: "titleTextColor")
         alert.addAction(albumAction)
 
         let viewController = getCurrentVC()