2025-11-24 14:00:44 +08:00

75 lines
3.2 KiB
Plaintext

<!-- pages/index/index.wxml -->
<view class="home-page">
<!-- 头部 -->
<view class="home-page__header {{isScrolled ? 'scrolled-style' : ''}}">
<view class="header-appName">
<text class="appName">{{ appName }}</text>
</view>
<!-- 搜索框 -->
<view class="home-search home-page-block-gap">
<view class="search-bar">
<icon type="search" size="14" color="#999" />
<input placeholder="搜索" placeholder-class="placeholder" bindinput="onSearchInput" />
<van-button round type="primary" size="small" bind:click="onSearch">搜索</van-button>
</view>
</view>
</view>
<!-- 分类图标区 -->
<view class="category-grid home-page-block-gap">
<view class="category-item" wx:for="{{categories}}" wx:key="id" data-id="{{item.id}}" bindtap="onGoCategory">
<image class="category-icon" src="{{item.icon}}" />
<text class="category-name">{{item.name}}</text>
</view>
</view>
<!-- 促销横幅 -->
<view class="promo-banner home-page-block-gap">
<van-notice-bar
left-icon="volume-o" background="#daf5e2" color="#333" speed="50"
text="在代码阅读过程中人们说脏话的频率是衡量代码质量的唯一标准。"
/>
</view>
<!-- 限时秒杀 -->
<view class="flash-sale home-page-block-gap">
<view class="section-header">
<text class="section-title">限时秒杀</text>
<text class="view-more">更多</text>
</view>
<scroll-view class="sale-products" scroll-x>
<view class="sale-item" wx:for="{{flashSaleProducts}}" wx:key="id" bindtap="onGoCommodity" data-id="{{item.id}}">
<image class="sale-image" src="{{item.image}}" />
<view class="sale-price-wrap">
<text class="sale-price">¥{{item.price}}</text>
<text class="original-price">¥{{item.originalPrice}}</text>
</view>
</view>
</scroll-view>
</view>
<!-- 猜你喜欢 -->
<view class="recommendation-header home-page-block-gap">
<text class="tab active">猜你喜欢</text>
<text class="tab">新品</text>
</view>
<view class="recommendation home-page-block-gap">
<view class="product-list">
<view class="product-item" wx:for="{{recommendedProducts}}" wx:key="id" bindtap="onGoCommodity" data-id="{{item.id}}">
<image class="item-image" src="{{item.image}}" mode="widthFix" />
<text class="item-name">{{item.name}}</text>
<!-- <view class="item-tags" wx:if="{{item.tags}}">
<text class="tag" wx:for="{{item.tags}}" wx:key="*this">{{item}}</text>
</view> -->
<view class="price-container">
<view>
<text class="current-price">¥{{item.price}}</text>
<text class="original-price" wx:if="{{item.originalPrice}}">¥{{item.originalPrice}}</text>
</view>
<van-icon name="add" color="#02CE26" size="48rpx" catchtap="onAddToCart" data-id="{{item.id}}" />
</view>
<!-- <view class="purchase-info">
<text class="sales" wx:if="{{item.sales}}">{{item.sales}}人付款</text>
<button class="buy-btn">立即购买</button>
</view> -->
</view>
</view>
</view>
<custom-tabbar />
</view>