From 4496721cd3af3c68ed4d55218d3e83ea0664c57e Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期一, 29 四月 2024 17:53:10 +0800
Subject: [PATCH] bug3

---
 packageBookService/pages/bookServices/detail/index.js |   55 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index ec81e90..3ee1ff3 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -150,7 +150,8 @@
       },
     ],
     showIndex: '',
-    successOrderNumber: ''
+    successOrderNumber: '',
+    applicationState: '' // 鐢靛瓙鏍蜂功鐢宠鐘舵��
   },
 
   resetTree: function (e) {
@@ -767,7 +768,8 @@
   // 鎵佸钩鍖栨暟鎹浆鎹ree
   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
     );
@@ -2023,7 +2024,9 @@
         this.data.bookBuy +
         "&bookId=" +
         this.data.bookDetail.id,
+
     });
+    debugger
   },
 
   //鏍蜂功鐢宠
@@ -2087,6 +2090,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 +2192,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 +2280,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({

--
Gitblit v1.9.1