diff --git a/frontend/src/views/user/Cart.vue b/frontend/src/views/user/Cart.vue index fb429a6..f7d712f 100644 --- a/frontend/src/views/user/Cart.vue +++ b/frontend/src/views/user/Cart.vue @@ -932,9 +932,24 @@ onMounted(() => { @media (max-width: 768px) { .cart-page { - padding-bottom: 20px; - padding-left: 8px; - padding-right: 8px; + padding: 8px !important; + padding-bottom: 16px !important; + } + + .cart-container { + display: flex !important; + flex-direction: column !important; + gap: 12px !important; + } + + .cart-left { + order: 2 !important; + } + + .cart-summary-panel { + order: 1 !important; + position: static !important; + margin-bottom: 0 !important; } .cart-header { @@ -946,39 +961,34 @@ onMounted(() => { overflow: visible !important; } - /* 商品项 - 使用grid两行布局 */ + /* 商品项 - 卡片式布局 */ .cart-item { - display: grid !important; - grid-template-columns: 50px 1fr auto !important; - grid-template-rows: auto auto !important; + display: flex !important; + flex-direction: column !important; + padding: 10px !important; + position: relative !important; gap: 8px !important; - padding: 12px !important; - align-items: center !important; + min-width: 0 !important; } - /* 复选框 - 第一行第一列 */ + /* 复选框 - 绝对定位左上角 */ .cart-item > .el-checkbox { - grid-column: 1 !important; - grid-row: 1 / 3 !important; - width: 50px !important; - justify-self: center !important; + position: absolute !important; + top: 8px !important; + left: 8px !important; + z-index: 10 !important; } - /* 商品图片+信息 - 第一行第二列 */ + /* 商品图片+名称 - 第一行 */ .cart-item > .item-product { - grid-column: 2 !important; - grid-row: 1 !important; display: flex !important; flex-direction: row !important; + align-items: flex-start !important; gap: 8px !important; - align-items: center !important; - } - - /* 删除按钮 - 第一行第三列 */ - .cart-item > .item-action { - grid-column: 3 !important; - grid-row: 1 !important; - justify-self: end !important; + padding-left: 32px !important; + padding-right: 50px !important; + min-width: 0 !important; + width: 100% !important; } /* 隐藏单价 */ @@ -986,39 +996,54 @@ onMounted(() => { display: none !important; } - /* 数量 - 第二行第二列 */ + /* 删除按钮 - 绝对定位右上角 */ + .cart-item > .item-action { + position: absolute !important; + top: 8px !important; + right: 8px !important; + z-index: 10 !important; + } + + /* 数量+小计 - 第二行 */ .cart-item > .item-quantity { - grid-column: 2 !important; - grid-row: 2 !important; display: flex !important; flex-direction: row !important; align-items: center !important; - gap: 8px !important; + justify-content: space-between !important; + padding-left: 32px !important; + width: 100% !important; } - /* 小计 - 第二行第三列 */ + /* 小计放在数量行的右侧 */ .cart-item > .item-subtotal { - grid-column: 3 !important; - grid-row: 2 !important; - justify-self: end !important; - text-align: right !important; + display: none !important; + } + + /* 在数量行内显示价格 */ + .item-quantity::after { + content: "¥" attr(data-price); + font-size: 14px; + font-weight: 600; + color: #f56c6c; } .item-product .item-image { - width: 50px !important; - height: 50px !important; + width: 45px !important; + height: 45px !important; flex-shrink: 0 !important; } .item-info { flex: 1 !important; min-width: 0 !important; + overflow: hidden !important; } .item-name { - font-size: 14px !important; + font-size: 13px !important; line-height: 1.3 !important; - -webkit-line-clamp: 1 !important; + margin-bottom: 2px !important; + word-break: break-all !important; } .item-tags { @@ -1026,84 +1051,90 @@ onMounted(() => { } .item-quantity :deep(.el-input-number) { - width: 90px !important; + width: 80px !important; } .item-quantity .stock-tip { - font-size: 11px !important; - } - - .item-subtotal .subtotal-price { - font-size: 14px !important; - font-weight: 600 !important; - color: #f56c6c !important; - white-space: nowrap !important; - } - - /* 支付方式 */ - .payment-methods { - grid-template-columns: repeat(2, 1fr) !important; - } - - .cart-left { - gap: 10px !important; + display: none !important; } + /* 地址 */ .checkout-section { padding: 10px !important; } .section-title { - font-size: 14px !important; - margin-bottom: 10px !important; + font-size: 13px !important; + margin-bottom: 8px !important; } + .address-item { + padding: 8px !important; + } + + .address-name { + font-size: 13px !important; + } + + .address-phone { + font-size: 12px !important; + } + + .address-detail { + font-size: 11px !important; + } + + /* 支付方式 */ + .payment-methods { + grid-template-columns: repeat(2, 1fr) !important; + gap: 6px !important; + } + + .payment-item { + padding: 8px 4px !important; + } + + .payment-icon { + font-size: 20px !important; + } + + .payment-name { + font-size: 11px !important; + } + + /* 订单摘要 */ .cart-summary-panel { padding: 10px !important; } .summary-title { - font-size: 15px !important; - margin-bottom: 10px !important; - padding-bottom: 8px !important; + font-size: 14px !important; + margin-bottom: 8px !important; + padding-bottom: 6px !important; } .summary-row { - font-size: 13px !important; - margin-bottom: 8px !important; + font-size: 12px !important; + margin-bottom: 6px !important; } .summary-total .total-amount { - font-size: 18px !important; + font-size: 16px !important; + } + + .summary-count { + font-size: 12px !important; + margin-bottom: 8px !important; } .checkout-btn { - height: 42px !important; - font-size: 15px !important; - } - - .address-item { - padding: 10px !important; - } - - .address-name { + height: 38px !important; font-size: 14px !important; } - .address-detail { - font-size: 12px !important; - } - - .payment-item { - padding: 12px 8px !important; - } - - .payment-icon { - font-size: 24px !important; - } - - .payment-name { - font-size: 13px !important; + .summary-actions { + margin-top: 8px !important; + padding-top: 8px !important; } }