|
|
@@ -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
|