|
|
|
@ -307,137 +307,81 @@ |
|
|
|
<!-- 底部弹出层 - 对比价格 --> |
|
|
|
<view wx:if="{{showCompareModal}}" class="compare-modal-overlay" bindtap="closeCompareModal"> |
|
|
|
<view class="compare-modal-container" catchtap="stopPropagation"> |
|
|
|
<view class="compare-modal-header"> |
|
|
|
<text class="compare-modal-title">对比价格</text> |
|
|
|
<text class="compare-modal-close" bindtap="closeCompareModal">×</text> |
|
|
|
<!-- 步骤指示器 --> |
|
|
|
<view class="compare-step-container"> |
|
|
|
<view class="compare-step-wrapper"> |
|
|
|
<view class="compare-step {{compareStep === 1 ? 'active' : ''}}"> |
|
|
|
<view class="compare-step-circle">{{compareStep === 1 ? '✓' : '1'}}</view> |
|
|
|
<view class="compare-step-line {{compareStep >= 2 ? 'active' : ''}}"></view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 选项卡 --> |
|
|
|
<view class="compare-tabs"> |
|
|
|
<view |
|
|
|
class="compare-tab {{activeTab === 'home' ? 'active' : ''}}" |
|
|
|
bindtap="switchTab" |
|
|
|
data-tab="home" |
|
|
|
> |
|
|
|
相同规格的同种类型 |
|
|
|
<view class="compare-step {{compareStep === 2 ? 'active' : ''}}"> |
|
|
|
<view class="compare-step-circle">{{compareStep === 2 ? '✓' : '2'}}</view> |
|
|
|
<view class="compare-step-line"></view> |
|
|
|
</view> |
|
|
|
<view class="compare-step"> |
|
|
|
<view class="compare-step-circle">3</view> |
|
|
|
</view> |
|
|
|
<view |
|
|
|
class="compare-tab {{activeTab === 'favorite' ? 'active' : ''}}" |
|
|
|
bindtap="switchTab" |
|
|
|
data-tab="favorite" |
|
|
|
> |
|
|
|
已收藏数据 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 商品列表 --> |
|
|
|
<view class="compare-goods-list"> |
|
|
|
<block wx:if="{{activeTab === 'home' && homeGoods.length > 0}}"> |
|
|
|
<view wx:for="{{homeGoods}}" wx:key="id" class="compare-goods-item" bindtap="viewCompareGoodsDetail" data-item="{{item}}"> |
|
|
|
<view class="product-image-wrapper"> |
|
|
|
<!-- 视频处理:根据mediaItems中的类型字段判断 --> |
|
|
|
<video |
|
|
|
wx:if="{{item.mediaItems && item.mediaItems.length > 0 && item.mediaItems[0].type === 'video'}}" |
|
|
|
class="product-media" |
|
|
|
src="{{item.mediaItems[0].url}}" |
|
|
|
mode="aspectFit" |
|
|
|
show-center-play-btn="{{true}}" |
|
|
|
show-play-btn="{{false}}" |
|
|
|
controls="{{true}}" |
|
|
|
autoplay="{{true}}" |
|
|
|
loop="{{true}}" |
|
|
|
muted="{{true}}" |
|
|
|
object-fit="contain" |
|
|
|
poster="" |
|
|
|
></video> |
|
|
|
<!-- 图片处理 --> |
|
|
|
<image |
|
|
|
wx:else |
|
|
|
class="product-media" |
|
|
|
src="{{item.mediaItems && item.mediaItems.length > 0 ? item.mediaItems[0].url : (item.imageUrls[0] || '')}}" |
|
|
|
mode="aspectFill" |
|
|
|
lazy-load="true" |
|
|
|
></image> |
|
|
|
<!-- 已售空标签 --> |
|
|
|
<view wx:if="{{item.isSoldOutLabel}}" class="sold-out-label">已售空</view> |
|
|
|
<!-- 标题和引导文字 --> |
|
|
|
<view class="compare-modal-header"> |
|
|
|
<text class="compare-modal-title">{{compareStep === 1 ? '选择鸡蛋品种' : '选择鸡蛋规格'}}</text> |
|
|
|
<text class="compare-modal-subtitle">{{compareStep === 1 ? '请选择您想对比的鸡蛋品种' : '请选择您想对比的鸡蛋规格'}}</text> |
|
|
|
</view> |
|
|
|
<view class="compare-goods-info"> |
|
|
|
<text class="compare-goods-name">{{item.name}}</text> |
|
|
|
<view class="compare-goods-spec-quantity"> |
|
|
|
<block wx:if="{{item.weightQuantityData && item.weightQuantityData.length > 0}}"> |
|
|
|
<view wx:for="{{item.weightQuantityData}}" wx:for-item="specItem" wx:key="index"> |
|
|
|
{{specItem.display}} |
|
|
|
<text wx:if="{{specItem.isOffShelf}}" style="color: red; margin-left: 20rpx;">已下架</text> |
|
|
|
|
|
|
|
<!-- 已选品种提示区 --> |
|
|
|
<view wx:if="{{compareStep === 2 && selectedCategory}}" class="compare-selected-category"> |
|
|
|
<text class="compare-selected-icon">✓</text> |
|
|
|
<text class="compare-selected-text">已选品种:{{selectedCategory}}</text> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
<block wx:else> |
|
|
|
{{item.specification || item.spec || item.specs || '暂无规格'}}|{{item.quantity || '暂无件数'}}件 |
|
|
|
</block> |
|
|
|
|
|
|
|
<!-- 内容区域 --> |
|
|
|
<view class="compare-content"> |
|
|
|
<!-- 品种选择列表 --> |
|
|
|
<block wx:if="{{compareStep === 1}}"> |
|
|
|
<view wx:for="{{categoryOptions}}" wx:key="index" class="compare-option {{selectedCategoryIndex === index ? 'selected' : ''}}" bindtap="selectCategory" data-index="{{index}}"> |
|
|
|
<view class="compare-option-icon">{{categoryIcons[index]}}</view> |
|
|
|
<view class="compare-option-info"> |
|
|
|
<text class="compare-option-name">{{item}}</text> |
|
|
|
<text class="compare-option-desc">{{categoryDescriptions[index]}}</text> |
|
|
|
</view> |
|
|
|
<text class="compare-goods-region-time"> |
|
|
|
{{item.province || item.region || '暂无地区'}}{{item.formattedDate ? ' | 售出时间:' + item.formattedDate : ''}} |
|
|
|
</text> |
|
|
|
<view class="compare-option-radio {{selectedCategoryIndex === index ? 'selected' : ''}}"> |
|
|
|
<view wx:if="{{selectedCategoryIndex === index}}" class="compare-option-radio-inner"></view> |
|
|
|
</view> |
|
|
|
<!-- 右侧售空文字 --> |
|
|
|
<view wx:if="{{item.status === 'sold_out'}}" class="sold-out-text">售空</view> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
<block wx:elif="{{activeTab === 'home' && homeGoods.length === 0}}"> |
|
|
|
<view class="compare-empty">暂无首页数据</view> |
|
|
|
</block> |
|
|
|
|
|
|
|
<block wx:if="{{activeTab === 'favorite' && favoriteGoods.length > 0}}"> |
|
|
|
<view wx:for="{{favoriteGoods}}" wx:key="id" class="compare-goods-item" bindtap="viewCompareGoodsDetail" data-item="{{item}}"> |
|
|
|
<view class="product-image-wrapper"> |
|
|
|
<!-- 视频处理:根据mediaItems中的类型字段判断 --> |
|
|
|
<video |
|
|
|
wx:if="{{item.mediaItems && item.mediaItems.length > 0 && item.mediaItems[0].type === 'video'}}" |
|
|
|
class="product-media" |
|
|
|
src="{{item.mediaItems[0].url}}" |
|
|
|
mode="aspectFit" |
|
|
|
show-center-play-btn="{{true}}" |
|
|
|
show-play-btn="{{false}}" |
|
|
|
controls="{{true}}" |
|
|
|
autoplay="{{true}}" |
|
|
|
loop="{{true}}" |
|
|
|
muted="{{true}}" |
|
|
|
object-fit="contain" |
|
|
|
poster="" |
|
|
|
></video> |
|
|
|
<!-- 图片处理 --> |
|
|
|
<image |
|
|
|
wx:else |
|
|
|
class="product-media" |
|
|
|
src="{{item.mediaItems && item.mediaItems.length > 0 ? item.mediaItems[0].url : (item.imageUrls[0] || '')}}" |
|
|
|
mode="aspectFill" |
|
|
|
lazy-load="true" |
|
|
|
></image> |
|
|
|
<!-- 已售空标签 --> |
|
|
|
<view wx:if="{{item.isSoldOutLabel}}" class="sold-out-label">已售空</view> |
|
|
|
<!-- 规格选择列表 --> |
|
|
|
<block wx:elif="{{compareStep === 2}}"> |
|
|
|
<view wx:for="{{currentSpecifications}}" wx:key="index" class="compare-option {{selectedSpecIndex === index ? 'selected' : ''}}" bindtap="selectSpec" data-index="{{index}}"> |
|
|
|
<view class="compare-option-info spec-info"> |
|
|
|
<text class="compare-option-name">{{item.display || item.weightSpec}}</text> |
|
|
|
<text class="compare-option-desc">{{item.price ? '价格:¥' + item.price : '价格:暂无'}}</text> |
|
|
|
</view> |
|
|
|
<view class="compare-goods-info"> |
|
|
|
<text class="compare-goods-name">{{item.name}}</text> |
|
|
|
<view class="compare-goods-spec-quantity"> |
|
|
|
<block wx:if="{{item.weightQuantityData && item.weightQuantityData.length > 0}}"> |
|
|
|
<view wx:for="{{item.weightQuantityData}}" wx:for-item="specItem" wx:key="index"> |
|
|
|
{{specItem.display}} |
|
|
|
<text wx:if="{{specItem.isOffShelf}}" style="color: red; margin-left: 20rpx;">已下架</text> |
|
|
|
<view class="compare-option-radio {{selectedSpecIndex === index ? 'selected' : ''}}"> |
|
|
|
<view wx:if="{{selectedSpecIndex === index}}" class="compare-option-radio-inner"></view> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
<block wx:else> |
|
|
|
{{item.specification || item.spec || item.specs || '暂无规格'}}|{{item.quantity || '暂无件数'}}件 |
|
|
|
</block> |
|
|
|
</view> |
|
|
|
<text class="compare-goods-region-time"> |
|
|
|
{{item.province || item.region || '暂无地区'}}{{item.formattedDate ? ' | 售出时间:' + item.formattedDate : ''}} |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
<!-- 右侧售空文字 --> |
|
|
|
<view wx:if="{{item.status === 'sold_out'}}" class="sold-out-text">售空</view> |
|
|
|
</block> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 底部按钮区域 --> |
|
|
|
<view class="compare-modal-footer"> |
|
|
|
<block wx:if="{{compareStep === 1}}"> |
|
|
|
<button class="compare-next-button" bindtap="nextStep"> |
|
|
|
下一步 |
|
|
|
</button> |
|
|
|
</block> |
|
|
|
<block wx:elif="{{activeTab === 'favorite' && favoriteGoods.length === 0}}"> |
|
|
|
<view class="compare-empty">暂无收藏商品</view> |
|
|
|
<block wx:elif="{{compareStep === 2}}"> |
|
|
|
<view class="compare-footer-buttons"> |
|
|
|
<button class="compare-back-button" bindtap="prevStep"> |
|
|
|
返回 |
|
|
|
</button> |
|
|
|
<button class="compare-confirm-button" bindtap="confirmCompare"> |
|
|
|
确认 |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</block> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|