From 253245731d2b0c5ea4994a9c4e17ad6b60136f2c Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 09 四月 2024 15:38:26 +0800
Subject: [PATCH] 答题器提交功能优化

---
 packageBookService/pages/bookServices/detail/components/tree/index.js |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js
index 8010c50..21163eb 100644
--- a/packageBookService/pages/bookServices/detail/components/tree/index.js
+++ b/packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -1,5 +1,7 @@
 const util = require("./components/util"); // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず
-import { loginInfo } from "../../../../../../assets/js/login";
+import {
+  loginInfo
+} from "../../../../../../assets/js/login";
 const app = getApp();
 Component({
   // checked: false,
@@ -55,10 +57,7 @@
     shoppingCart: true,
     stop: false,
   },
-  ready() {
-    this.setData({});
-    console.log("鍑嗗");
-  },
+  ready() {},
 
   onLoad() {
     this.setData({
@@ -73,7 +72,6 @@
     treeList: function (newValue) {
       const list = [];
       let checked = "";
-      console.log("鏂板��", this.properties.treeList);
       this.properties.treeList.forEach((item) => {
         if (item.children && item.children.length > 0) {
           list.push(...this.flattenTree([item]));
@@ -87,8 +85,7 @@
     handleList(tree) {
       for (let index = 0; index < tree.length; index++) {
         const item = tree[index];
-        if (item.sysType == "CmsItem" && !item.checked) {
-        }
+        if (item.sysType == "CmsItem" && !item.checked) {}
         if (item.children && item.children.length > 0) {
           this.handleList(item.children);
         }
@@ -168,7 +165,9 @@
         ) {
           return wx.showToast({
             icon: "error",
-            title: "璇峰厛璐拱璇ヨ祫婧�",
+            title: item.saleMethod[0].Price > 0 ?
+              "璇峰厛璐拱璇ヨ祫婧�" :
+              "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳",
           });
         }
         wx.navigateTo({
@@ -216,6 +215,7 @@
     // 鎷垮埌鎵�鏈夐」
     getAllChildren(id) {
       let result = [];
+
       function findChildren(item) {
         if (item.id === id) {
           if (item.children && item.children.length > 0) {
@@ -383,13 +383,10 @@
         this.properties.treeList,
         citem.id
       );
-      console.log(citem.checked, "citem.checked");
       if (!citem.checked) {
         //閫変腑鐨勬椂鍊欐坊鍔爄d
         let sonPurchaseSaleMethodId = this.data.sonPurchaseSaleMethodId || [];
-        console.log(this.properties.paymentPage, "this.properties.paymentPage");
         if (this.properties.paymentPage) {
-          console.log(789987);
           sonPurchaseSaleMethodId = [];
           this.properties.paymentPage = false;
         }
@@ -425,6 +422,8 @@
       });
       if (shoppingCartGetId.includes(saleMethodId)) {
         console.log(111);
+        // this.data.updateShoppingCartHidden();
+        // this.data.updateCloudLearning();
 
         wx.showToast({
           icon: "error",
@@ -435,13 +434,11 @@
         });
       } else {
         let query = {
-          requests: [
-            {
-              saleMethodId: saleMethodId,
-              storeEventId: null,
-              // agentCode: '鐢靛瓙涔�'
-            },
-          ],
+          requests: [{
+            saleMethodId: saleMethodId,
+            storeEventId: null,
+            // agentCode: '鐢靛瓙涔�'
+          }, ],
         };
         const addRes = await app.MG.store.addShoppingCart(query);
         console.log(addRes, "addRes");
@@ -451,7 +448,12 @@
         });
       }
     },
+    sadd() {
+      this.triggerEvent("updateShoppingCartHidden");
+      this.triggerEvent("updateCloudLearning");
+      console.log(789);
+    },
   },
 
   catchtap() {},
-});
+});
\ No newline at end of file

--
Gitblit v1.9.1