From 188a925be5b1024608eba034d1225e126b3134a8 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期三, 16 七月 2025 16:46:41 +0800
Subject: [PATCH] 资源扫码

---
 packageDomain/pages/resourceDetails/myAudio/index.js |   52 +++++++++++++++++-----------------------------------
 1 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js
index 409ae1c..9803f75 100644
--- a/packageDomain/pages/resourceDetails/myAudio/index.js
+++ b/packageDomain/pages/resourceDetails/myAudio/index.js
@@ -349,32 +349,10 @@
 
   // 鍒ゆ柇褰撳墠鐩爣鏄惁宸茶喘涔�
   async getCmsDataByQrcode() {
-    let query = {
-      storeInfo: this.data.storeInfo,
-      path: '*',
-      queryType: '*',
-      productId: this.data.bookId,
-      itemId: this.data.activeId,
-      itemFields: {
-        // 璧勬簮绫诲瀷锛岃瘯璇绘枃浠讹紝鏄惁鍏佽涓嬭浇绛夊弬鏁�
-        selectType: [],
-        freeFile: [],
-        file: [],
-        protectedFile: [],
-        resourcesClassification: [],
-        isDownload: [],
-        jsek_resourceBrief: [],
-        jsek_link: [],
-        jsek_questionBank: [],
-        learnSelectType: []
-      },
-      pading: {
-        start: 0,
-        size: 999
-      }
-    }
-    const data = await app.MG.store.getProductDetail(query)
-    return data?.datas ?? []
+    const query = {
+      cmsItemId: Number(this.data.activeId)
+    };
+    return app.MG.file.checkCmsItem(query)
   },
 
   resourceDetailsData() {
@@ -446,19 +424,23 @@
       });
       if (this.data.source == 'qrcode') {
         let qrData = this.data.threeLeveData.find(ditem => ditem.id == this.data.activeId)
-        const currentSaleMaths = await this.getCmsDataByQrcode()
-        // 鍒ゆ柇鏄惁璐拱鐩綍
-        const catalg = currentSaleMaths?.saleMethod?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        // 鍒ゆ柇鏄惁璐拱璧勬簮鏈韩 
-        const ownCms = qrData.saleMethods?.find(i => currentSaleMaths.purchasedSaleMethodIdList.includes(i.Id))
-        if (catalg || ownCms) {
+        const isBuyCms = await this.getCmsDataByQrcode() // 褰撳墠璧勬簮鎴栫埗绾х洰褰曟槸鍚﹁喘涔�
+        const isDefualtPrice = this.data.bookDetail?.defaultSaleMethod?.price // 褰撳墠涔︾殑浠烽粯璁ら攢鍞柟寮忎环鏍兼槸鍚︿负0
+        const isBuyBook = this.data.bookDetail?.alreadyBuy // 褰撳墠涔︽槸鍚﹁喘涔�
+        if (isBuyCms) {
           this.setData({
             threeLeveData: [qrData]
           })
         } else {
-          this.setData({
-            threeLeveData: []
-          })
+          if (isDefualtPrice == 0 || isBuyBook) {
+            this.setData({
+              threeLeveData: [qrData]
+            })
+          } else {
+            this.setData({
+              threeLeveData: []
+            })
+          }
         }
       } else {
         this.setData({

--
Gitblit v1.9.1