调整购买页面价格显示
This commit is contained in:
@@ -9,7 +9,7 @@ import {Card} from '@/components/ui/card'
|
||||
import {BillingMethodField} from '../shared/billing-method-field'
|
||||
import {FeatureList} from '../shared/feature-list'
|
||||
import {NumberStepperField} from '../shared/number-stepper-field'
|
||||
import {getAvailablePurchaseExpires, getAvailablePurchaseLives, getPurchaseSkuCountMin, getPurchaseSkuPrice, hasPurchaseSku, PurchaseSkuData} from '../shared/sku'
|
||||
import {getAvailablePurchaseExpires, getAvailablePurchaseLives, getPurchaseSkuCountMin, getPurchaseSkuDiscount, getPurchaseSkuPrice, hasPurchaseSku, PurchaseSkuData} from '../shared/sku'
|
||||
|
||||
export default function Center({skuData}: {
|
||||
skuData: PurchaseSkuData
|
||||
@@ -18,7 +18,7 @@ export default function Center({skuData}: {
|
||||
const type = useWatch<Schema>({name: 'type'}) as Schema['type']
|
||||
const live = useWatch<Schema>({name: 'live'}) as Schema['live']
|
||||
const expire = useWatch<Schema>({name: 'expire'}) as Schema['expire']
|
||||
const {modeList, priceMap} = skuData
|
||||
const {modeList, priceMap, discountMap} = skuData
|
||||
const liveList = type === '1'
|
||||
? getAvailablePurchaseLives(skuData, {mode: type, expire})
|
||||
: getAvailablePurchaseLives(skuData, {mode: type})
|
||||
@@ -144,6 +144,11 @@ export default function Center({skuData}: {
|
||||
live,
|
||||
expire: priceExpire,
|
||||
})
|
||||
const discount = getPurchaseSkuDiscount(discountMap, {
|
||||
mode: type,
|
||||
live,
|
||||
expire: priceExpire,
|
||||
})
|
||||
return (
|
||||
<FormOption
|
||||
key={live}
|
||||
@@ -151,6 +156,8 @@ export default function Center({skuData}: {
|
||||
value={live}
|
||||
label={`${Number(live) / 60} 小时`}
|
||||
description={price && `¥${price}/IP`}
|
||||
price={price}
|
||||
discount={discount}
|
||||
compare={field.value}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user