LNCreateOrderFailedPanel.swift 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // LNCreateOrderFailedPanel.swift
  3. // Lanu
  4. //
  5. // Created by OneeChan on 2025/12/22.
  6. //
  7. import Foundation
  8. import UIKit
  9. import SnapKit
  10. class LNCreateOrderFailedPanel: LNPopupView {
  11. override init(frame: CGRect) {
  12. super.init(frame: frame)
  13. setupViews()
  14. }
  15. required init?(coder: NSCoder) {
  16. fatalError("init(coder:) has not been implemented")
  17. }
  18. }
  19. extension LNCreateOrderFailedPanel {
  20. private func setupViews() {
  21. let bg = UIImageView()
  22. bg.image = .icOrderBg
  23. container.addSubview(bg)
  24. bg.snp.makeConstraints { make in
  25. make.horizontalEdges.equalToSuperview()
  26. make.top.equalToSuperview()
  27. }
  28. let ic = UIImageView()
  29. ic.image = .icOrderFailed
  30. container.addSubview(ic)
  31. ic.snp.makeConstraints { make in
  32. make.centerX.equalToSuperview()
  33. make.top.equalToSuperview().offset(59)
  34. }
  35. let descLabel = UILabel()
  36. descLabel.text = .init(key: "A00119")
  37. descLabel.font = .heading_h2
  38. descLabel.textColor = .text_4
  39. descLabel.numberOfLines = 0
  40. descLabel.textAlignment = .center
  41. container.addSubview(descLabel)
  42. descLabel.snp.makeConstraints { make in
  43. make.horizontalEdges.equalToSuperview().inset(16)
  44. make.top.equalTo(ic.snp.bottom).offset(16)
  45. }
  46. let confirmButton = UIButton()
  47. confirmButton.setTitle(.init(key: "A00002"), for: .normal)
  48. confirmButton.setTitleColor(.text_1, for: .normal)
  49. confirmButton.titleLabel?.font = .heading_h3
  50. confirmButton.setBackgroundImage(.primary_8, for: .normal)
  51. confirmButton.layer.cornerRadius = 23.5
  52. confirmButton.clipsToBounds = true
  53. confirmButton.addAction(UIAction(handler: { [weak self] _ in
  54. guard let self else { return }
  55. dismiss()
  56. }), for: .touchUpInside)
  57. container.addSubview(confirmButton)
  58. confirmButton.snp.makeConstraints { make in
  59. make.horizontalEdges.equalToSuperview().inset(12)
  60. make.top.equalTo(descLabel.snp.bottom).offset(46)
  61. make.bottom.equalToSuperview().offset(commonBottomInset)
  62. make.height.equalTo(47)
  63. }
  64. }
  65. }