From 12cc87a1f2f9b91359d3ca43fe052440d9890dac Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期二, 09 四月 2024 19:12:22 +0800
Subject: [PATCH] 购物车跳转图书详情

---
 pages/cart/index.js                                   |   17 ++-
 pages/cart/paymentPage/index.json                     |    3 
 pages/cart/paymentPage/index.js                       |  140 +++++++++++++++++----------
 pages/cart/paymentPage/index.wxml                     |    4 
 pages/bibliographyList/index.wxml                     |    5 
 pages/bookExhibitionList/index.wxss                   |    8 +
 pages/bookExhibitionList/index.js                     |   22 ++-
 packageDomain/pages/resourceDetails/myAudio/index.js  |   74 ++++----------
 pages/retrievalPage/index.wxml                        |    2 
 packageBookService/pages/bookServices/detail/index.js |    4 
 pages/cart/index.wxss                                 |   10 +
 11 files changed, 160 insertions(+), 129 deletions(-)

diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js
index 0ecff8a..cb319a8 100644
--- a/packageBookService/pages/bookServices/detail/index.js
+++ b/packageBookService/pages/bookServices/detail/index.js
@@ -977,6 +977,7 @@
       // 鍙戣捣璁㈠崟鍒濆鍖栬姹傚苟绛夊緟缁撴灉
       const res = await app.MG.store.initOrder(query);
       // 鑾峰彇璁㈠崟鍙峰苟璧嬪�肩粰 orderNumber.value
+      console.log(res, 'res456');
       bookOrdersId = res.orderNumber;
       // 妫�鏌ヨ鍗曞彿鏄惁瀛樺湪
       if (bookOrdersId) {
@@ -996,8 +997,7 @@
               }
             });
         } else {
-          const url =
-            "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId;
+          const url = "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId + '&onNorderSaleMethod=' + res.saleMethodLinks[0].orderSaleMethod.id;
           wx.navigateTo({
             url,
           });
diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js
index 5d30222..82f6c80 100644
--- a/packageDomain/pages/resourceDetails/myAudio/index.js
+++ b/packageDomain/pages/resourceDetails/myAudio/index.js
@@ -83,13 +83,9 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad(options) {
-
-
-
     const systInfo = wx.getSystemInfoSync();
     const menu = wx.getMenuButtonBoundingClientRect(); // 鑳跺泭淇℃伅
     const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 瀵艰埅鏍忛珮搴�
-
     this.setData({
       navBarHeight: navBarHeight,
       barHeight: systInfo.statusBarHeight,
@@ -101,26 +97,10 @@
       parentProductLinkPath: options.parentProductLinkPath,
       productLinkPath: options.productLinkPath
     })
-
     this.resourceDetailsData()
     this.getNoteList()
-
-
-
-
   },
-  onUnload() {
-    myAudio.src = ''
-    myAudio.destroy()
 
-    this.setData({
-      myAudioPos: '',
-      isplay: false, //鏄惁榛樿鎾斁,
-      myAudioCurrent: '00:00', // 褰撳墠鎾斁杩涘害
-      showData: '',
-    });
-    // console.log(myAudio.src);
-  },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
    * 
@@ -137,7 +117,6 @@
     this.setData({
       startTime: Date.now()
     })
-
   },
 
   /**
@@ -157,13 +136,27 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
    */
   onUnload() {
-    this.setData({
-      pauseTime: Date.now()
-    })
-    if (wx.getStorageSync(app.config.tokenKey)) {
-      let duration = this.data.pauseTime - this.data.startTime
-      this.count(duration)
-    }
+    // this.setData({
+    //   pauseTime: Date.now()
+    // })
+    // if (wx.getStorageSync(app.config.tokenKey)) {
+    //   let duration = this.data.pauseTime - this.data.startTime
+    //   this.count(duration)
+    // }
+
+
+    // myAudio.src = ''
+    // myAudio.destroy()
+    // this.setData({
+    //   myAudioPos: '',
+    //   isplay: false, //鏄惁榛樿鎾斁,
+    //   myAudioCurrent: '00:00', // 褰撳墠鎾斁杩涘害
+    //   showData: '',
+    // });
+    // 鍋滄闊抽鎾斁
+    myAudio.stop();
+    // 閿�姣� InnerAudioContext 瀹炰緥
+    myAudio.destroy();
   },
   count(timeStr) {
     const data = {
@@ -219,7 +212,6 @@
 
   },
   showDialog(e) {
-
     this.setData({
       submitTitle: this.data.bookName,
       dialogKey: true,
@@ -260,16 +252,13 @@
         size: 999
       }
     }
-
     app.MG.store.getProductDetail(query).then(res => {
       res.datas.cmsDatas[0].datas.forEach((item, index) => {
-
         if (item.selectType === "audio") {
           this.data.threeLeveData.push(item)
           this.setData({
             threeLeveData: this.data.threeLeveData
           })
-
           this.data.threeLeveData.forEach((items, index) => { // 淇敼姝ゅ娣诲姞index鍙傛暟
             if (this.data.productLinkPath == items.productLinkPath) {
               this.setData({
@@ -277,38 +266,25 @@
                 titleName: items.name
               })
               this.pubulicPlayFun()
-
               let selectedIndex = index; // 瀛樺偍閫変腑椤圭殑绱㈠紩
               this.setData({
                 selectedId: selectedIndex // 璁剧疆閫変腑椤圭殑绱㈠紩
               });
             }
           });
-
-
         }
-
       })
-      this.data.threeLeveData.forEach((item) => {
-        // console.log(item.name);
-      })
+      this.data.threeLeveData.forEach((item) => {})
     })
   },
   onVideo(e) {
-    // console.log(e, 'e');
     this.setData({
       myAudioCurrent: '00:00',
       myAudioPos: '',
-
-
       isplay: false
     })
-
     const item = e.currentTarget.dataset.item
-
     if (this.data.showData != '') {
-
-
       this.setData({
         titleName: item.name,
         selectId: item.id,
@@ -436,11 +412,8 @@
       topicIdOrRefCode: topicId + ''
     }
     await app.MG.ugc.getTopicMessageList(query).then((res) => {
-      // notePage.value.total = res.totalSize
       res.datas.forEach((item) => {
-
         item.createDate = this.convertTimestamp(item.createDate)
-
       })
       this.setData({
         "pageCount.total": res.totalSize,
@@ -652,14 +625,11 @@
       this.changeItem(this.data.threeLeveData[index - 1])
       this.setData({
         selectedId: index - 1,
-
       })
     } else {
       console.log('宸茬粡鏄涓�棣栦簡');
     }
-
   },
-
   //鍙冲垏鎹�
   onRightSwitch() {
     this.setData({
diff --git a/pages/bibliographyList/index.wxml b/pages/bibliographyList/index.wxml
index a02fde7..c87ddf3 100644
--- a/pages/bibliographyList/index.wxml
+++ b/pages/bibliographyList/index.wxml
@@ -42,7 +42,8 @@
         <view class="higherBox" wx:for="{{higherList}}" wx:key="index" wx:for-item="item" wx:for-index="index">
           <view class="outsideHigherImageBox">
             <view class="higherImageBox">
-              <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" />
+              <image wx:if="{{item.icon}}" data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" />
+              <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" />
               <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox">
                 <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" />
                 <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" />
@@ -70,6 +71,7 @@
           <view class="outsideHigherImageBox">
             <view class="higherImageBox">
               <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" />
+              <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" />
               <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox">
                 <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" />
                 <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" />
@@ -97,6 +99,7 @@
           <view class="outsideHigherImageBox">
             <view class="higherImageBox">
               <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" />
+              <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" />
               <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox">
                 <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" />
                 <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" />
diff --git a/pages/bookExhibitionList/index.js b/pages/bookExhibitionList/index.js
index e21b7df..a74e5d3 100644
--- a/pages/bookExhibitionList/index.js
+++ b/pages/bookExhibitionList/index.js
@@ -64,19 +64,19 @@
       value: 'timeAsc',
       options: [{
           value: 'nameAsc',
-          label: '鍚嶇О浠庨珮鍒颁綆',
+          label: '鍚嶇О姝e簭',
         },
         {
           value: 'nameDesc',
-          label: '鍚嶇О浠庝綆鍒伴珮',
+          label: '鍚嶇О鍊掑簭',
         },
         {
           value: 'timeAsc',
-          label: '鍒涘缓鏃堕棿浠庨珮鍒颁綆',
+          label: '鍑虹増鏃堕棿姝e簭',
         },
         {
           value: 'timeDesc',
-          label: '鍒涘缓鏃堕棿浠庡簳鍒伴珮',
+          label: '鍑虹増鏃堕棿鍊掑簭',
         },
       ],
     },
@@ -218,7 +218,7 @@
         // 'page.start': currentPage,
         'page.size': newSize
       });
-      this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
+      // this.bookExhibitionGet(); // 璋冪敤鏂规硶鍔犺浇鏇村鏁版嵁
 
 
 
@@ -398,9 +398,10 @@
     this.setData({
       'multipleSelect.value': e.detail.value,
     });
-
   },
   handleConfirm(event) {
+
+
 
     const {
       value
@@ -411,11 +412,14 @@
     this.data.keynoteValue = value
     this.bookExhibitionGet()
   },
-  handleReset() {
+
+
+  handleReset(e) {
 
     // 閲嶇疆鎿嶄綔鐨勫鐞嗛�昏緫
     this.data.keynoteValue = []
-    console.log('閲嶇疆鎿嶄綔');
+
+
     this.bookExhibitionGet()
   },
   onSwapRight() {
@@ -466,5 +470,5 @@
     console.log(e.detail.value, 'e.detail.value');
     this.bookExhibitionGet()
   },
- 
+
 })
\ No newline at end of file
diff --git a/pages/bookExhibitionList/index.wxss b/pages/bookExhibitionList/index.wxss
index a899a40..36b2627 100644
--- a/pages/bookExhibitionList/index.wxss
+++ b/pages/bookExhibitionList/index.wxss
@@ -256,7 +256,15 @@
   /* height: 700rpx; */
 }
 
+
+
 .bottom-box {
+  display: flex;
+  justify-content: center;
+  color: #999;
+  height: 80rpx;
+  font-size: 28rpx;
+  --td-loading-color: #ff6c00;
   margin-top: 100rpx;
   display: flex;
   justify-content: center;
diff --git a/pages/cart/index.js b/pages/cart/index.js
index aed9193..7e503ce 100644
--- a/pages/cart/index.js
+++ b/pages/cart/index.js
@@ -32,7 +32,7 @@
       title: '璐墿杞�'
     });
     this.shoppingCartGet();
-    console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length');
+
     this.setData({
       swipeOpened: true
     })
@@ -81,7 +81,7 @@
       searchList: []
     };
     app.MG.store.getShoppingCartProductList(query).then(res => {
-      console.log(res, 'res');
+
       this.setData({
         totalSize: res.totalSize
       })
@@ -98,7 +98,7 @@
         // })
         const type = item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product';
         item.type = type; // 灏唗ype璁剧疆涓篿tem瀵硅薄鐨勫睘鎬э紝鑰屼笉鏄娇鐢╯etData
-        console.log(item.linkCmsItems[0].name);
+
         item.name = item.linkCmsItems[0].name ? item.productMonWithLinkDto.product.name + ':' + item.linkCmsItems[0].name : item.productMonWithLinkDto.product.name
       });
 
@@ -192,7 +192,9 @@
             let data = {
               linkIds: selectedIds
             }
+            // '&onNorderSaleMethod=' + 
             app.MG.store.shoppingCartCreateOrder(data).then(res => {
+
               const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber
               wx.navigateTo({
                 url
@@ -221,7 +223,8 @@
           linkIds: selectedIds
         }
         app.MG.store.shoppingCartCreateOrder(data).then(res => {
-          const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber
+          console.log(res.saleMethodLinks[0].orderSaleMethod.id, 'ressss798');
+          const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber + '&onNorderSaleMethod=' + res.saleMethodLinks[0].orderSaleMethod.id
           wx.navigateTo({
             url
           });
@@ -283,8 +286,8 @@
     console.log(item);
     console.log(item.productMonWithLinkDto.product.id);
     console.log(item.productMonWithLinkDto.product.name);
-    // wx.navigateTo({
-    //   url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name
-    // })
+    wx.navigateTo({
+      url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name
+    })
   }
 });
\ No newline at end of file
diff --git a/pages/cart/index.wxss b/pages/cart/index.wxss
index 8e0fe3b..c0c1377 100644
--- a/pages/cart/index.wxss
+++ b/pages/cart/index.wxss
@@ -50,7 +50,7 @@
 .checkGroupBox {
   /* flex: 1; */
   margin: 0 30rpx;
-  width: 120rpx;
+  min-width: 120rpx;
 }
 
 
@@ -65,17 +65,22 @@
 .totalPrice {
   flex: 1;
   /* margin: 0 50rpx; */
-
+  min-width: 295rpx;
 }
 
 .buttonBox {
   margin-right: 80rpx;
+  min-width: 200rpx;
 }
 
 .tButtonBox {
   /* background-color: #FF6C00; */
   width: 200rpx;
   height: 80rpx;
+}
+
+.t-button__content {
+  min-width: 170rpx;
 }
 
 checkbox .wx-checkbox-input {
@@ -126,6 +131,7 @@
 
 .totalPriceText {
   color: #FF6C00;
+  min-width: 133rpx;
 }
 
 .LaelBox {
diff --git a/pages/cart/paymentPage/index.js b/pages/cart/paymentPage/index.js
index 5ebd7ac..ca6d273 100644
--- a/pages/cart/paymentPage/index.js
+++ b/pages/cart/paymentPage/index.js
@@ -1,4 +1,5 @@
 // pages/cart/paymentPage/index.js
+import Toast from 'tdesign-miniprogram/toast/index';
 const app = getApp()
 import {
   getPublicImage
@@ -10,6 +11,7 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
+    myOrderOrderNumber: [],
     orderNumber: null,
     navBarHeight: '',
     barHeight: '',
@@ -20,7 +22,8 @@
     orderGoods: '',
     isPaySuccess: false,
     isPayComplete: false,
-    type: ''
+    type: '',
+    onNorderSaleMethod: ''
   },
 
   /**
@@ -34,10 +37,12 @@
       orderNumber: options.orderNumber,
       navBarHeight: navBarHeight,
       barHeight: systInfo.statusBarHeight,
-      selectedIds: options.selectedIds
+      selectedIds: options.selectedIds,
+      onNorderSaleMethod: options.onNorderSaleMethod
     })
-    console.log('鎺ユ敹鍒扮殑璁㈠崟鍙�:', this.data.orderNumber);
+    console.log(this.data.onNorderSaleMethod, 'options');
     this.getOrderByOrderNumData()
+    this.getDataList()
   },
 
   /**
@@ -129,58 +134,87 @@
       })
     })
   },
-  confirmOrderGet() {
-    var that = this;
-    let query = {
-      orderNum: this.data.orderGoods
-    }
-    app.MG.store.confirmOrder(query).then(res => {
-      console.log(res.orderNumber, 'res');
-      if (res.orderNumber) {
-        let resOrderNum = {
-          orderNum: res.orderNumber,
-          platform: "WeChatAppCustom"
-        };
-        console.log(resOrderNum, 'resOrderNum');
-        // 鐢ㄦ埛鏈粦瀹氬井淇� 鎶�500
-        app.MG.store.makeWeChatPay(resOrderNum).then(payRes => {
-          console.log(payRes, 'payRes');
-          const payVal = JSON.parse(payRes);
-          wx.requestPayment({
-            "appId": payVal.appId,
-            "timeStamp": payVal.timeStamp,
-            "nonceStr": payVal.nonceStr,
-            "package": payVal.package,
-            "signType": payVal.signType,
-            "paySign": payVal.paySign,
-            success: function (res) {
-              console.log('鏀粯鎴愬姛');
-              if (res.errMsg == 'requestPayment:ok') {
-                that.setData({
-                  isPaySuccess: true
-                })
-              }
-            },
-            fail: function (res) {
-              console.log('鏀粯澶辫触');
-            },
-            // 鏃犺鏀粯鎴愬姛澶辫触閮戒細璋冪敤
-            "complete": function (res) {
-              if (res.errMsg == 'requestPayment:ok') {
-                that.setData({
-                  isPayComplete: true
-                })
-              }
-              if (that.data.isPaySuccess && that.data.isPayComplete) {
-                that.navToBack()
-              }
-            }
-          });
-        })
+  getDataList() {
+    let data = {
+      start: 0,
+      size: 999,
+      filterList: [{
+        field: 'State',
+        value: 'WaitPay'
+      }],
+      sort: {
+        type: 'Desc',
+        field: 'CreateDate'
       }
-
+    }
+    app.MG.store.getUserOrderList(data).then((res) => {
+      res.datas.forEach((item) => {
+        this.data.myOrderOrderNumber.push(item.saleMethodLinks[0].orderSaleMethod.id)
+        console.log(this.data.myOrderOrderNumber);
+      })
     })
-    // 璋冨彇寰俊浜岀淮鐮佹敮浠�
+  },
+  confirmOrderGet() {
+    if (this.data.myOrderOrderNumber.includes(parseInt(this.data.onNorderSaleMethod))) {
+      Toast({
+        context: this,
+        selector: '#t-toast',
+        message: '宸茬粡鍦ㄨ鍗曚腑',
+        theme: 'warning',
+        direction: 'column',
+      });
+    } else {
+      var that = this;
+      let query = {
+        orderNum: this.data.orderGoods
+      }
+      app.MG.store.confirmOrder(query).then(res => {
+        console.log(res.orderNumber, 'res');
+        if (res.orderNumber) {
+          let resOrderNum = {
+            orderNum: res.orderNumber,
+            platform: "WeChatAppCustom"
+          };
+          console.log(resOrderNum, 'resOrderNum');
+          // 鐢ㄦ埛鏈粦瀹氬井淇� 鎶�500
+          app.MG.store.makeWeChatPay(resOrderNum).then(payRes => {
+            console.log(payRes, 'payRes');
+            const payVal = JSON.parse(payRes);
+            wx.requestPayment({
+              "appId": payVal.appId,
+              "timeStamp": payVal.timeStamp,
+              "nonceStr": payVal.nonceStr,
+              "package": payVal.package,
+              "signType": payVal.signType,
+              "paySign": payVal.paySign,
+              success: function (res) {
+                console.log('鏀粯鎴愬姛');
+                if (res.errMsg == 'requestPayment:ok') {
+                  that.setData({
+                    isPaySuccess: true
+                  })
+                }
+              },
+              fail: function (res) {
+                console.log('鏀粯澶辫触');
+              },
+              // 鏃犺鏀粯鎴愬姛澶辫触閮戒細璋冪敤
+              "complete": function (res) {
+                if (res.errMsg == 'requestPayment:ok') {
+                  that.setData({
+                    isPayComplete: true
+                  })
+                }
+                if (that.data.isPaySuccess && that.data.isPayComplete) {
+                  that.navToBack()
+                }
+              }
+            });
+          })
+        }
+      })
+    }
+
   },
   // 椤甸潰杩斿洖
   navToBack() {
diff --git a/pages/cart/paymentPage/index.json b/pages/cart/paymentPage/index.json
index 7ff0ea1..239e7e2 100644
--- a/pages/cart/paymentPage/index.json
+++ b/pages/cart/paymentPage/index.json
@@ -3,7 +3,8 @@
   "usingComponents": {
     "t-icon": "tdesign-miniprogram/icon/icon",
     "t-button": "tdesign-miniprogram/button/button",
-    "t-dialog": "tdesign-miniprogram/dialog/dialog"
+    "t-dialog": "tdesign-miniprogram/dialog/dialog",
+    "t-toast": "tdesign-miniprogram/toast/toast"
   },
   "navigationStyle": "custom"
 }
\ No newline at end of file
diff --git a/pages/cart/paymentPage/index.wxml b/pages/cart/paymentPage/index.wxml
index e4bed5e..42f130e 100644
--- a/pages/cart/paymentPage/index.wxml
+++ b/pages/cart/paymentPage/index.wxml
@@ -86,4 +86,6 @@
       <t-button class="buttonBox" shape="round" catch:tap="confirmOrderGet">寰俊鏀粯</t-button>
     </view>
   </view>
-</view>
\ No newline at end of file
+</view>
+
+<t-toast id="t-toast" />
\ No newline at end of file
diff --git a/pages/retrievalPage/index.wxml b/pages/retrievalPage/index.wxml
index 83d5f01..b913801 100644
--- a/pages/retrievalPage/index.wxml
+++ b/pages/retrievalPage/index.wxml
@@ -31,7 +31,7 @@
           <view class="bookDataBox">
             <view class="bookDataForBox" wx:for="{{bookData}}" wx:key="index" wx:for-item="item" wx:for-index="index" data-item="{{item}}" bind:tap="onBook">
               <view class="imageBox">
-                <image src="{{item.icon}}" mode="aspectFill" />
+                <image src="{{item.icon}}" mode="aspectFit" />
               </view>
               <view class="bookDataNmae">
                 {{item.name}}

--
Gitblit v1.9.1