This commit is contained in:
parent
519bc32be6
commit
0725bf9a2b
@ -29,7 +29,7 @@
|
||||
<!-- ID and Amount -->
|
||||
<div class="pl-4">
|
||||
<div class="text-xs text-gray-500">名称</div>
|
||||
<div>{{ order.user_id }}</div>
|
||||
<div>{{ order.product_name }}</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="text-xs text-gray-500">支付金额</div>
|
||||
@ -39,7 +39,7 @@
|
||||
<!-- Time -->
|
||||
<div class="col-span-2 pl-4">
|
||||
<div class="text-xs text-gray-500">支付时间</div>
|
||||
<div class="whitespace-nowrap">{{ formatTime(order.updated_at) }}</div>
|
||||
<div class="whitespace-nowrap">{{ formatTime(order.update_at) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-sm font-semibold text-white">{{ item.user_hash }}</span>
|
||||
<span class="text-[10px] text-white/40">{{ formatTime(item.updated_at) }}</span>
|
||||
<span class="text-[10px] text-white/40">{{ formatTime(item.update_at) }}</span>
|
||||
</div>
|
||||
<div class="text-lg font-bold text-white tabular-nums">$ {{ item.amount }}</div>
|
||||
</div>
|
||||
|
||||
@ -68,7 +68,36 @@
|
||||
<FormControl>
|
||||
<Input
|
||||
v-bind="componentField"
|
||||
type="number"
|
||||
inputmode="decimal"
|
||||
@keypress="
|
||||
(e: KeyboardEvent) => {
|
||||
if (!/[\d.]/.test(e.key)) {
|
||||
e.preventDefault()
|
||||
}
|
||||
if (e.key === '.' && (e.target as HTMLInputElement).value.includes('.')) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
"
|
||||
@input="
|
||||
(e: any) => {
|
||||
let val = e.target.value
|
||||
// 1. 只允许数字和小数点
|
||||
val = val.replace(/[^\d.]/g, '')
|
||||
// 2. 只允许一个小数点
|
||||
const parts = val.split('.')
|
||||
if (parts.length > 2) {
|
||||
val = parts[0] + '.' + parts.slice(1).join('')
|
||||
}
|
||||
// 3. 强制限制两位小数
|
||||
if (parts[1] && parts[1].length > 2) {
|
||||
val = parts[0] + '.' + parts[1].slice(0, 2)
|
||||
}
|
||||
// 4. 关键:直接同步回 DOM,防止拼音输入暂留在框内
|
||||
e.target.value = val
|
||||
setFieldValue('money', val)
|
||||
}
|
||||
"
|
||||
class="h-full flex-1 rounded-[28px]! border-none bg-[#222222] px-4 text-center text-sm font-bold text-white placeholder:text-white/20 focus:ring-0! focus-visible:ring-0!"
|
||||
placeholder="不小于200RMB"
|
||||
/>
|
||||
@ -146,9 +175,9 @@ const formSchema = toTypedSchema(
|
||||
type: z.enum(ACCOUNT_TYPE),
|
||||
account: z.string().optional(),
|
||||
money: z
|
||||
.string()
|
||||
.coerce.string()
|
||||
.min(1, '金额不能为空')
|
||||
.regex(/^\d+(\.\d+)?$/, '格式错误'),
|
||||
.regex(/^\d+(\.\d{1,2})?$/, '格式错误,最多支持两位小数'),
|
||||
avatar: z.string().optional(),
|
||||
})
|
||||
.superRefine((data, ctx) => {
|
||||
@ -160,7 +189,7 @@ const formSchema = toTypedSchema(
|
||||
}),
|
||||
)
|
||||
|
||||
const { handleSubmit, resetForm, values } = useForm({
|
||||
const { handleSubmit, resetForm, values, setFieldValue } = useForm({
|
||||
validationSchema: formSchema,
|
||||
initialValues: { type: 'USDT(TRC20)', account: '', money: '', avatar: '' },
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user