闫增涛
2024-04-03 f52c21331fa71bd3ae6be41117f35cb54b076119
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -41,6 +41,9 @@
      type: Boolean,
      value: false,
    },
    checkAllState: {
      type: Boolean,
    },
  },
  data: {
    sonPurchaseSaleMethodId: "",
@@ -165,7 +168,10 @@
        ) {
          return wx.showToast({
            icon: "error",
            title: "请先购买该资源",
            title:
              item.saleMethod[0].Price > 0
                ? "请先购买该资源"
                : "请先点击领取查看按钮",
          });
        }
        wx.navigateTo({
@@ -307,16 +313,9 @@
        ids.push(item.id);
        checked = item.checked;
      });
      const flag =
        list.findIndex((item) => item.checked == false) > -1 ? true : false;
      var myEventDetail = {
        value: flag,
      }; // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true,
      }; // 触发事件的选项
      this.triggerEvent("changeCheckAll", myEventDetail, myEventOption);
      // const flag =
      //   list.findIndex((item) => item.checked == false) > -1 ? true : false;
      const flag = this.properties.checkAllState;
      const updataList = this.findAndUpdateItemsByIds(
        this.properties.treeList,
        ids,
@@ -331,6 +330,14 @@
      this.setData({
        treeList: updataList,
      });
      var myEventDetail = {
        value: !flag,
      }; // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true,
      }; // 触发事件的选项
      this.triggerEvent("changeCheckAll", myEventDetail, myEventOption);
    },
    // 章节勾选
@@ -422,6 +429,8 @@
      });
      if (shoppingCartGetId.includes(saleMethodId)) {
        console.log(111);
        // this.data.updateShoppingCartHidden();
        // this.data.updateCloudLearning();
        wx.showToast({
          icon: "error",
@@ -448,6 +457,11 @@
        });
      }
    },
    sadd() {
      this.triggerEvent("updateShoppingCartHidden");
      this.triggerEvent("updateCloudLearning");
      console.log(789);
    },
  },
  catchtap() {},