From 2ee8ddb1ecac7df4198e54e08ec7f22daf4b07c0 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期五, 03 一月 2025 16:57:38 +0800
Subject: [PATCH] 111

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

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 5d71e49..6eae7bd 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -75,7 +75,8 @@
       residue: 0, // 缁勫嵎鍓╀綑娆℃暟
       mockList: [], // 鐢ㄦ埛缁勫嵎鎻愪氦淇℃伅
     },
-    isBuyBank: false,
+    isBuyBank: false, // 棰樺簱鏄惁璐拱
+    isShoppingBank: false, // 棰樺簱鏄惁鍔犲叆璐墿杞�
     bankSaleData: null,
     relatedBookLoading: false,
     noRelatedBookData: false,
@@ -213,7 +214,8 @@
     protocolShow: false,
     protocolTxt: '',
     learnMenu: null,
-    md5List: []
+    md5List: [],
+    editDialog: false
   },
 
   resetTree: function (e) {
@@ -270,8 +272,6 @@
       this.setData({
         tabValue: options.tabValue,
       });
-
-
     }
   },
 
@@ -292,7 +292,7 @@
     this.setData({
       num: Number(this.data.paperBookList.length) + Number(this.data.electronicBookList.length),
     });
-    if (this.data.bookDetail) {
+    if (this.data.bookDetail.id) {
       this.getBookInfo(this.data.bookDetail.id)
     }
   },
@@ -432,10 +432,14 @@
         protectedEpub: [],
         probationPage: [], //pdf璇曡椤垫暟
         freeEpubPage: [], //epub璇曡鐧惧垎姣�
+        bookEditor: [], //鍥句功缂栬緫
+        contactInformation: [], //鑱旂郴鏂瑰紡
       },
     };
     app.MG.store.getProductDetail(query).then(async (res) => {
       this.getResourceCode(id, res.datas.rootCmsItemId)
+      res.datas.bookEditor = res.datas.bookEditor ? res.datas.bookEditor : '-'
+      res.datas.contactInformation = res.datas.contactInformation ? res.datas.contactInformation : '-'
       this.setData({
         bookDetail: res.datas,
         buyIdList: res.datas.purchasedSaleMethodIdList,
@@ -469,6 +473,16 @@
           }
           await this.getBookClass(classData);
         }
+      }
+      // 鎵爜浠庨搴撹烦杞洖鍥句功璇︽儏
+      const localData = wx.getStorageSync('tabValue')
+      if (localData) {
+        this.setData({
+          tabValue: localData
+        })
+        wx.removeStorage({
+          key: 'tabValue',
+        })
       }
       if (this.data.tabValue == 'questionBank' || this.data.tabValue == 'jsek_cloudLearning' || this.data.tabValue == 'jsek_teachingResources') {
         const checkData = this.data.cmsDatas.find(
@@ -507,13 +521,12 @@
         }
       }
       this.setData({
-        "bookDetail.publicationDate": moment(this.data.bookDetail.publicationDate).format("YYYY骞碝M鏈�"),
+        "bookDetail.publicationDate": this.data.bookDetail.publicationDate ? moment(this.data.bookDetail.publicationDate).format("YYYY骞碝M鏈�") : '',
         "bookDetail.price": this.numFormat(this.data.bookDetail.price),
         "bookDetail.oldPrice": this.numFormat(this.data.bookDetail.oldPrice),
         "bookDetail.paperPrice": this.numFormat(
           this.data.bookDetail.paperPrice
         ),
-
       });
     });
   },
@@ -532,8 +545,8 @@
       }
     }
     app.MG.store.getProductDetail(query).then((res) => {
-      console.log(111, res.datas.cmsDatas[0].datas);
       let isBuyBank = true
+      let isShoppingBank = true
       let bankSaleData = null
       // 鍒ゆ柇棰樺簱鏄惁鏁翠綋璐拱
       const bank = res.datas.cmsDatas[0].datas.find((item) => item.refCode == 'questionBank')
@@ -542,6 +555,7 @@
           bankSaleData = bank.saleMethod.find((item) => item.SaleType == 'Normal')
           if (bankSaleData) {
             isBuyBank = this.data.buyIdList.includes(bankSaleData.Id)
+            isShoppingBank = this.data.buyIdList.includes(bankSaleData.Id) ? true : this.data.shoppingCartGetId.includes(bankSaleData.Id)
           }
         }
       }
@@ -549,6 +563,7 @@
         resourceCodeList: res.datas.cmsDatas[0].datas,
         learnTaskData: res.datas.cmsDatas[0].datas.filter((item) => item.refCode == 'jsek_learningTasks')[0],
         isBuyBank,
+        isShoppingBank,
         bankSaleData
       })
       if (res.datas.cmsDatas[0].datas.length) this.setData({
@@ -744,6 +759,14 @@
       }
     }
   },
+
+  // 鑱旂郴
+  editPhone() {
+    this.setData({
+      editDialog: true
+    })
+  },
+
   // 鎴戣寤鸿
   suggestBtn() {
     // 妫�鏌ョ櫥褰曠姸鎬�
@@ -1162,19 +1185,17 @@
               });
             }
           } else {
-
             if (isTSFW.length > 0) {
-              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && (item.childrenFolderCount > 0 || item.childrenCount > 0) && (item.name !== '濉┖棰�' &&
-                  item.name !== '鍒ゆ柇棰�' &&
-                  item.name !== '澶氶�夐' &&
-                  item.name !== '绠�绛旈')) &&
-                item.refCode != 'jsek_interaction'
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.refCode != 'jsek_interaction' && (item.childrenFolderCount > 0 || item.childrenCount > 0) && (item.name !== '濉┖棰�' &&
+                item.name !== '鍒ゆ柇棰�' &&
+                item.name !== '澶氶�夐' &&
+                item.name !== '绠�绛旈') && item.name !== '鍗曢�夐')
               that.setData({
                 jslx: false,
               });
             } else {
-              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' &&
-                item.refCode != 'jsek_interaction')
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder')
+              // && item.refCode != 'jsek_interaction'
               that.setData({
                 jslx: true,
               });
@@ -1900,7 +1921,6 @@
   // 浜戝涔犲叏閮ㄨ喘涔�
   async buyCloudLearnClass() {
     const cloundMenu = this.data.resourceCodeList.find((item) => item.refCode == 'jsek_cloudLearning')
-    debugger
     let query = {
       remarks: '浜戝涔�',
       requests: [{
@@ -1952,7 +1972,6 @@
 
   // 棰樺簱璐拱
   async buyBank() {
-    console.log(11, this.data.bankSaleData);
     let query = {
       remarks: '浜戞祴璇�',
       requests: [{
@@ -1985,6 +2004,24 @@
         });
     }
   },
+  // 棰樺簱鍔犲叆璐墿杞�
+  handleShoppingBank() {
+    let query = {
+      requests: [{
+        saleMethodId: this.data.bankSaleData.Id,
+        storeEventId: null,
+        agentCode: "浜戞祴璇�",
+      }, ],
+    };
+    app.MG.store.addShoppingCart(query).then(res => {
+      wx.showToast({
+        icon: 'success',
+        title: '鍔犲叆鎴愬姛',
+      })
+      this.getShoppingCartProductGet();
+      this.getBookInfo(this.data.bookDetail.id)
+    })
+  },
   // 缁勫嵎鏍煎紡鍖栨棩鏈熸樉绀�
   DateFormat(date, fmt) {
     if (date && fmt) {

--
Gitblit v1.9.1