// // LiveReservationCancelView.swift // SodaLive // // Created by klaus on 2023/08/11. // import SwiftUI import Kingfisher struct LiveReservationCancelView: View { @StateObject var viewModel = LiveReservationStatusViewModel() let reservationId: Int var body: some View { BaseView(isLoading: $viewModel.isLoading) { VStack(spacing: 0) { DetailNavigationBar(title: viewModel.isCancelComplete ? "예약취소 확인" : "예약취소") ScrollView(.vertical, showsIndicators: false) { VStack(spacing: 0) { if let item = viewModel.selectedReservationStatusItem { if viewModel.isCancelComplete { Text("예약취소가 완료되었습니다.") .font(.custom(Font.bold.rawValue, size: 20)) .foregroundColor(Color(hex: "a285eb")) .frame(width: screenSize().width - 26.7, alignment: .leading) .padding(.top, 33.3) if item.price > 0 { Text("결제한 \(item.price)캔이\n환불처리 되었습니다.") .font(.custom(Font.medium.rawValue, size: 20)) .foregroundColor(Color(hex: "eeeeee")) .frame(width: screenSize().width - 26.7, alignment: .leading) .padding(.top, 20) } HStack(spacing: 13.3) { Text("다른 라이브 예약하기") .font(.custom(Font.medium.rawValue, size: 15)) .foregroundColor(Color.button) .padding(.vertical, 16) .frame(width: (screenSize().width - 40) / 2) .background(Color.button.opacity(0.2)) .cornerRadius(10) .overlay( RoundedRectangle(cornerRadius: 10) .stroke( Color.button, lineWidth: 1 ) ) .onTapGesture { AppState.shared.setAppStep(step: .main) } Text("캔내역 확인하기") .font(.custom(Font.medium.rawValue, size: 15)) .foregroundColor(.white) .padding(.vertical, 16) .frame(width: (screenSize().width - 40) / 2) .background(Color.button) .cornerRadius(10) .onTapGesture { AppState.shared.setAppStep(step: .canStatus(refresh: {})) } } .frame(width: screenSize().width - 26.7, alignment: .leading) .padding(.top, 20) } else { HStack(spacing: 20) { KFImage(URL(string: item.coverImageUrl)) .resizable() .scaledToFill() .frame(width: 80, height: 116.7, alignment: .top) .cornerRadius(4.7) VStack(alignment: .leading, spacing: 0) { Text(item.beginDateTime) .font(.custom(Font.medium.rawValue, size: 9.3)) .foregroundColor(Color(hex: "ffd300")) Text(item.masterNickname) .font(.custom(Font.medium.rawValue, size: 11.3)) .foregroundColor(Color.graybb) .padding(.top, 10) Text(item.title) .font(.custom(Font.medium.rawValue, size: 15.3)) .foregroundColor(Color(hex: "e2e2e2")) .lineLimit(2) .padding(.top, 4.3) Text( item.price > 0 ? "\(item.price)캔" : "무료" ) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "e2e2e2").opacity(0.4)) .padding(.top, 15.3) } } .padding(.horizontal, 13.3) .frame(width: screenSize().width) .padding(.top, 20) Rectangle() .foregroundColor(Color.gray90.opacity(0.5)) .padding(.horizontal, 13.3) .frame(width: screenSize().width, height: 1) .padding(.top, 13.3) VStack(spacing: 13.3) { Text("예약을 취소하시겠습니까?") .font(.custom(Font.bold.rawValue, size: 20)) .foregroundColor(Color(hex: "a285eb")) .frame(width: screenSize().width - 26.7, alignment: .leading) Text("예약취소 이유를 선택해주세요. 서비스 개선에 중요한 자료로 활용하겠습니다.") .font(.custom(Font.medium.rawValue, size: 13.3)) .foregroundColor(Color.grayee) .frame(width: screenSize().width - 26.7, alignment: .leading) } .padding(.top, 40) VStack(alignment: .leading, spacing: 16.7) { ForEach(0..