From af316e6d94c477505554b040f022f3e40457146c Mon Sep 17 00:00:00 2001 From: cyh666666 <2398882793@qq.com> Date: Wed, 28 Jan 2026 10:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=98=A8=E6=99=9A=E8=87=B3?= =?UTF-8?q?=E4=BB=8A=E6=97=A9=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 18 + pages/info/settings.uvue | 90 ++ pages/mall/consumer/cart copy.uvue | 1220 ++++++++++++++++ pages/mall/consumer/cart.uvue | 302 ++-- pages/mall/consumer/checkout copy.uvue | 1730 ++++++++++++++++++++++ pages/mall/consumer/checkout.uvue | 73 +- pages/mall/consumer/checkoutgood.uvue | 1733 +++++++++++++++++++++++ pages/mall/consumer/product-detail.uvue | 43 +- pages/mall/consumer/settings.uvue | 157 +- pages/mall/consumer/wallet.uvue | 20 +- pages/user/bind-email.uvue | 544 +++++++ pages/user/bind-phone.uvue | 548 +++++++ pages/user/change-password.uvue | 353 +++++ 13 files changed, 6635 insertions(+), 196 deletions(-) create mode 100644 pages/mall/consumer/cart copy.uvue create mode 100644 pages/mall/consumer/checkout copy.uvue create mode 100644 pages/mall/consumer/checkoutgood.uvue create mode 100644 pages/user/bind-email.uvue create mode 100644 pages/user/bind-phone.uvue create mode 100644 pages/user/change-password.uvue diff --git a/pages.json b/pages.json index a6b8041f..c07e0e02 100644 --- a/pages.json +++ b/pages.json @@ -169,6 +169,24 @@ "navigationBarTitleText": "客服聊天", "navigationStyle": "custom" } + }, + { + "path": "pages/user/change-password", + "style": { + "navigationBarTitleText": "修改密码" + } + }, + { + "path": "pages/user/bind-phone", + "style": { + "navigationBarTitleText": "绑定手机" + } + }, + { + "path": "pages/user/bind-email", + "style": { + "navigationBarTitleText": "绑定邮箱" + } } ], "tabBar": { diff --git a/pages/info/settings.uvue b/pages/info/settings.uvue index 6a96b7f5..465042e1 100644 --- a/pages/info/settings.uvue +++ b/pages/info/settings.uvue @@ -1033,4 +1033,94 @@ import i18n from '@/uni_modules/i18n/index.uts' // 保留用于语言切换 .action-btn.primary .action-text { color: #ffffff; } + +/* 响应式布局优化 */ +@media screen and (min-width: 480px) and (max-width: 767px) { + .settings-section { + margin: 12px 20px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + } + + .section-header { + width: 100%; + } + + .setting-item { + flex: 1 0 calc(50% - 20px); + margin: 10px; + border: 1px solid #f0f0f0; + border-radius: 8px; + padding: 16px; + box-sizing: border-box; + border-bottom: none; + flex-direction: column; + align-items: flex-start; + } + + .item-content { + width: 100%; + margin-bottom: 10px; + } + + .item-label, .item-desc, .item-value { + display: block; + width: 100%; + } + + .toggle-switch, .item-arrow { + align-self: flex-end; + margin-top: auto; + } +} + +@media screen and (min-width: 768px) { + .settings-page { + padding: 20px; + background-color: #f5f5f5; + } + + .settings-section { + margin: 0 auto 20px; + max-width: 800px; + border-radius: 12px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + } + + .section-header { + width: 100%; + } + + .setting-item { + flex: 1 0 calc(33.333% - 20px); + margin: 10px; + border: 1px solid #f0f0f0; + border-radius: 8px; + padding: 16px; + box-sizing: border-box; + border-bottom: none; + flex-direction: column; + align-items: flex-start; + } + + .item-content { + width: 100%; + margin-bottom: 10px; + } + + .item-label, .item-desc, .item-value { + display: block; + width: 100%; + } + + .toggle-switch, .item-arrow { + align-self: flex-end; + margin-top: auto; + } +} diff --git a/pages/mall/consumer/cart copy.uvue b/pages/mall/consumer/cart copy.uvue new file mode 100644 index 00000000..7d6e20f8 --- /dev/null +++ b/pages/mall/consumer/cart copy.uvue @@ -0,0 +1,1220 @@ + + + + + + diff --git a/pages/mall/consumer/cart.uvue b/pages/mall/consumer/cart.uvue index 69346032..5809cc95 100644 --- a/pages/mall/consumer/cart.uvue +++ b/pages/mall/consumer/cart.uvue @@ -82,6 +82,32 @@ + + + + + + + + 全选 + + + + + + 合计: + ¥{{ totalPrice }} + + + + + + + @@ -111,8 +137,8 @@ - - + + - @@ -137,7 +161,7 @@ - + --> @@ -415,15 +439,18 @@ const addToCart = (product: any) => { } } - // 检查商品是否已存在 - const existingItem = currentItems.find((item: any) => item.id === product.id) + // 检查商品是否已存在 (使用商品ID匹配,因为推荐商品没有SKU) + const existingItem = currentItems.find((item: any) => + item.productId === product.id || item.id === product.id + ) if (existingItem) { existingItem.quantity++ } else { // 添加新商品 currentItems.push({ - id: product.id, + id: product.id, // 商品ID(因为没有SKU) + productId: product.id, // 同样存储商品ID shopId: product.shopId || 'shop_recommend', shopName: product.shopName || '推荐好物', name: product.name, @@ -453,7 +480,11 @@ const goShopping = () => { } const navigateToProduct = (product: any) => { - uni.navigateTo({ url: `/pages/mall/consumer/product-detail?id=${product.id}` }) + // 使用productId(如果存在)作为跳转的商品ID,否则使用id + const productId = product.productId || product.id + uni.navigateTo({ + url: `/pages/mall/consumer/product-detail?id=${productId}&name=${encodeURIComponent(product.name)}&price=${product.price}&image=${encodeURIComponent(product.image)}` + }) } const goToCheckout = () => { @@ -465,7 +496,10 @@ const goToCheckout = () => { return } - // 获取选中的商品 + // 确保最新状态已保存到本地存储 + saveCartData() + + // 获取选中的商品 (直接过滤cartItems,不依赖cartGroups) const selectedItems = cartItems.value .filter(item => item.selected) .map(item => ({ @@ -475,10 +509,14 @@ const goToCheckout = () => { product_name: item.name, product_image: item.image, sku_specifications: item.spec, - price: item.price, - quantity: item.quantity + price: Number(item.price), // 确保是数字 + quantity: Number(item.quantity) // 确保是数字 })) + // 关键修复:将结算数据写入 Storage,确保 checkout 页面能稳定获取 + uni.setStorageSync('checkout_type', 'cart') + uni.setStorageSync('checkout_items', JSON.stringify(selectedItems)) + // 跳转到结算页面并传递数据 uni.navigateTo({ url: '/pages/mall/consumer/checkout', @@ -1059,83 +1097,171 @@ const goToCheckout = () => { } } -/* 底部结算栏 */ -.cart-footer { - position: fixed; - bottom: 0; - left: 0; - right: 0; - height: 60px; - background-color: white; - border-top: 1px solid #eee; - display: flex; - align-items: center; - justify-content: center; /* 居中内容 */ - padding: 0 15px; - z-index: 900; - padding-bottom: env(safe-area-inset-bottom); -} + /* 购物车操作栏样式 - 自适应横向排列 */ + .cart-action-bar { + background-color: white; + margin: 10px; + border-radius: 12px; + padding: 15px; + box-shadow: 0 2px 8px rgba(0,0,0,0.05); + } -.footer-content { - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; -} + .action-bar-content { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + gap: 10px; + } -.footer-left { - display: flex; - align-items: center; -} + .action-left, .action-right { + display: flex; + align-items: center; + flex-wrap: nowrap; + } -.select-all { - display: flex; - align-items: center; -} - -.select-all-text { - margin-left: 8px; - font-size: 14px; - color: #333; -} - -.footer-right { - display: flex; - align-items: center; -} - -.total-info { - margin-right: 15px; - text-align: right; -} - -.total-text { - font-size: 14px; - color: #333; - margin-right: 5px; -} - -.total-price { - font-size: 18px; - color: #ff5000; - font-weight: bold; -} - -.checkout-btn { - background-color: #ff5000; - color: white; - border: none; - border-radius: 25px; - padding: 8px 20px; - font-size: 14px; -} - -.delete-btn { - background-color: #ff3b30; /* 红色删除按钮 */ - color: white; - border: none; - border-radius: 25px; - padding: 8px 25px; - font-size: 14px; -} + .action-right { + justify-content: flex-end; + flex: 1; + min-width: 0; /* 防止溢出 */ + } + + /* 合计信息区域 - 自适应横向排列 */ + .total-info { + display: flex; + align-items: center; + margin-right: 12px; + flex-shrink: 0; + } + + .total-text { + font-size: 14px; + color: #333; + margin-right: 5px; + white-space: nowrap; + } + + .total-price { + font-size: 18px; + color: #ff5000; + font-weight: bold; + white-space: nowrap; + } + + /* 结算按钮 */ + .checkout-btn, .delete-btn { + background-color: #ff5000; + color: white; + border: none; + border-radius: 25px; + padding: 8px 20px; + font-size: 14px; + white-space: nowrap; + flex-shrink: 0; + } + + .delete-btn { + background-color: #ff3b30; /* 红色删除按钮 */ + padding: 8px 25px; + } + + /* 全选区域 */ + .select-all { + display: flex; + align-items: center; + } + + .select-all-text { + margin-left: 8px; + font-size: 14px; + color: #333; + white-space: nowrap; + } + + /* 响应式调整 */ + /* 手机端小屏幕优化 */ + @media screen and (max-width: 375px) { + .action-bar-content { + gap: 8px; + } + + .total-text { + font-size: 13px; + } + + .total-price { + font-size: 16px; + } + + .checkout-btn, .delete-btn { + padding: 8px 15px; + font-size: 13px; + } + + .select-all-text { + font-size: 13px; + } + } + + /* 平板端优化 */ + @media screen and (min-width: 768px) { + .cart-action-bar { + margin: 20px auto; + max-width: 95%; + padding: 20px; + } + + .action-bar-content { + gap: 20px; + } + + .total-price { + font-size: 20px; + } + + .checkout-btn, .delete-btn { + padding: 10px 30px; + font-size: 16px; + } + } + + /* 桌面端优化 */ + @media screen and (min-width: 1024px) { + .cart-action-bar { + max-width: 1200px; + padding: 20px 30px; + } + + .action-bar-content { + justify-content: space-between; + } + + .total-info { + margin-right: 30px; + } + + .total-text { + font-size: 16px; + } + + .total-price { + font-size: 22px; + } + + .checkout-btn, .delete-btn { + padding: 12px 40px; + font-size: 16px; + } + + .select-all-text { + font-size: 16px; + } + } + + /* 大屏幕优化 */ + @media screen and (min-width: 1400px) { + .cart-action-bar { + max-width: 1400px; + } + } diff --git a/pages/mall/consumer/checkout copy.uvue b/pages/mall/consumer/checkout copy.uvue new file mode 100644 index 00000000..7318fbf1 --- /dev/null +++ b/pages/mall/consumer/checkout copy.uvue @@ -0,0 +1,1730 @@ + +