From dc934dfd63fecff84d0bf996418e041b9bd4ea59 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 30 四月 2024 18:16:13 +0800
Subject: [PATCH] bug修改

---
 packageBookService/pages/bookServices/detail/index.js |   83 ++++++++++++++++++++++++++++++++---------
 1 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 110d42b..e5b7821 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -37,6 +37,8 @@
     openTeachids: [],
     openLearnids: [],
     openTestids: [],
+    isGoBuyResource: true,
+    learnPath: '',
     applyResourceState: false, // 鐢宠鏁欏璧勬簮鎸夐挳闃叉姈
     resourceClassList: [], // 璧勬簮鎵�灞炲垎绫�
     applyState: "", // 鏁欏璧勬簮鐢宠鐘舵��
@@ -150,7 +152,8 @@
       },
     ],
     showIndex: '',
-    successOrderNumber: ''
+    successOrderNumber: '',
+    applicationState: '' // 鐢靛瓙鏍蜂功鐢宠鐘舵��
   },
 
   resetTree: function (e) {
@@ -745,7 +748,7 @@
     return num
   },
 
-  // 缁櫬风洰褰曟坊鍔犲瓙椤规暟閲�
+  // 缁欑洰褰曟坊鍔犲瓙椤规暟閲�
   changeResourceChildren(list) {
     const changeList = (list) => {
       for (let index = 0; index < list.length; index++) {
@@ -767,7 +770,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
@@ -855,6 +859,7 @@
         SysType: 'CmsFolder',
         // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁�
         selectType: [],
+        learnSelectType: [],
         freeFile: [],
         file: [],
         protectedFile: [],
@@ -897,7 +902,24 @@
             }
           }
         });
-        this.getTreeList(res.datas.cmsDatas[0].datas, 17, list, '\\')
+        if (type.refCode == "jsek_cloudLearning") {
+          this.setData({
+            learnPath: type.productLinkPath
+          })
+          const dataList = res.datas.cmsDatas[0].datas
+          if (dataList.length) {
+            const tag = dataList.findIndex(item => this.isShowNeedBuy(item))
+            this.setData({
+              isGoBuyResource: tag > -1 ? true : false
+            })
+          } else {
+            this.setData({
+              isGoBuyResource: false
+            })
+          }
+        }
+        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);
@@ -1323,7 +1345,6 @@
   },
   // 鐢宠鏁欏璧勬簮
   applyResource() {
-
     // if (this.data.applyResourceState) {
     //   return wx.showToast({
     //     icon: "error",
@@ -1609,7 +1630,6 @@
   },
 
   updateShoppingCartHidden() {
-
     const isSHow = this.data.shoppingCartGetId.some(
       (item) => item == data.saleMethod[0].Id
     );
@@ -1684,19 +1704,19 @@
         };
         // 纭璁㈠崟
         const confirmOrderRes = await app.MG.store.confirmOrder(parameter);
-        console.log(confirmOrderRes.orderNumber, 'confirmOrderRes.orderNumber');
-
         if (confirmOrderRes.orderNumber) {
           child.changeReceive(false);
           wx.showToast({
             title: "棰嗗彇鎴愬姛",
           });
           this.getBookInfo(this.data.bookId);
+          this.getResourceDataList({
+            refCode: 'jsek_cloudLearning',
+            productLinkPath: this.data.learnPath
+          })
           this.setData({
             successOrderNumber: confirmOrderRes.orderNumber
           })
-
-
         }
       } catch (error) {
         console.log(error);
@@ -2022,6 +2042,7 @@
         this.data.bookBuy +
         "&bookId=" +
         this.data.bookDetail.id,
+
     });
   },
 
@@ -2086,6 +2107,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(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,
         });
@@ -2174,15 +2209,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(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({
@@ -2250,7 +2297,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