宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-07-05 0d8f5fc8a516bfd07e425909e4a4432600572ee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
//  TravelCouponTCell.swift
//  OKProject
//
//  Created by 无故事王国 on 2022/2/10.
//  Copyright © 2022 yangwang. All rights reserved.
//
 
import UIKit
 
class TravelCouponTCell: UITableViewCell {
 
    var couponModel:CouponModel!{
        didSet{
            nameL.text = couponModel.couponName
            selectionStyle = .none
 
            var userTypeText = ""
            switch couponModel.userType {
                case 0:userTypeText = ""
                case 1:userTypeText = "快车/专车"
                case 2:userTypeText = "出租车"
                case 3:userTypeText = "跨城出行"
                case 4:userTypeText = "小件物流"
                default:break
            }
 
            var priceNum = ""
            var info = ""
            switch couponModel.type {
                case .discount:
                    priceNum = String(format: "%.2lf", couponModel.money)
                    if couponModel.userType == 0{
                        info = String(format: "无门槛%@元抵扣券",couponModel.money.ld_formatFloat)
                    }else{
                        info = String(format: "%@%@元抵扣券",userTypeText,couponModel.money.ld_formatFloat)
                    }
                case .fullMinus:
                    priceNum = String(format: "%.2lf", couponModel.money)
 
                    if couponModel.userType == 0{
                        info = String(format: "无门槛满%@元减%@元",couponModel.fullMoney.ld_formatFloat,couponModel.money.ld_formatFloat)
                    }else{
                        info = String(format: "%@满%@元减%@元",userTypeText,couponModel.fullMoney.ld_formatFloat,couponModel.money.ld_formatFloat)
                    }
            }
 
            subContentL.text = info
 
            priceL.attributedText = AttributedStringbuilder.build()
                .add(string: "¥", withFont: UIFont.init(name: Semibold, size: 18)!, withColor: UIColor.white)
                .add(string: priceNum, withFont: UIFont.init(name: Semibold, size: 33)!, withColor: UIColor.white).mutableAttributedString
 
//            let arrributeStr = NSMutableAttributedString(string: priceNum)
//            arrributeStr.addAttribute(.font, value: UIFont.systemFont(ofSize: 40), range: NSRange(location: 1, length: priceNum.length-1))
 
        }
    }
 
    @IBOutlet weak var priceL: UILabel!
    @IBOutlet weak var nameL: UILabel!
    @IBOutlet weak var subContentL: UILabel!
    @IBOutlet weak var checkImg: UIImageView!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
}