126 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			126 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  ContentOrderDialogView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/13.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
 | 
						|
struct ContentOrderDialogView: View {
 | 
						|
    
 | 
						|
    @Binding var isShowing: Bool
 | 
						|
    
 | 
						|
    let price: Int
 | 
						|
    let onTapPurchase: (OrderType) -> Void
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        ZStack {
 | 
						|
            Color.black
 | 
						|
                .opacity(0.7)
 | 
						|
                .ignoresSafeArea()
 | 
						|
                .onTapGesture { isShowing = false }
 | 
						|
            
 | 
						|
            VStack(spacing: 0) {
 | 
						|
                Spacer()
 | 
						|
                
 | 
						|
                VStack(spacing: 26.7) {
 | 
						|
                    HStack(spacing: 0) {
 | 
						|
                        VStack(alignment: .leading, spacing: 5.3) {
 | 
						|
                            Text("대여")
 | 
						|
                                .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                .foregroundColor(.white)
 | 
						|
                            
 | 
						|
                            Text("(이용기간 5일)")
 | 
						|
                                .font(.custom(Font.light.rawValue, size: 12))
 | 
						|
                                .foregroundColor(.white)
 | 
						|
                        }
 | 
						|
                        
 | 
						|
                        Spacer()
 | 
						|
                        
 | 
						|
                        HStack(spacing: 8) {
 | 
						|
                            if UserDefaults.int(forKey: .userId) != 17958 {
 | 
						|
                                Image("ic_can")
 | 
						|
                                    .resizable()
 | 
						|
                                    .frame(width: 16.7, height: 16.7)
 | 
						|
                            }
 | 
						|
                            
 | 
						|
                            if UserDefaults.int(forKey: .userId) == 17958 {
 | 
						|
                                Text("\(Int(ceil(Double(price) * 0.7)) * 110)")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            } else {
 | 
						|
                                Text("\(Int(ceil(Double(price) * 0.7)))")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            }
 | 
						|
                            
 | 
						|
                            if UserDefaults.int(forKey: .userId) == 17958 {
 | 
						|
                                Text("원")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        .padding(.vertical, 8)
 | 
						|
                        .padding(.horizontal, 13.3)
 | 
						|
                        .background(Color.button)
 | 
						|
                        .cornerRadius(5.3)
 | 
						|
                        .onTapGesture {
 | 
						|
                            onTapPurchase(.RENTAL)
 | 
						|
                            isShowing = false
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    HStack(spacing: 0) {
 | 
						|
                        VStack(alignment: .leading, spacing: 5.3) {
 | 
						|
                            Text("소장")
 | 
						|
                                .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                .foregroundColor(.white)
 | 
						|
                            
 | 
						|
                            Text("(서비스 종료시까지)")
 | 
						|
                                .font(.custom(Font.light.rawValue, size: 12))
 | 
						|
                                .foregroundColor(.white)
 | 
						|
                        }
 | 
						|
                        
 | 
						|
                        Spacer()
 | 
						|
                        
 | 
						|
                        HStack(spacing: 8) {
 | 
						|
                            if UserDefaults.int(forKey: .userId) != 17958 {
 | 
						|
                                Image("ic_can")
 | 
						|
                                    .resizable()
 | 
						|
                                    .frame(width: 16.7, height: 16.7)
 | 
						|
                            }
 | 
						|
                            
 | 
						|
                            if UserDefaults.int(forKey: .userId) == 17958 {
 | 
						|
                                Text("\(price * 110)")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            } else {
 | 
						|
                                Text("\(price)")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            }
 | 
						|
                            
 | 
						|
                            if UserDefaults.int(forKey: .userId) == 17958 {
 | 
						|
                                Text("원")
 | 
						|
                                    .font(.custom(Font.bold.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(Color.grayee)
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                        .padding(.vertical, 8)
 | 
						|
                        .padding(.horizontal, 13.3)
 | 
						|
                        .background(Color.button)
 | 
						|
                        .cornerRadius(5.3)
 | 
						|
                        .onTapGesture {
 | 
						|
                            onTapPurchase(.KEEP)
 | 
						|
                            isShowing = false
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                .padding(24)
 | 
						|
                .background(Color.gray22)
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |