杨锴
2025-05-11 7453d2d0cef415b34323d1b91e6cfa4a6ba31178
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
//
//  StoresInfoView.swift
//  WanPai
//
//  Created by 杨锴 on 2023/6/14.
//
 
import UIKit
import JQTools
import QMUIKit
 
class StoresInfoView: UIView,JQNibView{
                @IBOutlet weak var label_topTitle: UILabel!
                @IBOutlet weak var view_container: UIView!
                @IBOutlet weak var img_logo: UIImageView!
                @IBOutlet weak var label_title: UILabel!
                @IBOutlet weak var label_address: UILabel!
                @IBOutlet weak var label_distance: UILabel!
                @IBOutlet weak var btn_exchange: QMUIButton!
 
 
                private var clouse:((Bool)->Void)!
                private var storeType:StoreType!
 
                enum StoreType{
                                case normal
                                case worldCup
                }
 
                override func awakeFromNib() {
                                super.awakeFromNib()
                                view_container.transform = .init(scaleX: 0.1, y: 0.1)
                                alpha = 0
                                layoutIfNeeded()
                                btn_exchange.imagePosition = .top
                                btn_exchange.spacingBetweenImageAndTitle = 8
                }
 
                static func show(_ detailModel:CourseDetailModel,clouse:@escaping (Bool)->Void){
                                let storesView = StoresInfoView.jq_loadNibView()
                                storesView.frame = sceneDelegate?.window?.frame ?? .zero
                                storesView.label_topTitle.text = "请报名预约门店"
                                storesView.img_logo.sd_setImage(with: URL(string: detailModel.storeCoverDrawing))
                                storesView.label_title.text = detailModel.storeName
                                storesView.label_address.text = detailModel.storeAddress
                                storesView.label_distance.text = String(format: "距你%.2lfkm", detailModel.distance)
                                storesView.clouse = clouse
                                sceneDelegate?.window?.addSubview(storesView)
 
                                UIView.animate(withDuration: 0.4) {
                                                storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
                                                storesView.alpha = 1
                                }
                }
 
                static func show(_ activityModel:ActivityDetailStoreModel,type:StoresInfoView.StoreType = .normal,clouse:@escaping (Bool)->Void){
                                let storesView = StoresInfoView.jq_loadNibView()
                                storesView.frame = sceneDelegate?.window?.frame ?? .zero
 
                                if type == .normal{
                                                storesView.label_topTitle.text = "请确认预约门店"
                                                storesView.btn_exchange.setTitle("更换门店", for: .normal)
                                }else{
                                                storesView.label_topTitle.text = "请确认参与赛点"
                                                storesView.btn_exchange.setTitle("更换赛点", for: .normal)
                                }
 
 
                                storesView.img_logo.sd_setImage(with: URL(string: activityModel.storeCoverDrawing))
                                storesView.label_title.text = activityModel.name
                                storesView.label_address.text = activityModel.address
                                storesView.label_distance.text = String(format: "距你%.2lfkm", activityModel.distance)
                                storesView.clouse = clouse
                                sceneDelegate?.window?.addSubview(storesView)
 
                                UIView.animate(withDuration: 0.4) {
                                                storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
                                                storesView.alpha = 1
                                }
                }
 
                static func show(_ siteDetailModel:SiteDetailModel,clouse:@escaping (Bool)->Void){
                                let storesView = StoresInfoView.jq_loadNibView()
                                storesView.frame = sceneDelegate?.window?.frame ?? .zero
 
                                storesView.img_logo.sd_setImage(with: URL(string: siteDetailModel.storeCoverDrawing))
                                storesView.label_title.text = siteDetailModel.storeName
                                storesView.label_address.text = siteDetailModel.storeAddress
                                storesView.label_distance.text = String(format: "距你%.2lfkm", siteDetailModel.distance)
                                storesView.clouse = clouse
                                sceneDelegate?.window?.addSubview(storesView)
 
                                UIView.animate(withDuration: 0.4) {
                                                storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
                                                storesView.alpha = 1
                                }
                }
 
                static func show(model:ActivityDetailStoreModel,clouse:@escaping (Bool)->Void){
                                let storesView = StoresInfoView.jq_loadNibView()
                                storesView.frame = sceneDelegate?.window?.frame ?? .zero
                                storesView.label_topTitle.text = "请确认参与赛点"
                                storesView.img_logo.sd_setImage(with: URL(string: model.storeCoverDrawing))
                                storesView.label_title.text = model.name
                                storesView.label_address.text = model.address
                                storesView.label_distance.text = String(format: "距你%.2lfkm", model.distance)
                                storesView.clouse = clouse
                                sceneDelegate?.window?.addSubview(storesView)
 
                                UIView.animate(withDuration: 0.4) {
                                                storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
                                                storesView.alpha = 1
                                }
                }
 
 
                @IBAction func cancelAction(_ sender: UIButton) {
                                close()
                }
 
 
                @IBAction func exchangeAction(_ sender: UIButton) {
                                close()
                                clouse(false)
                }
 
                @IBAction func completeAction(_ sender: UIButton) {
                                close()
                                clouse(true)
                }
 
                private func close(){
                                UIView.animate(withDuration: 0.4) {
                                                self.view_container.transform = .init(scaleX: 0.1, y: 0.1)
                                                self.alpha = 0
                                } completion: { _ in
                                                self.removeFromSuperview()
                                }
                }
}