CNLiveShopBodyDetailView.swift
9.2 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
//
// CNLiveShopBodyDetailView.swift
// metaCode
//
// Created by open on 2023/11/1.
//
import Foundation
/// 头视图
class ShopBodyOrderDetailHeaderView: UIView {
lazy var iconView: UIImageView = {
let iconView = UIImageView.init()
iconView.backgroundColor = .white
iconView.contentMode = .scaleAspectFill
return iconView
}()
lazy var smallView: UIImageView = {
let smallView = UIImageView.init()
smallView.backgroundColor = .clear
smallView.contentMode = .scaleAspectFill
return smallView
}()
lazy var smallLabel: UILabel = {
let smallLabel = UILabel.init()
smallLabel.textColor = .white
smallLabel.font = BoldFont_18_Fit
return smallLabel
}()
override init(frame: CGRect) {
super.init(frame: frame)
addSubview(iconView)
iconView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.left.right.equalToSuperview()
make.height.equalTo(50)
}
iconView.addSubview(smallView)
smallView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(15)
make.size.equalTo(20)
}
iconView.addSubview(smallLabel)
smallLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalTo(smallView.snp.right).offset(10)
make.right.equalToSuperview().offset(-15)
}
}
func setupDataSource(dict: NSDictionary) {
iconView.image = UIImage(named: dict["back_image"] as! String)
smallView.image = UIImage(named: (dict["icon_image"] as! String))
smallLabel.text = dict["statues"] as? String
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
/// 列表图
class ShopBodyOrderDetailOneTableViewCell: UITableViewCell {
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.textColor = HexColor("0x222833")
titleLabel.font = regular_adapt_font(pointSize: 15)
titleLabel.numberOfLines = 1
return titleLabel
}()
lazy var descLabel: UILabel = {
let descLabel = UILabel.init()
descLabel.textColor = HexColor("#959595")
descLabel.font = regular_adapt_font(pointSize: 13)
descLabel.numberOfLines = 2
return descLabel
}()
lazy var phoneButton: UIButton = {
let phoneButton = UIButton(type: .custom)
phoneButton.setTitleColor(HexColor("4A90E2"), for: .normal)
phoneButton.titleLabel?.font = regular_adapt_font(pointSize: 14)
phoneButton.addTarget(self, action: #selector(phoneCallBtnClick), for: .touchUpInside)
return phoneButton
}()
lazy var phoneView: UIImageView = {
let phoneView = UIImageView.init()
phoneView.backgroundColor = .white
phoneView.image = UIImage(named: "DS_order_phone")
return phoneView
}()
lazy var lineLabel: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#EAEAEA")
return lineLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.backgroundColor = .clear
selectionStyle = .none
}
@objc func phoneCallBtnClick() {
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
/// 列表图
class ShopBodyOrderDetailTwoTableViewCell: UITableViewCell {
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.textColor = HexColor("#333333")
titleLabel.font = BoldFont_16_Fit
titleLabel.numberOfLines = 2
titleLabel.lineBreakMode = .byTruncatingTail
return titleLabel
}()
lazy var statueLable: UILabel = {
let statueLabel = UILabel.init()
statueLabel.textColor = HexColor("#F5A623")
statueLabel.font = Font_13_Fit
statueLabel.textAlignment = .left
return statueLabel
}()
lazy var numberLabel: UILabel = {
let numberLabel = UILabel.init(frame: CGRect.zero)
numberLabel.font = Font_12_Fit
numberLabel.textColor = HexColor("#65656")
return numberLabel
}()
lazy var originalPriceLab: UILabel = {
let originalPriceLab = UILabel.init()
originalPriceLab.textColor = HexColor("#9c9c9c")
originalPriceLab.font = Font_10_Fit
return originalPriceLab
}()
lazy var priceLab: UILabel = {
let priceLab = UILabel.init()
priceLab.textColor = HexColor("FF415F")
priceLab.font = BoldFont_18_Fit
return priceLab
}()
lazy var descLabel: UILabel = {
let descLabel = UILabel.init()
descLabel.textColor = HexColor("9c9c9c")
descLabel.font = Font_14_Fit
descLabel.numberOfLines = 1
descLabel.lineBreakMode = .byTruncatingTail
return descLabel
}()
lazy var refundLab: UILabel = {
let refundLab = UILabel.init()
refundLab.font = Font_13_Fit
refundLab.textColor = HexColor("#F5A623")
refundLab.textAlignment = .right
return refundLab
}()
lazy var iconView: UIImageView = {
let iconView = UIImageView.init()
iconView.backgroundColor = .white
iconView.layer.cornerRadius = 5
iconView.layer.masksToBounds = true
iconView.image = UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 90, height: 90))
return iconView
}()
lazy var lineLabel: UILabel = {
let lineLabel = UILabel.init()
lineLabel.backgroundColor = HexColor("#EAEAEA")
return lineLabel
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
contentView.backgroundColor = .clear
selectionStyle = .none
addSubview(titleLabel)
addSubview(numberLabel)
addSubview(iconView)
addSubview(lineLabel)
addSubview(statueLable)
addSubview(originalPriceLab)
addSubview(priceLab)
addSubview(refundLab)
addSubview(descLabel)
setConstrainta()
}
func setupDataSource(goodsModel: ShopOrderListGoodsModel, isHiddenLine: Bool, isRefund: Bool, isState: Bool) {
titleLabel.text = goodsModel.title
descLabel.text = goodsModel.ads
priceLab.text = "\(goodsModel.price ?? "")"
iconView.kf.setImage(with: URL(string: goodsModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 90, height: 90)))
lineLabel.isHidden = isHiddenLine
// if !isRefund && isState {
// if (goodsModel.send_num == "0" || (Int(goodsModel.num) - Int(goodsModel.send_num)) + Int(goodsModel.refund_num) == Int(goodsModel.num)) {
// statueLable.text = "全部已发货"
// } else {
// statueLable.text = "\(Int(goodsModel.num) - Int(goodsModel.send_num))/\(goodsModel.num)已发货"
// }
// }
}
func setConstrainta() {
iconView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.left.equalToSuperview().offset(15)
make.top.equalToSuperview().offset(10)
make.size.equalTo(90)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(iconView.snp.right).offset(10)
make.right.equalToSuperview().offset(-15)
make.top.equalTo(iconView.snp.top).offset(5)
}
numberLabel.snp.makeConstraints { make in
make.centerY.equalTo(originalPriceLab)
make.right.equalToSuperview().offset(-15)
}
refundLab.snp.makeConstraints { make in
make.left.equalToSuperview().offset(15)
make.top.equalTo(iconView.snp.bottom).offset(10)
}
priceLab.snp.makeConstraints { make in
make.left.equalTo(iconView.snp.right).offset(10)
make.bottom.equalTo(iconView.snp.bottom).offset(-5)
}
originalPriceLab.snp.makeConstraints { make in
make.left.equalTo(priceLab.snp.right).offset(10)
make.bottom.equalTo(iconView.snp.bottom).offset(-5)
}
descLabel.snp.makeConstraints { make in
make.left.equalTo(iconView.snp.right).offset(10)
make.top.equalTo(titleLabel.snp.bottom).offset(5)
}
lineLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(15)
make.right.equalToSuperview().offset(-15)
make.bottom.equalToSuperview().offset(-1)
make.height.equalTo(1)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
/// 列表图
class ShopBodyOrderDetailThreeTableViewCell: UITableViewCell {
}
/// 尾视图
class ShopBodyOrderDetailFooterViewCell: UITableViewHeaderFooterView {
}