QYF-GitLab1
2025-07-31 0b9f190e5df708761642d9a688d251515c68a16f
packageBookService/pages/bookServices/detail/index.js
@@ -470,6 +470,7 @@
      res.datas.contactInformation = res.datas.contactInformation ? res.datas.contactInformation : '-'
      this.setData({
        bookDetail: res.datas,
        bookName: res.datas.name,
        buyIdList: res.datas.purchasedSaleMethodIdList,
        pageLoading: false
      });
@@ -998,34 +999,25 @@
    for (let item of tree) {
      // 是否显示按钮
      item.isShowIcon = false;
      if (item.sysType == 'CmsItem') {
        // 查找目录下资源销售方式,目录下资源没有销售方式
        if (item.saleMethod?.length == 0) {
          // 查看其父级是否有销售方式
          if (parent.saleMethod?.length > 0) {
            // 父级是有销售方式直接显示按钮
            // const index = data.findIndex(i => i.id == parent.id)
            parent.isShowIcon = true
          }
          //  else {
          //   // 父级没有销售方式,查找该资源父级
          //   const arr = parent.productLinkPath.split('\\')
          //   const linkData = arr[arr.length - 1] // arr[arr.length - 1] 排除自己
          //   linkData.reverse()
          //   const dataList = linkData.map(ritem => {
          //     const parentData = data.find(citem => citem.id == ritem);
          //     if (parentData) return parentData;
          //   })
          //   if (dataList?.length > 0) {
          //     const index = data.findIndex(i => i.id == dataList[0].id)
          //     data[index].isShowIcon = true
          //   }
          // }
        } else {
          item.isShowIcon = true
        }
      if (!wx.getStorageSync(app.config.tokenKey)) {
        item.isShowIcon = false;
      } else {
        this.handleSalmethodBtn(item.children, data, item)
        if (item.sysType == 'CmsItem') {
          // 查找目录下资源销售方式,目录下资源没有销售方式
          if (item.saleMethod?.length == 0) {
            // 查看其父级是否有销售方式
            if (parent.saleMethod?.length > 0) {
              // 父级是有销售方式直接显示按钮
              parent.isShowIcon = true
            }
          } else {
            item.isShowIcon = true
          }
        } else {
          if (item.children?.length > 0) {
            this.handleSalmethodBtn(item.children, data, item)
          }
        }
      }
    }
    return tree
@@ -1737,29 +1729,6 @@
  },
  // 判断资源是否购买
  resourceIsBuy(data) {
    // if (data.saleMethod && data.saleMethod.length) {
    //   const saleData = data.saleMethod.find((item) => item.SaleType == 'Normal')
    //   if (saleData.State == 'Disable') return false
    //   const isShow = this.data.buyIdList.some(
    //     (item) => item == saleData.Id
    //   );
    //   // 已经购买
    //   if (isShow || saleData.Price == 0) return false
    //   // 未购买,查看销售方式是否过期
    //   if (!isShow) {
    //     const flag = new Date(saleData.EndDate).getTime() >= new Date().getTime() &&
    //       new Date(saleData.BeginDate).getTime() <= new Date().getTime()
    //     if (flag) {
    //       // 为过期 ,需要购买
    //       return true
    //     } else {
    //       // 已过期 无需购买
    //       return false
    //     }
    //   }
    // } else {
    //   return false;
    // }
    let linkData = data.productLinkPath.split("\\");
    linkData.reverse()
    let dataList = linkData.map(item => {