fix
杨锴
2024-08-23 adc2db9bb29e7f316c46b6de679db1522ffc9cc8
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
//
//  PaymentOrderResultVC.swift
//  XQMuse
//
//  Created by 无故事王国 on 2024/8/15.
//
 
import UIKit
import JQTools
class PaymentOrderResultVC: BaseVC {
 
                var collectionView:UICollectionView!
                private  let topView = PaymentOrderResultTopView.jq_loadNibView()
//                private let shadowView = UIView()
 
                override func viewDidLoad() {
                                super.viewDidLoad()
                                title = "支付结果"
 
                }
 
                override func setUI() {
                                super.setUI()
                                view.backgroundColor = .white
 
                                let layout = HoverHeaderFlowLayout()
                                let w = (JQ_ScreenW - 18 * 3) / 2
                                layout.itemSize = CGSize(width: w, height: w * 1.319)
                                layout.headerReferenceSize = CGSize(width: JQ_ScreenW, height: 59)
                                collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
                                collectionView.backgroundColor = .clear
                                collectionView.delegate = self
                                collectionView.delegate = self
                                collectionView.dataSource = self
                                collectionView.backgroundColor = .white
                                collectionView.contentInset = UIEdgeInsets(top: 298, left: 18, bottom: 0, right: 18)
                                collectionView.register(UINib(nibName: "HomeRelaxBanner_2_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_HomeRelaxBanner_2_1_CCell")
                                collectionView.register(PaymentOrderResultHeaderView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
                                view.addSubview(collectionView)
                                collectionView.snp.makeConstraints { make in
                                                make.edges.equalToSuperview()
                                }
 
 
                                view.addSubview(topView)
                                topView.backgroundColor = .clear
                                topView.snp.makeConstraints {[unowned self] make in
                                                make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(0)
                                                make.left.right.equalToSuperview()
                                                make.height.equalTo(278)
                                }
 
//                                view.addSubview(shadowView)
//                                shadowView.backgroundColor = .white
//                                shadowView.snp.makeConstraints {[unowned self] make in
//                                                make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(0)
//                                                make.left.right.equalToSuperview()
//                                                make.height.equalTo(30)
//                                }
 
                }
 
                override func viewDidLayoutSubviews() {
                                super.viewDidLayoutSubviews()
//                                shadowView.jq_gradientColor(colorArr: [UIColor(hexStr: "#F5F5F5").withAlphaComponent(0.15).cgColor,UIColor.clear.cgColor], cornerRadius: 0, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: CGRect(x: 0, y: 0, width: JQ_ScreenW, height: 30),locations: [0.1,0.9])
                }
}
 
extension PaymentOrderResultVC:UIScrollViewDelegate{
                func scrollViewDidScroll(_ scrollView: UIScrollView) {
                                let v = (scrollView.contentOffset.y) + 298
                                topView.y = -v
                }
}
 
extension PaymentOrderResultVC:UICollectionViewDelegate & UICollectionViewDataSource{
                func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
                                return 50
                }
 
                func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
//                                let vc = HomeItemDetailVC()
//                                push(vc: vc)
                                
                }
 
                func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
                                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_1_CCell", for: indexPath) as! HomeRelaxBanner_2_1_CCell
                                cell.backgroundColor = .jq_randomColor
                                return cell
                }
 
                func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
                                if kind == UICollectionView.elementKindSectionHeader{
                                                let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "header", for: indexPath) as! PaymentOrderResultHeaderView
                                                return headerView
                                }
 
                                return UICollectionReusableView()
                }
}
 
class PaymentOrderResultHeaderView:UICollectionReusableView{
 
                override init(frame: CGRect) {
                                super.init(frame: frame)
                                setUI()
                }
 
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
 
                private func setUI(){
                                backgroundColor = .white
 
                                let lineView = UIView()
                                lineView.backgroundColor = UIColor(hexString: "#979797")?.withAlphaComponent(0.26)
                                addSubview(lineView)
                                lineView.snp.makeConstraints { make in
                                                make.left.equalTo(76)
                                                make.right.equalTo(-76)
                                                make.height.equalTo(1)
                                                make.centerY.equalToSuperview()
                                }
 
                                let lineLabel = UILabel()
                                lineLabel.text = "猜你喜欢"
                                lineLabel.backgroundColor = .white
                                lineLabel.textAlignment = .center
                                lineLabel.font = .systemFont(ofSize: 14, weight: .medium)
                                lineLabel.textColor = UIColor(hexString: "#3F4343")?.withAlphaComponent(0.79)
                                addSubview(lineLabel)
                                lineLabel.snp.makeConstraints { make in
                                                make.center.equalToSuperview()
                                                make.width.equalTo(71)
                                                make.height.equalTo(20)
                                }
                }
}