From 5a590aaf3fd9ed5f9cfd2d54e72c904ce4918e7f Mon Sep 17 00:00:00 2001
From: younger_times <841720330@qq.com>
Date: 星期三, 12 七月 2023 18:56:43 +0800
Subject: [PATCH] 完善“课程详情”

---
 WanPai/Root/Course/VC/CourseDetailVC.swift |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/WanPai/Root/Course/VC/CourseDetailVC.swift b/WanPai/Root/Course/VC/CourseDetailVC.swift
index 7e3a6b3..d2fadcb 100644
--- a/WanPai/Root/Course/VC/CourseDetailVC.swift
+++ b/WanPai/Root/Course/VC/CourseDetailVC.swift
@@ -49,28 +49,33 @@
             }
 
             label_price.text = detailModel.list.first!.paymentPrice.currency()
-
-
             if let subM = detailModel.list.first {
-                label_originPrice.isHidden = subM.originalPrice == 0
-                label_coin.isHidden = subM.playPaiCoin == 0
-                label_vipPrice.isHidden = subM.vipPrice == 0
+                label_originPrice.isHidden = subM.originalPrice == nil
+                label_coin.isHidden = subM.playPaiCoin == nil
+                label_vipPrice.isHidden = subM.vipPrice == nil
 
-                //原价
-                let attribute = AttributedStringbuilder.build().add(string: subM.originalPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).underLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
-                label_originPrice.attributedText = attribute.mutableAttributedString
+                    //原价
+                if let originPrice =  subM.originalPrice{
+                    let attribute = AttributedStringbuilder.build().add(string: originPrice.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58)).underLine(color: UIColor(hexStr: "#3F3F3F").withAlphaComponent(0.58))
+                    label_originPrice.attributedText = attribute.mutableAttributedString
+                }
 
-                //玩湃币
-                let coinAttribute = AttributedStringbuilder.build()
-                    .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
-                    .add(string: "\(subM.playPaiCoin)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
-                label_coin.attributedText = coinAttribute.mutableAttributedString
+
+                    //玩湃币
+                if let paiCoin = subM.playPaiCoin{
+                    let coinAttribute = AttributedStringbuilder.build()
+                        .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
+                        .add(string: "\(paiCoin)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
+                    label_coin.attributedText = coinAttribute.mutableAttributedString
+                }
 
                 //会员价
-                let vipAttribute = AttributedStringbuilder.build()
-                    .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
-                    .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
-                label_vipPrice.attributedText = vipAttribute.mutableAttributedString
+                if let vipPrice = subM.vipPrice{
+                    let vipAttribute = AttributedStringbuilder.build()
+                        .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F"))
+                        .add(string: vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313"))
+                    label_vipPrice.attributedText = vipAttribute.mutableAttributedString
+                }
             }
 
 
@@ -103,7 +108,7 @@
     }
 
     @IBAction func applyAction(_ sender: UIButton) {
-         let vc = CourseDetailApplyVC()
+         let vc = CourseDetailApplyVC(detailModel: detailModel)
         push(vc: vc)
     }
     

--
Gitblit v1.7.1