//
|
// 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
|
}
|
}
|