From 4307efae98646dd31e631992670fe385dbbc25da Mon Sep 17 00:00:00 2001 From: Eamon <17516219072@163.com> Date: Sat, 11 Apr 2026 17:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=93=8D=E4=BD=9C=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=B8=BA=E8=8F=9C=E5=8D=95=E6=A0=8F=20&=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=A1=B5=E9=9D=A2=E8=A1=A8=E6=A0=BC=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/trade.ts | 7 - src/app/(root)/admin/page.tsx | 6 +- src/app/(root)/balance/page.tsx | 2 +- src/app/(root)/batch/page.tsx | 4 +- src/app/(root)/billing/page.tsx | 16 +- src/app/(root)/channel/page.tsx | 2 +- src/app/(root)/client/balance/page.tsx | 2 +- src/app/(root)/client/batch/page.tsx | 17 +- src/app/(root)/client/billing/page.tsx | 27 ++- src/app/(root)/client/channel/page.tsx | 16 +- src/app/(root)/client/cust/page.tsx | 198 ++++++++--------- src/app/(root)/client/resources/page.tsx | 17 +- src/app/(root)/client/trade/page.tsx | 97 +++++---- src/app/(root)/cust/deposit.tsx | 2 +- src/app/(root)/cust/page.tsx | 167 ++++++++------- src/app/(root)/product/create.tsx | 44 +++- src/app/(root)/product/page.tsx | 2 +- src/app/(root)/product/update.tsx | 45 ++-- src/app/(root)/resources/page.tsx | 2 +- src/app/(root)/trade/page.tsx | 138 ++++-------- src/app/(root)/user/page.tsx | 2 +- src/components/ui/dropdown-menu.tsx | 257 +++++++++++++++++++++++ 22 files changed, 675 insertions(+), 395 deletions(-) create mode 100644 src/components/ui/dropdown-menu.tsx diff --git a/src/actions/trade.ts b/src/actions/trade.ts index f9bc93f..75965e8 100644 --- a/src/actions/trade.ts +++ b/src/actions/trade.ts @@ -30,10 +30,3 @@ export async function getTrade(params: { }) { return callByUser>("/api/admin/trade/page/of-user", params) } -export async function getTradeComplete(params: { - user_id: number - trade_no: string - method: number -}) { - return callByUser>("/api/admin/trade/complete", params) -} diff --git a/src/app/(root)/admin/page.tsx b/src/app/(root)/admin/page.tsx index 86548c4..3701912 100644 --- a/src/app/(root)/admin/page.tsx +++ b/src/app/(root)/admin/page.tsx @@ -54,15 +54,15 @@ export default function AdminPage() { { header: "用户名", accessorKey: "username" }, { header: "姓名", - accessorFn: row => row.name ?? "-", + accessorFn: row => row.name ?? "", }, { header: "手机号", - accessorFn: row => row.phone ?? "-", + accessorFn: row => row.phone ?? "", }, { header: "邮箱", - accessorFn: row => row.email ?? "-", + accessorFn: row => row.email ?? "", }, { header: "状态", diff --git a/src/app/(root)/balance/page.tsx b/src/app/(root)/balance/page.tsx index ad9d3b8..5dd5b10 100644 --- a/src/app/(root)/balance/page.tsx +++ b/src/app/(root)/balance/page.tsx @@ -146,7 +146,7 @@ export default function BalancePage() { - + + + + + + 用户会员号: {userPhone} +
- + + 用户会员号: {userPhone}
- + + 用户会员号: {userPhone} +
- + - + @@ -249,30 +249,7 @@ export default function UserQueryPage() { header: "操作", cell: ({ row }) => { return ( -
- {/* - - - - - */} +
- - - - - - - - - - - - - - - - + + + + + + + { + router.push( + `/client/trade?userId=${row.original.id}`, + ) + }} + > + 交易明细 + + + + { + router.push( + `/client/billing?userId=${row.original.id}`, + ) + }} + > + 账单详情 + + + + { + router.push( + `/client/resources?userId=${row.original.id}`, + ) + }} + > + 套餐管理 + + + + { + router.push( + `/client/batch?userId=${row.original.id}`, + ) + }} + > + 提取记录 + + + + { + router.push( + `/client/channel?userId=${row.original.id}`, + ) + }} + > + IP管理 + + + + { + router.push( + `/client/balance?userId=${row.original.id}&phone=${row.original.phone}`, + ) + }} + > + 余额明细 + + + +
) }, @@ -370,20 +354,6 @@ export default function UserQueryPage() { currentUser={currentEditUser} onSuccess={refreshTable} /> - - {/* */} - - {/* */}
) } diff --git a/src/app/(root)/client/resources/page.tsx b/src/app/(root)/client/resources/page.tsx index b87f5d6..8e7bb11 100644 --- a/src/app/(root)/client/resources/page.tsx +++ b/src/app/(root)/client/resources/page.tsx @@ -2,7 +2,7 @@ import { zodResolver } from "@hookform/resolvers/zod" import { format, isBefore, isSameDay } from "date-fns" import { Box, Loader2, Timer } from "lucide-react" -import { useSearchParams } from "next/navigation" +import { useRouter, useSearchParams } from "next/navigation" import { Suspense, useCallback, useMemo, useState } from "react" import { Controller, useForm } from "react-hook-form" import { toast } from "sonner" @@ -421,9 +421,20 @@ function ResourceList({ resourceType }: ResourceListProps) { ], [isLong, updatingId, handleStatusChange], ) - + const router = useRouter() + const userPhone = searchParams.get("phone") return (
+ + 用户会员号: {userPhone} +
- + + 用户会员号: {userPhone} +
- + - + @@ -361,109 +367,124 @@ export default function CustPage() { meta: { pin: "right" }, header: "操作", cell: ({ row }) => { + const user = row.original return ( -
+
+ + - - - - - - - - - - - - - - - - - - + + + + + + + + router.push( + `/client/trade?userId=${user.id}&phone=${user.phone}`, + ) + } + > + 交易明细 + + + + + + router.push( + `/client/billing?userId=${user.id}&phone=${user.phone}`, + ) + } + > + 账单详情 + + + + + + router.push( + `/client/resources?userId=${user.id}&phone=${user.phone}`, + ) + } + > + 套餐管理 + + + + + + router.push( + `/client/batch?userId=${user.id}&phone=${user.phone}`, + ) + } + > + 提取记录 + + + + + + router.push( + `/client/channel?userId=${user.id}&phone=${user.phone}`, + ) + } + > + IP管理 + + + + + + router.push( + `/client/balance?userId=${user.id}&phone=${user.phone}`, + ) + } + > + 余额明细 + + + +
) }, diff --git a/src/app/(root)/product/create.tsx b/src/app/(root)/product/create.tsx index b94ab7c..24652ab 100644 --- a/src/app/(root)/product/create.tsx +++ b/src/app/(root)/product/create.tsx @@ -43,16 +43,17 @@ const schema = z.object({ .refine( v => !Number.isNaN(Number(v)) && Number(v) > 0, "请输入有效的正数单价", - ), + ) + .refine(val => /^\d+(\.\d{1,2})?$/.test(val), "价格最多只能保留两位小数"), discount_id: z.string().optional(), price_min: z .string() - .optional() - .or(z.literal("")) + .min(1, "请输入最低价格") .refine( - v => !v || (!Number.isNaN(Number(v)) && Number(v) > 0), + v => !Number.isNaN(Number(v)) && Number(v) > 0, "请输入有效的正数价格", - ), + ) + .refine(val => /^\d+(\.\d{1,2})?$/.test(val), "价格最多只能保留两位小数"), }) export function CreateProductSku(props: { @@ -159,12 +160,25 @@ export function CreateProductSku(props: { name="price" render={({ field, fieldState }) => ( - 单价 + 单价 ) => { + let value = e.target.value + value = value.replace(/[^\d.]/g, "") + const dotCount = (value.match(/\./g) || []).length + if (dotCount > 1) { + value = value.slice(0, value.lastIndexOf(".")) + } + if (value.includes(".")) { + const [int, dec] = value.split(".") + value = `${int}.${dec.slice(0, 2)}` + } + field.onChange(value) + }} /> {fieldState.invalid && ( @@ -172,7 +186,6 @@ export function CreateProductSku(props: { )} /> - 最低价格 ) => { + let value = e.target.value + value = value.replace(/[^\d.]/g, "") + const dotCount = (value.match(/\./g) || []).length + if (dotCount > 1) { + value = value.slice(0, value.lastIndexOf(".")) + } + if (value.includes(".")) { + const [int, dec] = value.split(".") + value = `${int}.${dec.slice(0, 2)}` + } + field.onChange(value) + }} /> {fieldState.invalid && ( diff --git a/src/app/(root)/product/page.tsx b/src/app/(root)/product/page.tsx index dc75284..7e051e4 100644 --- a/src/app/(root)/product/page.tsx +++ b/src/app/(root)/product/page.tsx @@ -57,7 +57,7 @@ function Products(props: { }, [refresh]) return ( -
+

产品列表

diff --git a/src/app/(root)/product/update.tsx b/src/app/(root)/product/update.tsx index 86a3f93..7e682ef 100644 --- a/src/app/(root)/product/update.tsx +++ b/src/app/(root)/product/update.tsx @@ -43,7 +43,8 @@ const schema = z.object({ .refine( v => !Number.isNaN(Number(v)) && Number(v) > 0, "请输入有效的正数单价", - ), + ) + .refine(val => /^\d+(\.\d{1,2})?$/.test(val), "价格最多只能保留两位小数"), discount_id: z.string().optional(), price_min: z .string() @@ -51,7 +52,8 @@ const schema = z.object({ .refine( v => !Number.isNaN(Number(v)) && Number(v) > 0, "请输入有效的正数价格", - ), + ) + .refine(val => /^\d+(\.\d{1,2})?$/.test(val), "价格最多只能保留两位小数"), }) export function UpdateProductSku(props: { @@ -97,19 +99,6 @@ export function UpdateProductSku(props: { : null, price_min: data.price_min, }) - console.log({ - id: props.sku.id, - code: data.code, - name: data.name, - price: data.price, - discount_id: - data.discount_id && data.discount_id !== "" - ? Number(data.discount_id) - : null, - price_min: data.price_min, - }) - - console.log(resp, "resp") if (resp.success) { toast.success("套餐修改成功") @@ -182,6 +171,19 @@ export function UpdateProductSku(props: { placeholder="请输入单价" {...field} aria-invalid={fieldState.invalid} + onChange={(e: React.ChangeEvent) => { + let value = e.target.value + value = value.replace(/[^\d.]/g, "") + const dotCount = (value.match(/\./g) || []).length + if (dotCount > 1) { + value = value.slice(0, value.lastIndexOf(".")) + } + if (value.includes(".")) { + const [int, dec] = value.split(".") + value = `${int}.${dec.slice(0, 2)}` + } + field.onChange(value) + }} /> {fieldState.invalid && ( @@ -200,6 +202,19 @@ export function UpdateProductSku(props: { placeholder="请输入最低价格" {...field} aria-invalid={fieldState.invalid} + onChange={(e: React.ChangeEvent) => { + let value = e.target.value + value = value.replace(/[^\d.]/g, "") + const dotCount = (value.match(/\./g) || []).length + if (dotCount > 1) { + value = value.slice(0, value.lastIndexOf(".")) + } + if (value.includes(".")) { + const [int, dec] = value.split(".") + value = `${int}.${dec.slice(0, 2)}` + } + field.onChange(value) + }} /> {fieldState.invalid && ( diff --git a/src/app/(root)/resources/page.tsx b/src/app/(root)/resources/page.tsx index 5ca78cd..7d55e19 100644 --- a/src/app/(root)/resources/page.tsx +++ b/src/app/(root)/resources/page.tsx @@ -542,7 +542,7 @@ function ResourceList({ resourceType }: ResourceListProps) { />
- + + - )} - +
+ {platform === 1 ? ( + 电脑网站 + ) : platform === 2 ? ( + 手机网站 + ) : ( + - + )}
) }, }, + { + header: "支付渠道", + accessorKey: "method", + cell: ({ row }) => { + const methodMap: Record = { + 1: "支付宝", + 2: "微信", + 3: "商福通", + 4: "商福通渠道支付宝", + 5: "商福通渠道微信", + } + return ( +
+ {methodMap[row.original.method as number] || "未知"} +
+ ) + }, + }, + { header: "渠道订单号", accessorKey: "outer_no" }, ]} /> diff --git a/src/app/(root)/user/page.tsx b/src/app/(root)/user/page.tsx index 3170bb8..0b86b99 100644 --- a/src/app/(root)/user/page.tsx +++ b/src/app/(root)/user/page.tsx @@ -80,7 +80,7 @@ export default function UserPage() {
- +