修复购买套餐每日限购字段参数 & 底部服务保障链接
This commit is contained in:
@@ -17,7 +17,7 @@ export default function Center() {
|
||||
const type = useWatch({name: 'type'})
|
||||
useEffect(() => {
|
||||
if (type === '1') {
|
||||
form.setValue('quota', 100)
|
||||
form.setValue('daily_limit', 100)
|
||||
}
|
||||
else {
|
||||
form.setValue('quota', 500)
|
||||
@@ -144,7 +144,7 @@ export default function Center() {
|
||||
{/* 包时:每日提取上限 */}
|
||||
<FormField
|
||||
className="space-y-4"
|
||||
name="quota"
|
||||
name="daily_limit"
|
||||
label="每日提取上限">
|
||||
{({id, field}) => {
|
||||
const value = Number(field.value) || 100
|
||||
@@ -159,7 +159,7 @@ export default function Center() {
|
||||
className={`h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg ${
|
||||
value === minValue ? 'opacity-50 cursor-not-allowed' : ''
|
||||
}`}
|
||||
onClick={() => form.setValue('quota', Math.max(minValue, value - step))}
|
||||
onClick={() => form.setValue('daily_limit', Math.max(minValue, value - step))}
|
||||
disabled={value === minValue}>
|
||||
<Minus/>
|
||||
</Button>
|
||||
@@ -172,7 +172,7 @@ export default function Center() {
|
||||
theme="outline"
|
||||
type="button"
|
||||
className="h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg"
|
||||
onClick={() => form.setValue('quota', value + step)}>
|
||||
onClick={() => form.setValue('daily_limit', value + step)}>
|
||||
<Plus/>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -26,6 +26,7 @@ export default function Right() {
|
||||
const live = useWatch({control, name: 'live'})
|
||||
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')
|
||||
|
||||
useEffect(() => {
|
||||
@@ -35,12 +36,10 @@ export default function Right() {
|
||||
long: {
|
||||
live: Number(live),
|
||||
mode: Number(mode),
|
||||
quota: quota,
|
||||
quota: Number(mode) === 1 ? dailyLimit : quota,
|
||||
expire: Number(mode) === 1 ? Number(expire) : undefined,
|
||||
},
|
||||
}
|
||||
console.log(params, 'params')
|
||||
|
||||
try {
|
||||
const priceValue = await getPrice(params)
|
||||
if (priceValue.success && priceValue.data?.price) {
|
||||
@@ -56,7 +55,7 @@ export default function Right() {
|
||||
}
|
||||
}
|
||||
price()
|
||||
}, [expire, live, quota, mode])
|
||||
}, [dailyLimit, expire, live, quota, mode])
|
||||
return (
|
||||
<Card className={merge(
|
||||
`flex-none basis-90 p-6 flex flex-col gap-6 relative`,
|
||||
@@ -97,7 +96,7 @@ export default function Right() {
|
||||
<li className="flex justify-between items-center">
|
||||
<span className="text-sm text-gray-500">每日限额</span>
|
||||
<span className="text-sm">
|
||||
{quota}
|
||||
{dailyLimit}
|
||||
个
|
||||
</span>
|
||||
</li>
|
||||
@@ -113,7 +112,7 @@ export default function Right() {
|
||||
</span>
|
||||
</p>
|
||||
<Suspense>
|
||||
<BalanceOrLogin {...{method, price, mode, live, quota, expire}}/>
|
||||
<BalanceOrLogin {...{method, price, mode, live, quota, expire, dailyLimit}}/>
|
||||
</Suspense>
|
||||
</Card>
|
||||
)
|
||||
@@ -126,6 +125,7 @@ function BalanceOrLogin(props: {
|
||||
live: string
|
||||
quota: number
|
||||
expire: string
|
||||
dailyLimit: number
|
||||
}) {
|
||||
const profile = use(useProfileStore(store => store.profile))
|
||||
return profile ? (
|
||||
@@ -186,7 +186,7 @@ function BalanceOrLogin(props: {
|
||||
mode: Number(props.mode),
|
||||
live: Number(props.live),
|
||||
expire: Number(props.expire),
|
||||
quota: props.quota,
|
||||
quota: props.mode === '1' ? props.dailyLimit : props.quota,
|
||||
},
|
||||
}}/>
|
||||
</>
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Center() {
|
||||
const type = useWatch({name: 'type'})
|
||||
useEffect(() => {
|
||||
if (type === '1') {
|
||||
form.setValue('quota', 2000)
|
||||
form.setValue('daily_limit', 2000)
|
||||
}
|
||||
else {
|
||||
form.setValue('quota', 10000)
|
||||
@@ -138,7 +138,7 @@ export default function Center() {
|
||||
{/* 包时:每日提取上限 */}
|
||||
<FormField
|
||||
className="space-y-4"
|
||||
name="quota"
|
||||
name="daily_limit"
|
||||
label="每日提取上限">
|
||||
{({id, field}) => (
|
||||
<div className="flex gap-2 items-center">
|
||||
@@ -146,7 +146,7 @@ export default function Center() {
|
||||
theme="outline"
|
||||
type="button"
|
||||
className="h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg"
|
||||
onClick={() => form.setValue('quota', Math.max(2_000, Number(field.value) - 1_000))}
|
||||
onClick={() => form.setValue('daily_limit', Math.max(2_000, Number(field.value) - 1_000))}
|
||||
disabled={Number(field.value) === 2_000}>
|
||||
<Minus/>
|
||||
</Button>
|
||||
@@ -162,7 +162,7 @@ export default function Center() {
|
||||
theme="outline"
|
||||
type="button"
|
||||
className="h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg"
|
||||
onClick={() => form.setValue('quota', Number(field.value) + 1_000)}>
|
||||
onClick={() => form.setValue('daily_limit', Number(field.value) + 1_000)}>
|
||||
<Plus/>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,7 @@ export default function Right() {
|
||||
const mode = useWatch({control, name: 'type'})
|
||||
const expire = useWatch({control, name: 'expire'})
|
||||
const quota = useWatch({control, name: 'quota'})
|
||||
const dailyLimit = useWatch({control, name: 'daily_limit'})
|
||||
const [price, setPrice] = useState<string>('0.00')
|
||||
useEffect(() => {
|
||||
const price = async () => {
|
||||
@@ -32,12 +33,10 @@ export default function Right() {
|
||||
short: {
|
||||
live: Number(live),
|
||||
mode: Number(mode),
|
||||
quota: quota,
|
||||
quota: Number(mode) === 1 ? dailyLimit : quota,
|
||||
expire: Number(mode) === 1 ? Number(expire) : undefined,
|
||||
},
|
||||
}
|
||||
console.log(params, 'params')
|
||||
|
||||
try {
|
||||
const priceResponse = await getPrice(params)
|
||||
if (priceResponse.success && priceResponse.data?.price) {
|
||||
@@ -53,7 +52,7 @@ export default function Right() {
|
||||
}
|
||||
}
|
||||
price()
|
||||
}, [expire, live, quota, mode])
|
||||
}, [expire, live, quota, mode, dailyLimit])
|
||||
|
||||
return (
|
||||
<Card className={merge(
|
||||
@@ -95,7 +94,7 @@ export default function Right() {
|
||||
<li className="flex justify-between items-center">
|
||||
<span className="text-sm text-gray-500">每日限额</span>
|
||||
<span className="text-sm">
|
||||
{quota}
|
||||
{dailyLimit}
|
||||
个
|
||||
</span>
|
||||
</li>
|
||||
@@ -111,7 +110,7 @@ export default function Right() {
|
||||
</span>
|
||||
</p>
|
||||
<Suspense>
|
||||
<BalanceOrLogin {...{method, price, mode, live, quota, expire}}/>
|
||||
<BalanceOrLogin {...{method, price, mode, live, quota, expire, dailyLimit}}/>
|
||||
</Suspense>
|
||||
</Card>
|
||||
)
|
||||
@@ -124,6 +123,7 @@ function BalanceOrLogin(props: {
|
||||
live: string
|
||||
quota: number
|
||||
expire: string
|
||||
dailyLimit: number
|
||||
}) {
|
||||
const profile = use(useProfileStore(store => store.profile))
|
||||
return profile ? (
|
||||
@@ -184,7 +184,7 @@ function BalanceOrLogin(props: {
|
||||
mode: Number(props.mode),
|
||||
live: Number(props.live),
|
||||
expire: Number(props.expire),
|
||||
quota: props.quota,
|
||||
quota: props.mode === '1' ? props.dailyLimit : props.quota,
|
||||
},
|
||||
}}/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user