From 9cc35aa83764cb91436750db66e9868c99c1de90 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期一, 29 四月 2024 13:14:50 +0800
Subject: [PATCH] 标题bug1

---
 pages/cart/index.js |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/pages/cart/index.js b/pages/cart/index.js
index 7e503ce..8dfc613 100644
--- a/pages/cart/index.js
+++ b/pages/cart/index.js
@@ -11,6 +11,9 @@
 
 Page({
   data: {
+    price: '',
+    loading: true,
+    hidden: true,
     swipeOpened: false,
     onDisabled: false,
     imgUrl: [],
@@ -86,11 +89,11 @@
         totalSize: res.totalSize
       })
       res.datas.forEach(item => {
-        console.log(res);
 
         this.setData({
           bookId: res.id,
-          bookName: res.name
+          bookName: res.name,
+          price: item.saleMethod.price.toFixed(2),
         })
         item.imgUrl = getPublicImage(item.productMonWithLinkDto.product.icon, '', '160');
         // this.setData({
@@ -105,17 +108,22 @@
       this.setData({
         shoppingCartData: res.datas
       });
-      console.log(this.data.shoppingCartData, 'shoppingCartData');
       if (this.data.shoppingCartData.length === 0) {
         this.setData({
           onDisabled: true
         })
       } else {
-        console.log(2222);
         this.setData({
           onDisabled: false
         })
       }
+      setTimeout(() => {
+        this.setData({
+          loading: false,
+          hidden: false,
+        })
+      }, 600)
+
     });
     wx.stopPullDownRefresh()
 
@@ -271,7 +279,6 @@
   },
   // 涓嬫媺鍑芥暟
   onPullDownRefresh() {
-
     this.setData({
       start: 1,
       checkAll: false,
@@ -281,13 +288,20 @@
     console.log(978);
     this.shoppingCartGet()
   },
-  onBook(e) {
+  async onBook(e) {
     const item = e.currentTarget.dataset.item
     console.log(item);
-    console.log(item.productMonWithLinkDto.product.id);
-    console.log(item.productMonWithLinkDto.product.name);
+    let parentData = null;
+    parentData = await app.MG.store.getProductBySaleMethod({
+      'saleMethodId': item.saleMethod.id
+    })
+    console.log(parentData)
+    let bookId = item.productMonWithLinkDto.product.id;
+    if (parentData.parentProduct.length > 0) {
+      bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
+    }
     wx.navigateTo({
-      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name
+      url: '/packageBookService/pages/bookServices/detail/index?id=' + bookId + '&name=' + item.productMonWithLinkDto.product.name
     })
   }
 });
\ No newline at end of file

--
Gitblit v1.9.1