litian
2024-04-10 0c8505fb7d8a3ba0a3ef6dbcf5a7aa8cdb36105d
pages/cart/index.js
@@ -86,8 +86,6 @@
        totalSize: res.totalSize
      })
      res.datas.forEach(item => {
        console.log(res);
        this.setData({
          bookId: res.id,
          bookName: res.name
@@ -105,13 +103,11 @@
      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
        })
@@ -281,13 +277,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
    })
  }
});