Переглянути джерело

Merge branch 'develop' into feature/nanxinlin

南鑫林 6 роки тому
батько
коміт
ff39b3dc8a
14 змінених файлів з 284 додано та 46 видалено
  1. 4 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 3 2
      RainbowPlanet/RainbowPlanet/Modules/CommonModules/PickView/PickHeaderView.swift
  3. 1 1
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundPhotoCell.swift
  4. 16 6
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundReasonCell.swift
  5. 30 4
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/ViewController/OrderApplyRefundController.swift
  6. 15 8
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/View/OrderCommentAddImgCollectionCell.swift
  7. 33 15
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/View/OrderCommentTableViewCell.swift
  8. 53 1
      RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/ViewController/OrderCommentController.swift
  9. 29 0
      RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductRefundReasonModel.swift
  10. 34 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift
  11. 22 3
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaServiceConfigApi.swift
  12. 14 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaNetWorkServiceProduct.swift
  13. 29 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaServiceProductApi.swift
  14. 1 1
      RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

+ 4 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -341,6 +341,7 @@
 		BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */; };
 		BDD4FB1422840954006FE833 /* ShoppingCartOrderPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */; };
 		BDD4FB1722840DD3006FE833 /* OrderPayAcountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDD4FB1622840DD3006FE833 /* OrderPayAcountView.swift */; };
+		BDDF3B28228EBB72003A7D16 /* ProductRefundReasonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDDF3B27228EBB72003A7D16 /* ProductRefundReasonModel.swift */; };
 		BDE3045D22851E4F001D050F /* ProductCartListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDE3045C22851E4F001D050F /* ProductCartListModel.swift */; };
 		BDE3045F228554CA001D050F /* ProductCartAmountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDE3045E228554CA001D050F /* ProductCartAmountModel.swift */; };
 		BDEF7791228571DC00ED0AC0 /* CommonPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEF7790228571DC00ED0AC0 /* CommonPayView.swift */; };
@@ -731,6 +732,7 @@
 		BDD4FB1122840597006FE833 /* ShoppingCartPayOrderController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartPayOrderController.swift; sourceTree = "<group>"; };
 		BDD4FB1322840954006FE833 /* ShoppingCartOrderPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartOrderPayView.swift; sourceTree = "<group>"; };
 		BDD4FB1622840DD3006FE833 /* OrderPayAcountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderPayAcountView.swift; sourceTree = "<group>"; };
+		BDDF3B27228EBB72003A7D16 /* ProductRefundReasonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductRefundReasonModel.swift; sourceTree = "<group>"; };
 		BDE3045C22851E4F001D050F /* ProductCartListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductCartListModel.swift; sourceTree = "<group>"; };
 		BDE3045E228554CA001D050F /* ProductCartAmountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductCartAmountModel.swift; sourceTree = "<group>"; };
 		BDEF7790228571DC00ED0AC0 /* CommonPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonPayView.swift; sourceTree = "<group>"; };
@@ -2226,6 +2228,7 @@
 				BDE3045C22851E4F001D050F /* ProductCartListModel.swift */,
 				BDE3045E228554CA001D050F /* ProductCartAmountModel.swift */,
 				A71738AC228AB7B2000AEA6A /* ProductCommentListModel.swift */,
+				BDDF3B27228EBB72003A7D16 /* ProductRefundReasonModel.swift */,
 			);
 			path = ProductModel;
 			sourceTree = "<group>";
@@ -3324,6 +3327,7 @@
 				A7284A7322546460000BAEC4 /* SwiftMoyaServicePayApi.swift in Sources */,
 				BDE3045D22851E4F001D050F /* ProductCartListModel.swift in Sources */,
 				A7A98DFF227E8501005306E9 /* SwiftMoyaNetWorkServiceProduct.swift in Sources */,
+				BDDF3B28228EBB72003A7D16 /* ProductRefundReasonModel.swift in Sources */,
 				A7CC74DC2270352F003C4F38 /* MineOrderCollectionViewCell.swift in Sources */,
 				BDD4FB1222840597006FE833 /* ShoppingCartPayOrderController.swift in Sources */,
 				A7284404224DBFBD00F82F30 /* UserModel.swift in Sources */,

+ 3 - 2
RainbowPlanet/RainbowPlanet/Modules/CommonModules/PickView/PickHeaderView.swift

@@ -23,12 +23,10 @@ class PickHeaderView: BaseView {
         }
         cancleButton.snp.makeConstraints { (make) in
             make.centerY.equalToSuperview()
-            make.size.equalTo(kScaleWidth * 30)
             make.left.equalTo(kScaleWidth * 7)
         }
         sureButton.snp.makeConstraints { (make) in
             make.centerY.equalToSuperview()
-            make.size.equalTo(kScaleWidth * 30)
             make.right.equalTo(kScaleWidth * -7)
         }
     }
@@ -41,12 +39,15 @@ class PickHeaderView: BaseView {
     lazy var cancleButton: UIButton = {
         let cancleButton = UIButton(type: UIButton.ButtonType.custom)
         cancleButton.setTitle("取消", for: UIControl.State.normal)
+        cancleButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         return cancleButton
     }()
     
     lazy var sureButton: UIButton = {
         let sureButton = UIButton(type: UIButton.ButtonType.custom)
         sureButton.setTitle("完成", for: UIControl.State.normal)
+        sureButton.setTitleColor(k333333Color, for: UIControl.State.normal)
+
 
         return sureButton
     }()

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundPhotoCell.swift

@@ -165,7 +165,7 @@ extension OrderApplyRefundPhotoCell: UICollectionViewDelegateFlowLayout,UICollec
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
-        return UIEdgeInsets(top: 10, left: 15, bottom: 0, right: 15)
+        return UIEdgeInsets(top: 10, left: 15, bottom: 20, right: 15)
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

+ 16 - 6
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/View/OrderApplyRefundReasonCell.swift

@@ -13,6 +13,18 @@ class OrderApplyRefundReasonCell: UITableViewCell {
     
     let disposeBag = DisposeBag()
     
+    typealias ReasonBlock = () -> Void
+    var reasonBlock : ReasonBlock?
+    
+    // 选中の退款原因
+    var selRefundReason: String? {
+        didSet {
+            if self.selRefundReason?.count ?? 0 > 0 {
+                chooseBtn.setTitle(self.selRefundReason, for: UIControl.State.normal)
+            }
+        }
+    }
+    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderApplyRefundReasonCell {
         let ID = "OrderApplyRefundReasonCell"
         tableView.register(OrderApplyRefundReasonCell.self, forCellReuseIdentifier: ID)
@@ -54,7 +66,7 @@ class OrderApplyRefundReasonCell: UITableViewCell {
         chooseBtn.snp.makeConstraints { (make) in
             make.right.equalToSuperview().offset(-14)
             make.centerY.equalTo(titleLabel)
-            make.width.equalTo(54)
+            make.left.greaterThanOrEqualTo(titleLabel.snp_right).offset(35)
             make.height.equalTo(30)
         }
         chooseBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.right, imageTitleSpace: 4)
@@ -76,11 +88,9 @@ class OrderApplyRefundReasonCell: UITableViewCell {
         chooseBtn.setImage(kImage(name: "my_arrows_unfold"), for: UIControl.State.normal)
         chooseBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
             chooseBtn.isSelected = !chooseBtn.isSelected
-            //            if let allSelectBlock = self?.allSelectBlock {
-            //                let isAllSel: Int = chooseBtn.isSelected == true ? 1 : 0
-            //                allSelectBlock(isAllSel)
-            //            }
-            print("点击了--选择")
+                if let reasonBlock = self?.reasonBlock {
+                    reasonBlock()
+                }            
         }).disposed(by: disposeBag)
         return chooseBtn
     }()

+ 30 - 4
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderApplyRefund/ViewController/OrderApplyRefundController.swift

@@ -13,6 +13,11 @@ class OrderApplyRefundController: BaseViewController {
     
     var orderModel: OrderModel?
     
+    // 退款原因数组
+    var refundReasonArr: Array<String>?
+    // 选中の退款原因
+    var selRefundReason: String?
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -54,7 +59,7 @@ class OrderApplyRefundController: BaseViewController {
     }
     
     override func setupData() {
-        
+        self.refundReasonApi()
     }
     
     lazy var tableView: UITableView = {
@@ -105,6 +110,16 @@ extension OrderApplyRefundController : UITableViewDelegate, UITableViewDataSourc
             }
         case 1:
             let reasonCell = OrderApplyRefundReasonCell.cellWith(tableView: tableView, indexPath: indexPath)
+            reasonCell.selRefundReason = self.selRefundReason
+            reasonCell.reasonBlock = {
+                [weak self] in
+                AlertSheetView.sheetPickViewOneComponentsView(titles: self!.refundReasonArr ?? [], title: "", height: 250, sureClosure: { (row, value) in                    
+                    self?.selRefundReason = value
+                    // 刷新cell
+                    let indexPath = IndexPath(item: indexPath.row, section: indexPath.section)
+                    self?.tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
+                })
+            }
             return reasonCell
         case 2:
             let phoneCell = OrderApplyRefundPhoneCell.cellWith(tableView: tableView, indexPath: indexPath)
@@ -114,10 +129,10 @@ extension OrderApplyRefundController : UITableViewDelegate, UITableViewDataSourc
             return noteCell
         case 4:
             let photoCell = OrderApplyRefundPhotoCell.cellWith(tableView: tableView, indexPath: indexPath)
-            photoCell.frame = tableView.frame
-            photoCell.setNeedsLayout()
-            photoCell.reloadData()
             photoCell.imgCount = 0
+            photoCell.frame = tableView.bounds
+            photoCell.layoutIfNeeded()
+            photoCell.reloadData()
             return photoCell
         default:
             return UITableViewCell()
@@ -145,3 +160,14 @@ extension OrderApplyRefundController : UITableViewDelegate, UITableViewDataSourc
     }
     
 }
+
+// MARK: - 逻辑处理
+extension OrderApplyRefundController {
+    /// 获取退款原因
+    func refundReasonApi() {
+        SwiftMoyaNetWorkServiceProduct.shared().productRefundReasonApi { [weak self] (refundModel) -> (Void) in
+            let refundModel = refundModel as! ProductRefundReasonModel
+            self?.refundReasonArr = refundModel.refundReason
+        }
+    }
+}

+ 15 - 8
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/View/OrderCommentAddImgCollectionCell.swift

@@ -4,7 +4,7 @@
 //
 //  Created by Christopher on 2019/5/17.
 //  Copyright © 2019 RainbowPlanet. All rights reserved.
-//  添加照片のCell(有图)(85*85)
+//  添加照片のCell(有图)
 
 import UIKit
 import RxSwift
@@ -13,13 +13,21 @@ class OrderCommentAddImgCollectionCell: UICollectionViewCell {
     
     let disposeBag = DisposeBag()
     
+    var showImage: UIImage? {
+        didSet {
+            if self.showImage != nil {
+                picImageView.image = self.showImage
+            }
+        }
+    }
+    
     var productSearchModel: ProductSearchModel? {
         didSet {
             picImageView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))            
         }
     }
     
-    typealias DelPicBlock = (_ productSearchModel: ProductSearchModel?,_ indexPath:IndexPath?) -> Void
+    typealias DelPicBlock = (_ idxRow:Int?) -> Void
     var delPicBlock : DelPicBlock?
     
     class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> OrderCommentAddImgCollectionCell {
@@ -61,7 +69,7 @@ class OrderCommentAddImgCollectionCell: UICollectionViewCell {
     private func setupLayouts() {
         imgBackView.snp.makeConstraints { (make) in
             make.left.bottom.equalToSuperview()
-            make.size.equalTo(76)
+            make.size.equalTo((kScreenWidth-30-5*3)/4-9)
         }
         picImageView.snp.makeConstraints { (make) in
             make.edges.equalToSuperview()
@@ -87,11 +95,10 @@ class OrderCommentAddImgCollectionCell: UICollectionViewCell {
         delButton.setImage(kImage(name: "common_sku_cancel"), for: UIControl.State.normal)
         delButton.rx.tap.subscribe(onNext: {
             [weak self] (data) in
-//            if let delPicBlock = self?.delPicBlock {
-//                delPicBlock(self?.productSearchModel,self?.indexPath)
-//            }
-            print("点击删除图片")
-            
+            let idxPath = self?.indexPath as! IndexPath
+            if let delPicBlock = self?.delPicBlock {
+                delPicBlock(idxPath.row)
+            }
         }).disposed(by: disposeBag)
         return delButton
     }()

+ 33 - 15
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/View/OrderCommentTableViewCell.swift

@@ -13,6 +13,19 @@ class OrderCommentTableViewCell: UITableViewCell {
     
     private let maxImageCount: Int = 6
     
+    typealias ChoosePicBlock = () -> Void
+    var choosePicBlock : ChoosePicBlock?
+    
+    typealias DelPicTransBlock = (_ idxRow:Int?) -> Void
+    var delPicTransBlock : DelPicTransBlock?
+    
+    var imgCount: Int = 0
+    var goodsImageArr: Array<UIImage>? {
+        didSet {
+            imgCount = self.goodsImageArr?.count ?? 0
+        }
+    }
+    
     var productMdl : ProductModel? {
         didSet {
             // 商品图片
@@ -24,11 +37,6 @@ class OrderCommentTableViewCell: UITableViewCell {
         }
     }
     
-    var imgCount: Int? {
-        didSet {
-            
-        }
-    }
     
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> OrderCommentTableViewCell {
         let ID = "OrderCommentTableViewCell"
@@ -181,22 +189,31 @@ extension OrderCommentTableViewCell: UICollectionViewDelegateFlowLayout,UICollec
     }
     
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        if imgCount! < maxImageCount {
-            return imgCount!+1
+        if imgCount < maxImageCount {
+            return imgCount+1
         } else {
             return maxImageCount
         }
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-        if imgCount! < maxImageCount && indexPath.row == imgCount {
+        if imgCount < maxImageCount && indexPath.row == imgCount {
             // 添加图片
-            let cell = OrderCommentDefaultCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-            return cell
+            let aCell = OrderCommentDefaultCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+            return aCell
         } else {
             // 展示图片
-            let cell = OrderCommentAddImgCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
-            return cell
+            let pCell = OrderCommentAddImgCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+            if indexPath.row < imgCount {
+                pCell.showImage = self.goodsImageArr![indexPath.row]
+            }
+            pCell.delPicBlock = {
+                [weak self] (idxRow) in
+                if let delPicTransBlock = self?.delPicTransBlock {
+                    delPicTransBlock(idxRow)
+                }                
+            }
+            return pCell
         }
     }
     
@@ -209,9 +226,10 @@ extension OrderCommentTableViewCell: UICollectionViewDelegateFlowLayout,UICollec
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {        
-        if imgCount! < maxImageCount && indexPath.row == imgCount {
-            // 添加图片
-            print("点击添加图片")
+        if imgCount < maxImageCount && indexPath.row == imgCount {
+            if let choosePicBlock = self.choosePicBlock {
+                choosePicBlock()
+            }
         }
     }
     

+ 53 - 1
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/ViewController/OrderCommentController.swift

@@ -11,6 +11,8 @@ import RxSwift
 
 class OrderCommentController: BaseViewController {
     
+    var goodsImageArr = Array<UIImage>()
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -77,7 +79,41 @@ extension OrderCommentController : UITableViewDelegate, UITableViewDataSource {
     
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         let commentCell = OrderCommentTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-        commentCell.imgCount = 3
+        commentCell.goodsImageArr = self.goodsImageArr
+        commentCell.frame = tableView.bounds
+        commentCell.layoutIfNeeded()
+        commentCell.reloadData()
+        commentCell.choosePicBlock = {
+            [weak self] in
+            // 添加图片            
+            UIAlertController.showConfirmActionSheet(camera: { (action) in
+                PhotoAndCameraManager.shared().authorizeCamera()
+                PhotoAndCameraManager.shared().photoAndCameraManagerImageBlock = { [weak self] (image) in
+                    if self?.goodsImageArr.count ?? 0 < 6 {
+                        self?.goodsImageArr.append(image)
+                        self?.tableView.reloadData()
+                    } else {
+                        print("------超过最大数量")
+                    }
+                    
+                }
+            }) { (action) in
+                PhotoAndCameraManager.shared().authorizePhoto()
+                PhotoAndCameraManager.shared().photoAndCameraManagerImageBlock = { [weak self] (image) in
+                    if self?.goodsImageArr.count ?? 0 < 6 {
+                        self?.goodsImageArr.append(image)
+                        self?.tableView.reloadData()
+                    } else {
+                        print("------超过最大数量")
+                    }
+                }
+            }
+        }
+        commentCell.delPicTransBlock = {
+            [weak self] (idxRow) in
+            self?.goodsImageArr.remove(at: idxRow!)
+            self?.tableView.reloadData()
+        }
         return commentCell
     }
     
@@ -105,3 +141,19 @@ extension OrderCommentController : UITableViewDelegate, UITableViewDataSource {
     
 }
 
+//MARK: - 逻辑处理
+extension OrderCommentController {
+    
+    /// 上传图片
+    ///
+    /// - Parameter goodsImageArr: 图片数组
+    func uploadFaceUrl(image:UIImage) -> Void {
+//        SwiftMoyaNetWorkService.shared.commonUploadpicSingleApi(imageArray:goodsImageArr) { [weak self] (data) -> (Void) in
+//
+//            SwiftMoyaNetWorkService.shared.minePersonalUploadFaceUrlApi(faceUrl: data as! String , completion: { [weak self] (data) -> (Void) in
+//                self?.personalPortraitView.isReloadData = true
+//                NotificationCenter.default.post(name: kMineUserQueryModelTokenModelChangeNotificationName, object: nil,userInfo: nil)
+//            })
+//        }
+    }
+}

+ 29 - 0
RainbowPlanet/RainbowPlanet/Service/Model/ProductModel/ProductRefundReasonModel.swift

@@ -0,0 +1,29 @@
+//
+//  ProductRefundReasonModel.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/5/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import ObjectMapper
+
+
+class ProductRefundReasonModel : NSObject, Mappable{
+    
+    var refundReason : [String]?
+    
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return ProductRefundReasonModel()
+    }
+    required init?(map: Map){}
+    private override init(){}
+    
+    func mapping(map: Map)
+    {
+        refundReason <- map["refund_reason"]
+    }
+    
+}

+ 34 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift

@@ -66,4 +66,38 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
         }
     }
     
+    // MARK: 单图上传
+    /// 单图上传
+    ///
+    /// - Parameters:
+    ///   - imageArray: 图片数据
+    ///   - completion: null
+    func configUploadImgApi(imageArray:Array<UIImage>, completion: @escaping apiCallBack) {
+        
+        var  multipartData = Array<Any>()
+        let  parameters = Dictionary<String,Any>()
+        for (index,image) in imageArray.enumerated() {
+            let data = image.jpegData(compressionQuality: 0.5)
+            let today = Date()
+//            let formData = MultipartFormData(provider: .data(data!), name: "file\(index)",fileName: "\(today).png", mimeType: "image/png")
+            let formData = MultipartFormData(provider: .data(data!), name: "image",fileName: "\(today).png", mimeType: "image/png")
+
+            multipartData.append(formData)
+        }
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(target: MultiTarget(SwiftMoyaServiceConfigApi.configUploadImg(parameters: parameters, dataArray: multipartData))) { (data) in
+            let rootModel = data as! RootModel
+//            if rootModel.code == "1" {
+//                SwiftProgressHUD.shared().showSuccess(rootModel.msg!, "success")
+//                let commonUploadpicSingleModel = CommonUploadpicSingleModel(JSONString: rootModel.data!)
+//                completion(commonUploadpicSingleModel!.url! as Any)
+//            }else if rootModel.code == "0" {
+//                SwiftProgressHUD.shared().showError(rootModel.msg!, "error")
+//            }else {
+                SwiftProgressHUD.shared().hide()
+            print(rootModel)
+//            }
+        }
+    }
+            
 }

+ 22 - 3
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaServiceConfigApi.swift

@@ -17,15 +17,22 @@ public let kConfigPickupNodeIndexApi = "/config/pickupNode/index"
 /// 已开通城市列表
 public let kConfigCityManagementIndexApi = "/config/cityManagement/index"
 
+// MARK: - 图片上传
+/// 图片上传
+public let kConfigUploadImgApi = "/config/upload"
+
 
 /// 基础配置
 ///
 /// - configPickupNodeIndex: 自提点列表
 /// - configCityManagementIndex: 已开通城市列表
+/// - configUploadImg: 图片上传
 public enum SwiftMoyaServiceConfigApi {
     case configPickupNodeIndex(parameters:Dictionary<String, Any>)
     case configCityManagementIndex(parameters:Dictionary<String, Any>)
-
+    case configUploadImg(parameters:Dictionary<String, Any>,dataArray:Array<Any>)
+    
+    
 }
 
 extension SwiftMoyaServiceConfigApi: TargetType {
@@ -33,7 +40,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
     public var baseURL: URL {
         switch self {
         case .configPickupNodeIndex,
-             .configCityManagementIndex
+             .configCityManagementIndex,
+             .configUploadImg
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -45,6 +53,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
             return kConfigPickupNodeIndexApi
         case .configCityManagementIndex:
             return kConfigCityManagementIndexApi
+        case .configUploadImg:
+            return kConfigUploadImgApi
         }
     }
     
@@ -54,6 +64,9 @@ extension SwiftMoyaServiceConfigApi: TargetType {
              .configCityManagementIndex
             :
             return .get
+        case .configUploadImg
+            :
+            return .post
         }
     }
     
@@ -66,6 +79,11 @@ extension SwiftMoyaServiceConfigApi: TargetType {
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
             return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
+            
+        case .configUploadImg(_,let dataArray)
+            :
+            return .uploadMultipart(dataArray as! [MultipartFormData])
+
         }
     }
     
@@ -85,7 +103,8 @@ extension SwiftMoyaServiceConfigApi: TargetType {
         //同task,具体选择看后台 有application/x-www-form-urlencoded 、application/json
         switch self {
         case .configPickupNodeIndex,
-             .configCityManagementIndex
+             .configCityManagementIndex,
+             .configUploadImg
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
         }

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

@@ -357,4 +357,18 @@ class SwiftMoyaNetWorkServiceProduct: NSObject {
         }
     }
     
+    // MARK: - 退款原因
+    /// 退款原因
+    ///
+    /// - Parameters:    
+    ///   - completion: 回调
+    func productRefundReasonApi(completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()                        
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared().request(ProductRefundReasonModel.self, target: MultiTarget(SwiftMoyaServiceProductApi.productRefundReason(parameters: parameters))) { (refundReasonModel) in
+            SwiftProgressHUD.shared().hide()
+            completion(refundReasonModel)
+        }
+    }
+    
 }

+ 29 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceProduct/SwiftMoyaServiceProductApi.swift

@@ -57,6 +57,14 @@ public let kProductCartIsSelApi = "/product/isSelect"
 /// 购物车-全选
 public let kProductCartAllSelApi = "/product/isSelectAll"
 
+// MARK: - 退款原因
+/// 退款原因
+public let kProductRefundReasonApi = "/product/config"
+
+// MARK: - 新增商品评价
+/// 新增商品评价
+public let kProductAddCommentApi = "/product/commentCreate"
+
 
 /// 商品
 ///
@@ -72,6 +80,8 @@ public let kProductCartAllSelApi = "/product/isSelectAll"
 /// - productCartAmount: 购物车-数量
 /// - productCartIsSel: 购物车-选中
 /// - productCartAllSel: 购物车-全选
+/// - productRefundReason: 退款原因
+/// - productAddComment: 新增商品评价
 public enum SwiftMoyaServiceProductApi {
     case productSearch(parameters:Dictionary<String, Any>)
     case productCategory(parameters:Dictionary<String, Any>)
@@ -85,6 +95,8 @@ public enum SwiftMoyaServiceProductApi {
     case productCartAmount(parameters:Dictionary<String, Any>)
     case productCartIsSel(parameters:Dictionary<String, Any>)
     case productCartAllSel(parameters:Dictionary<String, Any>)
+    case productRefundReason(parameters:Dictionary<String, Any>)
+    case productAddComment(parameters:Dictionary<String, Any>)
 }
 
 extension SwiftMoyaServiceProductApi: TargetType {
@@ -102,7 +114,9 @@ extension SwiftMoyaServiceProductApi: TargetType {
              .productCartDelete,
              .productCartAmount,
              .productCartIsSel,
-             .productCartAllSel
+             .productCartAllSel,
+             .productRefundReason,
+             .productAddComment
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -134,12 +148,17 @@ extension SwiftMoyaServiceProductApi: TargetType {
             return kProductCartIsSelApi
         case .productCartAllSel:
             return kProductCartAllSelApi
+        case .productRefundReason:
+            return kProductRefundReasonApi
+        case .productAddComment:
+            return kProductAddCommentApi
         }
     }
     
     public var method: Moya.Method {
         switch self {
-        case.productCartAdd
+        case .productCartAdd,
+             .productAddComment
             :
             return .post
         case .productCartAmount,
@@ -153,7 +172,8 @@ extension SwiftMoyaServiceProductApi: TargetType {
              .productCartList,
              .productDetail,
              .productCommentList,
-             .productHotSale
+             .productHotSale,
+             .productRefundReason
             :
             return .get
         case .productCartDelete
@@ -176,7 +196,9 @@ extension SwiftMoyaServiceProductApi: TargetType {
              .productCartDelete(var parameters),
              .productCartAmount(var parameters),
              .productCartIsSel(var parameters),
-             .productCartAllSel(var parameters)
+             .productCartAllSel(var parameters),
+             .productRefundReason(var parameters),
+             .productAddComment(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -210,7 +232,9 @@ extension SwiftMoyaServiceProductApi: TargetType {
              .productCartDelete,
              .productCartAmount,
              .productCartIsSel,
-             .productCartAllSel
+             .productCartAllSel,
+             .productRefundReason,
+             .productAddComment
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
         }

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

@@ -130,7 +130,7 @@ class AlertSheetView: NSObject {
     
     
     /// 单个选择器
-    func sheetPickViewOneComponentsView(titles:[String],title:String,height:CGFloat,sureClosure:((_ row: Int,_ value:String) -> Void)?) {
+    class func sheetPickViewOneComponentsView(titles:[String],title:String,height:CGFloat,sureClosure:((_ row: Int,_ value:String) -> Void)?) {
         let view = PickViewOneComponentsView(titles: titles,title: title)
         view.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: height * kScaleWidth + kSafeTabBarHeight)
         let vProperty = FWPopupViewProperty()