闫增涛
2024-04-29 558845242a07b68f42fa1802c45ab2769395d8b8
packageBookService/pages/bookServices/detail/index.js
@@ -150,7 +150,8 @@
      },
    ],
    showIndex: '',
    successOrderNumber: ''
    successOrderNumber: '',
    applicationState: '' // 电子样书申请状态
  },
  resetTree: function (e) {
@@ -767,7 +768,8 @@
  // 扁平化数据转换tree
  getTreeList(rootList, pathLength, newArr, path) {
    for (const item of rootList) {
      if (item.productLinkPath.length == pathLength && item.productLinkPath.includes(path)) {
      // 此处原本 item.productLinkPath.length == pathLength 但 productLinkPath 长度个别书存在4、5位交错
      if ((pathLength - item.productLinkPath.length >= 0 && pathLength - item.productLinkPath.length <= 3) && item.productLinkPath.includes(path)) {
        if (item.sysType == 'CmsItem') {
          if (item.selectType == 'webpage') {
            item.disabled = true
@@ -898,7 +900,8 @@
            }
          }
        });
        this.getTreeList(res.datas.cmsDatas[0].datas, 17, list, '\\')
        const num = query.cmsPath.length + 6
        this.getTreeList(res.datas.cmsDatas[0].datas, num, list, '\\')
        list = this.ensureTreeConsistency(list)
        list = this.changeResourceChildren(list)
        console.log('修改后云', list);
@@ -1324,7 +1327,6 @@
  },
  // 申请教学资源
  applyResource() {
    // if (this.data.applyResourceState) {
    //   return wx.showToast({
    //     icon: "error",
@@ -1610,7 +1612,6 @@
  },
  updateShoppingCartHidden() {
    const isSHow = this.data.shoppingCartGetId.some(
      (item) => item == data.saleMethod[0].Id
    );
@@ -2087,6 +2088,20 @@
            list.push(item);
          }
        });
        const smBook = list.find(item => item.content[0].id == this.data.bookDetail.id)
        console.log('已申请', smBook);
        if (smBook && smBook.state == 'Normal') {
          const flag = new Date(JSON.parse(smBook.feedBack).endDate + '23:59:59').getTime() > new Date().getTime()
          if (flag) {
            this.setData({
              applicationState: 'Normal'
            })
          } else {
            this.setData({
              applicationState: 'overdue'
            })
          }
        }
        this.setData({
          alreadyElectronicBookList: list,
        });
@@ -2175,15 +2190,27 @@
          return false;
        }
        let isApply = this.data.alreadyElectronicBookList.find(
          (eitem) => eitem.id == this.data.bookDetail.id
          (eitem) => eitem.content[0].id == this.data.bookDetail.id
        );
        if (isApply) {
          wx.showToast({
            title: "该书已申请!",
            icon: "none",
            duration: 1000,
          });
          return false;
          if (isApply.state == 'WaitAudit') {
            wx.showToast({
              title: "该书已申请!",
              icon: "none",
              duration: 1000,
            });
            return false;
          } else if (isApply.state == 'Normal') {
            const flag = new Date(JSON.parse(isApply.feedBack).endDate + '23:59:59').getTime() > new Date().getTime()
            if (flag) {
              wx.showToast({
                title: "该书已申请!",
                icon: "none",
                duration: 1000,
              });
              return false;
            }
          }
        }
        if (this.data.electronicBookList.length >= 2) {
          wx.showToast({
@@ -2251,7 +2278,7 @@
          return false;
        }
        let isApply = this.data.alreadyPaperBookList.find(
          (pitem) => pitem.id == this.data.bookDetail.id
          (pitem) => pitem.content[0].id == this.data.bookDetail.id
        );
        if (isApply) {
          wx.showToast({