huanggang 7 lat temu
rodzic
commit
546ee390db

+ 43 - 2
pages/shopCart/shopCart.js

@@ -12,21 +12,27 @@ Page({
     },
     all_checked: false,
     allPrice: 0,
-    allGoodsPrice: 0
+    allGoodsPrice: 0,
+    hasmore: false,
+    curpage:0
   },
   onLoad: function () {
 
   },
   onShow: function () {
     let self = this;
+    const curpage = this.data.curpage;
     getReq({
       act: 'cart',
-      op: 'list'
+      op: 'list',
+      minest_cartid: curpage
     }, function (res) {
       if (res.code == 200) {
+        let hasmore = res.datas.mobile_page.hasmore;
         let free_info = res.datas.free_info;
         let summary_datas = res.datas.summary;
         let cart_list = res.datas.cart_list;
+        let lashCartListId = cart_list[cart_list.length - 1].cart_id;
         let summary = [];
         for (let item of cart_list) {
           item.checked = false;
@@ -38,6 +44,12 @@ Page({
             }
           }
         }
+        if (hasmore) {
+          self.setData({
+            hasmore: true,
+            curpage: lashCartListId
+          })
+        }  
         self.setData({
           free_info,
           summary,
@@ -201,5 +213,34 @@ Page({
         })
       }
     })
+  },
+  onReachBottom(){
+    let self = this;
+    let hasmore = this.data.hasmore;
+    if(hasmore) {
+      let req_curpage = this.data.curpage;
+      getReq({
+        act: 'cart',
+        op: 'list',
+        minest_cartid: req_curpage
+      }, function (res) {
+        self.setData({
+          curpage: req_curpage
+        })
+        console.log(res);
+      })
+    }
+  },
+  settlement(){
+    const cart_id_list = [];
+    for (cart_item of this.data.cart_list) {
+      if (cart_item.checked) {
+        cart_id_list.push(cart_item);
+      }
+    }
+    cart_list = cart_id_list.join(',');
+    wx.navigateTo({
+      url: `/pages/confirmOrder/confirmOrder?iscart=1&cart_id=${cart_list}`
+    })
   }
 })

+ 1 - 1
pages/shopCart/shopCart.wxml

@@ -38,7 +38,7 @@
       </view>
     </view>
   </block>
-
+  <view class='clear_fixed'></view>
 </view>
 
 <view class="handle_fixed">

+ 3 - 0
pages/shopCart/shopCart.wxss

@@ -149,4 +149,7 @@
     display: inline-block;
     width: 40rpx;
     text-align: center;
+}
+.clear_fixed {
+  height: 88rpx;
 }

+ 1 - 1
project.config.json

@@ -30,7 +30,7 @@
 			"list": []
 		},
 		"miniprogram": {
-			"current": -1,
+			"current": 2,
 			"list": [
 				{
 					"id": 0,