60 lines
1.9 KiB
Swift
60 lines
1.9 KiB
Swift
//
|
||
// ScenicPromotionSettingsQueueBindingCard.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/7/2.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
/// 设置页排队打卡点绑定卡片,支持多选。
|
||
struct ScenicPromotionSettingsQueueBindingCard: View {
|
||
@ObservedObject var viewModel: ScenicPromotionSettingsViewModel
|
||
|
||
var body: some View {
|
||
ScenicPromotionSettingsCard(
|
||
title: "排队打卡点绑定",
|
||
subtitle: "可多选,用于宣传页展示排队动态",
|
||
icon: "checklist.checked",
|
||
tint: AppDesign.primary
|
||
) {
|
||
Menu {
|
||
ForEach(viewModel.queuePoints) { point in
|
||
Button {
|
||
viewModel.toggleQueuePoint(point)
|
||
} label: {
|
||
Label(
|
||
"\(point.name) · \(point.areaName)",
|
||
systemImage: viewModel.selectedQueuePointIDs.contains(point.id) ? "checkmark.circle.fill" : "circle"
|
||
)
|
||
}
|
||
}
|
||
} label: {
|
||
ScenicPromotionSettingsSelectionField(
|
||
title: viewModel.selectedQueuePointNames,
|
||
subtitle: "\(viewModel.selectedQueuePointIDs.count) 个已选择",
|
||
icon: "chevron.down"
|
||
)
|
||
}
|
||
.buttonStyle(.plain)
|
||
|
||
if viewModel.selectedQueuePointIDs.isEmpty {
|
||
ScenicPromotionSettingsInlineNotice(
|
||
text: "提交前至少选择一个排队打卡点",
|
||
tint: AppDesign.warning
|
||
)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
#if DEBUG
|
||
#Preview("排队绑定卡片") {
|
||
ScenicPromotionSettingsQueueBindingCard(
|
||
viewModel: ScenicPromotionPreviewSupport.settingsViewModel()
|
||
)
|
||
.padding()
|
||
.background(AppDesign.background)
|
||
}
|
||
#endif
|