CommonMoneyView.swift 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //
  2. // CommonMoneyView.swift
  3. // xingchuangke
  4. //
  5. // Created by Apple on 2021/3/3.
  6. // Copyright © 2021 Virgil. All rights reserved.
  7. //
  8. import UIKit
  9. class CommonMoneyView: UIView {
  10. lazy var bgImgV: UIImageView = {
  11. let imgV = UIImageView.init(image: UIImage(named: "img_card_banner_07"))
  12. imgV.isUserInteractionEnabled = true
  13. return imgV
  14. }()
  15. lazy var earnTitLbl: UILabel = {
  16. let lbl = UILabel.init()
  17. lbl.text = "账户余额"
  18. lbl.textColor = UIColor.white
  19. return lbl
  20. }()
  21. lazy var allTiTle: UILabel = {
  22. let lbl = UILabel.init()
  23. lbl.text = "(=待划拨金额+可提现金额)"
  24. lbl.textColor = UIColor.white
  25. lbl.font = UIFont.systemFont(ofSize: 11)
  26. return lbl
  27. }()
  28. lazy var earnLbl: UILabel = {
  29. let lbl = UILabel.init()
  30. lbl.text = "¥0.00"
  31. lbl.textColor = UIColor.white
  32. return lbl
  33. }()
  34. lazy var dhMoneyt: UILabel = {
  35. let lbl = UILabel.init()
  36. lbl.text = "待划拨金额"
  37. lbl.textColor = UIColor.white
  38. lbl.font = UIFont.systemFont(ofSize: 15)
  39. return lbl
  40. }()
  41. lazy var dhMoney: UILabel = {
  42. let lbl = UILabel.init()
  43. lbl.text = "¥0.00"
  44. lbl.textColor = UIColor.white
  45. lbl.font = UIFont.systemFont(ofSize: 15)
  46. return lbl
  47. }()
  48. lazy var rewardTitLbl: UILabel = {
  49. let lbl = UILabel.init()
  50. lbl.text = "可提现金额"
  51. lbl.textColor = UIColor.white
  52. lbl.textAlignment = .right
  53. lbl.font = UIFont.systemFont(ofSize: 15)
  54. return lbl
  55. }()
  56. lazy var rewardLbl: UILabel = {
  57. let lbl = UILabel.init()
  58. lbl.text = "¥0.00"
  59. lbl.textColor = UIColor.white
  60. lbl.textAlignment = .right
  61. lbl.font = UIFont.systemFont(ofSize: 15)
  62. return lbl
  63. }()
  64. lazy var rewardControl: UIControl = {
  65. let btn = UIControl.init()
  66. btn.isUserInteractionEnabled = true
  67. return btn
  68. }()
  69. lazy var lineView: UIView = {
  70. let lbl = UIView.init()
  71. lbl.backgroundColor = .lightGray
  72. return lbl
  73. }()
  74. override init(frame: CGRect) {
  75. super.init(frame: frame)
  76. setupUI()
  77. }
  78. required init?(coder: NSCoder) {
  79. fatalError("init(coder:) has not been implemented")
  80. }
  81. func setupUI() {
  82. self.addSubview(bgImgV)
  83. bgImgV.addSubview(earnTitLbl)
  84. bgImgV.addSubview(allTiTle)
  85. bgImgV.addSubview(earnLbl)
  86. bgImgV.addSubview(dhMoneyt)
  87. bgImgV.addSubview(dhMoney)
  88. bgImgV.addSubview(rewardTitLbl)
  89. bgImgV.addSubview(rewardLbl)
  90. bgImgV.addSubview(lineView)
  91. bgImgV.addSubview(rewardControl)
  92. let w = self.frame.width
  93. let h = self.frame.height
  94. bgImgV.setOrigin(x: 0, y: 0)
  95. bgImgV.setSize(width: w, height: h)
  96. bgImgV.layer.cornerRadius = 10
  97. bgImgV.layer.masksToBounds = true
  98. earnTitLbl.setOrigin(x: 20, y: 15)
  99. earnTitLbl.setSizeHeight(height: 30)
  100. earnTitLbl.setSizeWidth(width: 70)
  101. allTiTle.setOrigin(x: 20+earnTitLbl.frame.size.width, y: 15)
  102. allTiTle.setSizeHeight(height: 30)
  103. allTiTle.setSizeWidth(width: 150)
  104. earnLbl.setOrigin(x: 20, y: 10+earnTitLbl.frame.size.height)
  105. earnLbl.setSizeHeight(height: 30)
  106. earnLbl.setSizeWidth(width: 150)
  107. lineView.setOrigin(x: 20, y: 13+earnLbl.frame.size.height+earnLbl.frame.origin.y)
  108. lineView.setSizeHeight(height: 1)
  109. lineView.setSizeWidth(width: w-40)
  110. dhMoneyt.setOrigin(x: 20, y: 25+earnLbl.frame.size.height+earnLbl.frame.origin.y)
  111. dhMoneyt.setSizeHeight(height: 30)
  112. dhMoneyt.setSizeWidth(width: 150)
  113. dhMoney.setOrigin(x: 20, y: dhMoneyt.frame.size.height+dhMoneyt.frame.origin.y)
  114. dhMoney.setSizeHeight(height: 30)
  115. dhMoney.setSizeWidth(width: 150)
  116. rewardTitLbl.setOrigin(x: w - 170, y: dhMoneyt.frame.origin.y)
  117. rewardTitLbl.setSizeHeight(height: 30)
  118. rewardTitLbl.setSizeWidth(width: 150)
  119. rewardLbl.setOrigin(x: w - 170, y: dhMoney.frame.origin.y)
  120. rewardLbl.setSizeHeight(height: 30)
  121. rewardLbl.setSizeWidth(width: 150)
  122. rewardControl.setOrigin(x: 0, y: earnLbl.frame.size.height+earnLbl.frame.origin.y)
  123. rewardControl.setSize(width: 150, height: 150)
  124. }
  125. /*
  126. // Only override draw() if you perform custom drawing.
  127. // An empty implementation adversely affects performance during animation.
  128. override func draw(_ rect: CGRect) {
  129. // Drawing code
  130. }
  131. */
  132. }