diff --git a/大妈集市.rp b/大妈集市.rp index f76caca..fbb6a29 100644 Binary files a/大妈集市.rp and b/大妈集市.rp differ diff --git a/用户端APP/1 首页/1.1 菜市场/1.1.3 会员专区/会员专区.html b/用户端APP/1 首页/1.1 菜市场/1.1.3 会员专区/会员专区.html index 10c5d9c..7d67276 100644 --- a/用户端APP/1 首页/1.1 菜市场/1.1.3 会员专区/会员专区.html +++ b/用户端APP/1 首页/1.1 菜市场/1.1.3 会员专区/会员专区.html @@ -164,6 +164,7 @@ gap: 15px; padding: 10px 0; border-bottom: 1px dashed #eee; + position: relative; } .product-list-item:last-child { border-bottom: none; @@ -212,6 +213,66 @@ border-radius: 4px; align-self: flex-start; } + + /* 购物车控件样式 */ + .add-to-cart { + position: absolute; + bottom: 5px; + right: 5px; + width: 24px; + height: 24px; + background-color: #4CAF50; + color: white; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-size: 16px; + cursor: pointer; + font-weight: bold; + } + + .cart-controls { + position: absolute; + bottom: 5px; + right: 5px; + display: none; + flex-direction: row; + align-items: center; + gap: 5px; + } + + .cart-controls.show { + display: flex; + } + + .cart-btn { + width: 24px; + height: 24px; + background-color: #4CAF50; + color: white; + border: none; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-size: 16px; + cursor: pointer; + font-weight: bold; + } + + .cart-count { + min-width: 24px; + height: 24px; + background-color: #f0f0f0; + color: #333; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + font-size: 14px; + padding: 0 5px; + } /* 响应式设计 */ @@ -337,6 +398,12 @@
300积分
积分兑换
+
+
+
+ +
1
+ +
商品图标
@@ -345,6 +412,12 @@
¥35.00
积分双倍
+
+
+
+ +
1
+ +
商品图标
@@ -353,6 +426,12 @@
¥12.50
优惠券可用
+
+
+
+ +
1
+ +
@@ -393,6 +472,12 @@
¥12.50
优惠券可用
+
+
+
+ +
1
+ +
@@ -428,6 +513,12 @@
¥58.00
积分双倍
+
+
+
+ +
1
+ +
商品图标
@@ -436,6 +527,12 @@
¥28.00
优惠券可用
+
+
+
+ +
1
+ +
@@ -513,6 +610,32 @@ } }); }); + + // 添加到购物车功能 + function addToCart(element) { + const productItem = element.closest('.product-list-item'); + const addToCartBtn = productItem.querySelector('.add-to-cart'); + const cartControls = productItem.querySelector('.cart-controls'); + + // 隐藏添加按钮,显示数量控制器 + addToCartBtn.style.display = 'none'; + cartControls.classList.add('show'); + } + + // 修改商品数量 + function changeQuantity(element, change) { + const productItem = element.closest('.product-list-item'); + const cartCountElement = productItem.querySelector('.cart-count'); + let count = parseInt(cartCountElement.innerText) || 1; + + // 更新数量 + count += change; + + // 确保数量至少为1 + if (count < 1) count = 1; + + cartCountElement.innerText = count; + } \ No newline at end of file