Explorar el Código

专区商品分页

junyuanz hace 5 años
padre
commit
60c0cb288d
Se han modificado 3 ficheros con 22 adiciones y 8 borrados
  1. 20 6
      pages/areacart/areacart.js
  2. 1 1
      pages/user/all/all.wxml
  3. 1 1
      project.config.json

+ 20 - 6
pages/areacart/areacart.js

@@ -5,7 +5,7 @@ Page({
   data: {
     orderId: 0,
     count:1,
-    cartList:{},
+    cartList:[],
     cartCount:0,
     cartTotal:0,
     checkeditems:'',
@@ -14,7 +14,10 @@ Page({
     selectedall:false,
     submitlock:false,
     x:0,
-    currentX: 0
+    currentX: 0,
+    perpage:5,
+    nowpage:1,
+    cartMore:true
   },
   handleMovableChange: function(e) {
     // this.data.currentX = e.detail.x;
@@ -40,18 +43,18 @@ Page({
 //  }
   },
   onLoad: function (options) {
-  	this.getCartList();
+//	this.getCartList();
   },
   onShow: function () {
   	this.getCartList();
   	this.setData({submitlock: false});
   	this.setData({selectedall: false});
-  	this.getCartListAndSelected();
+//	this.getCartListAndSelected();
   },
   getCartList:function(){
   	console.log('getCartList')
   	var that = this
-    var url = 'v1/products?ptype=shop_sale&&page=1&&per_page=3'
+    var url = 'v1/products?ptype=&&page='+that.data.nowpage+'&&per_page='+that.data.perpage
     var params = {}
     var success = function (res) {
       console.log(res)
@@ -62,7 +65,8 @@ Page({
     			res.data.list[i]['count'] = 1;
     		}
     		that.setData({
-	        cartList: res.data.list,
+    			cartMore: res.data.list_count > that.data.cartList.length,
+	        cartList: that.data.cartList.concat(res.data.list || []),
 	        cartCount: res.data.count,
 	        cartTotal: res.data.total
 	      })
@@ -76,6 +80,16 @@ Page({
     }
     _request.$get(url, params, success)
   },
+  onReachBottom: function () {
+  	console.log('onreachbottom')
+    if (this.data.cartMore) {
+      var page = this.data.nowpage + 1
+      this.setData({
+        nowpage: page
+      })
+      this.getCartList()
+    }
+  },
   getCartListAndSelected:function(){
   	console.log('getCartList')
   	var that = this

+ 1 - 1
pages/user/all/all.wxml

@@ -13,7 +13,7 @@
     <button class="user-title" wx:if="{{userInfo == 'nologin'}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo" style="font-size: 18px;margin-top: -20px;">立即登陆</button>
     
     <view class="user-title" wx:if="{{userInfo != 'nologin'}}"><text>NO.{{info.wx_user.id}}</text><text wx:if="{{info.user.tel}}"> | TEL : {{info.user.tel}}</text></view>
-    <span class="user-title" style="top: 165rpx;" wx:if="{{userInfo.rank == 1}}">(身份:群主)</span>
+    <span class="user-title" style="top: 165rpx;" wx:if="{{userInfo.rank == 1}}">(身份:代理)</span>
     <span class="user-title" style="top: 165rpx;" wx:if="{{userInfo.rank == 2}}">(身份:店长)</span>
     
     <!--<view wx:if="{{userInfo != 'nologin' && !bindTel}}">

+ 1 - 1
project.config.json

@@ -19,7 +19,7 @@
 			"disablePlugins": [],
 			"outputPath": ""
 		},
-		"useCompilerModule": false,
+		"useCompilerModule": true,
 		"userConfirmedUseCompilerModuleSwitch": false,
 		"compileHotReLoad": false,
 		"useIsolateContext": true