You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.8 KiB

<view class="container">
<!-- 头部导航栏 -->
<view class="header">
<view class="header-content" style="width: 800rpx; display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; padding: 0 20rpx;">
<button class="title" bindtap="goBackToCategories">返回分类</button>
<text class="title">商品选择</text>
<view style="width: 120rpx;"></view> <!-- 占位,保持标题居中 -->
</view>
</view>
<view class="content">
<!-- 加载中状态 -->
<view wx:if="{{loading}}" class="loading">
<view class="loading-spinner"></view>
<text class="loading-text">正在加载商品数据...</text>
</view>
<!-- 错误提示 -->
<view wx:if="{{error}}" class="error-card">
<view class="error-icon">⚠️</view>
<text class="error-text">{{error}}</text>
<button bindtap="loadProductNames" class="btn-primary">重新加载</button>
</view>
<!-- 商品名称列表 -->
<view wx:else class="product-section">
<!-- 当前选择的分类 -->
<view wx:if="{{category}}" class="current-category">
<text class="current-category-label">当前分类:</text>
<text class="current-category-name">{{category}}</text>
<!-- 价格范围 -->
<view wx:if="{{priceRange.hasPrice}}" class="price-range">
<text class="price-range-label">价格范围:</text>
<text class="price-range-value">¥{{priceRange.min}} - ¥{{priceRange.max}}</text>
</view>
</view>
<view class="section-header">
<text class="section-title">商品列表</text>
<text class="section-count">{{productNames.length}}个商品</text>
</view>
<!-- 有商品时显示网格 -->
<view wx:if="{{productNames.length > 0}}" class="product-grid">
<view
wx:for="{{productNames}}"
wx:key="*this"
class="product-card"
data-product="{{item}}"
bindtap="selectProduct"
>
<view class="product-icon">🛍️</view>
<text class="product-name">{{item}}</text>
<view class="product-arrow">→</view>
</view>
</view>
<!-- 无商品时显示空状态 -->
<view wx:if="{{productNames.length === 0}}" class="empty-state">
<view class="empty-icon">📦</view>
<text class="empty-text">
{{category ? '该分类下暂无商品' : '暂无商品'}}
</text>
<button bindtap="loadProductNames" class="btn-secondary">重新加载</button>
</view>
<!-- 暂无更多商品提示 -->
<view wx:if="{{productNames.length > 0}}" class="no-more">
<text class="no-more-text">暂无更多商品选择</text>
</view>
</view>
</view>
</view>