Browse Source

修改规格选择页面:1. 修复加载时显示暂无商品的问题 2. 改为一行显示一个规格的列表布局

蛋吧eggbar
徐飞洋 1 month ago
parent
commit
d035d591af
  1. 41
      pages/evaluate2/index.wxml
  2. 68
      pages/evaluate2/index.wxss
  3. 21
      pages/evaluate2/product-list.wxml

41
pages/evaluate2/index.wxml

@ -38,32 +38,29 @@
</view> </view>
<!-- 规格列表 --> <!-- 规格列表 -->
<view wx:if="{{!loading && !error && specifications.length > 0}}" class="spec-section"> <view wx:if="{{!loading && !error && specifications.length > 0}}" class="spec-section">
<view class="section-header"> <view class="section-header">
<text class="section-title">可用规格</text> <text class="section-title">可用规格</text>
<text class="section-count">{{specifications.length}}个</text> <text class="section-count">{{specifications.length}}个</text>
</view> </view>
<view class="spec-grid"> <view class="spec-list">
<view <view
wx:for="{{specifications}}" wx:for="{{specifications}}"
wx:key="item.name" wx:key="item.name"
class="spec-card" class="spec-item"
data-spec="{{item}}" data-spec="{{item}}"
bindtap="goToSpecDetail" bindtap="goToSpecDetail"
style="width: 224rpx; height: 125rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx"> >
<view class="spec-info" style="height: 129rpx; display: flex; box-sizing: border-box">
<text class="spec-name">{{item.name}}</text> <text class="spec-name">{{item.name}}</text>
<view class="spec-arrow">→</view>
</view> </view>
</view>
<view class="spec-arrow">→</view>
<!-- 暂无更多规格提示 -->
<view wx:if="{{specifications.length > 0}}" class="no-more">
<text class="no-more-text">暂无更多规格选择</text>
</view> </view>
</view> </view>
<!-- 暂无更多规格提示 -->
<view wx:if="{{specifications.length > 0}}" class="no-more">
<text class="no-more-text">暂无更多规格选择</text>
</view>
</view>
<!-- 无规格提示 --> <!-- 无规格提示 -->
<view wx:if="{{!loading && !error && specifications.length === 0}}" class="empty-state" style="height: 600rpx; display: flex; box-sizing: border-box"> <view wx:if="{{!loading && !error && specifications.length === 0}}" class="empty-state" style="height: 600rpx; display: flex; box-sizing: border-box">

68
pages/evaluate2/index.wxss

@ -232,32 +232,32 @@
border-radius: 20rpx; border-radius: 20rpx;
} }
/* 规格网格布局 */ /* 规格列表布局 */
.spec-grid { .spec-list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
margin-top: 16rpx; margin-top: 16rpx;
display: flex;
flex-direction: column;
gap: 16rpx;
} }
/* 规格卡片 */ /* 规格 */
.spec-card { .spec-item {
background: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.95);
border-radius: 20rpx; border-radius: 20rpx;
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.08); box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.08);
transition: all 0.3s ease; transition: all 0.3s ease;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
backdrop-filter: blur(8rpx); backdrop-filter: blur(8rpx);
border: 1rpx solid rgba(255, 255, 255, 0.3); border: 1rpx solid rgba(255, 255, 255, 0.3);
min-height: 200rpx;
display: flex; display: flex;
flex-direction: column; align-items: center;
justify-content: space-between;
} }
.spec-card::before { .spec-item::before {
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
@ -267,22 +267,15 @@
background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%); background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
} }
.spec-card:hover { .spec-item:hover {
transform: translateY(-6rpx); transform: translateY(-4rpx);
box-shadow: 0 12rpx 32rpx rgba(0,0,0,0.15); box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.12);
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
} }
.spec-card:active { .spec-item:active {
transform: translateY(-2rpx); transform: translateY(-2rpx);
box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.12); box-shadow: 0 6rpx 20rpx rgba(0,0,0,0.1);
}
.spec-info {
margin-bottom: 20rpx;
flex: 1;
display: flex;
align-items: center;
} }
.spec-name { .spec-name {
@ -291,36 +284,11 @@
color: #2c3e50; color: #2c3e50;
line-height: 1.4; line-height: 1.4;
word-break: break-word; word-break: break-word;
flex: 1;
padding-right: 40rpx; padding-right: 40rpx;
} }
.spec-price {
display: flex;
flex-direction: column;
margin-top: 16rpx;
}
.price-label {
font-size: 20rpx;
color: #999;
margin-bottom: 4rpx;
}
.price-value {
font-size: 36rpx;
font-weight: 700;
color: #e74c3c;
transition: all 0.3s ease;
}
.spec-card:hover .price-value {
transform: scale(1.05);
}
.spec-arrow { .spec-arrow {
position: absolute;
top: 32rpx;
right: 28rpx;
font-size: 32rpx; font-size: 32rpx;
color: #4a90e2; color: #4a90e2;
font-weight: bold; font-weight: bold;
@ -328,7 +296,7 @@
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.spec-card:hover .spec-arrow { .spec-item:hover .spec-arrow {
opacity: 1; opacity: 1;
transform: translateX(4rpx); transform: translateX(4rpx);
} }

21
pages/evaluate2/product-list.wxml

@ -15,15 +15,17 @@
<text class="loading-text">正在加载商品数据...</text> <text class="loading-text">正在加载商品数据...</text>
</view> </view>
<!-- 错误提示 --> <!-- 非加载状态 -->
<view wx:if="{{error}}" class="error-card"> <view wx:else>
<view class="error-icon">⚠️</view> <!-- 错误提示 -->
<text class="error-text">{{error}}</text> <view wx:if="{{error}}" class="error-card">
<button bindtap="loadProductNames" class="btn-primary">重新加载</button> <view class="error-icon">⚠️</view>
</view> <text class="error-text">{{error}}</text>
<button bindtap="loadProductNames" class="btn-primary">重新加载</button>
<!-- 商品名称列表 --> </view>
<view wx:else class="product-section">
<!-- 商品名称列表 -->
<view wx:else class="product-section">
<!-- 当前选择的分类 --> <!-- 当前选择的分类 -->
<view wx:if="{{category}}" class="current-category"> <view wx:if="{{category}}" class="current-category">
<text class="current-category-label">当前分类:</text> <text class="current-category-label">当前分类:</text>
@ -68,5 +70,6 @@
<text class="no-more-text">暂无更多商品选择</text> <text class="no-more-text">暂无更多商品选择</text>
</view> </view>
</view> </view>
</view>
</view> </view>
</view> </view>
Loading…
Cancel
Save