fix: 重构购物车移动端布局使用flex-wrap

- 使用flex-wrap让每个元素单独一行
- 复选框垂直居中在左侧
- 删除按钮固定右上角
- 商品信息、数量、小计各占一行

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 00:20:56 +08:00
parent 2dcf3019ef
commit fa879af05e
+25 -10
View File
@@ -941,22 +941,27 @@ onMounted(() => {
display: none; display: none;
} }
/* 商品项整体容器 */
.cart-item { .cart-item {
display: block; display: flex;
flex-wrap: wrap;
align-items: flex-start;
padding: 12px; padding: 12px;
padding-left: 40px; padding-left: 44px;
position: relative; position: relative;
gap: 0;
} }
/* 复选框 - 左上角 */ /* 复选框 - 左侧固定 */
.cart-item > .el-checkbox { .cart-item > .el-checkbox {
position: absolute; position: absolute;
top: 14px; top: 50%;
left: 12px; left: 12px;
transform: translateY(-50%);
width: 24px; width: 24px;
} }
/* 删除按钮 - 右上角 */ /* 删除按钮 - 右上角固定 */
.cart-item > .item-action { .cart-item > .item-action {
position: absolute; position: absolute;
top: 12px; top: 12px;
@@ -964,52 +969,62 @@ onMounted(() => {
width: auto; width: auto;
} }
/* 商品信息 - 一行 */ /* 商品图片+信息 - 占满一行 */
.cart-item > .item-product { .cart-item > .item-product {
width: 100%;
display: flex; display: flex;
gap: 10px; gap: 10px;
padding-right: 50px; padding-right: 50px;
margin-bottom: 10px; margin-bottom: 12px;
cursor: pointer;
} }
/* 隐藏单价 */ /* 隐藏单价 */
.cart-item > .item-price { .cart-item > .item-price {
display: none; display: none;
} }
/* 数量 - 单独一行 */ /* 数量 - 占满一行 */
.cart-item > .item-quantity { .cart-item > .item-quantity {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
margin-bottom: 8px; margin-bottom: 8px;
} }
/* 小计金额 - 单独一行 */ /* 小计 - 占满一行 */
.cart-item > .item-subtotal { .cart-item > .item-subtotal {
width: 100%;
text-align: left; text-align: left;
} }
/* 商品图片 */
.item-product .item-image { .item-product .item-image {
width: 50px; width: 50px;
height: 50px; height: 50px;
flex-shrink: 0; flex-shrink: 0;
} }
/* 商品信息 */
.item-info { .item-info {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
} }
/* 数量输入框 */
.item-quantity :deep(.el-input-number) { .item-quantity :deep(.el-input-number) {
width: 100px; width: 100px;
} }
/* 小计金额样式 */
.item-subtotal .subtotal-price { .item-subtotal .subtotal-price {
font-size: 16px; font-size: 16px;
font-weight: 600;
color: #f56c6c; color: #f56c6c;
} }
/* 支付方式2列 */
.payment-methods { .payment-methods {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
} }