From a36d1ac6c87a05682228f7d0857d8d46666e69ad Mon Sep 17 00:00:00 2001 From: kleap-admin Date: Fri, 16 Jan 2026 16:33:09 +0000 Subject: [PATCH] Update app/checkout/page.tsx --- app/checkout/page.tsx | 119 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 app/checkout/page.tsx diff --git a/app/checkout/page.tsx b/app/checkout/page.tsx new file mode 100644 index 0000000..a5f1cc3 --- /dev/null +++ b/app/checkout/page.tsx @@ -0,0 +1,119 @@ +"use client"; +import { useState } from "react"; +import { useSearchParams, useRouter } from "next/navigation"; +import { Container } from "@/components/container"; +import { Heading } from "@/components/heading"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { NavBar } from "@/components/navbar"; +import { Footer } from "@/components/footer"; + +const products = { + ultra: { name: "👑 ULTRA", price: 16000 }, + mega: { name: "💎 MEGA", price: 9500 }, + premium: { name: "⭐ PREMIUM", price: 4800 }, + basico: { name: "🔹 Básico", price: 2900 }, + esencia: { name: "🟢 ESENCIA", price: 1650 }, + origen: { name: "🔵 ORIGEN", price: 1250 }, + raiz: { name: "🟡 RAÍZ", price: 950 }, + mini: { name: "🔴 Mini", price: 650 }, +}; + +export default function CheckoutPage() { + const searchParams = useSearchParams(); + const router = useRouter(); + const planId = (searchParams.get("plan") as keyof typeof products) || "mini"; + const product = products[planId]; + + const [formData, setFormData] = useState({ + name: "", + email: "", + phone: "", + address: "", + paymentMethod: "card", + }); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + const orderId = Math.random().toString(36).substring(7).toUpperCase(); + localStorage.setItem(`order_${orderId}`, JSON.stringify({ + ...formData, + product: product.name, + price: product.price, + status: "Pendiente", + date: new Date().toISOString(), + })); + router.push(`/payment?orderId=${orderId}`); + }; + + return ( +
+ + +
+
+ Finalizar Pedido +
+
+ + setFormData({...formData, name: e.target.value})} /> +
+
+ + setFormData({...formData, email: e.target.value})} /> +
+
+ + setFormData({...formData, phone: e.target.value})} /> +
+
+ + setFormData({...formData, address: e.target.value})} /> +
+
+ + +
+ +
+
+ +
+ + + Resumen del Pedido + + +
+ Producto: + {product.name} +
+
+ Total: + ${product.price.toLocaleString()} USD +
+

+ * El precio en MXN se calculará al tipo de cambio del día durante el pago. +

+
+
+
+
+
+
+ ); +}