zhangzf hace 1 día
padre
commit
d52f7d45c9

+ 12 - 4
src/app/(public)/customer/account/edit/page.tsx

@@ -9,8 +9,16 @@ import {
 import Link from "next/link";
 import { DatePicker } from "@heroui/date-picker";
 const AccountEditPage = () => {
+  interface UserForm {
+  firstname: string;
+  lastname: string;
+  date: CalendarDate  | string;
+  email: string;
+  current_password: string;
+  password: string;
+}
   // 统一表单对象
-  const [form, setForm] = useState({
+  const [form, setForm] = useState<UserForm>({
     firstname: "",
     lastname: "",
     date: parseDate("2026-05-12"),
@@ -20,7 +28,7 @@ const AccountEditPage = () => {
   });
 
   // 统一处理所有input变化
-  const handleChange = (e) => {
+  const handleChange = (e:any) => {
     const { name, value } = e.target;
     setForm((prev) => ({
       ...prev,
@@ -42,7 +50,7 @@ const AccountEditPage = () => {
     }));
   };
   // 勾选框改变时:隐藏时 → 清空密码
-  const handleCheckChange = (e) => {
+  const handleCheckChange = (e: React.ChangeEvent<HTMLInputElement>) => {
     const isChecked = e.target.checked;
     setShowContent(isChecked);
 
@@ -56,7 +64,7 @@ const AccountEditPage = () => {
     }
   };
   // 统一提交
-  const handleSubmit = (e) => {
+  const handleSubmit = (e:any) => {
     e.preventDefault();
     // 直接拿form所有数据
     console.log("表单数据:", form);

+ 11 - 4
src/app/(public)/customer/account/pointlist/page.tsx

@@ -118,7 +118,14 @@ const mockPointsData = [
     currentPoints: "My points:101240",
   },
 ];
-
+interface ListDates {
+  id: number;
+  points: number;
+  type: string;
+  desc: string;
+  createTime: string;
+  // 你自己加字段...
+}
 const PointsDetails = () => {
   // 状态管理
   const [activeTab, setActiveTab] = useState("all"); // 激活标签:all/rewarded/used
@@ -130,7 +137,7 @@ const PointsDetails = () => {
 
   // 每页展示12条
   const PAGE_SIZE = 12;
-  const fetchData = useCallback((page: number, tab: string) => {
+  const fetchData = useCallback((page: number, tab: string): Promise<ListDates[]> => {
     return new Promise((resolve) => {
         setTimeout(() => {
           let data = mockPointsData;
@@ -154,7 +161,7 @@ const PointsDetails = () => {
 
     setLoading(true);
     
-    fetchData(page+1,activeTab).then((res) => {
+    fetchData(page+1,activeTab).then((res:any) => {
 
         setListData(res);
 
@@ -169,7 +176,7 @@ const PointsDetails = () => {
   // 初始化
   useEffect(() => {
     // 筛选数据
-    fetchData(1,'all').then((result)=> {
+    fetchData(1,'all').then((result:any)=> {
         
         setListData(result);
         // 判断是否有更多数据

+ 2 - 2
src/app/(public)/customer/address/new/page.tsx

@@ -15,7 +15,7 @@ const NewAddressPage = () => {
     default_shipping: 0, // 收货地址默认
   });
   // 统一处理所有input变化
-  const handleChange = (e) => {
+  const handleChange = (e:any) => {
     const { name, value } = e.target;
     setForm((prev) => ({
       ...prev,
@@ -23,7 +23,7 @@ const NewAddressPage = () => {
     }));
   };
   // 统一提交
-  const handleSubmit = (e) => {
+  const handleSubmit = (e:any) => {
     e.preventDefault();
     // const submitData = {
     //   ...form,