闫增涛
2024-04-09 3d73fb33c46aada16a6060adcd4ea14bb33b6b2a
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -1,7 +1,5 @@
const util = require("./components/util"); // 引入封装过的加载提示
import {
  loginInfo
} from "../../../../../../assets/js/login";
import { loginInfo } from "../../../../../../assets/js/login";
const app = getApp();
Component({
  // checked: false,
@@ -57,10 +55,7 @@
    shoppingCart: true,
    stop: false,
  },
  ready() {
    this.setData({});
    console.log("准备");
  },
  ready() {},
  onLoad() {
    this.setData({
@@ -75,7 +70,6 @@
    treeList: function (newValue) {
      const list = [];
      let checked = "";
      console.log("新值", this.properties.treeList);
      this.properties.treeList.forEach((item) => {
        if (item.children && item.children.length > 0) {
          list.push(...this.flattenTree([item]));
@@ -89,7 +83,8 @@
    handleList(tree) {
      for (let index = 0; index < tree.length; index++) {
        const item = tree[index];
        if (item.sysType == "CmsItem" && !item.checked) {}
        if (item.sysType == "CmsItem" && !item.checked) {
        }
        if (item.children && item.children.length > 0) {
          this.handleList(item.children);
        }
@@ -169,7 +164,10 @@
        ) {
          return wx.showToast({
            icon: "error",
            title: "请先购买该资源",
            title:
              item.saleMethod[0].Price > 0
                ? "请先购买该资源"
                : "请先点击领取查看按钮",
          });
        }
        wx.navigateTo({
@@ -217,6 +215,7 @@
    // 拿到所有项
    getAllChildren(id) {
      let result = [];
      function findChildren(item) {
        if (item.id === id) {
          if (item.children && item.children.length > 0) {
@@ -438,11 +437,13 @@
        });
      } else {
        let query = {
          requests: [{
            saleMethodId: saleMethodId,
            storeEventId: null,
            // agentCode: '电子书'
          }, ],
          requests: [
            {
              saleMethodId: saleMethodId,
              storeEventId: null,
              // agentCode: '电子书'
            },
          ],
        };
        const addRes = await app.MG.store.addShoppingCart(query);
        console.log(addRes, "addRes");
@@ -453,13 +454,11 @@
      }
    },
    sadd() {
      this.triggerEvent('updateShoppingCartHidden');
      this.triggerEvent('updateCloudLearning');
      this.triggerEvent("updateShoppingCartHidden");
      this.triggerEvent("updateCloudLearning");
      console.log(789);
    },
  },
  catchtap() {}
})
  catchtap() {},
});