yiming
2024-03-26 c5864be56488bee0c767d4b1cf157db4a0ec33c3
pages/cart/index.js
@@ -5,6 +5,7 @@
Page({
  data: {
    onDisabled: false,
    imgUrl: [],
    shoppingCartData: [],
    checkAll: false,
@@ -23,10 +24,18 @@
      title: '购物车'
    });
    this.shoppingCartGet();
    console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length');
  },
  onShow() {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        active: 3
      })
    }
    this.shoppingCartGet();
    this.setData({ totalPrice: 0.00, selectedCount: 0, checkAll: false, })
  },
  onDelete(e) {
@@ -35,7 +44,7 @@
      ids: [item.id]
    }).then(res => {
      this.shoppingCartGet();
      wx.showToast({ title: '你点击了删除', icon: 'none' });
      wx.showToast({ title: '删除图书成功', icon: 'none' });
    });
  },
@@ -53,7 +62,7 @@
      })
      res.datas.forEach(item => {
        console.log(item, 'item456');
        // console.log(item, 'item456');
        item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160');
        this.setData({
@@ -65,8 +74,22 @@
      this.setData({
        shoppingCartData: res.datas
      });
      if (this.data.shoppingCartData.length === 0) {
        console.log(11111);
        this.setData({
          onDisabled: true
        })
      } else {
        console.log(2222);
        this.setData({
          onDisabled: false
        })
      }
    });
    wx.stopPullDownRefresh()
  },
  bottomChange(e) {
@@ -126,7 +149,7 @@
        linkIds: selectedIds
      }
      app.MG.store.shoppingCartCreateOrder(data).then(res => {
        console.log(res, 456);
        // console.log(res, 456);
        const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber