Commit 51d4e3216535f0d73c59eaf2a713d82516d7f4be

Authored by zhiyangdu
1 parent 690c7a33

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

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