"use client" import { useState, useEffect } from "react" import { Zap, BookOpen, Check, TrendingUp } from "lucide-react" import { getFullBookPrice, getAllSections } from "@/lib/book-data" import { useStore } from "@/lib/store" import { AuthModal } from "./modules/auth/auth-modal" import { PaymentModal } from "./modules/payment/payment-modal" export function PurchaseSection() { const [fullBookPrice, setFullBookPrice] = useState(9.9) const [sectionsCount, setSectionsCount] = useState(55) const [isAuthOpen, setIsAuthOpen] = useState(false) const [isPaymentOpen, setIsPaymentOpen] = useState(false) const { isLoggedIn } = useStore() useEffect(() => { const sections = getAllSections() setSectionsCount(sections.length) setFullBookPrice(getFullBookPrice(sections.length)) }, []) const handlePurchase = () => { if (!isLoggedIn) { setIsAuthOpen(true) return } setIsPaymentOpen(true) } return (
{/* 区域标题 */}

选择购买方式

一次付费,永久阅读

{/* 定价卡片 */}
{/* 单节购买 */}

单节购买

按兴趣选择章节

¥1

/节

{/* 整本购买 - 推荐 */}
{/* 推荐标签 */}
最划算
{/* 背景光效 */}

整本购买

全部 {sectionsCount} 节内容

¥{fullBookPrice.toFixed(1)}

¥{sectionsCount}

{/* 权益列表 */}
{[ "解锁全部 " + sectionsCount + " 节商业案例", "后续更新内容免费阅读", "专属读者社群入群资格", "分销返佣最高90%" ].map((benefit, idx) => (
{benefit}
))}
{/* 购买按钮 */}
{/* 动态定价说明 */}

动态定价机制

每新增一章节,整本价格 +¥1,早买早优惠

setIsAuthOpen(false)} /> setIsPaymentOpen(false)} type="fullbook" amount={fullBookPrice} onSuccess={() => window.location.reload()} />
) }