From e6a156a6a8bb6f1d3a17e9310269f53c56e10b42 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期一, 08 四月 2024 22:29:26 +0800
Subject: [PATCH] 问题修改

---
 packageBookService/pages/bookServices/detail/index.js |  105 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 73 insertions(+), 32 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index d3cea05..97cf4ee 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -429,12 +429,14 @@
     };
     app.MG.store.getProductList(obj).then((res) => {
       if (res.datas && res.datas.length > 0) {
+        console.log(res.datas[0], 2)
         this.setData({
           bookItemDetail: res.datas[0],
           selectedIds: res.datas[0].defaultSaleMethod.id,
           bookBuy: res.datas[0].purchasedSaleMethodIdList.indexOf(
             res.datas[0].defaultSaleMethodId
           ) > -1,
+          "bookDetail.price": this.numFormat(res.datas[0].price),
         });
         let times = new Date(res.datas[0].defaultSaleMethod.endDate).getTime();
         let startTime = new Date(
@@ -613,11 +615,16 @@
   onTabsChange(e) {
     this.setData({
       tabValue: e.detail.value,
-      noResources: false
-    })
-    if (e.detail.label == '鏁欏璧勬簮' || e.detail.label == '浜戝涔�' || e.detail.label == '浜戞祴璇�') {
-      const checkData = this.data.cmsDatas.find(item => item.refCode == e.detail.value)
-
+      noResources: false,
+    });
+    if (
+      e.detail.label == "鏁欏璧勬簮" ||
+      e.detail.label == "浜戝涔�" ||
+      e.detail.label == "浜戞祴璇�"
+    ) {
+      const checkData = this.data.cmsDatas.find(
+        (item) => item.refCode == e.detail.value
+      );
 
       if (checkData) {
         if (e.detail.value == "jsek_cloudLearning") {
@@ -804,8 +811,21 @@
         size: 999,
       },
     };
-    const data = await app.MG.store.getProductDetail(query);
+    let data = await app.MG.store.getProductDetail(query);
+    // 濡傛灉item灞傜骇閲屾湁floder锛屽垹闄loder
+    const flag = data.datas.cmsDatas[0].datas.findIndex(
+      (item) => item.sysType == "CmsItem"
+    );
+    if (flag > -1)
+      data.datas.cmsDatas[0].datas = data.datas.cmsDatas[0].datas.filter(
+        (item) => item.sysType == "CmsItem"
+      );
     data.datas.cmsDatas[0].datas.forEach((item) => {
+      //   if (item.sysType == "CmsFolder" && flag > -1) {
+      //     item.isShow = false;
+      //   } else {
+      //     item.isShow = true;
+      //   }
       this.data.resourceClassList.forEach((type) => {
         if (type.value == item.resourcesClassification)
           item.resourceClass = type.name;
@@ -945,13 +965,29 @@
       console.log(bookOrdersId);
       // 妫�鏌ヨ鍗曞彿鏄惁瀛樺湪
       if (bookOrdersId) {
-        const url = "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId;
-        wx.navigateTo({
-          url,
-        });
+        if (this.data.bookDetail.price == "0.00") {
+          app.MG.store.confirmOrder({
+            orderNum: bookOrdersId
+          }).then(res => {
+            if (res) {
+              wx.showToast({
+                title: "棰嗗彇鎴愬姛",
+                icon: "none",
+                duration: 1000,
+              });
+              this.getBookInfo(this.data.bookDetail.id);
+            }
+          })
+        } else {
+          const url = "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId;
+          wx.navigateTo({
+            url,
+          });
+        }
       } else {
         console.log(222);
       }
+
     } else {
       wx.showToast({
         title: "鍟嗗搧涓嶅湪鏈夋晥鏈�",
@@ -1300,15 +1336,18 @@
   },
 
   updateShoppingCartHidden() {
-    const isSHow = this.data.shoppingCartGetId.some((item) => item == data.saleMethod[0].Id)
+    const isSHow = this.data.shoppingCartGetId.some(
+      (item) => item == data.saleMethod[0].Id
+    );
     console.log(isSHow);
-    return !isSHow
-
+    return !isSHow;
   },
   updateCloudLearning() {
-    const checkData = this.data.cmsDatas.find(item => item.refCode == 'jsek_cloudLearning')
-    this.getResourceData(checkData)
-    debugger
+    const checkData = this.data.cmsDatas.find(
+      (item) => item.refCode == "jsek_cloudLearning"
+    );
+    this.getResourceData(checkData);
+    debugger;
     console.log(55555);
   },
   // 閬嶅巻鏍戠粨鏋勮浆鎹负鏁扮粍鏂规硶
@@ -1648,7 +1687,7 @@
     });
     this.onLoad({
       id: e.detail.id,
-      name: e.detail.name
+      name: e.detail.name,
     });
   },
   // 搴曢儴璐拱鎸夐挳
@@ -1808,14 +1847,7 @@
           });
           return false;
         }
-        if (this.data.electronicBookList.length >= 2) {
-          wx.showToast({
-            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
-            icon: "none",
-            duration: 1000,
-          });
-          return false;
-        }
+
         let isHas = this.data.electronicBookList.find(
           (eitem) => eitem.id == this.data.bookDetail.id
         );
@@ -1833,6 +1865,14 @@
         if (isApply) {
           wx.showToast({
             title: "璇ヤ功宸茬敵璇凤紒",
+            icon: "none",
+            duration: 1000,
+          });
+          return false;
+        }
+        if (this.data.electronicBookList.length >= 2) {
+          wx.showToast({
+            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
             icon: "none",
             duration: 1000,
           });
@@ -1877,14 +1917,18 @@
           });
           return false;
         }
-        if (this.data.paperBookList.length >= 2) {
+        let isApply = this.data.alreadyPaperBookList.find(
+          (pitem) => pitem.id == this.data.bookDetail.id
+        );
+        if (isApply) {
           wx.showToast({
-            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
+            title: "璇ヤ功宸茬敵璇凤紒",
             icon: "none",
             duration: 1000,
           });
           return false;
         }
+
         let isHas = this.data.paperBookList.find(
           (pitem) => pitem.id == this.data.bookDetail.id
         );
@@ -1896,12 +1940,9 @@
           });
           return false;
         }
-        let isApply = this.data.alreadyPaperBookList.find(
-          (pitem) => pitem.id == this.data.bookDetail.id
-        );
-        if (isApply) {
+        if (this.data.paperBookList.length >= 2) {
           wx.showToast({
-            title: "璇ヤ功宸茬敵璇凤紒",
+            title: "姣忔鏈�澶氬彧鍙敵璇�2鏈牱涔�",
             icon: "none",
             duration: 1000,
           });

--
Gitblit v1.9.1