From 14ed505ae64153919fcfedbcdfc03e508a1ffa50 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 02 一月 2025 15:12:08 +0800
Subject: [PATCH] 题库扫码未购买优化

---
 packagePersonal/pages/myOrder/index.js |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/packagePersonal/pages/myOrder/index.js b/packagePersonal/pages/myOrder/index.js
index 9798e7f..20cb563 100644
--- a/packagePersonal/pages/myOrder/index.js
+++ b/packagePersonal/pages/myOrder/index.js
@@ -49,7 +49,6 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-    console.log(options);
     this.getDataList(false)
   },
 
@@ -80,7 +79,6 @@
 
   getDataList(isReachBottom) {
     var searchArr = [];
-    console.log(this.data.searchText, "earch")
     if (this.data.searchText != undefined && this.data.searchText != "") {
       searchArr.push({
         compareType: "Contains",
@@ -156,8 +154,11 @@
             loading: false
           })
         } else {
+          wx.showToast({
+            icon: 'error',
+            title: '鏆傛棤鏁版嵁',
+          })
           this.setData({
-            list: [],
             skeletonLoding: false,
             loading: false
           })
@@ -168,19 +169,40 @@
     })
   },
   onSearchOrder(e) {
+    console.log(e.detail.value);
     this.setData({
       searchText: e.detail.value,
     })
     this.getDataList(false);
   },
-  goBookDetails(e) {
+  async goBookDetails(e) {
+    console.log(e.currentTarget.dataset);
     const {
       book,
       remarks
     } = e.currentTarget.dataset;
-    let id = remarks != null && JSON.stringify(remarks).slice(1, -1) == 'object' && JSON.parse(remarks).pId ? JSON.parse(remarks).pId : book.orderSaleMethod.product.id;
+    let parentData = null;
+    let bookId = book.orderSaleMethod.product.id;
+    const type = book.orderSaleMethod.product.cmsTypeRefCode
+    let url = ''
+    if (type == 'jsek_mediaBook') {
+      // 鍥句功銆佷簯瀛︿範
+      parentData = await app.MG.store.getProductBySaleMethod({
+        'saleMethodId': book.orderSaleMethod.id
+      })
+      if (parentData.parentProduct.length > 0) {
+        bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
+      }
+      url = `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}`
+    } else if (type == 'jsek_digitalCourses') {
+      // 璇剧▼
+      url = '/pages/digitalCourses/digitalCoursesDetails/index?id=' + book.orderSaleMethod.product.id + '&path=' + ''
+    } else if (type == 'jsek_digitalTextbooks') {
+      // 鏁板瓧鏁欐潗
+      url = '/pages/digitalTextbooks/digitalTextbooksDetails/index?id=' + book.orderSaleMethod.product.id
+    }
     wx.navigateTo({
-      url: `/packageBookService/pages/bookServices/detail/index?id=${id}&name=${book.name}`,
+      url
     });
   },
 
@@ -322,7 +344,29 @@
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
-  onShareAppMessage() {
-
+  onShareAppMessage() {},
+  // 澶勭悊璁㈠崟绫诲瀷鏄剧ず
+  handleOrderType(book) {
+    console.log(book);
+    const type = book.orderSaleMethod.product.cmsTypeRefCode
+    let title = ''
+    if (type == 'jsek_mediaBook') {
+      if (book.orderSaleMethod.type == 'defaultSaleMethod') {
+        title = '鍥句功鏈嶅姟-鐢靛瓙涔�'
+      } else if (book.orderSaleMethod.type == 'createProductSaleMethod' && book.orderSaleMethod.cmsItemList == 0) {
+        title = '鍥句功鏈嶅姟-缁勫嵎'
+      } else {
+        if (book.orderSaleMethod.cmsItemList.length && book.orderSaleMethod.cmsItemList[0].type == "questionBankFolder") {
+          title = '鍥句功鏈嶅姟-浜戞祴璇�'
+        } else {
+          title = '鍥句功鏈嶅姟-浜戝涔�'
+        }
+      }
+    } else if (type == 'jsek_digitalCourses') {
+      title = '鏁板瓧鏁欐潗'
+    } else {
+      title = '鏁板瓧璇剧▼'
+    }
+    return title
   }
 })
\ No newline at end of file

--
Gitblit v1.9.1