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