微信 小程序组件 加入购物车全套 one wxml

时间:2023-02-02 09:27:53
<!--pages/shop/shop.wxml-->
<view wx:if="{{hasList}}">
<view class="container carts-list">
<view wx:key="isshop" wx:for="{{carts}}" class="carts-item" >
<view class="carts-choice">
<icon wx:if="{{item.selected}}" type="success" color="rgba(255,51,0,1)" size="30" bindtap="bindCheckbox" data-index="{{index}}"/>
<icon wx:else type="success" color="rgba(255,51,0,0.1)" size="30" bindtap="bindCheckbox" data-index="{{index}}"/>
</view>
<view class="carts-image">
<image src="{{item.image}}"></image>
</view>
<view class="carts-text">
<view class="carts-title">
<text>{{item.teaname}}</text>
</view>
<view class="carts-subtitle">
<text>¥{{item.price}}</text>
</view>
<!-- 加减号控制数量---------------------------------------- -->
<view class="stepper">
<!-- 减号 -->
<text class="{{minusStatuses[index]}}" disabled="true" data-index="{{index}}" bindtap="bindMinus">-</text>
<!-- 数值 -->
<!-- <input type="number" bindinput="bindManual" value="{{item.num}}" /> -->
<view class="number" bindchange="bindManual">{{item.num}}</view>
<!-- 加号 -->
<text class="normal" data-index="{{index}}" bindtap="bindPlus">+</text>
</view>
</view>
<view class="delete">
<view class="delete-img" bindtap="deleteList" data-index="{{index}}">
<image src="../../imgs/car/shopping_del.png"></image>
</view>
</view>
</view>
</view>
<!------------------------------------------ -->
<!-- 点击结算弹出框 -->
<!-- <toast show="{{toastHidden}}" bindchange="bindToastChange">
{{toastStr}}
</toast> -->
<!-- 点击结算弹出框 -->
<!-- <toast show="{{toastHidden}}" bindchange="bindToastChange">
加载
</toast> -->
<!-- 全选和结算---------------------------------------- -->
<view class="carts-footer">
<view class="all-chioce">
<view class="footer-left">
<icon wx:if="{{selectedAllStatus}}" type="success" color="rgba(255,51,0,1)" size="30" bindtap="bindSelectAll"/>
<icon wx:else type="success" color="rgba(255,51,0,0.1)" size="30" bindtap="bindSelectAll"/>
<text>全选</text>
</view>
<view class="footer-right">
<view class="right-text">
<text>合计</text>
<text>{{total}}</text>
</view>
<view class="free">
<text>不含运费及优惠</text>
</view>
</view>
</view>
<view class="button">立即结算</view>
</view>
</view>
<view wx:if="{{!hasList}}" class="">
<text>购物车为空的时候的布局</text>
<view class="" bindtap="tobackHome" >返回首页</view>
</view>