fix: 为小屏手机优化购物车布局
- 订单摘要放在顶部,商品列表在下方 - 商品项使用卡片式布局 - 复选框和删除按钮绝对定位 - 图片缩小为45px,更紧凑 - 各元素尺寸适配375px宽度 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -932,9 +932,24 @@ onMounted(() => {
|
|||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.cart-page {
|
.cart-page {
|
||||||
padding-bottom: 20px;
|
padding: 8px !important;
|
||||||
padding-left: 8px;
|
padding-bottom: 16px !important;
|
||||||
padding-right: 8px;
|
}
|
||||||
|
|
||||||
|
.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 {
|
.cart-header {
|
||||||
@@ -946,39 +961,34 @@ onMounted(() => {
|
|||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 商品项 - 使用grid两行布局 */
|
/* 商品项 - 卡片式布局 */
|
||||||
.cart-item {
|
.cart-item {
|
||||||
display: grid !important;
|
display: flex !important;
|
||||||
grid-template-columns: 50px 1fr auto !important;
|
flex-direction: column !important;
|
||||||
grid-template-rows: auto auto !important;
|
padding: 10px !important;
|
||||||
|
position: relative !important;
|
||||||
gap: 8px !important;
|
gap: 8px !important;
|
||||||
padding: 12px !important;
|
min-width: 0 !important;
|
||||||
align-items: center !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 复选框 - 第一行第一列 */
|
/* 复选框 - 绝对定位左上角 */
|
||||||
.cart-item > .el-checkbox {
|
.cart-item > .el-checkbox {
|
||||||
grid-column: 1 !important;
|
position: absolute !important;
|
||||||
grid-row: 1 / 3 !important;
|
top: 8px !important;
|
||||||
width: 50px !important;
|
left: 8px !important;
|
||||||
justify-self: center !important;
|
z-index: 10 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 商品图片+信息 - 第一行第二列 */
|
/* 商品图片+名称 - 第一行 */
|
||||||
.cart-item > .item-product {
|
.cart-item > .item-product {
|
||||||
grid-column: 2 !important;
|
|
||||||
grid-row: 1 !important;
|
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
flex-direction: row !important;
|
flex-direction: row !important;
|
||||||
|
align-items: flex-start !important;
|
||||||
gap: 8px !important;
|
gap: 8px !important;
|
||||||
align-items: center !important;
|
padding-left: 32px !important;
|
||||||
}
|
padding-right: 50px !important;
|
||||||
|
min-width: 0 !important;
|
||||||
/* 删除按钮 - 第一行第三列 */
|
width: 100% !important;
|
||||||
.cart-item > .item-action {
|
|
||||||
grid-column: 3 !important;
|
|
||||||
grid-row: 1 !important;
|
|
||||||
justify-self: end !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 隐藏单价 */
|
/* 隐藏单价 */
|
||||||
@@ -986,39 +996,54 @@ onMounted(() => {
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 数量 - 第二行第二列 */
|
/* 删除按钮 - 绝对定位右上角 */
|
||||||
|
.cart-item > .item-action {
|
||||||
|
position: absolute !important;
|
||||||
|
top: 8px !important;
|
||||||
|
right: 8px !important;
|
||||||
|
z-index: 10 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 数量+小计 - 第二行 */
|
||||||
.cart-item > .item-quantity {
|
.cart-item > .item-quantity {
|
||||||
grid-column: 2 !important;
|
|
||||||
grid-row: 2 !important;
|
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
flex-direction: row !important;
|
flex-direction: row !important;
|
||||||
align-items: center !important;
|
align-items: center !important;
|
||||||
gap: 8px !important;
|
justify-content: space-between !important;
|
||||||
|
padding-left: 32px !important;
|
||||||
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 小计 - 第二行第三列 */
|
/* 小计放在数量行的右侧 */
|
||||||
.cart-item > .item-subtotal {
|
.cart-item > .item-subtotal {
|
||||||
grid-column: 3 !important;
|
display: none !important;
|
||||||
grid-row: 2 !important;
|
}
|
||||||
justify-self: end !important;
|
|
||||||
text-align: right !important;
|
/* 在数量行内显示价格 */
|
||||||
|
.item-quantity::after {
|
||||||
|
content: "¥" attr(data-price);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #f56c6c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-product .item-image {
|
.item-product .item-image {
|
||||||
width: 50px !important;
|
width: 45px !important;
|
||||||
height: 50px !important;
|
height: 45px !important;
|
||||||
flex-shrink: 0 !important;
|
flex-shrink: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-info {
|
.item-info {
|
||||||
flex: 1 !important;
|
flex: 1 !important;
|
||||||
min-width: 0 !important;
|
min-width: 0 !important;
|
||||||
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-name {
|
.item-name {
|
||||||
font-size: 14px !important;
|
font-size: 13px !important;
|
||||||
line-height: 1.3 !important;
|
line-height: 1.3 !important;
|
||||||
-webkit-line-clamp: 1 !important;
|
margin-bottom: 2px !important;
|
||||||
|
word-break: break-all !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-tags {
|
.item-tags {
|
||||||
@@ -1026,84 +1051,90 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item-quantity :deep(.el-input-number) {
|
.item-quantity :deep(.el-input-number) {
|
||||||
width: 90px !important;
|
width: 80px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-quantity .stock-tip {
|
.item-quantity .stock-tip {
|
||||||
font-size: 11px !important;
|
display: none !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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 地址 */
|
||||||
.checkout-section {
|
.checkout-section {
|
||||||
padding: 10px !important;
|
padding: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
font-size: 14px !important;
|
font-size: 13px !important;
|
||||||
margin-bottom: 10px !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 {
|
.cart-summary-panel {
|
||||||
padding: 10px !important;
|
padding: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary-title {
|
.summary-title {
|
||||||
font-size: 15px !important;
|
font-size: 14px !important;
|
||||||
margin-bottom: 10px !important;
|
margin-bottom: 8px !important;
|
||||||
padding-bottom: 8px !important;
|
padding-bottom: 6px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary-row {
|
.summary-row {
|
||||||
font-size: 13px !important;
|
font-size: 12px !important;
|
||||||
margin-bottom: 8px !important;
|
margin-bottom: 6px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.summary-total .total-amount {
|
.summary-total .total-amount {
|
||||||
font-size: 18px !important;
|
font-size: 16px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-count {
|
||||||
|
font-size: 12px !important;
|
||||||
|
margin-bottom: 8px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkout-btn {
|
.checkout-btn {
|
||||||
height: 42px !important;
|
height: 38px !important;
|
||||||
font-size: 15px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.address-item {
|
|
||||||
padding: 10px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.address-name {
|
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-detail {
|
.summary-actions {
|
||||||
font-size: 12px !important;
|
margin-top: 8px !important;
|
||||||
}
|
padding-top: 8px !important;
|
||||||
|
|
||||||
.payment-item {
|
|
||||||
padding: 12px 8px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-icon {
|
|
||||||
font-size: 24px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.payment-name {
|
|
||||||
font-size: 13px !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user