购买页面 & IP提取页面样式调整

This commit is contained in:
Eamon-meng
2026-04-27 17:08:41 +08:00
parent 78d916ade1
commit 574ad0e662
7 changed files with 102 additions and 87 deletions

View File

@@ -81,6 +81,35 @@ export default function Center({skuData}: {
return (
<Card className="flex-auto p-6 flex flex-col gap-10 relative">
<BillingMethodField modeList={modeList} timeDailyLimit={100}/>
{/* 套餐时效 */}
{type === '1' && (
<FormField name="expire" label="套餐有效时间" description="有效时间内可用于提取 IP">
{({id, field}) => (
<RadioGroup
id={id}
value={field.value}
onValueChange={(value) => {
field.onChange(value)
const nextLiveList = getAvailablePurchaseLives(skuData, {mode: type, expire: value})
if (!nextLiveList.includes(live) && nextLiveList[0]) {
setValue('live', nextLiveList[0])
}
}}
className="flex gap-4 flex-wrap">
{expireList.map(day => (
<FormOption
key={day}
id={`${id}-${day}`}
value={day}
label={`${day}`}
compare={field.value}
/>
))}
</RadioGroup>
)}
</FormField>
)}
{/* IP 时效 */}
<FormField<Schema, 'live'>
@@ -129,36 +158,6 @@ export default function Center({skuData}: {
)}
</FormField>
{/* 套餐时效 */}
{type === '1' && (
<FormField name="expire" label="套餐有效时间" description="有效时间内可用于提取 IP">
{({id, field}) => (
<RadioGroup
id={id}
value={field.value}
onValueChange={(value) => {
field.onChange(value)
const nextLiveList = getAvailablePurchaseLives(skuData, {mode: type, expire: value})
if (!nextLiveList.includes(live) && nextLiveList[0]) {
setValue('live', nextLiveList[0])
}
}}
className="flex gap-4 flex-wrap">
{expireList.map(day => (
<FormOption
key={day}
id={`${id}-${day}`}
value={day}
label={`${day}`}
compare={field.value}
/>
))}
</RadioGroup>
)}
</FormField>
)}
{/* 每日提取上限/购买数量 */}
{type === '1' ? (
<NumberStepperField

View File

@@ -20,7 +20,7 @@ export type Schema = z.infer<typeof schema>
export default function LongForm({skuList}: {skuList: ProductItem['skus']}) {
const skuData = parsePurchaseSkuList('long', skuList)
const defaultMode = skuData.modeList.includes('2') ? '2' : '1'
const defaultMode = skuData.modeList.includes('1') ? '1' : '2'
const defaultLive = getAvailablePurchaseLives(skuData, {mode: defaultMode})[0] || ''
const defaultExpire = defaultMode === '1'
? getAvailablePurchaseExpires(skuData, {mode: defaultMode, live: defaultLive})[0] || '0'