修复自定义充值和立即充值部分

This commit is contained in:
Eamon
2026-08-20 15:48:35 +08:00
parent 623e3d527f
commit 0a5e75c40c
4 changed files with 21 additions and 31 deletions

View File

@@ -193,8 +193,8 @@ export default function IpLinePage() {
return (
<>
<Toaster position="top-center" richColors />
<Wrap className="flex flex-col gap-4 mt-30 max-w-6xl mx-auto px-4 pb-20 bg-white">
<div className="grid grid-cols-3">
<Wrap className="flex flex-col gap-4 mt-20 max-w-6xl mx-auto px-4 pb-20 bg-white">
<div className="grid grid-cols-3 mt-3">
<div></div>
<h3 className="text-3xl font-bold text-gray-800 text-center">
IP线路表

View File

@@ -84,6 +84,7 @@ export default function HttpPage() {
// 支付弹窗状态
const [payDialogOpen, setPayDialogOpen] = useState(false)
const [payAmount, setPayAmount] = useState(0)
const [payMethod, setPayMethod] = useState("2")
const [isRecharge] = useState(true)
const [isLoading, setIsLoading] = useState(false)
@@ -94,10 +95,9 @@ export default function HttpPage() {
let price = 0
switch (activeTab) {
case "prepaid":
price = Number(customAmount) || 0
price = Number(customAmount) || 1
break
case "unlimited":
// 简化计算
price = whitelistCount * periodCount * 0.5
break
case "daily":
@@ -124,16 +124,18 @@ export default function HttpPage() {
setTimeout(() => {
setIsLoading(false)
setPayDialogOpen(false)
toast.success(`支付成功!支付金额:¥${totalPrice.toFixed(2)}`)
toast.success(`支付成功!支付金额:¥${payAmount.toFixed(2)}`)
}, 1500)
}
// 打开支付弹窗
const openPayDialog = () => {
if (totalPrice <= 0) {
const openPayDialog = (amount?: number) => {
const effectivePrice = Number(amount ?? totalPrice)
if (effectivePrice <= 0) {
toast.error("请输入有效的充值金额")
return
}
setPayAmount(effectivePrice)
setPayDialogOpen(true)
}
@@ -541,7 +543,7 @@ export default function HttpPage() {
<DialogContent className="sm:max-w-md">
<DialogHeader>
<DialogTitle className="text-center">
¥{totalPrice.toFixed(2)}
¥{payAmount.toFixed(2)}
</DialogTitle>
</DialogHeader>
@@ -585,7 +587,7 @@ export default function HttpPage() {
</a>
</p>
<p className="text-gray-600 mt-2">
H币{totalPrice.toFixed(2)}
H币{payAmount.toFixed(2)}
</p>
</div>
)}
@@ -614,7 +616,7 @@ function PrepaidCardCustom({
}: {
amount: string
onAmountChange: (v: string) => void
onPay: () => void
onPay: (amount: number) => void
}) {
return (
<Card className="relative text-center border-0 shadow-md overflow-visible">
@@ -643,7 +645,7 @@ function PrepaidCardCustom({
<li></li>
</ul>
<Button
onClick={onPay}
onClick={() => onPay(Number(amount) || 1)}
className="w-full rounded-md bg-linear-to-r from-blue-500 to-cyan-400 text-white hover:opacity-90"
>
@@ -657,7 +659,7 @@ function PrepaidCard({
onPay,
}: {
plan: { amount: number; bonus: string; total: number; tag: string }
onPay: () => void
onPay: (amount: number) => void
}) {
return (
<Card className="relative text-center border-0 shadow-md overflow-visible">
@@ -677,7 +679,7 @@ function PrepaidCard({
<li></li>
</ul>
<Button
onClick={onPay}
onClick={() => onPay(plan.amount)}
className="w-full rounded-md bg-linear-to-r from-blue-500 to-cyan-400 text-white hover:opacity-90"
>
@@ -692,7 +694,7 @@ function PrepaidCardLarge({
onPay,
}: {
plan: { amount: number; bonus: string; total: number; tag: string }
onPay: () => void
onPay: (amount: number) => void
}) {
return (
<Card className="relative text-center border-0 shadow-md bg-white overflow-visible">
@@ -703,7 +705,7 @@ function PrepaidCardLarge({
<div className="text-3xl font-bold">{plan.amount}</div>
<p className="text-sm text-muted-foreground">{plan.total}H币</p>
<Button
onClick={onPay}
onClick={() => onPay(plan.amount)}
className="rounded-md bg-linear-to-r from-blue-500 to-cyan-400 text-white hover:opacity-90 px-10"
>

View File

@@ -1,7 +1,4 @@
import { zodResolver } from "@hookform/resolvers/zod"
import { useEffect, useState } from "react"
import { Controller, useForm } from "react-hook-form"
import { z } from "zod"
import { useState } from "react"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
@@ -12,7 +9,6 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog"
import { FieldError } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
@@ -22,14 +18,6 @@ import alipay from "../_assets/alipay.svg"
import balance from "../_assets/balance.svg"
import wechat from "../_assets/wechat.svg"
const shippingSchema = z.object({
name: z.string().trim().min(1, "请输入收货人"),
phone: z.string().regex(/^1\d{10}$/, "请输入正确的手机号"),
address: z.string().trim().min(1, "请输入地址"),
})
type ShippingValues = z.infer<typeof shippingSchema>
const PRODUCT_VARIANTS = [
{
id: 1,

View File

@@ -24,17 +24,17 @@ export default function SoftDownloadPage() {
return (
<Wrap className="flex flex-col gap-6 mt-20 bg-white">
<div className="grid grid-cols-3">
<div className="grid grid-cols-3 mt-3">
<div></div>
<h3 className="text-3xl font-bold text-gray-800 text-center">
</h3>
<div className="flex gap-4 text-sm justify-end items-end text-blue-500">
<a
href="/softDownload"
href="/ipline"
className="no-underline hover:text-blue-700 active:no-underline focus:no-underline"
>
IP线路表
</a>
<a
href="/help"