From 77041c81c325c0bc88c94dc28d732f656cc4c885 Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期二, 17 十月 2023 18:28:29 +0800
Subject: [PATCH] 修复BUG

---
 WanPai/Root/Course/VC/CourseDetailApplyVC.swift |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
index 7c23d08..de2a9ed 100644
--- a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
+++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -19,8 +19,8 @@
     @IBOutlet weak var cons_tableHei: NSLayoutConstraint!
     @IBOutlet weak var btn_coupon: TapBtn!
 
-    @IBOutlet weak var img_cover: UIImageView!
-    @IBOutlet weak var label_title: UILabel!
+	@IBOutlet weak var view_banner: CommonBannerView!
+	@IBOutlet weak var label_title: UILabel!
     @IBOutlet weak var label_listenWeek: UILabel!
     @IBOutlet weak var label_listenTime: UILabel!
     @IBOutlet weak var label_store: UILabel!
@@ -55,7 +55,10 @@
         title = "课程详情"
 
         if let m = detailModel{
-            img_cover.sd_setImage(with: URL(string: m.detailDrawing))
+			view_banner.setImages(images: m.detailDrawing.components(separatedBy: ","), type: .URL) { index in
+
+			}
+
             label_title.text = m.name
             label_listenWeek.text = "每" + m.weeks.joined(separator: "、")
 			label_listenTime.text = m.times.joined(separator: "|")
@@ -89,6 +92,8 @@
             changePrice(selectClassIndex)
         }
 
+
+		btn_addStudent.isHidden = isExtend
 		if isExtend{
 			btn_handleBtn.setTitle("续课", for: .normal)
 		}else{
@@ -161,7 +166,7 @@
     
     @IBAction func paymentAction(_ sender: UIButton) {
         guard detailModel != nil else {return}
-        guard studentModels.count != 0 else {alertError(msg: "请选择学员");return}
+        guard studentModels.count != 0 else {alertError(msg: "请选择运动营成员");return}
         StoresInfoView.show(detailModel!) { [weak self] status in
             guard let weakSelf = self else { return }
             if status{
@@ -183,7 +188,7 @@
 
                     let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count
 
-                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil)) { [weak self] payType in
+                    PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil,integral:nil)) { [weak self] payType in
                         guard let weakSelf = self else { return }
 
 						var paymentPrice:Double = 0
@@ -192,7 +197,7 @@
 								paymentPrice = discountPrice
 							case .coin:
 								paymentPrice = Double(coin)
-							case .courseNum:break
+							case .courseNum,.integral:break
 						}
 
                         Services.courcePayment(conponId: weakSelf.selectCouponModel?.id, courseConfigId: model.id, id: weakSelf.detailModel!.id, price: paymentPrice, payType: payType, stuId: weakSelf.studentModels.map({$0.id})).subscribe(onNext: { data in
@@ -221,12 +226,26 @@
 										let vc = PaymentResultVC(result: .success, objType: .courseApply,handleVC: self,courseConfigId: model.id)
 										vc.modalPresentationStyle = .fullScreen
 										self?.present(vc, animated: true)
-                                    case .courseNum:break
+									case .courseNum,.integral:break
                                 }
                             }else{
                                 alertError(msg: data.msg)
                             }
-                        }).disposed(by: weakSelf.disposeBag)
+						},onError: { error in
+							if let er = error as? NetworkRequest.NetRequestError{
+								switch er {
+									case .Other(_,let string):
+										let vc = PaymentResultVC(result: .fail(string), objType: .courseApply,handleVC: nil)
+										vc.modalPresentationStyle = .fullScreen
+										weakSelf.present(vc, animated: true)
+									default:
+										let vc = PaymentResultVC(result: .fail("支付失败"), objType: .courseApply,handleVC: nil)
+										vc.modalPresentationStyle = .fullScreen
+										weakSelf.present(vc, animated: true)
+								}
+							}
+
+						}).disposed(by: weakSelf.disposeBag)
                     }
                 }
             }else{
@@ -327,7 +346,6 @@
         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Common_1_CCell", for: indexPath) as! Common_1_CCell
         cell.isSelected = indexPath.row == selectClassIndex
         cell.courseDetailListModel = m
-
         return cell
     }
     
@@ -371,10 +389,10 @@
 				tableView.reloadData()
 				weakSelf.changePrice(weakSelf.selectClassIndex)
 			}else{
-				alert(msg: "至少选择一位学员")
+				alert(msg: "至少选择一位运动营成员")
 			}
-
         }
+		cell.btn_handle.isHidden = isExtend
         return cell
     }
 }

--
Gitblit v1.7.1