Commit 51d4e3216535f0d73c59eaf2a713d82516d7f4be

Authored by zhiyangdu
1 parent 690c7a33

tab按钮筛选初始化页数为1.页数为1的时候会出现为空状态

src/pages/myGiftBox/myGiftBox.vue
@@ -171,13 +171,12 @@ export default { @@ -171,13 +171,12 @@ export default {
171 if(this.active==0){ 171 if(this.active==0){
172 // 收礼订单列表 172 // 收礼订单列表
173 this.receivingGiftStatue = name; 173 this.receivingGiftStatue = name;
174 - this.getorderGiftList(); 174 + this.getorderGiftList(1);
175 }else{ 175 }else{
176 // 送礼订单列表 176 // 送礼订单列表
177 this.giveGifStatue = name; 177 this.giveGifStatue = name;
178 - this.getorderGiveGiftList(); 178 + this.getorderGiveGiftList(1);
179 } 179 }
180 -  
181 }, 180 },
182 /** 181 /**
183 * 下啦滑动加载更多 182 * 下啦滑动加载更多
@@ -186,7 +185,7 @@ export default { @@ -186,7 +185,7 @@ export default {
186 if (this.active === 0) { 185 if (this.active === 0) {
187 // 收礼订单列表 186 // 收礼订单列表
188 this.loading = this.receivingGifts.loading; 187 this.loading = this.receivingGifts.loading;
189 - this.receivingGifts.pages++; 188 + this.receivingGifts.pages++;
190 this.getorderGiftList(); 189 this.getorderGiftList();
191 } else { 190 } else {
192 // 送礼订单列表 191 // 送礼订单列表
@@ -252,7 +251,9 @@ export default { @@ -252,7 +251,9 @@ export default {
252 /** 251 /**
253 * 获取收礼礼物列表 252 * 获取收礼礼物列表
254 */ 253 */
255 - getorderGiftList() { 254 + getorderGiftList(initPage) {
  255 + console.log(initPage)
  256 + console.log(this.receivingGifts.pages)
256 this.receivingGifts.loading = true; 257 this.receivingGifts.loading = true;
257 // 加载中提示 258 // 加载中提示
258 Indicator.open("加载中..."); 259 Indicator.open("加载中...");
@@ -262,13 +263,14 @@ export default { @@ -262,13 +263,14 @@ export default {
262 "/Api/" + this.getApiVersion().index + "/orderGiftList", 263 "/Api/" + this.getApiVersion().index + "/orderGiftList",
263 { 264 {
264 uid: this.$route.query.uid, // 用户id 265 uid: this.$route.query.uid, // 用户id
265 - page: this.receivingGifts.pages, // 分页 默认为1 一页20条 266 + page: initPage || this.receivingGifts.pages, // 分页 默认为1 一页20条
266 type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) 267 type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃)
267 status:this.receivingGiftStatue// 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 268 status:this.receivingGiftStatue// 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货
268 }, 269 },
269 this.getorderGiftListCallback, 270 this.getorderGiftListCallback,
270 { 271 {
271 - method: "post" 272 + method: "post",
  273 + initPage
272 } 274 }
273 ); 275 );
274 }, 276 },
@@ -288,6 +290,10 @@ export default { @@ -288,6 +290,10 @@ export default {
288 this.receivingGifts.loading = false; 290 this.receivingGifts.loading = false;
289 // 解构数据 291 // 解构数据
290 let { data: datas } = res; 292 let { data: datas } = res;
  293 + // 页脚等于1的时候会出现数据获取为空
  294 + if(ext.initPage==1 || this.receivingGifts.pages==1){
  295 + this.receivingGiftsInfo = datas.list;
  296 + }
291 // 设置shopFnsDynamic达人动态数据 297 // 设置shopFnsDynamic达人动态数据
292 if (datas.list && datas.list.length) { 298 if (datas.list && datas.list.length) {
293 if (this.receivingGifts.pages > 1) { 299 if (this.receivingGifts.pages > 1) {
@@ -299,7 +305,6 @@ export default { @@ -299,7 +305,6 @@ export default {
299 this.$set(this, "receivingGiftsInfo", datas.list); 305 this.$set(this, "receivingGiftsInfo", datas.list);
300 } 306 }
301 }else{ 307 }else{
302 - this.receivingGiftsInfo = datas.list;  
303 this.this.receivingGifts.pages = 1; // 数据为空时页脚从1开始计算 308 this.this.receivingGifts.pages = 1; // 数据为空时页脚从1开始计算
304 this.tipText = "已经全部加载完毕"; //提示全部加载为空 309 this.tipText = "已经全部加载完毕"; //提示全部加载为空
305 } 310 }
@@ -374,7 +379,7 @@ export default { @@ -374,7 +379,7 @@ export default {
374 /** 379 /**
375 * 获取送礼礼物列表 380 * 获取送礼礼物列表
376 */ 381 */
377 - getorderGiveGiftList() { 382 + getorderGiveGiftList(initPage) {
378 this.giftGiving.loading = true; 383 this.giftGiving.loading = true;
379 // 加载中提示 384 // 加载中提示
380 Indicator.open("加载中..."); 385 Indicator.open("加载中...");
@@ -384,13 +389,14 @@ export default { @@ -384,13 +389,14 @@ export default {
384 "/Api/" + this.getApiVersion().index + "/orderGiveGiftList", 389 "/Api/" + this.getApiVersion().index + "/orderGiveGiftList",
385 { 390 {
386 uid: this.$route.query.uid, // 用户id 391 uid: this.$route.query.uid, // 用户id
387 - page: this.giftGiving.pages, // 分页 默认为1 一页20条 392 + page: initPage||this.giftGiving.pages, // 分页 默认为1 一页20条
388 type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) 393 type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃)
389 status: this.giveGifStatue // 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 394 status: this.giveGifStatue // 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货
390 }, 395 },
391 this.getorderGiveGiftListCallback, 396 this.getorderGiveGiftListCallback,
392 { 397 {
393 - method: "post" 398 + method: "post",
  399 + initPage
394 } 400 }
395 ); 401 );
396 }, 402 },
@@ -408,8 +414,11 @@ export default { @@ -408,8 +414,11 @@ export default {
408 if (res.code == 200) { 414 if (res.code == 200) {
409 // 解构数据 415 // 解构数据
410 let { data: datas } = res; 416 let { data: datas } = res;
411 - // 设置giftGivingItem数据  
412 - 417 + // 页脚等于1的时候会出现数据获取为空
  418 + if(ext.initPage==1 || this.receivingGifts.pages==1){
  419 + this.giftGivingItem = datas.list;
  420 + }
  421 + // 设置giftGivingItem数据
413 if (datas.list && datas.list.length) { 422 if (datas.list && datas.list.length) {
414 // 隐藏加载圈 423 // 隐藏加载圈
415 this.giftGiving.loading = false; 424 this.giftGiving.loading = false;
@@ -422,7 +431,6 @@ export default { @@ -422,7 +431,6 @@ export default {
422 this.$set(this, "giftGivingItem", datas.list); 431 this.$set(this, "giftGivingItem", datas.list);
423 } 432 }
424 }else{ 433 }else{
425 - this.giftGivingItem = datas.list;  
426 this.giftGiving.pages = 1;// 数据为空时设置分页数为1 434 this.giftGiving.pages = 1;// 数据为空时设置分页数为1
427 this.tipText = "已经全部加载完毕"; //提示全部加载为空 435 this.tipText = "已经全部加载完毕"; //提示全部加载为空
428 } 436 }