filter
This commit is contained in:
parent
0b8e2e5f0c
commit
6fa48ad37a
|
|
@ -12,24 +12,7 @@ Page({
|
|||
longitude: 121.4737,
|
||||
phone: '021-88888888'
|
||||
},
|
||||
carList: [
|
||||
{
|
||||
id: 1,
|
||||
title: '丰田 卡罗拉 1.2T 自动',
|
||||
image: 'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg',
|
||||
registerDate: '2021-05',
|
||||
mileage: 3.5,
|
||||
emission: '国六'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '本田 思域 1.5T 手动',
|
||||
image: 'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg',
|
||||
registerDate: '2020-08',
|
||||
mileage: 5.2,
|
||||
emission: '国五'
|
||||
}
|
||||
],
|
||||
carList: [],
|
||||
selectedSort: 'default',
|
||||
selectedBrand: '',
|
||||
selectedPrice: '',
|
||||
|
|
@ -98,7 +81,7 @@ Page({
|
|||
method: 'POST',
|
||||
data: data
|
||||
});
|
||||
console.log(raw)
|
||||
this.setData({carList:raw.items})
|
||||
} catch (err) {
|
||||
console.error('加载品牌失败', err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@
|
|||
>
|
||||
<van-tag
|
||||
class="mytag"
|
||||
type="{{opt._checked ? 'success' : 'default'}}"
|
||||
round
|
||||
plain="{{!opt._checked}}"
|
||||
>
|
||||
{{opt.key}}
|
||||
|
|
@ -100,17 +98,20 @@
|
|||
|
||||
<!-- 汽车列表 -->
|
||||
<view class="car-list">
|
||||
<block wx:for="{{carList}}" wx:key="id">
|
||||
<view class="car-item">
|
||||
<image src="{{item.image}}" class="car-image" mode="aspectFill" />
|
||||
<view class="car-info">
|
||||
<view class="car-title">{{item.title}}</view>
|
||||
<view class="car-detail">
|
||||
<span class="car-subtext">{{item.registerDate}}</span>
|
||||
<span class="car-subtext">{{item.mileage}} km</span>
|
||||
<span class="car-subtext">{{item.emission}}</span>
|
||||
</view>
|
||||
<view wx:for="{{carList}}" wx:key="id" class="car-item">
|
||||
<image class="car-image" src="{{item.cover_image[0]}}" mode="aspectFill" />
|
||||
|
||||
<view class="car-info">
|
||||
<view class="car-title">{{item.title}}</view>
|
||||
<view class="car-price">
|
||||
<text class="price-new">¥{{item.price}}万</text>
|
||||
<text class="price-old">¥{{item.re_price}}万</text>
|
||||
</view>
|
||||
<view class="car-attrs">
|
||||
<van-tag wx:for="{{item.attr}}" wx:key="index" wx:for-item="opt">
|
||||
{{opt}}
|
||||
</van-tag>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,161 +1,383 @@
|
|||
.banner {
|
||||
height: 300rpx;
|
||||
/* 页面整体样式 */
|
||||
page {
|
||||
background-color: #f5f6fa;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
}
|
||||
|
||||
/* 顶部轮播图样式 */
|
||||
.banner {
|
||||
height: 400rpx;
|
||||
border-radius: 0 0 32rpx 32rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
border-radius: 0 0 32rpx 32rpx;
|
||||
}
|
||||
|
||||
/* 公司信息卡片 */
|
||||
.company-info {
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
margin: 24rpx 24rpx 32rpx 24rpx;
|
||||
padding: 32rpx;
|
||||
border-radius: 24rpx;
|
||||
box-shadow: 0 12rpx 48rpx rgba(102, 126, 234, 0.25);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.company-info::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
right: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.company-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
margin-bottom: 16rpx;
|
||||
text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.company-address {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.company-address van-icon {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.company-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.car-list {
|
||||
padding: 20rpx;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
.banner {
|
||||
height: 300rpx;
|
||||
}
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.car-list {
|
||||
padding: 20rpx;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
|
||||
.car-item {
|
||||
background: #fff;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 1rpx 4rpx rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.car-image {
|
||||
width: 220rpx;
|
||||
height: 140rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.car-info {
|
||||
flex: 1;
|
||||
padding: 0 10rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.car-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.car-detail text {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
.car-detail {
|
||||
font-size: 24rpx; /* 父容器整体字体大小 */
|
||||
color: #999999; /* 次要文字颜色 */
|
||||
display: flex;
|
||||
gap: 20rpx; /* 间隔,兼容微信小程序flex-gap */
|
||||
}
|
||||
|
||||
.car-subtext {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.param-options {
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
.sticky-filter {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.filter-extend {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.filter-group {
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.filter-label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.filter-checkbox {
|
||||
margin-right: 16rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.filter-range {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.range-separator {
|
||||
margin: 0 12rpx;
|
||||
}
|
||||
.range-unit {
|
||||
margin-left: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
|
||||
.company-address text {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.company-actions {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.company-actions .van-button {
|
||||
flex: 1;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.3);
|
||||
color: #ffffff !important;
|
||||
backdrop-filter: blur(10rpx);
|
||||
border-radius: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.company-actions .van-button:hover {
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
|
||||
/* 筛选栏样式 */
|
||||
.sticky-filter {
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
margin: 0 24rpx;
|
||||
overflow: hidden;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
/* 筛选扩展面板 */
|
||||
.filter-extend {
|
||||
padding: 32rpx 24rpx;
|
||||
background: #ffffff;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.filter-group {
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.filter-label {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 16rpx;
|
||||
position: relative;
|
||||
padding-left: 12rpx;
|
||||
}
|
||||
|
||||
.filter-label::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 24rpx;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
/* 标签筛选样式 */
|
||||
.filter-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx 30rpx;
|
||||
}
|
||||
.van-tag{
|
||||
padding: 10rpx 20rpx !important;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.filter-tag-item {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.filter-tag-item:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.mytag {
|
||||
transition: all 0.3s ease;
|
||||
border-radius: 20rpx !important;
|
||||
font-size: 26rpx !important;
|
||||
padding: 8rpx 16rpx !important;
|
||||
border: 2rpx solid #e1e8ed !important;
|
||||
}
|
||||
|
||||
.mytag[type="success"] {
|
||||
background: linear-gradient(135deg, #11998e, #38ef7d) !important;
|
||||
border-color: #11998e !important;
|
||||
color: #ffffff !important;
|
||||
box-shadow: 0 4rpx 12rpx rgba(17, 153, 142, 0.3);
|
||||
}
|
||||
|
||||
/* 滑块筛选样式 */
|
||||
.filter-slider-group {
|
||||
padding: 12rpx 0;
|
||||
padding: 24rpx;
|
||||
background: #f8f9fa;
|
||||
border-radius: 16rpx;
|
||||
border: 2rpx solid #e9ecef;
|
||||
}
|
||||
|
||||
.slider-label {
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
color: #495057;
|
||||
margin-bottom: 20rpx;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 确认按钮样式 */
|
||||
.filter-extend .van-button {
|
||||
background: linear-gradient(135deg, #667eea, #764ba2) !important;
|
||||
border: none !important;
|
||||
border-radius: 20rpx !important;
|
||||
font-weight: 600 !important;
|
||||
font-size: 32rpx !important;
|
||||
padding: 20rpx 0 !important;
|
||||
box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
/* 汽车列表样式 */
|
||||
.car-list {
|
||||
padding: 24rpx;
|
||||
padding-top: 16rpx;
|
||||
}
|
||||
|
||||
.car-item {
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.06);
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.car-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(135deg, transparent 0%, rgba(102, 126, 234, 0.05) 100%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.car-item:active {
|
||||
transform: translateY(-4rpx);
|
||||
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.12);
|
||||
}
|
||||
|
||||
.car-item:active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.car-image {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.car-info {
|
||||
padding: 24rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.car-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 16rpx;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.car-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.price-new {
|
||||
font-size: 36rpx;
|
||||
font-weight: 800;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.price-old {
|
||||
font-size: 26rpx;
|
||||
color: #95a5a6;
|
||||
text-decoration: line-through;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.price-old::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2rpx;
|
||||
background: #95a5a6;
|
||||
}
|
||||
|
||||
.car-attrs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.car-attrs .van-tag {
|
||||
background: linear-gradient(135deg, #ffeaa7, #fab1a0) !important;
|
||||
color: #2d3436 !important;
|
||||
border: none !important;
|
||||
border-radius: 12rpx !important;
|
||||
font-size: 22rpx !important;
|
||||
padding: 6rpx 12rpx !important;
|
||||
font-weight: 500 !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(250, 177, 160, 0.3);
|
||||
}
|
||||
|
||||
.car-attrs .van-tag:nth-child(2n) {
|
||||
background: linear-gradient(135deg, #a8e6cf, #88d8c0) !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(136, 216, 192, 0.3);
|
||||
}
|
||||
|
||||
.car-attrs .van-tag:nth-child(3n) {
|
||||
background: linear-gradient(135deg, #ffd3a5, #fd9853) !important;
|
||||
box-shadow: 0 2rpx 8rpx rgba(253, 152, 83, 0.3);
|
||||
}
|
||||
|
||||
/* 下拉菜单优化 */
|
||||
.van-dropdown-menu {
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.van-dropdown-menu__item {
|
||||
font-weight: 500;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
/* 树形选择器优化 */
|
||||
.van-tree-select {
|
||||
border-radius: 0 0 24rpx 24rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 响应式优化 */
|
||||
@media (max-width: 750rpx) {
|
||||
.company-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.filter-tags {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.car-price {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画效果 */
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(30rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.car-item {
|
||||
animation: fadeInUp 0.5s ease-out;
|
||||
}
|
||||
|
||||
.car-item:nth-child(n+2) {
|
||||
animation-delay: 0.1s;
|
||||
}
|
||||
|
||||
.car-item:nth-child(n+3) {
|
||||
animation-delay: 0.2s;
|
||||
}
|
||||
|
||||
/* 滚动条样式 */
|
||||
::-webkit-scrollbar {
|
||||
width: 8rpx;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(135deg, #5a6fd8, #6a4190);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user