diff --git a/app/checkout/page.jsx b/app/checkout/page.jsx
index d426d27..d75e978 100644
--- a/app/checkout/page.jsx
+++ b/app/checkout/page.jsx
@@ -3,6 +3,7 @@
import { useEffect, useState, Suspense } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import Image from "next/image";
+import PaymentModal from "@/components/PaymentModal";
function CheckoutContent() {
const router = useRouter();
@@ -11,6 +12,7 @@ function CheckoutContent() {
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [address, setAddress] = useState(null);
+ const [showPaymentModal, setShowPaymentModal] = useState(false);
// 获取地址的函数
const fetchAddress = async (token) => {
@@ -129,6 +131,10 @@ function CheckoutContent() {
)}&${params.toString()}`;
};
+ const handleSubmitOrder = () => {
+ setShowPaymentModal(true);
+ };
+
return (
@@ -215,10 +221,17 @@ function CheckoutContent() {
+
+
setShowPaymentModal(false)}
+ amount={total}
+ />
);
diff --git a/app/favicon.ico b/app/favicon.ico
index 718d6fe..4323a57 100644
Binary files a/app/favicon.ico and b/app/favicon.ico differ
diff --git a/app/globals.css b/app/globals.css
index 825a1cf..c1534fd 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -10,5 +10,4 @@
body {
color: var(--foreground);
background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
}
diff --git a/app/good/[id]/page.jsx b/app/good/[id]/page.jsx
index 50147d6..4fea3e4 100644
--- a/app/good/[id]/page.jsx
+++ b/app/good/[id]/page.jsx
@@ -24,7 +24,6 @@ export default function ProductDetail() {
throw new Error("获取商品详情失败");
}
const data = await res.json();
- console.log(data);
setProduct(data);
} catch (err) {
setError(err.message);
diff --git a/app/layout.js b/app/layout.js
index f54761d..888857b 100644
--- a/app/layout.js
+++ b/app/layout.js
@@ -1,28 +1,16 @@
-import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { Toaster } from "react-hot-toast";
-const geistSans = Geist({
- variable: "--font-geist-sans",
- subsets: ["latin"],
-});
-
-const geistMono = Geist_Mono({
- variable: "--font-geist-mono",
- subsets: ["latin"],
-});
-
export const metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
+ title: "宠物用品商城",
+ description: "专业的宠物用品购物平台,为您的宠物提供优质商品",
+ keywords: "宠物用品,宠物商城,宠物食品,宠物玩具",
};
export default function RootLayout({ children }) {
return (
-
-
+
+
{children}
{
+ const url = searchParams.get("url");
+ if (url) {
+ router.replace(decodeURIComponent(url));
+ } else if (!searchParams.toString()) {
+ router.replace("/tab");
+ }
+ }, [searchParams, router]);
+
return ;
}
diff --git a/app/tab/profile/page.jsx b/app/tab/profile/page.jsx
index cb4b51e..6b8c794 100644
--- a/app/tab/profile/page.jsx
+++ b/app/tab/profile/page.jsx
@@ -8,6 +8,7 @@ export default function Profile() {
const [isLoggedIn, setIsLoggedIn] = React.useState(false);
const [userData, setUserData] = React.useState(null);
const [points, setPoints] = useState(0);
+ const [currentImageIndex, setCurrentImageIndex] = useState(0);
useEffect(() => {
// 检查本地存储中是否有用户信息
@@ -44,6 +45,14 @@ export default function Profile() {
fetchUserPoints();
}, []);
+ useEffect(() => {
+ const timer = setInterval(() => {
+ setCurrentImageIndex((prevIndex) => (prevIndex + 1) % 3);
+ }, 3000);
+
+ return () => clearInterval(timer);
+ }, []);
+
return (
{/* 顶部用户信息区域 */}
@@ -51,7 +60,10 @@ export default function Profile() {
{isLoggedIn && userData ? (
+
+ {/* 宠物相册区域 */}
+
+
+
推荐商品
+
+
+
+ {[
+ "https://s2.loli.net/2025/02/11/QCxNUXcDaPeRohE.png",
+ "https://s2.loli.net/2025/02/11/FdX5giEp9DjGx4J.png",
+ "https://s2.loli.net/2025/02/11/9zRiqkcn43BjHvp.png",
+ ].map((url, index) => (
+
+
+
+ ))}
+
+
+ {[0, 1, 2].map((index) => (
+
+ ))}
+
+
+
);
}
diff --git a/app/user/profile/page.jsx b/app/user/profile/page.jsx
index 569c6fd..3ecd3b9 100644
--- a/app/user/profile/page.jsx
+++ b/app/user/profile/page.jsx
@@ -32,7 +32,10 @@ export default function UserProfile() {
{
+ toast.error("微信支付接口调用失败");
+ onClose();
+ };
+
+ return (
+
+
+
+
+
+
+
支付金额
+
{amount.toFixed(2)}元
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/next.config.js b/next.config.js
deleted file mode 100644
index b8856a7..0000000
--- a/next.config.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @type {import('next').NextConfig} */
-const nextConfig = {
- images: {
- remotePatterns: [
- {
- protocol: "https",
- hostname: "imageplaceholder.net",
- },
- ],
- },
-};
-
-module.exports = nextConfig;
diff --git a/next.config.mjs b/next.config.mjs
index 4678774..c1ca7fb 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -1,4 +1,17 @@
/** @type {import('next').NextConfig} */
-const nextConfig = {};
+const nextConfig = {
+ images: {
+ remotePatterns: [
+ {
+ protocol: "https",
+ hostname: "imageplaceholder.net",
+ },
+ {
+ protocol: "https",
+ hostname: "s2.loli.net",
+ },
+ ],
+ },
+};
export default nextConfig;