diff --git a/src/app/(home)/footer.tsx b/src/app/(home)/footer.tsx
index 1331932..9bc8e43 100644
--- a/src/app/(home)/footer.tsx
+++ b/src/app/(home)/footer.tsx
@@ -19,7 +19,7 @@ export default function Footer(props: FooterProps) {
QQ: 70177252
服务保障
@@ -56,14 +56,14 @@ export default function Footer(props: FooterProps) {
}
-
- 敬请期待
+
@@ -184,3 +183,33 @@ function DashboardChart(props: DashboardChartProps) {
)
}
+
+function LongChart() {
+ return (
+
+
+
+
+
+ `日期: ${chartData.find(item => item.formattedTime === value)?.fullDate || value}`}
+ formatter={value => [`${value}`, '套餐使用量']}
+ />
+
+
+
+
+ )
+}
diff --git a/src/components/composites/purchase/index.tsx b/src/components/composites/purchase/index.tsx
index 326ba18..9508b95 100644
--- a/src/components/composites/purchase/index.tsx
+++ b/src/components/composites/purchase/index.tsx
@@ -4,8 +4,6 @@ import {merge} from '@/lib/utils'
import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs'
import LongForm from '@/components/composites/purchase/long/form'
import ShortForm from '@/components/composites/purchase/short/form'
-import FixedForm from '@/components/composites/purchase/fixed/form'
-import Custom from '@/components/composites/purchase/custom/page'
import {usePathname, useRouter, useSearchParams} from 'next/navigation'
import SelfDesc from '@/components/features/self-desc'
export type TabType = 'short' | 'long' | 'fixed' | 'custom'
diff --git a/src/components/composites/purchase/long/right.tsx b/src/components/composites/purchase/long/right.tsx
index 1a5cae8..6dee7ef 100644
--- a/src/components/composites/purchase/long/right.tsx
+++ b/src/components/composites/purchase/long/right.tsx
@@ -19,6 +19,12 @@ import {Schema} from '@/components/composites/purchase/long/form'
import {Card} from '@/components/ui/card'
import {getPrice, CreateResourceReq} from '@/actions/resource'
+interface PriceData {
+ price: string
+ discounted_price?: string
+ discounted?: number
+}
+
export default function Right() {
const {control} = useFormContext()
const method = useWatch({control, name: 'pay_type'})
@@ -27,7 +33,11 @@ export default function Right() {
const quota = useWatch({control, name: 'quota'})
const expire = useWatch({control, name: 'expire'})
const dailyLimit = useWatch({control, name: 'daily_limit'})
- const [price, setPrice] = useState('')
+ const [priceData, setPriceData] = useState({
+ price: '0.00',
+ discounted_price: '0.00',
+ discounted: 0,
+ })
useEffect(() => {
const price = async () => {
@@ -42,17 +52,31 @@ export default function Right() {
}
try {
const priceValue = await getPrice(params)
+ console.log(priceValue, 'priceValue')
+
if (priceValue.success && priceValue.data?.price) {
- setPrice(priceValue.data.price)
+ const data: PriceData = priceValue.data
+ setPriceData({
+ price: data.price,
+ discounted_price: data.discounted_price ?? data.price ?? '',
+ discounted: data.discounted,
+ })
}
}
catch (error) {
console.error('获取价格失败:', error)
- setPrice('0.00')
+ setPriceData({
+ price: '0.00',
+ discounted_price: '0.00',
+ discounted: 0,
+ })
}
}
price()
}, [dailyLimit, expire, live, quota, mode])
+
+ const {price, discounted_price: discountedPrice = '', discounted} = priceData
+
return (
{mode === '2' ? (
-
- 购买 IP 量
-
- {quota}
- 个
-
-
+ <>
+
+ 购买 IP 量
+
+ {quota}
+ 个
+
+
+
+ 实价
+
+ ¥{price}
+
+
+ >
) : (
<>
@@ -97,19 +129,30 @@ export default function Right() {
个
+
+ 原价
+
+ ¥{price}
+
+
+
+ 总折扣
+
+ -¥{discounted}
+
+
>
)}
- 价格
+ 实付价格
- ¥
- {price}
+ ¥{discountedPrice}
-
+
)
@@ -117,7 +160,7 @@ export default function Right() {
function BalanceOrLogin(props: {
method: 'wechat' | 'alipay' | 'balance'
- price: string
+ discountedPrice: string
mode: string
live: string
quota: number
@@ -176,7 +219,7 @@ function BalanceOrLogin(props: {
()
const method = useWatch({control, name: 'pay_type'})
@@ -25,7 +32,11 @@ export default function Right() {
const expire = useWatch({control, name: 'expire'})
const quota = useWatch({control, name: 'quota'})
const dailyLimit = useWatch({control, name: 'daily_limit'})
- const [price, setPrice] = useState('')
+ const [priceData, setPriceData] = useState({
+ price: '0.00',
+ discounted_price: '0.00',
+ discounted: 0,
+ })
useEffect(() => {
const price = async () => {
@@ -40,18 +51,31 @@ export default function Right() {
}
try {
const priceResponse = await getPrice(params)
- if (priceResponse.success && priceResponse.data?.price) {
- setPrice(priceResponse.data.price)
+ console.log(priceResponse, 'priceResponse')
+
+ if (priceResponse.success && priceResponse.data) {
+ const data: PriceData = priceResponse.data
+ setPriceData({
+ price: data.price,
+ discounted_price: data.discounted_price ?? data.price ?? '',
+ discounted: data.discounted,
+ })
}
}
catch (error) {
console.error('获取价格失败:', error)
- setPrice('0.00')
+ setPriceData({
+ price: '0.00',
+ discounted_price: '0.00',
+ discounted: 0,
+ })
}
}
price()
}, [expire, live, quota, mode, dailyLimit])
+ const {price, discounted_price: discountedPrice = '', discounted} = priceData
+
return (
{mode === '2' ? (
-
- 购买 IP 量
-
- {quota}
- 个
-
-
+ <>
+
+ 购买 IP 量
+
+ {quota}
+ 个
+
+
+
+ 实价
+
+ ¥{price}
+
+
+ >
) : (
<>
@@ -96,19 +128,32 @@ export default function Right() {
个
+
+ 原价
+
+ ¥{price}
+
+
+ {discounted === 1 ? '' : (
+
+ 总折扣
+
+ -¥{discounted === 1 ? '' : discounted}
+
+
+ )}
>
)}
- 价格
+ 实付价格
- ¥
- {price}
+ ¥{discountedPrice}
-
+
)
@@ -116,7 +161,7 @@ export default function Right() {
function BalanceOrLogin(props: {
method: 'wechat' | 'alipay' | 'balance'
- price: string
+ discountedPrice: string
mode: string
live: string
quota: number
@@ -175,7 +220,7 @@ function BalanceOrLogin(props: {