From a1ac0f1634ff0bd8f04259fc4cf7ebabd8c8c82d Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期二, 10 十月 2023 16:40:52 +0800
Subject: [PATCH] 修复BUG

---
 WanPai/Root/Course/VC/CourseDetailApplyVC.swift |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
index 20c5ed7..7127fe4 100644
--- a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
+++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -57,7 +57,7 @@
         if let m = detailModel{
             img_cover.sd_setImage(with: URL(string: m.coverDrawing))
             label_title.text = m.name
-            label_listenWeek.text = m.weeks.joined(separator: "、")
+            label_listenWeek.text = "每" + m.weeks.joined(separator: "、")
 			label_listenTime.text = m.times.joined(separator: "|")
             label_store.text = m.storeName
             label_address.text = m.storeAddress
@@ -158,8 +158,21 @@
             guard let weakSelf = self else { return }
             if status{
                 if let model = weakSelf.detailModel?.list[weakSelf.selectClassIndex]{
-					let price = (model.vipPrice == nil ? (model.originalPrice ?? 0) : model.vipPrice!) * Double(weakSelf.studentModels.count)
+
+					var price:Double = 0
+					//是否是会员
+					if weakSelf.detailModel?.isVip == 1 && model.vipPrice != 0{
+						price = model.vipPrice
+					}else{
+						price = model.paymentPrice
+					}
+
+					//计算人数总价
+					price = price * Double(weakSelf.studentModels.count)
+
+					//减去优惠
 					let discountPrice = price - (weakSelf.selectCouponModel?.favorable ?? 0)
+
                     let coin = (model.playPaiCoin ?? 0) * weakSelf.studentModels.count
 
                     PaymentView.show(money: (ali:discountPrice,wx:discountPrice,coin:coin,course:nil)) { [weak self] payType in
@@ -224,10 +237,11 @@
 				studentCount = Double(studentModels.count)
 			}
 
+			label_price.isHidden = subM.paymentPrice == 0
 			label_price.text = (subM.paymentPrice * studentCount - (selectCouponModel?.favorable ?? 0)).currency()
             label_originPrice.isHidden = subM.originalPrice == nil || subM.originalPrice == 0
             label_coin.isHidden = subM.playPaiCoin == nil || subM.playPaiCoin == 0
-            label_vipPrice.isHidden = subM.vipPrice == nil || subM.vipPrice == 0
+            label_vipPrice.isHidden = subM.vipPrice == 0
 
                 //原价
             if let originPrice =  subM.originalPrice{
@@ -244,10 +258,10 @@
             }
 
                 //会员价
-            if let vipPrice = subM.vipPrice{
+            if subM.vipPrice != 0{
                 let vipAttribute = AttributedStringbuilder.build()
                     .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
-                    .add(string: (vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
+					.add(string: (subM.vipPrice * studentCount).currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
                 label_vipPrice.attributedText = vipAttribute.mutableAttributedString
             }
 
@@ -286,7 +300,8 @@
 
 	override func viewDidLayoutSubviews() {
 		super.viewDidLayoutSubviews()
-		label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: 58, height: 25)
+		let w = String.jq_getWidth(text: detailModel?.type.strTitle ?? "", height: 25, font: 14) + 16
+		label_courseType.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: w, height: 25)
 	}
 }
 

--
Gitblit v1.7.1