2025-10-26 16:26:56 +08:00

86 lines
2.9 KiB
Plaintext

<!-- pages/index/index.wxml -->
<view class="category-page">
<!-- 头部 -->
<view class="category-header">
<text class="appName">{{ appName }}</text>
<!-- 搜索框 -->
<view class="category-search">
<view class="search-bar">
<icon type="search" size="14" color="#999" />
<input placeholder="搜索" placeholder-class="placeholder" bindinput="onSearchInput"
bindconfirm="onSearch" />
<text class="search-button">搜索</text>
</view>
</view>
<!-- 分类导航 -->
<scroll-view class="category-scroll" scroll-x>
<view class="category-list">
<view class="category-item {{curCategoryId === item.id ? 'active' : ''}}" wx:for="{{categories}}" wx:key="id" data-id="{{ item.id }}" bindtap="onChooseCategory">
<image class="category-icon" src="{{item.icon}}" />
<text class="category-name">{{item.name}}</text>
</view>
</view>
</scroll-view>
</view>
<!-- 主内容区 -->
<view class="main-content">
<!-- 左侧分类 -->
<scroll-view class="left-categories" scroll-y>
<view
class="left-category-item {{item.active ? 'active' : ''}}"
wx:for="{{leftCategories}}"
wx:key="id"
bindtap="onChooseLeftCategory"
data-index="{{index}}"
>
<text>{{item.name}}</text>
</view>
</scroll-view>
<!-- 右侧商品列表 -->
<scroll-view class="right-products" scroll-y>
<!-- 推荐标签 -->
<view class="tag-list">
<view
class="tag-item {{activeTag === item ? 'active' : ''}}"
wx:for="{{recommendTags}}"
wx:key="*this"
bindtap="onChooseTab"
data-tag="{{item}}"
>
<text>{{item}}</text>
</view>
</view>
<!-- 商品网格 -->
<view class="products-grid">
<view
class="product-card"
wx:for="{{products}}"
wx:key="id"
bindtap="onGoCommodity"
data-id="{{item.id}}"
>
<image class="product-image" src="{{item.image}}" mode="aspectFill" />
<view class="product-info">
<text class="product-name">{{item.name}}</text>
<text class="product-desc">{{item.desc}}</text>
<view class="product-tags">
<text class="tag" wx:for="{{item.tags}}" wx:key="*this">{{item}}</text>
</view>
<view class="price-section">
<view class="price-left">
<view class="current-price">¥{{item.currentPrice}}</view>
<view class="original-price" wx:if="{{item.originalPrice}}">
¥{{item.originalPrice}}
</view>
</view>
<van-icon class="add-cart-btn" name="add" bindtap="onAddToCart" data-id="{{item.id}}" size="48rpx" />
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 自定义底部 TabBar -->
<custom-tabbar cartCount="{{ 1 }}" />
</view>