gerson
2024-08-11 b2b8e5ed16f139597b10452df0c467b6e7cde500
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<view bindtap="onSwipeCellPage">
  <!-- 购物车列表结构 -->
  <view
    wx:if="{{ token && cartList.length }}"
    class="container goods-wrap"
    bindtap="onSwipeCellPageTap"
  >
    <view class="goods-item" wx:for="{{ cartList }}" wx:key="goodsId">
      <van-swipe-cell
        class="goods-swipe"
        right-width="{{ 65 }}"
        id="swipe-cell-{{ item.goodsId }}"
        bind:open="swipeCellOpen"
        bind:click="onSwipeCellClick"
      >
        <van-cell-group border="{{ false }}">
          <view class="goods-info">
            <view class="left">
              <van-checkbox
                checked-color="#FA4126"
                value="{{ item.isChecked }}"
                bindchange="updateChecked"
                data-id="{{ item.goodsId }}"
                data-index="{{ index }}"
              ></van-checkbox>
            </view>
            <view class="mid">
              <image class="img" src="{{ item.imageUrl }}" />
            </view>
            <view class="right">
              <view class="title"> {{ item.name }} </view>
              <view class="buy">
                <view class="price">
                  <view class="symbol">¥</view>
                  <view class="num">{{ item.price }}</view>
                </view>
                <view class="buy-btn">
                  <van-stepper
                    min="1"
                    max="200"
                    integer
                    value="{{ item.count }}"
                    data-id="{{ item.goodsId }}"
                    data-index="{{ index }}"
                    data-oldbuynum="{{ item.count }}"
                    bindchange="changeBuyNum"
                  />
                </view>
              </view>
            </view>
          </view>
        </van-cell-group>
        <view
          slot="right"
          class="van-swipe-cell__right"
          bindtap="delCartGoods"
          data-id="{{ item.goodsId }}"
          >删除</view
        >
      </van-swipe-cell>
    </view>
  </view>
 
  <!-- 购物车列表为空展示的结构 -->
  <van-empty wx:else description="{{ emptyDes }}">
    <navigator
      url="/pages/index/index"
      open-type="switchTab"
      wx:if="{{ token && cartList.length === 0 }}"
    >
      <van-button round type="danger" class="bottom-button">去购物</van-button>
    </navigator>
 
    <navigator url="/pages/login/login" wx:else>
      <van-button round type="danger" class="bottom-button">去登录</van-button>
    </navigator>
  </van-empty>
 
  <!-- 底部工具栏 -->
  <!-- 底部工具栏组件展示价格,默认是以 分 的形式进行展示,如果需要以 元 的方式进行展示 -->
  <van-submit-bar
    wx:if="{{ cartList.length }}"
    price="{{ totalPrice * 100 }}"
    button-text="去结算"
    tip="{{ true }}"
    bind:submit="toOrder"
  >
    <van-checkbox
      value="{{ selectAllStatus }}"
      checked-color="#FA4126"
      bindchange="selectAllStatus"
    >
      全选
    </van-checkbox>
  </van-submit-bar>
</view>