149 lines
6.2 KiB
Plaintext
149 lines
6.2 KiB
Plaintext
<view class="mall-panel {{embedded ? 'is-embedded' : ''}}">
|
||
<view wx:if="{{loading}}" class="mall-state">加载中...</view>
|
||
<view wx:elif="{{error}}" class="mall-state">{{error}}</view>
|
||
|
||
<block wx:else>
|
||
<view class="mall-search">
|
||
<input
|
||
class="mall-search-input"
|
||
value="{{query}}"
|
||
placeholder="搜索商品"
|
||
confirm-type="search"
|
||
bindinput="onQueryInput"
|
||
/>
|
||
</view>
|
||
|
||
<scroll-view class="mall-cats" scroll-x enhanced show-scrollbar="{{false}}">
|
||
<view class="mall-cat {{categoryFilter === '' ? 'is-active' : ''}}" data-code="" bindtap="onCategoryTap">全部</view>
|
||
<view
|
||
wx:for="{{categories}}"
|
||
wx:key="code"
|
||
class="mall-cat {{categoryFilter === item.code ? 'is-active' : ''}}"
|
||
data-code="{{item.code}}"
|
||
bindtap="onCategoryTap"
|
||
>{{item.name}}</view>
|
||
</scroll-view>
|
||
|
||
<view class="mall-grid">
|
||
<view
|
||
wx:for="{{products}}"
|
||
wx:key="sku_code"
|
||
class="mall-card"
|
||
data-index="{{index}}"
|
||
bindtap="onCardTap"
|
||
>
|
||
<view class="mall-thumb-wrap">
|
||
<image wx:if="{{item.image_src}}" class="mall-thumb" src="{{item.image_src}}" mode="aspectFill" />
|
||
<view wx:else class="mall-thumb mall-thumb--empty"></view>
|
||
<view wx:if="{{item.qty > 0}}" class="mall-card-badge">{{item.qty}}</view>
|
||
</view>
|
||
<view class="mall-name">{{item.name}}</view>
|
||
<view wx:if="{{item.meta_text}}" class="mall-meta">{{item.meta_text}}</view>
|
||
<view wx:if="{{item.description}}" class="mall-desc">{{item.description}}</view>
|
||
<view class="mall-card-foot">
|
||
<view class="mall-price {{item.has_price ? '' : 'is-missing'}}">{{item.price_text}}<text wx:if="{{item.has_price && item.unit}}" class="mall-price-unit">/{{item.unit}}</text></view>
|
||
<view class="mall-step">
|
||
<view wx:if="{{item.qty > 0}}" class="mall-step-btn" data-index="{{index}}" catchtap="onQtyMinus">−</view>
|
||
<view wx:if="{{item.qty > 0}}" class="mall-step-qty" catchtap="noop">{{item.qty}}</view>
|
||
<!-- 加号常显:无价时置灰,点一下提示「待报价」(不再直接消失) -->
|
||
<view
|
||
class="mall-step-btn mall-step-btn--add {{item.has_price ? '' : 'is-disabled'}}"
|
||
data-index="{{index}}"
|
||
catchtap="onCardTap"
|
||
>+</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view wx:if="{{!products.length}}" class="mall-state mall-state--empty">暂无商品</view>
|
||
</view>
|
||
|
||
<root-portal enable="{{true}}">
|
||
<!-- 购物车条常显:空购物车也保留图标,避免用户找不到入口 -->
|
||
<view class="mall-bar">
|
||
<view class="mall-bar-left">
|
||
<van-icon name="cart-o" size="22px" color="#ffffff" />
|
||
<view class="mall-bar-badge">{{cartCount}}</view>
|
||
<view class="mall-bar-total">合计 ¥{{cartTotal}}</view>
|
||
</view>
|
||
<view class="mall-bar-btn {{cartCount > 0 ? '' : 'is-disabled'}}" bindtap="openCheckout">去下单</view>
|
||
</view>
|
||
</root-portal>
|
||
|
||
<root-portal enable="{{true}}">
|
||
<view wx:if="{{checkoutVisible}}" class="mall-mask" catchtouchmove="noop">
|
||
<view class="mall-sheet">
|
||
<view class="mall-sheet-head">
|
||
<view class="mall-sheet-title">确认下单</view>
|
||
<view class="mall-sheet-close" bindtap="closeCheckout">取消</view>
|
||
</view>
|
||
|
||
<scroll-view class="mall-sheet-body" scroll-y>
|
||
<view class="mall-sheet-items">
|
||
<view wx:for="{{checkoutItems}}" wx:key="sku_code" class="mall-sheet-item">
|
||
<text class="mall-sheet-item-name">{{item.name}}</text>
|
||
<text class="mall-sheet-item-qty">×{{item.quantity}}{{item.unit}}</text>
|
||
<text class="mall-sheet-item-amount">¥{{item.amount}}</text>
|
||
<view class="mall-item-method">
|
||
<input
|
||
class="mall-item-field mall-item-method-input"
|
||
value="{{item.processing_method}}"
|
||
data-index="{{index}}"
|
||
maxlength="50"
|
||
bindinput="onItemMethodInput"
|
||
bindblur="onItemMethodBlur"
|
||
/>
|
||
<picker
|
||
class="mall-item-method-pick"
|
||
mode="selector"
|
||
range="{{processingMethods}}"
|
||
value="{{item.methodIndex}}"
|
||
data-index="{{index}}"
|
||
bindchange="onItemMethodChange"
|
||
>
|
||
<view class="mall-item-method-arrow">▾</view>
|
||
</picker>
|
||
</view>
|
||
<input
|
||
class="mall-item-field mall-item-remark"
|
||
value="{{item.remark}}"
|
||
data-index="{{index}}"
|
||
placeholder="备注"
|
||
maxlength="200"
|
||
bindinput="onItemRemarkInput"
|
||
/>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="mall-field mall-field--address">
|
||
<text class="mall-label">收货地址</text>
|
||
<input
|
||
class="mall-input mall-input--address"
|
||
value="{{deliveryAddress}}"
|
||
placeholder="填写详细收货地址"
|
||
maxlength="200"
|
||
disabled="{{addressSaving}}"
|
||
bindinput="onAddressInput"
|
||
bindblur="onAddressBlur"
|
||
/>
|
||
</view>
|
||
<picker mode="date" start="{{dateMin}}" end="{{dateMax}}" value="{{deliveryDate}}" bindchange="onDeliveryDateChange">
|
||
<view class="mall-field">
|
||
<text class="mall-label">配送日</text>
|
||
<text class="mall-value">{{deliveryDate}}</text>
|
||
</view>
|
||
</picker>
|
||
<view class="mall-field">
|
||
<text class="mall-label">备注</text>
|
||
<input class="mall-input" value="{{remark}}" placeholder="选填" bindinput="onRemarkInput" />
|
||
</view>
|
||
</scroll-view>
|
||
<view class="mall-sheet-actions">
|
||
<view class="mall-btn mall-btn--ghost" bindtap="closeCheckout">取消</view>
|
||
<view class="mall-btn mall-btn--primary" bindtap="submitOrder">确认下单</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</root-portal>
|
||
</block>
|
||
</view>
|