Commit 052f52c8 authored by pete谢兆麟's avatar pete谢兆麟

重复选择问题修复

parent 5aaba841
...@@ -21,6 +21,7 @@ class YHMakePlanSelectAlertView: UIView { ...@@ -21,6 +21,7 @@ class YHMakePlanSelectAlertView: UIView {
var lineView: UIView! var lineView: UIView!
var selectIndex: Int = 0 var selectIndex: Int = 0
var selectProductId: Int = 0 var selectProductId: Int = 0
var firstData: YHMakePlanMainModel?
var dataSource: YHMakePlanMainModel? { var dataSource: YHMakePlanMainModel? {
didSet { didSet {
updata() updata()
...@@ -52,6 +53,7 @@ class YHMakePlanSelectAlertView: UIView { ...@@ -52,6 +53,7 @@ class YHMakePlanSelectAlertView: UIView {
static func show(dataSource: YHMakePlanMainModel, callBack: @escaping ((Int) -> Void)) { static func show(dataSource: YHMakePlanMainModel, callBack: @escaping ((Int) -> Void)) {
let view = YHMakePlanSelectAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)) let view = YHMakePlanSelectAlertView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.dataSource = dataSource view.dataSource = dataSource
view.firstData = dataSource
view.block = callBack view.block = callBack
let window = UIApplication.shared.yhKeyWindow() let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view) window?.addSubview(view)
...@@ -217,6 +219,10 @@ class YHMakePlanSelectAlertView: UIView { ...@@ -217,6 +219,10 @@ class YHMakePlanSelectAlertView: UIView {
@objc func orderButtonClick() { @objc func orderButtonClick() {
if let block = block { if let block = block {
if dataSource?.sub_product[selectIndex].is_add_cart == firstData?.sub_product[selectIndex].is_add_cart {
dismiss()
return
}
block(dataSource?.sub_product[selectIndex].product_id ?? 0) block(dataSource?.sub_product[selectIndex].product_id ?? 0)
} }
dismiss() dismiss()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment