'use client' import {useFormContext} from 'react-hook-form' import {FormField} from '@/components/ui/form' import {RadioGroup} from '@/components/ui/radio-group' import FormOption from '../option' import {PurchaseFormValues} from './form-values' export function BillingMethodField(props: { expireList: string[] timeDailyLimit: number }) { const {setValue} = useFormContext() return ( className="flex flex-col gap-4" name="type" label="计费方式" > {({id, field}) => ( { field.onChange(value) if (value === '2') { setValue('expire', '0') return } if (props.expireList.length > 0) { setValue('expire', props.expireList[0]) } setValue('daily_limit', props.timeDailyLimit) }} className="flex gap-4 max-md:flex-col" > )} ) }