字段对接
All checks were successful
site-dist-deploy / build-and-deploy (push) Successful in 1m12s

This commit is contained in:
speakeloudest 2026-02-02 11:20:42 +02:00
parent 519bc32be6
commit 0725bf9a2b
3 changed files with 36 additions and 7 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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: '' },
})