diff --git a/src/app/(root)/batch/page.tsx b/src/app/(root)/batch/page.tsx index 7c3014e..7f683a2 100644 --- a/src/app/(root)/batch/page.tsx +++ b/src/app/(root)/batch/page.tsx @@ -275,9 +275,10 @@ export default function BatchPage() { accessorKey: "resource.resource_no", cell: ({ row }) => { const resourceNo = row.original.resource?.resource_no + const type = row.original.resource?.type return ( (loadData) + console.log(table, "table") const onFilter = handleSubmit(() => { table.pagination.onPageChange(1) @@ -353,24 +354,24 @@ export default function BillingPage() { header: "创建时间", accessorKey: "created_at", cell: ({ row }) => { - const createdAt = row.original.created_at; - if (!createdAt) return -; - - const date = new Date(createdAt); - if (isNaN(date.getTime())) return -; - - return format(date, "yyyy-MM-dd HH:mm:ss"); + const createdAt = row.original.created_at + if (!createdAt) return - + + const date = new Date(createdAt) + if (isNaN(date.getTime())) return - + + return format(date, "yyyy-MM-dd HH:mm:ss") }, }, { header: "套餐号", accessorKey: "resource.resource_no", - cell: ({ row }) => { const resource_no = row.original.resource?.resource_no + const type = row.original.resource?.type return resource_no ? ( { const resource_no = row.original.resource?.resource_no + const type = row.original.resource?.type return ( { - const createdAt = row.original.created_at; - if (!createdAt) return -; - - const date = new Date(createdAt); - if (isNaN(date.getTime())) return -; - - return format(date, "yyyy-MM-dd HH:mm:ss"); + const createdAt = row.original.created_at + if (!createdAt) return - + + const date = new Date(createdAt) + if (isNaN(date.getTime())) return - + + return format(date, "yyyy-MM-dd HH:mm:ss") }, }, { header: "过期时间", accessorKey: "expired_at", cell: ({ row }) => { - const expiredAt = row.original.expired_at; - if (!expiredAt) return -; - - const date = new Date(expiredAt); - if (isNaN(date.getTime())) return -; - - return format(date, "yyyy-MM-dd HH:mm:ss"); + const expiredAt = row.original.expired_at + if (!expiredAt) return - + + const date = new Date(expiredAt) + if (isNaN(date.getTime())) return - + + return format(date, "yyyy-MM-dd HH:mm:ss") }, }, ]} diff --git a/src/app/(root)/client/batch/page.tsx b/src/app/(root)/client/batch/page.tsx index 9f69969..02262cd 100644 --- a/src/app/(root)/client/batch/page.tsx +++ b/src/app/(root)/client/batch/page.tsx @@ -1,6 +1,7 @@ "use client" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" +import Link from "next/link" import { useRouter, useSearchParams } from "next/navigation" import { Suspense, useState } from "react" import { Controller, useForm } from "react-hook-form" @@ -250,7 +251,24 @@ export default function BatchPage() { header: "会员号", accessorFn: row => row.user?.phone || "", }, - { header: "套餐号", accessorKey: "resource.resource_no" }, + { + header: "套餐号", + accessorKey: "resource.resource_no", + cell: ({ row }) => { + const resourceNo = row.original.resource?.resource_no + const type = row.original.resource?.type + return ( + + {resourceNo} + + ) + }, + }, { header: "批次号", accessorKey: "batch_no" }, { header: "省份", accessorKey: "prov" }, { header: "城市", accessorKey: "city" }, diff --git a/src/app/(root)/client/billing/page.tsx b/src/app/(root)/client/billing/page.tsx index b870fa7..9e5b85d 100644 --- a/src/app/(root)/client/billing/page.tsx +++ b/src/app/(root)/client/billing/page.tsx @@ -2,6 +2,7 @@ import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" import { CreditCard, Wallet } from "lucide-react" +import Link from "next/link" import { useRouter, useSearchParams } from "next/navigation" import { Suspense, useEffect, useState } from "react" import { Controller, useForm } from "react-hook-form" @@ -340,13 +341,31 @@ export default function BillingPage() { "yyyy-MM-dd HH:mm:ss", ), }, - { header: "套餐号", accessorKey: "resource.resource_no" }, + { + header: "套餐号", + accessorKey: "resource.resource_no", + cell: ({ row }) => { + const resource_no = row.original.resource?.resource_no + const type = row.original.resource?.type + return resource_no ? ( + + {resource_no} + + ) : ( + + ) + }, + }, { header: "账单详情", accessorKey: "info", cell: ({ row }) => { const bill = row.original - return (
diff --git a/src/app/(root)/client/channel/page.tsx b/src/app/(root)/client/channel/page.tsx index 8389d5f..3d51448 100644 --- a/src/app/(root)/client/channel/page.tsx +++ b/src/app/(root)/client/channel/page.tsx @@ -1,6 +1,7 @@ "use client" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" +import Link from "next/link" import { useRouter, useSearchParams } from "next/navigation" import { Suspense, useState } from "react" import { Controller, useForm } from "react-hook-form" @@ -244,7 +245,24 @@ export default function ChannelPage() { header: "会员号", accessorFn: row => row.user?.phone || "", }, - { header: "套餐号", accessorKey: "resource.resource_no" }, + { + header: "套餐号", + accessorKey: "resource.resource_no", + cell: ({ row }) => { + const resource_no = row.original.resource?.resource_no + const type = row.original.resource?.type + return ( + + {resource_no} + + ) + }, + }, { header: "批次号", accessorKey: "batch_no" }, { header: "节点", diff --git a/src/app/(root)/client/resources/page.tsx b/src/app/(root)/client/resources/page.tsx index bacc75c..caaaa8a 100644 --- a/src/app/(root)/client/resources/page.tsx +++ b/src/app/(root)/client/resources/page.tsx @@ -16,6 +16,12 @@ import { DataTable, useDataTable } from "@/components/data-table" import { Page } from "@/components/page" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu" import { Field, FieldError, @@ -224,6 +230,7 @@ function ResourceList({ resourceType }: ResourceListProps) { const isLong = resourceType === "long" const listFn = isLong ? ResourceLong : ResourceShort const [updatingId, setUpdatingId] = useState(null) + const router = useRouter() const { control, handleSubmit, reset } = useForm({ resolver: zodResolver(filterSchema), defaultValues: { @@ -313,7 +320,34 @@ function ResourceList({ resourceType }: ResourceListProps) {
{name}
- {resourceNo} + + + {resourceNo} + + + { + router.push(`/billing?resource_no=${resourceNo}`) + }} + > + 账单详情 + + { + router.push(`/batch?resource_no=${resourceNo}`) + }} + > + 提取记录 + + { + router.push(`/channel?resource_no=${resourceNo}`) + }} + > + IP管理 + + +
@@ -435,7 +469,7 @@ function ResourceList({ resourceType }: ResourceListProps) { }, }, ], - [isLong, updatingId, handleStatusChange], + [isLong, updatingId, handleStatusChange, router], ) return ( diff --git a/src/app/(root)/cust/page.tsx b/src/app/(root)/cust/page.tsx index 53b811b..9943d0b 100644 --- a/src/app/(root)/cust/page.tsx +++ b/src/app/(root)/cust/page.tsx @@ -99,7 +99,6 @@ export default function CustPage() { (page: number, size: number) => { const result: FilterValues = {} const filters = getValues() - console.log(filters, "filters") if (filters.account?.trim()) result.account = filters.account.trim() if (filters.name?.trim()) result.name = filters.name.trim() diff --git a/src/app/(root)/resources/page.tsx b/src/app/(root)/resources/page.tsx index 44d3c0f..f98243a 100644 --- a/src/app/(root)/resources/page.tsx +++ b/src/app/(root)/resources/page.tsx @@ -176,9 +176,24 @@ function getTodayUsage(lastAt: Date | null | undefined, daily: number) { } export default function ResourcesPage() { + const searchParams = useSearchParams() + const typeParam = searchParams.get("type") + + const defaultTab = useMemo(() => { + if (typeParam === "1") return "short" + if (typeParam === "2") return "long" + return "short" + }, [typeParam]) + + const [activeTab, setActiveTab] = useState(defaultTab) + return ( - + 短效套餐 @@ -253,6 +268,7 @@ function ResourceList({ resourceType }: ResourceListProps) { ) const table = useDataTable(fetchResources) + console.log(table, "table") const handleStatusChange = useCallback( async (resource: Resources, newStatusValue: string) => { @@ -369,7 +385,7 @@ function ResourceList({ resourceType }: ResourceListProps) { const detail = getResourceDetail(row.original) const live = detail?.live if (live === undefined) return "-" - return {isLong ? `${live}小时` : `${live}分钟`} + return {isLong ? `${live}分钟` : `${live}分钟`} }, }, {