Commit a9ab3b7bc4d95d8ddb1bc68f79d90800d11eb8c7

Authored by antploy
1 parent 6e2513f7

组合购列表分页优化

packageB/pages/zuhegou/list/list.js
@@ -127,46 +127,25 @@ Page({ @@ -127,46 +127,25 @@ Page({
127 if(!this.data.ismore) return false; 127 if(!this.data.ismore) return false;
128 128
129 var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; 129 var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage;
130 - var plist=null,alllist=th.data.goodlist;  
131 - if(!alllist) alllist=[];  
132 -  
133 - await getApp().request.promiseGet(i,  
134 - {isShowLoading:1,data:{store_id:os.stoid,user_id:getApp().globalData.user_id}}  
135 - ).then(res=>{  
136 - plist=res.data.data.pageData;  
137 - console.log("是什么即将开始",plist);  
138 - });  
139 -  
140 - if(plist.length<=0) {  
141 - 130 + // var plist=null,alllist=th.data.goodlist;
  131 + // if(!alllist) alllist=[];
  132 + let {goodlist}=this.data;
  133 + const {data:res}=await getApp().request.promiseGet(i,{
  134 + isShowLoading:1,
  135 + data:{store_id:os.stoid,user_id:getApp().globalData.user_id}
  136 + })
  137 + if(res.code==0 && res.data.pageData.length>0){
  138 + if(res.data.page>1){
  139 + goodlist=goodlist.concat(res.data.pageData)
  140 + }else{
  141 + goodlist=res.data.pageData;
  142 + }
  143 + }else{
142 getApp().showWarning("没有更多数据"); 144 getApp().showWarning("没有更多数据");
143 th.data.ismore=0; 145 th.data.ismore=0;
144 - if(e.data.currentPage==1 && this.data.type==1){  
145 - // setTimeout(function () {  
146 - // th.data.ismore=1;  
147 - // th.setData({type:0});  
148 - // th.requestSalelist();  
149 - // },1000);  
150 - }  
151 - return false;  
152 } 146 }
153 -  
154 - //--循环读取接口---  
155 - // for(var i=0;i<plist.length;i++) {  
156 - // var prom_id = plist[i].id;  
157 - // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +  
158 - // os.stoid + "/1/" + prom_id, {}  
159 - // ).then(res=>{  
160 - // if(res.data.code==0){  
161 - // plist[i].status=1;  
162 - // if(res.data.data<=0) plist[i].status=3;  
163 - // }  
164 - // })  
165 - // alllist.push(plist[i]);  
166 - // }  
167 e.data.currentPage++; 147 e.data.currentPage++;
168 - // console.log("秒杀商品列表", alllist);  
169 - th.setData({goodlist:plist,isshow:1}); 148 + th.setData({goodlist,isshow:1});
170 149
171 }, 150 },
172 onPullDownRefresh: function() { 151 onPullDownRefresh: function() {