From 6df96b3e7a7da1985ee875e84711e9f15c5fbff0 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期二, 24 十二月 2024 18:25:02 +0800
Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master

---
 packageBookService/pages/bookServices/detail/index.js |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 0228268..917c602 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -7,6 +7,7 @@
 } from "../../../../assets/js/login";
 import FormData from '../../../../utils/formdata/index.js';
 const app = getApp();
+var pastData = require('../../psychologyAnswer/testdata/index')
 Page({
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
@@ -74,7 +75,8 @@
       residue: 0, // 缁勫嵎鍓╀綑娆℃暟
       mockList: [], // 鐢ㄦ埛缁勫嵎鎻愪氦淇℃伅
     },
-    isBuyBank: false,
+    isBuyBank: false, // 棰樺簱鏄惁璐拱
+    isShoppingBank: false, // 棰樺簱鏄惁鍔犲叆璐墿杞�
     bankSaleData: null,
     relatedBookLoading: false,
     noRelatedBookData: false,
@@ -291,7 +293,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)
     }
   },
@@ -392,6 +394,7 @@
   },
   // 鑾峰彇鍥句功璇︽儏
   getBookInfo(id) {
+    console.log(id, "id")
     this.setData({
       "mockData'.id": 0,
       "mockData.price": 0,
@@ -435,6 +438,7 @@
     };
     app.MG.store.getProductDetail(query).then(async (res) => {
       this.getResourceCode(id, res.datas.rootCmsItemId)
+      console.log(res.datas, "res.datas")
       this.setData({
         bookDetail: res.datas,
         buyIdList: res.datas.purchasedSaleMethodIdList,
@@ -506,7 +510,7 @@
         }
       }
       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(
@@ -531,8 +535,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')
@@ -541,6 +545,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)
           }
         }
       }
@@ -548,6 +553,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({
@@ -1162,17 +1168,22 @@
             }
           } else {
             if (isTSFW.length > 0) {
-              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0)
+              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')
+              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.refCode != 'jsek_interaction')
+              // && item.refCode != 'jsek_interaction'
               that.setData({
                 jslx: true,
               });
             }
             if (data.length > 0) {
+              console.log('data', data);
               let list = []
               that.getTreeList(data, list, query.cmsPath)
               list = that.ensureTreeConsistency(list)
@@ -1182,6 +1193,20 @@
                 loading: false,
                 openTeachids: result,
               });
+              //Json璧嬪��
+              // const bookId = that.data.bookId
+              // if (bookId == 6619) {
+              //   const jsonData = {}
+              //   jsonData.name = "蹇冪悊娴嬭瘎"
+              //   jsonData.children = [...pastData.postData.list]
+              //   var test = that.data.test;
+              //   test.push(jsonData);
+              //   that.setData({
+              //     test: test,
+              //   });
+              //   console.log(that.data.test, "鏁欏浜掑姩");
+              // }
+
             } else {
               that.setData({
                 noResources: true,
@@ -1930,7 +1955,6 @@
 
   // 棰樺簱璐拱
   async buyBank() {
-    console.log(11, this.data.bankSaleData);
     let query = {
       remarks: '浜戞祴璇�',
       requests: [{
@@ -1963,6 +1987,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