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.
118 lines
4.2 KiB
118 lines
4.2 KiB
<view class="container">
|
|
<!-- 头部导航栏 -->
|
|
<view class="header">
|
|
<view class="header-content" style="width: 740rpx; display: block; box-sizing: border-box; height: 106rpx">
|
|
<text class="title">分类选择</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 登录弹窗 -->
|
|
<view wx:if="{{showOneKeyLoginModal}}" class="auth-modal-overlay">
|
|
<view class="auth-modal-container">
|
|
<view class="auth-modal-title">授权登录</view>
|
|
<view class="auth-modal-content">授权您的手机号后才能使用完整功能</view>
|
|
<view class="auth-modal-buttons">
|
|
<button
|
|
class="auth-primary-button"
|
|
open-type="getPhoneNumber"
|
|
bindgetphonenumber="onGetPhoneNumber"
|
|
>
|
|
授权手机号
|
|
</button>
|
|
<button
|
|
class="auth-cancel-button"
|
|
bindtap="closeOneKeyLoginModal"
|
|
>
|
|
取消
|
|
</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="content" style="width: 600rpx; display: block; box-sizing: border-box">
|
|
<!-- 加载中状态 -->
|
|
<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>
|
|
<view class="button-group">
|
|
<button bindtap="loadCategories" class="btn-primary">重新加载</button>
|
|
<button bindtap="goBackToProductList" class="btn-secondary">返回商品列表</button>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 分类选择区域 -->
|
|
<view wx:else class="category-section">
|
|
<view class="section-header">
|
|
<text class="section-title">商品分类</text>
|
|
<text class="section-count">{{categories.length}}个</text>
|
|
</view>
|
|
<view class="category-grid">
|
|
<view
|
|
wx:for="{{categories}}"
|
|
wx:key="item"
|
|
class="category-card"
|
|
data-category="{{item}}"
|
|
bindtap="selectCategory"
|
|
style="height: 120rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx; width: 579rpx">
|
|
<view class="category-info">
|
|
<text class="category-name" style="position: relative; top: 1rpx">{{item}}</text>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 商品信息 (当有productName时显示) -->
|
|
<view wx:if="{{productName}}" class="product-card">
|
|
<view class="product-info-container">
|
|
<view class="product-info-row">
|
|
<text class="product-label">商品名称</text>
|
|
<button bindtap="goBackToProductList" class="btn-back">
|
|
<text class="btn-back-icon">←</text>
|
|
<text class="btn-back-text">更换商品</text>
|
|
</button>
|
|
</view>
|
|
<text class="product-name">{{productName}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 规格列表 (当有specifications时显示) -->
|
|
<view wx:if="{{!loading && !error && specifications.length > 0}}" class="spec-section">
|
|
<view class="section-header">
|
|
<text class="section-title">可用规格</text>
|
|
<text class="section-count">{{specifications.length}}个</text>
|
|
</view>
|
|
<view class="spec-grid">
|
|
<view
|
|
wx:for="{{specifications}}"
|
|
wx:key="item.name"
|
|
class="spec-card"
|
|
data-spec="{{item}}"
|
|
bindtap="goToSpecDetail"
|
|
>
|
|
<view class="spec-info">
|
|
<text class="spec-name">{{item.name}}</text>
|
|
</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 && productName}}" class="empty-state">
|
|
<view class="empty-icon">📋</view>
|
|
<text class="empty-text">该商品暂无可用规格</text>
|
|
<button bindtap="goBackToProductList" class="btn-secondary">返回商品列表</button>
|
|
</view>
|
|
</view>
|
|
</view>
|