yiming
2024-04-12 2aab00f91bd4cda4715f1a141f4d26a3667a91b6
pages/cart/index.js
@@ -11,6 +11,8 @@
Page({
  data: {
    loading: true,
    hidden: true,
    swipeOpened: false,
    onDisabled: false,
    imgUrl: [],
@@ -86,8 +88,6 @@
        totalSize: res.totalSize
      })
      res.datas.forEach(item => {
        console.log(res);
        this.setData({
          bookId: res.id,
          bookName: res.name
@@ -105,17 +105,19 @@
      this.setData({
        shoppingCartData: res.datas
      });
      console.log(this.data.shoppingCartData, 'shoppingCartData');
      if (this.data.shoppingCartData.length === 0) {
        this.setData({
          onDisabled: true
        })
      } else {
        console.log(2222);
        this.setData({
          onDisabled: false
        })
      }
      this.setData({
        loading: false,
        hidden: false,
      })
    });
    wx.stopPullDownRefresh()
@@ -271,7 +273,6 @@
  },
  // 下拉函数
  onPullDownRefresh() {
    this.setData({
      start: 1,
      checkAll: false,
@@ -281,13 +282,20 @@
    console.log(978);
    this.shoppingCartGet()
  },
  onBook(e) {
  async onBook(e) {
    const item = e.currentTarget.dataset.item
    console.log(item);
    console.log(item.productMonWithLinkDto.product.id);
    console.log(item.productMonWithLinkDto.product.name);
    let parentData = null;
    parentData = await app.MG.store.getProductBySaleMethod({
      'saleMethodId': item.saleMethod.id
    })
    console.log(parentData)
    let bookId = item.productMonWithLinkDto.product.id;
    if (parentData.parentProduct.length > 0) {
      bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
    }
    wx.navigateTo({
      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name
      url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + item.productMonWithLinkDto.product.name
    })
  }
});