闫增涛
2024-03-25 985f70ad180b1ce396cf03e29cc2551a0bd892a2
删除多余文件
2个文件已修改
45 ■■■■■ 已修改文件
app.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.js 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -52,9 +52,7 @@
        "pages/bookServices/detail/index",
        "pages/bookServices/examination/examination",
        "pages/bookServices/webpage/index",
        "pages/components/webView/index",
        "pages/bookServices/buyResource/index",
        "pages/bookServices/detail/buyResource/index"
        "pages/components/webView/index"
      ]
    }
  ],
packageBookService/pages/bookServices/detail/buyResource/index.js
@@ -12,6 +12,8 @@
    openLearnids: [],
    bookId: '',
    loading: false,
    shoppingList: [],
    shoppingCartGetId: [],
  },
  /**
@@ -29,6 +31,8 @@
    this.getResourceClass()
    console.log(options);
    this.getResourceData({ productLinkPath: options.productLinkPath, refCode: options.refCode })
    this.getShoppingCartProductGet()
    this.getBookInfo(options.bookId)
  },
  /**
@@ -270,6 +274,25 @@
    });
  },
  // 获取已购买商品
  getShoppingCartProductGet() {
    let query = {
      start: 0,
      size: 999,
      filterList: [],
      searchList: []
    }
    app.MG.store.getShoppingCartProductList(query).then((res) => {
      const list = []
      res.datas.forEach((item) => {
        list.push(item.saleMethod.id)
      })
      this.setData({
        shoppingList: res.datas,
        shoppingCartGetId: list
      })
    })
  },
    // 判断资源是否购买
    resourceIsBuy(data) {
      if (data.saleMethod && data.saleMethod.length) {
@@ -279,6 +302,24 @@
        return false
      }
    },
  // 判断资源加入购物车按钮是否显示
  isShoppingCart(data) {
    if (data.saleMethod && data.saleMethod.length) {
      if (data.saleMethod[0].Price <= 0) return false
      // 再判断是否购买
      const isBuy = this.data.buyIdList.some((item) => item == data.saleMethod[0].Id)
      if (isBuy) {
        // 购买了
        return false
      } else {
        // 判断是否加入购物车
        const isSHow = this.data.shoppingCartGetId.some((item) => item == data.saleMethod[0].Id)
        return !isSHow
      }
    } else {
      return false
    }
  },
  // 获取展开项
  findChildIds(data, result) {
    let index = 0