diff --git a/src/app/(root)/billing/page.tsx b/src/app/(root)/billing/page.tsx index c378957..4ea2ca0 100644 --- a/src/app/(root)/billing/page.tsx +++ b/src/app/(root)/billing/page.tsx @@ -1,6 +1,7 @@ "use client" import { zodResolver } from "@hookform/resolvers/zod" import { format } from "date-fns" +import { CreditCard } from "lucide-react" import { Suspense, useEffect, useState } from "react" import { Controller, useForm } from "react-hook-form" import { toast } from "sonner" @@ -342,6 +343,42 @@ export default function BillingPage() { { header: "ID", accessorKey: "id" }, { header: "会员号", accessorFn: row => row.user?.phone || "-" }, { header: "套餐号", accessorKey: "resource.resource_no" }, + { + header: "账单详情", + accessorKey: "info", + cell: ({ row }) => { + const bill = row.original + + return ( +
+ {/* 类型展示 */} +
+ {bill.type === 1 && ( +
+ + 消费 +
+ )} + {bill.type === 2 && ( +
+ + 退款 +
+ )} + {bill.type === 3 && ( +
+ + 充值 +
+ )} +
+ + {/* 账单详情 */} +
{bill.info}
+
+ ) + }, + }, { header: "应付金额", accessorKey: "amount", diff --git a/src/app/(root)/product/page.tsx b/src/app/(root)/product/page.tsx index 087bb4d..10dbed3 100644 --- a/src/app/(root)/product/page.tsx +++ b/src/app/(root)/product/page.tsx @@ -121,14 +121,16 @@ function ProductSkus(props: { selected?: number }) { columns={[ { header: "套餐编码", accessorKey: "code" }, { header: "套餐名称", accessorKey: "name" }, - { header: "单价", accessorKey: "price" }, + { header: "单价", accessorFn: row => Number(row.price).toFixed(2) }, { header: "折扣", accessorFn: row => row.discount?.name ?? "—" }, { header: "最终价格", - accessorFn: row => - row.discount + accessorFn: row => { + const value = row.discount ? (Number(row.price) * Number(row.discount.discount)) / 100 - : Number(row.price), + : Number(row.price) + return Number(value.toFixed(2)) + }, }, { header: "创建时间",