98b7600797
对标安卓正式版、对接 app-server(8770)的 SwiftUI 客户端。iOS 无障碍受限、无比价核心,做自成一体:美团 CPS 导购 + 福利(签到/任务/金币)+ 查看(比价记录/省钱战绩)。 功能完整 M0-M5:脚手架、短信登录(JWT+Keychain+401 自动刷新)、首页券 feed 导购、比价记录+省钱战绩、福利、我的(资料/反馈/设置/注销)。 单 target、0 三方依赖、XcodeGen 生成工程;Debug/Release 双 plist 分流 ATS。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
60 lines
2.1 KiB
Swift
60 lines
2.1 KiB
Swift
import SwiftUI
|
|
|
|
/// 单张优惠券卡片,对齐安卓 FeedCard:图 + 券名 + 门店 + 到手价/原价 + 「抢」。
|
|
struct CouponCardView: View {
|
|
let card: CouponCard
|
|
let onTap: () -> Void
|
|
|
|
var body: some View {
|
|
HStack(spacing: 12) {
|
|
AsyncImage(url: URL(string: card.headImageUrl)) { phase in
|
|
switch phase {
|
|
case .success(let image):
|
|
image.resizable().aspectRatio(contentMode: .fill)
|
|
default:
|
|
AppColors.gray100
|
|
}
|
|
}
|
|
.frame(width: 84, height: 84)
|
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(card.name)
|
|
.font(.subheadline)
|
|
.lineLimit(2)
|
|
if let poi = card.poiName, !poi.isEmpty {
|
|
Text(poi)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
.lineLimit(1)
|
|
}
|
|
HStack(alignment: .firstTextBaseline, spacing: 6) {
|
|
Text("¥\(card.sellPrice)")
|
|
.font(.headline)
|
|
.foregroundStyle(AppColors.hot)
|
|
Text("¥\(card.originalPrice)")
|
|
.font(.caption)
|
|
.strikethrough()
|
|
.foregroundStyle(.secondary)
|
|
if let dist = card.distanceText, !dist.isEmpty {
|
|
Spacer(minLength: 0)
|
|
Text(dist).font(.caption2).foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
}
|
|
|
|
Button(action: onTap) {
|
|
Text("抢")
|
|
.font(.subheadline.bold())
|
|
.padding(.horizontal, 18)
|
|
.padding(.vertical, 8)
|
|
.background(AppColors.primary)
|
|
.foregroundStyle(.black)
|
|
.clipShape(Capsule())
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
.padding(.vertical, 6)
|
|
}
|
|
}
|