Selaa lähdekoodia

订单列表完成

南鑫林 6 vuotta sitten
vanhempi
commit
6dc7e5a787
15 muutettua tiedostoa jossa 611 lisäystä ja 75 poistoa
  1. 5 1
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 61 8
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderButtonTableViewCell.swift
  3. 50 1
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeAndButtonTableViewCell.swift
  4. 11 1
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeAndTimeTableViewCell.swift
  5. 17 1
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeTableViewCell.swift
  6. 4 37
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderListView.swift
  7. 12 6
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderProductTableViewCell.swift
  8. 55 4
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderShopAndStatusTableViewCell.swift
  9. 12 6
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderTotalAmountTableViewCell.swift
  10. 220 0
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderListViewController.swift
  11. 1 2
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderViewController.swift
  12. 120 0
      RainbowPlanet/RainbowPlanet/Service/Model/OrderModel/OrderListModel.swift
  13. 4 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaServiceCMSApi.swift
  14. 22 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift
  15. 17 6
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaServiceOrderApi.swift

+ 5 - 1
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -303,6 +303,7 @@
 		A7FF1592228C918100A85748 /* OrderRefunddetailsStatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1591228C918100A85748 /* OrderRefunddetailsStatusTableViewCell.swift */; };
 		A7FF1594228C919A00A85748 /* OrderRefunddetailsTipsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1593228C919A00A85748 /* OrderRefunddetailsTipsTableViewCell.swift */; };
 		A7FF1596228CFA8100A85748 /* OrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1595228CFA8100A85748 /* OrderListViewController.swift */; };
+		A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FF1597228D092A00A85748 /* OrderListModel.swift */; };
 		BD1DC6C5228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C3228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift */; };
 		BD1DC6C6228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C4228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift */; };
 		BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */; };
@@ -666,6 +667,7 @@
 		A7FF1591228C918100A85748 /* OrderRefunddetailsStatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderRefunddetailsStatusTableViewCell.swift; sourceTree = "<group>"; };
 		A7FF1593228C919A00A85748 /* OrderRefunddetailsTipsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderRefunddetailsTipsTableViewCell.swift; sourceTree = "<group>"; };
 		A7FF1595228CFA8100A85748 /* OrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderListViewController.swift; sourceTree = "<group>"; };
+		A7FF1597228D092A00A85748 /* OrderListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderListModel.swift; sourceTree = "<group>"; };
 		BD1DC6C3228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceOrder.swift; sourceTree = "<group>"; };
 		BD1DC6C4228CFD0B00B89C57 /* SwiftMoyaServiceOrderApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceOrderApi.swift; sourceTree = "<group>"; };
 		BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCreateParameterModel.swift; sourceTree = "<group>"; };
@@ -1575,9 +1577,9 @@
 		A738D203225AEAD000EEE860 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				A72A73722233966800B21995 /* RootModel */,
 				A71738A922898651000AEA6A /* ShopModel */,
 				A7B4E736228190810012914A /* CommonModel */,
-				A72A73722233966800B21995 /* RootModel */,
 				A7A98E00227E88E8005306E9 /* ProductModel */,
 				BD1DC6C7228D002200B89C57 /* OrderModel */,
 				A79057032276D5FE0037F823 /* ConfigModel */,
@@ -2702,6 +2704,7 @@
 			isa = PBXGroup;
 			children = (
 				BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */,
+				A7FF1597228D092A00A85748 /* OrderListModel.swift */,
 			);
 			path = OrderModel;
 			sourceTree = "<group>";
@@ -3248,6 +3251,7 @@
 				A72A72AF22321DE000B21995 /* AppInfo.swift in Sources */,
 				A7D460942276854500A5A54E /* BaiduToCity2Model.swift in Sources */,
 				A72A72D422321E2700B21995 /* EnumMacro.swift in Sources */,
+				A7FF1598228D092A00A85748 /* OrderListModel.swift in Sources */,
 				A7FF157D228C837100A85748 /* OrderDetailStatusTableViewCell.swift in Sources */,
 				A7A98E41228046C5005306E9 /* ShoppingMallSepcialTableViewCell.swift in Sources */,
 				A70B2C5E22886F4D00B2449F /* ShopViewTableViewCell.swift in Sources */,

+ 61 - 8
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderButtonTableViewCell.swift

@@ -57,14 +57,6 @@ class OrderButtonTableViewCell: UITableViewCell {
         
     }
     
-    private lazy var addressLabel: UILabel = {
-        let addressLabel = UILabel()
-        addressLabel.textColor = kfe352bColor
-        addressLabel.font = kRegularFont13
-        addressLabel.text = "自提地址:碑林区建设西路新城南门柜机"
-        return addressLabel
-    }()
-    
     private lazy var oneButton: UIButton = {
         let oneButton = UIButton(type: UIButton.ButtonType.custom)
         oneButton.cornerRadius = 14
@@ -81,4 +73,65 @@ class OrderButtonTableViewCell: UITableViewCell {
         return twoButton
     }()
 
+    var orderModel: OrderModel? {
+        didSet {
+            if orderModel?.deliverType == 2 { //快递
+                if orderModel?.feedbackStatus == 0 { //未维权
+                    switch orderModel?.status {
+                    case 0: //待付款
+                        oneButton.setTitle("去付款", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        
+                        twoButton.setTitle("取消订单", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                    case 2: //收货
+                        oneButton.setTitle("查看物流", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        
+                        twoButton.setTitle("确认收货", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                    case 6: //已完成
+                        oneButton.setTitle("去评价", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.setTitle("查看物流", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                        
+                    default: 
+                        break
+                    }
+                }else {//1-退款处理中/2-退款完成/3-拒绝退款
+                    switch orderModel?.feedbackStatus {
+                    case 1,2: //1-退款处理中 2-退款完成
+                        oneButton.setTitle("退款详情", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.isHidden = true
+                    case 3: //3-拒绝退款
+                        oneButton.setTitle("退款详情", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.setTitle("查看物流", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                    default:
+                        break
+                    }
+                }
+            }
+        }
+    }
 }

+ 50 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeAndButtonTableViewCell.swift

@@ -66,7 +66,6 @@ class OrderDeliveryModeAndButtonTableViewCell: UITableViewCell {
         let addressLabel = UILabel()
         addressLabel.textColor = kfe352bColor
         addressLabel.font = kRegularFont13
-        addressLabel.text = "自提地址:碑林区建设西路新城南门柜机"
         return addressLabel
     }()
     
@@ -85,5 +84,55 @@ class OrderDeliveryModeAndButtonTableViewCell: UITableViewCell {
         twoButton.titleLabel?.font = kRegularFont14
         return twoButton
     }()
+    
+    var orderModel: OrderModel? {
+        didSet {
+            if orderModel?.deliverType == 1 { //自提
+                addressLabel.text = "自提地址:\(orderModel?.address ?? "")"
+
+                if orderModel?.feedbackStatus == 0 { //未维权
+                    switch orderModel?.status {
+                    case 0: //待付款/已自提/已完成
+                        oneButton.setTitle("去付款", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+
+                        twoButton.setTitle("取消订单", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                    case 5: //已自提
+                        oneButton.setTitle("确认收货", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.isHidden = true
+                        
+                    default: //待发货/待收货/配送中/待自提/已关闭
+                        break
+                    }
+                }else {//1-退款处理中/2-退款完成/3-拒绝退款
+                    switch orderModel?.feedbackStatus {
+                    case 1,2: //1-退款处理中 2-退款完成
+                        oneButton.setTitle("退款详情", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.isHidden = true
+                    case 3: //3-拒绝退款
+                        oneButton.setTitle("退款详情", for: UIControl.State.normal)
+                        oneButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+                        oneButton.backgroundColor = kFFA42FColor
+                        twoButton.setTitle("查看物流", for: UIControl.State.normal)
+                        twoButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+                        twoButton.backgroundColor = UIColor.white
+                        twoButton.layer.borderColor = k333333Color.cgColor
+                        twoButton.layer.borderWidth = 1
+                    default:
+                        break
+                    }
+                }
+            }
+        }
+    }
 
 }

+ 11 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeAndTimeTableViewCell.swift

@@ -64,7 +64,6 @@ class OrderDeliveryModeAndTimeTableViewCell: UITableViewCell {
         deliveryModeLabel.backgroundColor = kf5f5f5Color
         deliveryModeLabel.textColor = k333333Color
         deliveryModeLabel.font = kRegularFont13
-        deliveryModeLabel.text = "  自提  "
         deliveryModeLabel.cornerRadius = 10
         deliveryModeLabel.masksToBounds = true
         return deliveryModeLabel
@@ -83,5 +82,16 @@ class OrderDeliveryModeAndTimeTableViewCell: UITableViewCell {
         lineLabel.backgroundColor = kf5f5f5Color
         return lineLabel
     }()
+    
+    var orderModel: OrderModel? {
+        didSet {
+            if orderModel?.deliverType == 1 { //自提
+                deliveryModeLabel.text = "  自提  "
+            }else if orderModel?.deliverType == 2 { //快递
+                deliveryModeLabel.text = "  快递  "
+            }
+            timeLabel.text = orderModel?.createdAt
+        }
+    }
 
 }

+ 17 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderDeliveryModeTableViewCell.swift

@@ -55,5 +55,21 @@ class OrderDeliveryModeTableViewCell: UITableViewCell {
         addressLabel.text = "自提地址:碑林区建设西路新城南门柜机"
         return addressLabel
     }()
-
+    
+    var orderModel: OrderModel? {
+        didSet {
+            if orderModel?.deliverType == 1 { //自提
+                if orderModel?.feedbackStatus == 0 { //未维权
+                    switch orderModel?.status {
+                    case 1,2,3,4,7: //待发货/待收货/配送中/待自提/已关闭
+                       addressLabel.text = "自提地址:\(orderModel?.address ?? "")"
+                    default: //待付款/已自提/已完成
+                        break
+                    }
+                }else {//1-退款处理中/2-退款完成/3-拒绝退款
+                    
+                }
+            }
+        }
+    }
 }

+ 4 - 37
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderListView.swift

@@ -12,6 +12,10 @@ class OrderListView: BaseView {
 
     override func setupViews() {
         addSubview(tableView)
+        let emptyView =  EmptyView.shared.diyCustomEmptyViewStyle2(iconStr: "page04", titleStr: "当前暂无数据")
+        emptyView.contentViewY = kScaleValue(value: 182)
+        tableView.ly_emptyView = emptyView
+        tableView.ly_startLoading()
         
     }
     
@@ -25,8 +29,6 @@ class OrderListView: BaseView {
         let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
         tableView.separatorStyle = .none
         tableView.backgroundColor = kf7f8faColor
-        tableView.dataSource = self
-        tableView.delegate = self
         tableView.estimatedRowHeight = 0.000001
         tableView.estimatedSectionFooterHeight = 0.000001
         tableView.estimatedSectionHeaderHeight = 0.000001
@@ -35,38 +37,3 @@ class OrderListView: BaseView {
 
 }
 
-extension OrderListView : UITableViewDelegate, UITableViewDataSource {
-    func numberOfSections(in tableView: UITableView) -> Int {
-
-        return 0
-    }
-    
-    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return 0
-    }
-    
-    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        return UITableViewCell()
-    }
-    
-    
-    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        return UITableView.automaticDimension
-    }
-    
-    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
-        return 10
-    }
-    
-    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
-        return nil
-    }
-    
-    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
-        return 0
-    }
-    
-    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
-        return nil
-    }
-}

+ 12 - 6
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderProductTableViewCell.swift

@@ -10,7 +10,7 @@ import UIKit
 
 class OrderProductTableViewCell: UITableViewCell {
 
-    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> UITableViewCell {
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderProductTableViewCell {
         let ID = "OrderProductTableViewCell"
         tableView.register(OrderProductTableViewCell.self, forCellReuseIdentifier: ID)
         let cell : OrderProductTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! OrderProductTableViewCell
@@ -91,7 +91,6 @@ class OrderProductTableViewCell: UITableViewCell {
     
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
-        titleLabel.text = "果雪语 眉山脐橙4斤装 新鲜脐"
         titleLabel.textColor = k333333Color
         titleLabel.font = kBoldFont14
         return titleLabel
@@ -99,7 +98,6 @@ class OrderProductTableViewCell: UITableViewCell {
     
     private lazy var timeLabel: UILabel = {
         let timeLabel = UILabel()
-        timeLabel.text = "预计配送时间:次日达"
         timeLabel.textColor = k666666Color
         timeLabel.font = kRegularFont12
         return timeLabel
@@ -107,7 +105,6 @@ class OrderProductTableViewCell: UITableViewCell {
     
     private lazy var skuLabel: UILabel = {
         let skuLabel = UILabel()
-        skuLabel.text = "规格:3个装"
         skuLabel.textColor = k999999Color
         skuLabel.font = kRegularFont12
         return skuLabel
@@ -115,7 +112,6 @@ class OrderProductTableViewCell: UITableViewCell {
     
     private lazy var priceLabel: UILabel = {
         let priceLabel = UILabel()
-        priceLabel.text = "¥258"
         priceLabel.textColor = k333333Color
         priceLabel.font = kRegularFont14
         return priceLabel
@@ -123,7 +119,6 @@ class OrderProductTableViewCell: UITableViewCell {
     
     private lazy var numberLabel: UILabel = {
         let numberLabel = UILabel()
-        numberLabel.text = "x1"
         numberLabel.textColor = k999999Color
         numberLabel.font = kRegularFont13
         return numberLabel
@@ -134,4 +129,15 @@ class OrderProductTableViewCell: UITableViewCell {
         lineLabel.backgroundColor = kf5f5f5Color
         return lineLabel
     }()
+    
+    var orderModelDetailModel: OrderModelDetailModel? {
+        didSet {
+            productImageView.kf.setImage(with: kURLImage(name: orderModelDetailModel?.productImg ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+            titleLabel.text = orderModelDetailModel?.productName
+            timeLabel.text = "预计配送时间:\(orderModelDetailModel?.receiveTime ?? "")"
+            skuLabel.text = "规格:\(orderModelDetailModel?.skuName ?? "")"
+            priceLabel.text = "¥\(orderModelDetailModel?.productPrice ?? 0)"
+            numberLabel.text = "x\(orderModelDetailModel?.amount ?? 0)"
+        }
+    }
 }

+ 55 - 4
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderShopAndStatusTableViewCell.swift

@@ -10,7 +10,7 @@ import UIKit
 
 class OrderShopAndStatusTableViewCell: UITableViewCell {
 
-    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> UITableViewCell {
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderShopAndStatusTableViewCell {
         let ID = "OrderShopAndStatusTableViewCell"
         tableView.register(OrderShopAndStatusTableViewCell.self, forCellReuseIdentifier: ID)
         let cell : OrderShopAndStatusTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! OrderShopAndStatusTableViewCell
@@ -70,9 +70,7 @@ class OrderShopAndStatusTableViewCell: UITableViewCell {
     
     private lazy var statusLabel: UILabel = {
         let statusLabel = UILabel()
-        statusLabel.text = "订单状态"
         statusLabel.font = kRegularFont14
-        statusLabel.textColor = kFFA42FColor
         return statusLabel
     }()
     
@@ -81,5 +79,58 @@ class OrderShopAndStatusTableViewCell: UITableViewCell {
         lineLabel.backgroundColor = kf5f5f5Color
         return lineLabel
     }()
-
+    
+    var orderModel: OrderModel? {
+        didSet {
+            shopButton.setTitle(orderModel?.shopName ?? "", for: UIControl.State.normal)
+            shopButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 5)
+            if orderModel?.feedbackStatus == 0 { //未维权
+                switch orderModel?.status {
+                case 0: //待付款
+                     statusLabel.text = "待付款"
+                     statusLabel.textColor = kFFA42FColor
+                    break
+                case 1: //待发货
+                    statusLabel.text = "待发货"
+                    statusLabel.textColor = kFFA42FColor
+                case 2: //已发货/待收货
+                    statusLabel.text = "待收货"
+                    statusLabel.textColor = k333333Color
+                case 3: //配送中
+                    statusLabel.text = "配送中"
+                    statusLabel.textColor = kFFA42FColor
+                case 4: //待自提
+                    statusLabel.text = "待自提"
+                    statusLabel.textColor = kFFA42FColor
+                case 5: //已自提
+                    statusLabel.text = "已自提"
+                    statusLabel.textColor = k333333Color
+                    
+                case 6: //已完成
+                    statusLabel.text = "已完成"
+                    statusLabel.textColor = k333333Color
+                case 7: //已关闭
+                    statusLabel.text = "已关闭"
+                    statusLabel.textColor = k333333Color
+                    
+                default:
+                    break
+                }
+            }else {
+                switch orderModel?.feedbackStatus {
+                case 1: //1-退款处理中
+                    statusLabel.text = "退款中"
+                    statusLabel.textColor = kFFA42FColor
+                case 2: //2-退款完成
+                    statusLabel.text = "退款完成"
+                    statusLabel.textColor = k333333Color
+                case 3: //3-拒绝退款
+                    statusLabel.text = "退款失败"
+                    statusLabel.textColor = k333333Color
+                default:
+                    break
+                }
+            }
+        }
+    }
 }

+ 12 - 6
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/View/OrderTotalAmountTableViewCell.swift

@@ -10,7 +10,7 @@ import UIKit
 
 class OrderTotalAmountTableViewCell: UITableViewCell {
     
-    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> UITableViewCell {
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderTotalAmountTableViewCell {
         let ID = "OrderTotalAmountTableViewCell"
         tableView.register(OrderTotalAmountTableViewCell.self, forCellReuseIdentifier: ID)
         let cell : OrderTotalAmountTableViewCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! OrderTotalAmountTableViewCell
@@ -73,11 +73,6 @@ class OrderTotalAmountTableViewCell: UITableViewCell {
         let numberLabel = UILabel()
         numberLabel.textColor = k999999Color
         numberLabel.font = kRegularFont14
-        let str = "共1件商品,合计"
-        let attributedString = NSMutableAttributedString.init(string: str)
-        let range = str.range(of: "1")
-        attributedString.changeForegroundColor(k333333Color, range: NSRange(range!, in: "1"))
-        numberLabel.attributedText = attributedString
         return numberLabel
     }()
     
@@ -86,5 +81,16 @@ class OrderTotalAmountTableViewCell: UITableViewCell {
         lineLabel.backgroundColor = kf5f5f5Color
         return lineLabel
     }()
+    
+    var orderModel: OrderModel? {
+        didSet {
+            moneyLabel.text = "\(orderModel?.realPrice ?? 0)"
+            let str = "共\(orderModel?.amount ?? 0)件商品,合计"
+            let attributedString = NSMutableAttributedString.init(string: str)
+            let range = str.range(of: "\(orderModel?.amount ?? 0)")
+            attributedString.changeForegroundColor(k333333Color, range: NSRange(range!, in: "\(orderModel?.amount ?? 0)"))
+            numberLabel.attributedText = attributedString
+        }
+    }
 
 }

+ 220 - 0
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderListViewController.swift

@@ -11,6 +11,9 @@ import JXSegmentedView
 
 class OrderListViewController: UIViewController {
 
+    var orderVCType : OrderVCType?
+    var orderModelArray = Array<OrderModel>()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -29,16 +32,233 @@ class OrderListViewController: UIViewController {
     }
     
     func setupData() {
+        orderListView.tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
+            [weak self] (page) in
+            self?.orderPurchaseOrderListApi(page: page)
+        }
+        orderListView.tableView.addFooterWithWithHeader(withAutomaticallyRefresh: true) {
+            [weak self] (page) in
+            self?.orderPurchaseOrderListApi(page: page)
+        }
         
     }
     
+    func orderPurchaseOrderListApi(page:Int = 1) {
+        SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseOrderListApi(page: page, status: orderVCType.map { $0.rawValue } ?? -1) {
+            [weak self] (orderListModel) -> (Void) in
+            let orderListModel = orderListModel as? OrderListModel
+            if orderListModel?.pagination?.currentPage ?? 1  <= orderListModel?.pagination?.totalPages ?? 1 {
+                if orderListModel?.pagination?.currentPage == 1{
+                    self?.orderModelArray.removeAll()
+                    self?.orderListView.tableView.resetNoMoreData()
+                }
+                self?.orderModelArray = (self?.orderModelArray)! + (orderListModel?.data!)!
+                self?.orderListView.tableView.reloadData()
+            }else {
+                self?.orderListView.tableView.endFooterNoMoreData()
+            }
+        }
+    }
+    
     private lazy var orderListView: OrderListView = {
         let orderListView = OrderListView()
+        orderListView.tableView.dataSource = self
+        orderListView.tableView.delegate = self
         return orderListView
     }()
+}
 
+extension OrderListViewController : UITableViewDelegate, UITableViewDataSource {
+    func numberOfSections(in tableView: UITableView) -> Int {
+        
+        return orderModelArray.isEmpty ? 0 : orderModelArray.count
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        let orderModel = orderModelArray[section]
+        
+        
+        if !(orderModel.detail?.isEmpty ?? true) {
+            switch orderModel.deliverType {
+            case 1: //自提
+                if orderModel.feedbackStatus == 0 { //未维权
+                    switch orderModel.status {
+                    case 0: //待付款
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 1: //待发货
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 2: //已发货/待收货
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 3: //配送中
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 4: //待自提
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 5: //已自提
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 6: //已完成
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 7: //已关闭
+                        return 4 + (orderModel.detail?.count ?? 0)
+                        
+                    default:
+                        return 0
+                    }
+                }else {
+                    switch orderModel.feedbackStatus {
+                    case 1: //1-退款处理中
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 2: //2-退款完成
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 3: //3-拒绝退款
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    default:
+                        return 0
+                    }
+                }
+               
+            case 2: //快递
+                if orderModel.feedbackStatus == 0 { //未维权
+                    switch orderModel.status {
+                    case 0: //待付款
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 1: //待发货
+                        return 3 + (orderModel.detail?.count ?? 0)
+                    case 2: //已发货/待收货
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 3: //配送中
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 4: //待自提
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 5: //已自提
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 6: //已完成
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 7: //已关闭
+                         return 3 + (orderModel.detail?.count ?? 0)
+                    default:
+                        return 0
+                    }
+                }else {
+                    switch orderModel.feedbackStatus {
+                    case 1: //1-退款处理中
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 2: //2-退款完成
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    case 3: //3-拒绝退款
+                        return 4 + (orderModel.detail?.count ?? 0)
+                    default:
+                        return 0
+                    }
+                }
+            default:
+                return 0
+            }
+        }else {
+            return 0
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        switch indexPath.row {
+        case 0:
+            let cell = OrderShopAndStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.orderModel = orderModelArray[indexPath.section]
+            return cell
+        case 1:
+            let cell = OrderDeliveryModeAndTimeTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.orderModel = orderModelArray[indexPath.section]
+            return cell
+        case orderModelArray.count + 2:
+            let cell = OrderTotalAmountTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.orderModel = orderModelArray[indexPath.section]
+            return cell
+        case orderModelArray.count + 3:
+            let orderModel = orderModelArray[indexPath.section]
+            switch orderModel.deliverType {
+            case 1: //自提
+                if orderModel.feedbackStatus == 0 { //未维权
+                    switch orderModel.status {
+                    case 0,5: //待付款/已自提/已完成
+                        let cell = OrderDeliveryModeAndButtonTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                        return cell
+                    case 1,4,7: //待发货/待自提/已关闭
+                        let cell = OrderDeliveryModeTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                        return cell
+                    case 2,3: //待收货/配送中
+                        let cell = OrderButtonTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                        return cell
+                    default:
+                        return UITableViewCell()
+                    }
+                }else {
+                    let cell = OrderDeliveryModeAndButtonTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                    return cell
+                }
+                
+            case 2: //快递
+                if orderModel.feedbackStatus == 0 { //未维权
+                    switch orderModel.status {
+                    case 0,2,3,6: //待付款/待收货//配送中
+                        let cell = OrderButtonTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                        return cell
+                    case 1,4,5,7: //待发货//待自提//已自提/已关闭
+                        return UITableViewCell()
+                    default:
+                        return UITableViewCell()
+                    }
+                }else {
+                    let cell = OrderButtonTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                    return cell
+                }
+            default:
+                return UITableViewCell()
+            }
+        default:
+            let cell = OrderProductTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+            let orderModel = orderModelArray[indexPath.section]
+            if !(orderModel.detail?.isEmpty ?? true) {
+                cell.orderModelDetailModel = orderModel.detail?[indexPath.row-2]
+            }
+            return cell
+            
+        }
+    }
+    
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        switch indexPath.row {
+        case 0:
+            return 48
+        case 1:
+           return 40
+        case orderModelArray.count + 2:
+            return 40
+        case orderModelArray.count + 3:
+            return UITableView.automaticDimension
+        default:
+            return 108
+        }
+        
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 10
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0
+    }
+    
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return nil
+    }
 }
 
+
 extension OrderListViewController : JXSegmentedListContainerViewListDelegate {
     func listView() -> UIView {
         return view

+ 1 - 2
RainbowPlanet/RainbowPlanet/Modules/OrderModule/Order/ViewController/OrderViewController.swift

@@ -144,8 +144,7 @@ extension OrderViewController :JXSegmentedListContainerViewDataSource {
     }
     func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
         let vc = OrderListViewController()
-//        let cmsTemplateModel = cmsTemplateModels![index]
-//        vc.shoppingMallListVCType = cmsTemplateModel.applyType ?? 0
+        vc.orderVCType = orderVCType
         return vc
     }
 }

+ 120 - 0
RainbowPlanet/RainbowPlanet/Service/Model/OrderModel/OrderListModel.swift

@@ -0,0 +1,120 @@
+//
+//	OrderListModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class OrderListModel : NSObject, Mappable{
+
+	var data : [OrderModel]?
+	var pagination : PaginationModel?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return OrderListModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		data <- map["data"]
+		pagination <- map["pagination"]
+		
+	}
+}
+
+class OrderModel : NSObject, Mappable{
+    
+    var address : String?
+    var amount : Int?
+    var createdAt : String?
+    var deliverType : Int?
+    var detail : [OrderModelDetailModel]?
+    var feedbackStatus : Int?
+    var id : Int?
+    var patchNum : String?
+    var purchaseNo : String?
+    var realPrice : Int?
+    var refundNo : String?
+    var shopId : Int?
+    var shopName : String?
+    var status : Int?
+    var transPrice : Int?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return OrderModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        address <- map["address"]
+        amount <- map["amount"]
+        createdAt <- map["created_at"]
+        deliverType <- map["deliver_type"]
+        detail <- map["detail"]
+        feedbackStatus <- map["feedback_status"]
+        id <- map["id"]
+        patchNum <- map["patch_num"]
+        purchaseNo <- map["purchase_no"]
+        realPrice <- map["real_price"]
+        refundNo <- map["refund_no"]
+        shopId <- map["shop_id"]
+        shopName <- map["shop_name"]
+        status <- map["status"]
+        transPrice <- map["trans_price"]
+        
+    }
+    
+}
+
+class OrderModelDetailModel : NSObject, Mappable{
+    
+    var amount : Int?
+    var categoryName1 : String?
+    var categoryName2 : String?
+    var categoryName3 : String?
+    var feedbackStatus : Int?
+    var id : Int?
+    var productId : Int?
+    var productImg : String?
+    var productName : String?
+    var productPrice : Int?
+    var realPrice : Int?
+    var receiveTime : String?
+    var skuId : Int?
+    var skuName : String?
+    var status : Int?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return OrderModelDetailModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        amount <- map["amount"]
+        categoryName1 <- map["category_name1"]
+        categoryName2 <- map["category_name2"]
+        categoryName3 <- map["category_name3"]
+        feedbackStatus <- map["feedback_status"]
+        id <- map["id"]
+        productId <- map["product_id"]
+        productImg <- map["product_img"]
+        productName <- map["product_name"]
+        productPrice <- map["product_price"]
+        realPrice <- map["real_price"]
+        receiveTime <- map["receive_time"]
+        skuId <- map["sku_id"]
+        skuName <- map["sku_name"]
+        status <- map["status"]
+        
+    }
+}

+ 4 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCMS/SwiftMoyaServiceCMSApi.swift

@@ -59,11 +59,13 @@ extension SwiftMoyaServiceCMSApi: TargetType {
     
     public var method: Moya.Method {
         switch self {
+        case .cmsTemplateSetPreview
+            :
+            return .post
         case .cmsTemplateSetTemplateName,
-             .cmsTemplateSetPreview,
              .cmsTemplateSetProductList
             :
-            return .post
+            return .get
         }
     }
     

+ 22 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaNetWorkServiceOrder.swift

@@ -122,5 +122,27 @@ class SwiftMoyaNetWorkServiceOrder: NSObject {
                 completion(productSearchListModel)
         }
     }
+
+    // MARK: - 前台订单列表
+    /// 前台订单列表
+    ///
+    /// - Parameters:
+    ///   - status: 订单状态
+    ///   - completion: 回调
+    func orderPurchaseOrderListApi(page:Int = 1,status:Int = -1,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        
+        if status == -1 {
+            parameters.updateValue("", forKey: "search_status")
+        }else {
+            parameters.updateValue(status, forKey: "search_status")
+        }
+        parameters.updateValue(page, forKey: "page")
+         SwiftMoyaNetWorkManager.shared().request(OrderListModel.self,target: MultiTarget(SwiftMoyaServiceOrderApi.orderPurchaseOrderList(parameters: parameters))) { (orderListModel) in
+            SwiftProgressHUD.shared().hide()
+            completion(orderListModel)
+        }
+
+    }
         
 }

+ 17 - 6
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceOrder/SwiftMoyaServiceOrderApi.swift

@@ -13,18 +13,25 @@ import Moya
 /// 搜索、列表、热销
 public let kOrderCreateApi = "/order/purchase/create"
 
+// MARK: - 前台订单列表
+/// 前台订单列表
+public let kOrderPurchaseOrderListApi = "/order/purchase/orderList"
+
 /// 商品
 ///
 /// - productSearch: 搜索、列表、热销
+/// - orderPurchaseOrderList: 搜索、列表、热销
 public enum SwiftMoyaServiceOrderApi {
     case orderCreate(parameters:Dictionary<String, Any>)
+    case orderPurchaseOrderList(parameters:Dictionary<String, Any>)
 }
 
 extension SwiftMoyaServiceOrderApi: TargetType {
     
     public var baseURL: URL {
         switch self {
-        case .orderCreate
+        case .orderCreate,
+             .orderPurchaseOrderList
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -34,6 +41,8 @@ extension SwiftMoyaServiceOrderApi: TargetType {
         switch self {
         case .orderCreate:
             return kOrderCreateApi
+        case .orderPurchaseOrderList:
+            return kOrderPurchaseOrderListApi
         }
     }
     
@@ -47,9 +56,9 @@ extension SwiftMoyaServiceOrderApi: TargetType {
 //             .productCartAllSel
 //            :
 //            return .put
-//        case .productSearch,
-//            :
-//            return .get
+        case .orderPurchaseOrderList
+            :
+            return .get
 //        case .productCartDelete
 //            :
 //            return .delete
@@ -59,7 +68,8 @@ extension SwiftMoyaServiceOrderApi: TargetType {
     // MARK: - 请求任务事件(这里附带上参数)
     public var task: Task {
         switch self {
-        case .orderCreate(var parameters)
+        case .orderCreate(var parameters),
+             .orderPurchaseOrderList(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -82,7 +92,8 @@ extension SwiftMoyaServiceOrderApi: TargetType {
     public var headers: [String : String]? {
         //同task,具体选择看后台 有application/x-www-form-urlencoded 、application/json
         switch self {
-        case .orderCreate
+        case .orderCreate,
+             .orderPurchaseOrderList
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
         }