修复购买套餐Input框和计算数量传参的问题 &
This commit is contained in:
@@ -105,6 +105,12 @@ export default function Center() {
|
||||
className="w-40 h-10 border border-gray-200 rounded-sm text-center"
|
||||
min={minValue}
|
||||
step={step}
|
||||
onBlur={(e) => {
|
||||
const value = Number(e.target.value)
|
||||
if (value < 500) {
|
||||
form.setValue('quota', 500)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
theme="outline"
|
||||
@@ -164,9 +170,20 @@ export default function Center() {
|
||||
<Minus/>
|
||||
</Button>
|
||||
|
||||
<div className="w-40 h-10 border border-gray-200 rounded-sm flex items-center justify-center">
|
||||
{value}
|
||||
</div>
|
||||
<Input
|
||||
{...field}
|
||||
id={id}
|
||||
type="number"
|
||||
className="w-40 h-10 border border-gray-200 rounded-sm text-center"
|
||||
min={100}
|
||||
step={100}
|
||||
onBlur={(e) => {
|
||||
const value = Number(e.target.value)
|
||||
if (value < 100) {
|
||||
form.setValue('daily_limit', 100)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
theme="outline"
|
||||
|
||||
@@ -27,7 +27,7 @@ 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<string>('0.00')
|
||||
const [price, setPrice] = useState<string>('')
|
||||
|
||||
useEffect(() => {
|
||||
const price = async () => {
|
||||
@@ -36,7 +36,7 @@ export default function Right() {
|
||||
long: {
|
||||
live: Number(live),
|
||||
mode: Number(mode),
|
||||
quota: Number(mode) === 1 ? dailyLimit : quota,
|
||||
quota: Number(mode) === 1 ? Number(dailyLimit) : Number(quota),
|
||||
expire: Number(mode) === 1 ? Number(expire) : undefined,
|
||||
},
|
||||
}
|
||||
@@ -45,9 +45,6 @@ export default function Right() {
|
||||
if (priceValue.success && priceValue.data?.price) {
|
||||
setPrice(priceValue.data.price)
|
||||
}
|
||||
else {
|
||||
setPrice('0.00')
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error('获取价格失败:', error)
|
||||
|
||||
Reference in New Issue
Block a user