import { notFound } from 'next/navigation' import { prisma } from '@/lib/prisma' import { AddToCartButton } from '@/components/AddToCartButton' import { ArrowLeft, Package, Star, Shield, Truck, RotateCcw } from 'lucide-react' import Link from 'next/link' interface ComponentDetailPageProps { params: Promise<{ id: string }> } export default async function ComponentDetailPage({ params }: ComponentDetailPageProps) { const component = await prisma.component.findUnique({ where: { id: (await params).id }, include: { componentType: true } }) if (!component) { notFound() } const specifications = component.specifications ? JSON.parse(component.specifications) : {} // 获取同类型的其他产品推荐 const relatedComponents = await prisma.component.findMany({ where: { componentTypeId: component.componentTypeId, id: { not: component.id } }, take: 4, orderBy: { createdAt: 'desc' } }) return (
暂无商品图片
价格含税,全国包邮
全国包邮
正品保障
7天无理由退换
{component.description || '暂无详细描述'}
{Object.keys(specifications).length > 0 && ( <>¥{item.price}