|
@@ -29,7 +29,8 @@ class OrderApplyRefundController: BaseViewController {
|
|
|
// 选中の退款原因
|
|
|
var selRefundReason: String? = ""
|
|
|
|
|
|
-
|
|
|
+ // 上传图片数组
|
|
|
+ var goodsImageArr = Array<UIImage>()
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
@@ -48,7 +49,7 @@ class OrderApplyRefundController: BaseViewController {
|
|
|
commitButton.backgroundColor = kFFA42FColor
|
|
|
self.view.addSubview(commitButton)
|
|
|
commitButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
- self?.orderPurchaseRefundApi()
|
|
|
+ self?.applyOrderRefund()
|
|
|
|
|
|
}).disposed(by: disposeBag)
|
|
|
commitButton.snp.makeConstraints { (make) in
|
|
@@ -159,10 +160,42 @@ extension OrderApplyRefundController : UITableViewDelegate, UITableViewDataSourc
|
|
|
noteCell.orderModel = orderDetailModel
|
|
|
return noteCell
|
|
|
case 4:
|
|
|
- let photoCell = OrderApplyRefundPhotoCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ let photoCell = OrderApplyRefundPhotoCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ photoCell.goodsImageArr = self.goodsImageArr
|
|
|
photoCell.frame = tableView.bounds
|
|
|
photoCell.layoutIfNeeded()
|
|
|
photoCell.reloadData()
|
|
|
+ photoCell.choosePicBlock = {
|
|
|
+ [weak self] in
|
|
|
+ // 添加图片
|
|
|
+ UIAlertController.showConfirmActionSheet(camera: { (action) in
|
|
|
+ PhotoAndCameraManager.shared().authorizeCamera()
|
|
|
+ PhotoAndCameraManager.shared().photoAndCameraManagerImageBlock = { [weak self] (image) in
|
|
|
+ if self?.goodsImageArr.count ?? 0 < 3 {
|
|
|
+ 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 < 3 {
|
|
|
+ self?.goodsImageArr.append(image)
|
|
|
+ self?.tableView.reloadData()
|
|
|
+ } else {
|
|
|
+ print("------超过最大数量")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ photoCell.delPicTransBlock = {
|
|
|
+ [weak self] (idxRow) in
|
|
|
+ self?.goodsImageArr.remove(at: idxRow!)
|
|
|
+ self?.tableView.reloadData()
|
|
|
+ }
|
|
|
return photoCell
|
|
|
default:
|
|
|
return UITableViewCell()
|
|
@@ -235,7 +268,7 @@ extension OrderApplyRefundController {
|
|
|
}
|
|
|
|
|
|
// 申请退款
|
|
|
- func orderPurchaseRefundApi() {
|
|
|
+ func applyOrderRefund() {
|
|
|
|
|
|
if productArr?.isEmpty ?? true {
|
|
|
SwiftProgressHUD.shared().showText("请选择退款商品")
|
|
@@ -247,6 +280,11 @@ extension OrderApplyRefundController {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if productArr?.count == 0 {
|
|
|
+ SwiftProgressHUD.shared().showText("请拍照上传问题")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 子订单id参数
|
|
|
var subIdArr: Array<Int> = []
|
|
|
for productMdl in productArr ?? [] {
|
|
@@ -256,12 +294,23 @@ extension OrderApplyRefundController {
|
|
|
}
|
|
|
let detailJsonStr = JSON(subIdArr).description
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-// SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseRefundApi(purchaseId: Int(orderDetailModel!.purchaseNo!)!, mobile: orderDetailModel!.mobile!, refundReason: selRefundReason!, refund_remark: orderDetailModel!.remark ?? "", detail: detailJsonStr, imgs: <#T##String#>) { (data) -> (Void) in
|
|
|
-// print(data)
|
|
|
-// }
|
|
|
-
|
|
|
+ // 多图上传
|
|
|
+ SwiftMoyaNetWorkServiceConfig.shared().configUploadMultiImgApi(imageArray: goodsImageArr) { [weak self] (imgUrlArr) -> (Void) in
|
|
|
+ let imgJsonStr = JSON(imgUrlArr).description
|
|
|
+
|
|
|
+ self?.orderPurchaseRefundApi(purchaseId: (self?.orderDetailModel!.purchaseNo)!, mobile: (self?.orderDetailModel!.mobile!)!, refundReason: (self?.selRefundReason!)!, refund_remark: self?.orderDetailModel!.remark ?? "", detail: detailJsonStr, imgs: imgJsonStr)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func orderPurchaseRefundApi(purchaseId:String = "",mobile:String = "",refundReason:String = "",refund_remark:String = "",detail:String = "",imgs:String = "") {
|
|
|
+ SwiftMoyaNetWorkServiceOrder.shared().orderPurchaseRefundApi(purchaseId: purchaseId, mobile: mobile, refundReason: refundReason, refund_remark: refund_remark, detail: detail, imgs: imgs) { (orderApplyRefundModel) -> (Void) in
|
|
|
+ let applyRefundMdl = orderApplyRefundModel as! OrderApplyRefundModel
|
|
|
+
|
|
|
+ let vc = OrderRefunddetailsViewController()
|
|
|
+ vc.refundNo = applyRefundMdl.refundNo
|
|
|
+ self.navigationController?.pushViewController(vc, animated: true)
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|