Commit bbe1887939412bd682fa7df00fe3bb4b9006603b
1 parent
c8df3150
组件修改
Showing
1 changed file
with
15 additions
and
4 deletions
components/goods_list/goods_list.js
| @@ -24,25 +24,36 @@ Component({ | @@ -24,25 +24,36 @@ Component({ | ||
| 24 | methods: { | 24 | methods: { |
| 25 | 25 | ||
| 26 | get_list:function(){ | 26 | get_list:function(){ |
| 27 | - | 27 | + |
| 28 | var that = this; | 28 | var that = this; |
| 29 | + if(that.data.is_no_more==0) return false; | ||
| 30 | + | ||
| 31 | + | ||
| 29 | var curPage = that.data.curPage; | 32 | var curPage = that.data.curPage; |
| 30 | getApp().request.get('/api/weshop/goods/page?page',{ | 33 | getApp().request.get('/api/weshop/goods/page?page',{ |
| 31 | data: { is_mainshow: 1, isonsale: 1, | 34 | data: { is_mainshow: 1, isonsale: 1, |
| 32 | is_recommend: 1, is_on_sale: 1, | 35 | is_recommend: 1, is_on_sale: 1, |
| 33 | store_id: o.stoid, | 36 | store_id: o.stoid, |
| 34 | page: curPage, | 37 | page: curPage, |
| 35 | - pageSize:10, | 38 | + pageSize:6, |
| 36 | }, | 39 | }, |
| 37 | success: function (res){ | 40 | success: function (res){ |
| 38 | 41 | ||
| 39 | - that.data.curPage++; | 42 | + |
| 40 | var data=res.data; | 43 | var data=res.data; |
| 44 | + var total=data.data.total; | ||
| 45 | + if (total <= curPage*6){ | ||
| 46 | + that.setData({ is_no_more: 0 }); | ||
| 47 | + }else{ | ||
| 48 | + that.data.curPage++; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /*-- | ||
| 41 | if (res.data.data.pageData.length==0){ | 52 | if (res.data.data.pageData.length==0){ |
| 42 | that.setData({is_no_more:0}); | 53 | that.setData({is_no_more:0}); |
| 43 | t.showWarning("加载完啦", null, 500, !1) | 54 | t.showWarning("加载完啦", null, 500, !1) |
| 44 | return false; | 55 | return false; |
| 45 | - } | 56 | + }--*/ |
| 46 | //加载完成 | 57 | //加载完成 |
| 47 | if (data.data.pageData) { | 58 | if (data.data.pageData) { |
| 48 | that.setData({load_complete:1}); | 59 | that.setData({load_complete:1}); |