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

feat: 陪玩师列表和技能详情有折扣时,显示折扣后的价格

陈文艺 1 місяць тому
батько
коміт
5df23cd9aa

+ 5 - 2
Lanu/Views/Game/MateList/LNGameMateListCell.swift

@@ -151,14 +151,17 @@ extension LNGameMateListCell: LNOrderManagerNotify {
     }
     
     private func updateDiscount() {
-        if curItem?.userNo.isMyUid == false,
-           let discount = LNOrderManager.shared.discountFor(curItem?.price ?? 0) {
+        guard let curItem else { return }
+        if curItem.userNo.isMyUid == false,
+           let discount = LNOrderManager.shared.discountFor(curItem.price) {
             saleView.isHidden = false
             discountView.update(1 - discount)
             priceLabel.textColor = .init(hex: "#FF6F32")
+            priceLabel.text = (curItem.price * (1 - discount)).toDisplay
         } else {
             saleView.isHidden = true
             priceLabel.textColor = .text_5
+            priceLabel.text = curItem.price.toDisplay
         }
     }
 }

+ 4 - 1
Lanu/Views/Game/Skill/LNSkillBottomMenuView.swift

@@ -91,11 +91,14 @@ extension LNSkillBottomMenuView: LNOrderManagerNotify {
     }
     
     private func updateDiscount() {
-        if let discount = LNOrderManager.shared.discountFor(curDetail?.price ?? 0) {
+        guard let curDetail else { return }
+        if let discount = LNOrderManager.shared.discountFor(curDetail.price) {
             discountView.isHidden = false
             newbieDiscountView.update(1 - discount)
+            priceLabel.text = (curDetail.price * (1 - discount)).toDisplay
         } else {
             discountView.isHidden = true
+            priceLabel.text = curDetail.price.toDisplay
         }
     }
 }