添加优惠券功能 & 更新折扣管理的接口
This commit is contained in:
@@ -26,7 +26,7 @@ import { useFetch } from "@/hooks/data"
|
||||
import type { User } from "@/models/user"
|
||||
|
||||
type FilterValues = {
|
||||
phone?: string
|
||||
account?: string
|
||||
name?: string
|
||||
identified?: boolean
|
||||
enabled?: boolean
|
||||
@@ -34,7 +34,7 @@ type FilterValues = {
|
||||
}
|
||||
|
||||
const filterSchema = z.object({
|
||||
phone: z.string().optional(),
|
||||
account: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
identified: z.string().optional(),
|
||||
enabled: z.string().optional(),
|
||||
@@ -49,7 +49,7 @@ export default function UserPage() {
|
||||
const { control, handleSubmit, reset } = useForm<FormValues>({
|
||||
resolver: zodResolver(filterSchema),
|
||||
defaultValues: {
|
||||
phone: "",
|
||||
account: "",
|
||||
name: "",
|
||||
identified: "all",
|
||||
enabled: "all",
|
||||
@@ -71,7 +71,7 @@ export default function UserPage() {
|
||||
const onFilter = handleSubmit(data => {
|
||||
const result: FilterValues = {}
|
||||
|
||||
if (data.phone) result.phone = data.phone
|
||||
if (data.account) result.account = data.account
|
||||
if (data.name) result.name = data.name
|
||||
if (data.identified && data.identified !== "all")
|
||||
result.identified = data.identified === "1"
|
||||
@@ -89,15 +89,15 @@ export default function UserPage() {
|
||||
<form onSubmit={onFilter} className="bg-white p-4">
|
||||
<div className="flex flex-wrap items-end gap-4">
|
||||
<Controller
|
||||
name="phone"
|
||||
name="account"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-40 flex-none"
|
||||
>
|
||||
<FieldLabel>手机号</FieldLabel>
|
||||
<Input {...field} placeholder="请输入手机号" />
|
||||
<FieldLabel>账号</FieldLabel>
|
||||
<Input {...field} placeholder="请输入账号" />
|
||||
<FieldError>{fieldState.error?.message}</FieldError>
|
||||
</Field>
|
||||
)}
|
||||
@@ -111,8 +111,8 @@ export default function UserPage() {
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-40 flex-none"
|
||||
>
|
||||
<FieldLabel>账户</FieldLabel>
|
||||
<Input {...field} placeholder="请输入账户" />
|
||||
<FieldLabel>用户名-手机号-邮箱</FieldLabel>
|
||||
<Input {...field} placeholder="请输入用户名-手机号-邮箱" />
|
||||
<FieldError>{fieldState.error?.message}</FieldError>
|
||||
</Field>
|
||||
)}
|
||||
@@ -189,7 +189,7 @@ export default function UserPage() {
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
reset({
|
||||
phone: "",
|
||||
account: "",
|
||||
name: "",
|
||||
identified: "all",
|
||||
enabled: "all",
|
||||
@@ -260,7 +260,7 @@ export default function UserPage() {
|
||||
},
|
||||
{ header: "联系方式", accessorKey: "contact_wechat" },
|
||||
{
|
||||
header: "管理员",
|
||||
header: "客户经理",
|
||||
cell: ({ row }) => row.original.admin?.name || "-",
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user