Commit f9c9e6741ab62cff4c99f898f1d86dfa3e3bf7f3
1 parent
8d291fc1
礼物筛选
Showing
2 changed files
with
46 additions
and
10 deletions
src/pages/myGiftBox/myGiftBox.less
src/pages/myGiftBox/myGiftBox.vue
| @@ -16,8 +16,9 @@ | @@ -16,8 +16,9 @@ | ||
| 16 | </div> | 16 | </div> |
| 17 | <!-- btn按钮筛选 --> | 17 | <!-- btn按钮筛选 --> |
| 18 | <div class="tab_btn_list"> | 18 | <div class="tab_btn_list"> |
| 19 | - <van-tabs swipeable> | ||
| 20 | - <van-tab v-for="index in 10" :title="'选项 ' + index"> | 19 | + <van-tabs @change="onStatusFiltering" v-model="btnActive" swipeable> |
| 20 | + <van-tab v-for="(item,index) in (active==0?receivingGiftsTab:giveGifTab)" :title="item.name" :key="'tab'+index"> | ||
| 21 | + | ||
| 21 | </van-tab> | 22 | </van-tab> |
| 22 | </van-tabs> | 23 | </van-tabs> |
| 23 | </div> | 24 | </div> |
| @@ -73,6 +74,23 @@ export default { | @@ -73,6 +74,23 @@ export default { | ||
| 73 | name: "myGiftBox", | 74 | name: "myGiftBox", |
| 74 | data() { | 75 | data() { |
| 75 | return { | 76 | return { |
| 77 | + receivingGiftsTab:[ // 收礼tab筛选 | ||
| 78 | + {name:'全部',status:0}, | ||
| 79 | + {name:'未填写地址',status:1}, | ||
| 80 | + {name:'待发货',status:2}, | ||
| 81 | + {name:'已完成',status:3}, | ||
| 82 | + {name:'已发货',status:4} | ||
| 83 | + ], | ||
| 84 | + receivingGiftStatue:null, // 收礼订单状态筛选 | ||
| 85 | + giveGifTab:[ // 送礼tab筛选 | ||
| 86 | + {name:'全部',status:0}, | ||
| 87 | + {name:'可分享',status:1}, | ||
| 88 | + {name:'未填写地址',status:2}, | ||
| 89 | + {name:'待发货',status:3}, | ||
| 90 | + {name:'未领退款',status:4} | ||
| 91 | + ], | ||
| 92 | + giveGifStatue:null, // 送礼订单状态筛选 | ||
| 93 | + btnActive:0, // 按钮tab状态 | ||
| 76 | active: 0, | 94 | active: 0, |
| 77 | receivingGiftsInfo: null, // 收礼列表页数据 | 95 | receivingGiftsInfo: null, // 收礼列表页数据 |
| 78 | loading: false, // 判断是否加载 | 96 | loading: false, // 判断是否加载 |
| @@ -148,6 +166,19 @@ export default { | @@ -148,6 +166,19 @@ export default { | ||
| 148 | this.setGiftBottomVisibleBySwitchTab(0); | 166 | this.setGiftBottomVisibleBySwitchTab(0); |
| 149 | } | 167 | } |
| 150 | }, | 168 | }, |
| 169 | + // tab订单状态筛选 | ||
| 170 | + onStatusFiltering(name, title){ | ||
| 171 | + if(this.active==0){ | ||
| 172 | + // 收礼订单列表 | ||
| 173 | + this.receivingGiftStatue = name; | ||
| 174 | + this.getorderGiftList(); | ||
| 175 | + }else{ | ||
| 176 | + // 送礼订单列表 | ||
| 177 | + this.giveGifStatue = name; | ||
| 178 | + this.getorderGiveGiftList(); | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + }, | ||
| 151 | /** | 182 | /** |
| 152 | * 下啦滑动加载更多 | 183 | * 下啦滑动加载更多 |
| 153 | */ | 184 | */ |
| @@ -155,10 +186,12 @@ export default { | @@ -155,10 +186,12 @@ export default { | ||
| 155 | if (this.active === 0) { | 186 | if (this.active === 0) { |
| 156 | // 收礼订单列表 | 187 | // 收礼订单列表 |
| 157 | this.loading = this.receivingGifts.loading; | 188 | this.loading = this.receivingGifts.loading; |
| 189 | + this.receivingGifts.pages++; | ||
| 158 | this.getorderGiftList(); | 190 | this.getorderGiftList(); |
| 159 | } else { | 191 | } else { |
| 160 | // 送礼订单列表 | 192 | // 送礼订单列表 |
| 161 | this.loading = this.giftGiving.loading; | 193 | this.loading = this.giftGiving.loading; |
| 194 | + this.giftGiving.pages++; | ||
| 162 | this.getorderGiveGiftList(); | 195 | this.getorderGiveGiftList(); |
| 163 | } | 196 | } |
| 164 | if (!this.loading) { | 197 | if (!this.loading) { |
| @@ -221,7 +254,6 @@ export default { | @@ -221,7 +254,6 @@ export default { | ||
| 221 | */ | 254 | */ |
| 222 | getorderGiftList() { | 255 | getorderGiftList() { |
| 223 | this.receivingGifts.loading = true; | 256 | this.receivingGifts.loading = true; |
| 224 | - this.receivingGifts.pages++; | ||
| 225 | // 加载中提示 | 257 | // 加载中提示 |
| 226 | Indicator.open("加载中..."); | 258 | Indicator.open("加载中..."); |
| 227 | 259 | ||
| @@ -232,7 +264,7 @@ export default { | @@ -232,7 +264,7 @@ export default { | ||
| 232 | uid: this.$route.query.uid, // 用户id | 264 | uid: this.$route.query.uid, // 用户id |
| 233 | page: this.receivingGifts.pages, // 分页 默认为1 一页20条 | 265 | page: this.receivingGifts.pages, // 分页 默认为1 一页20条 |
| 234 | type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) | 266 | type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) |
| 235 | - status: 0 // 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 | 267 | + status:this.receivingGiftStatue// 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 |
| 236 | }, | 268 | }, |
| 237 | this.getorderGiftListCallback, | 269 | this.getorderGiftListCallback, |
| 238 | { | 270 | { |
| @@ -252,13 +284,12 @@ export default { | @@ -252,13 +284,12 @@ export default { | ||
| 252 | 284 | ||
| 253 | // 返回处理 | 285 | // 返回处理 |
| 254 | if (res.code == 200) { | 286 | if (res.code == 200) { |
| 287 | + // 隐藏加载圈 | ||
| 288 | + this.receivingGifts.loading = false; | ||
| 255 | // 解构数据 | 289 | // 解构数据 |
| 256 | let { data: datas } = res; | 290 | let { data: datas } = res; |
| 257 | // 设置shopFnsDynamic达人动态数据 | 291 | // 设置shopFnsDynamic达人动态数据 |
| 258 | - | ||
| 259 | if (datas.list && datas.list.length) { | 292 | if (datas.list && datas.list.length) { |
| 260 | - // 隐藏加载圈 | ||
| 261 | - this.receivingGifts.loading = false; | ||
| 262 | if (this.receivingGifts.pages > 1) { | 293 | if (this.receivingGifts.pages > 1) { |
| 263 | this.$set(this, "receivingGiftsInfo", [ | 294 | this.$set(this, "receivingGiftsInfo", [ |
| 264 | ...this.receivingGiftsInfo, | 295 | ...this.receivingGiftsInfo, |
| @@ -267,6 +298,9 @@ export default { | @@ -267,6 +298,9 @@ export default { | ||
| 267 | } else { | 298 | } else { |
| 268 | this.$set(this, "receivingGiftsInfo", datas.list); | 299 | this.$set(this, "receivingGiftsInfo", datas.list); |
| 269 | } | 300 | } |
| 301 | + }else{ | ||
| 302 | + this.receivingGiftsInfo = datas.list; | ||
| 303 | + this.this.receivingGifts.pages = 1; // 数据为空时页脚从1开始计算 | ||
| 270 | } | 304 | } |
| 271 | /* 获取达人动态数据 结束 */ | 305 | /* 获取达人动态数据 结束 */ |
| 272 | } else if (res.code == 400) { | 306 | } else if (res.code == 400) { |
| @@ -341,7 +375,6 @@ export default { | @@ -341,7 +375,6 @@ export default { | ||
| 341 | */ | 375 | */ |
| 342 | getorderGiveGiftList() { | 376 | getorderGiveGiftList() { |
| 343 | this.giftGiving.loading = true; | 377 | this.giftGiving.loading = true; |
| 344 | - this.giftGiving.pages++; | ||
| 345 | // 加载中提示 | 378 | // 加载中提示 |
| 346 | Indicator.open("加载中..."); | 379 | Indicator.open("加载中..."); |
| 347 | 380 | ||
| @@ -352,7 +385,7 @@ export default { | @@ -352,7 +385,7 @@ export default { | ||
| 352 | uid: this.$route.query.uid, // 用户id | 385 | uid: this.$route.query.uid, // 用户id |
| 353 | page: this.giftGiving.pages, // 分页 默认为1 一页20条 | 386 | page: this.giftGiving.pages, // 分页 默认为1 一页20条 |
| 354 | type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) | 387 | type: 1, // 1 收礼列表 2 送礼列表(送礼已废弃) |
| 355 | - status: 0 // 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 | 388 | + status: this.giveGifStatue // 0或者不传 全部 1 未填地址 2 未发货 3 已完成 4 已发货 |
| 356 | }, | 389 | }, |
| 357 | this.getorderGiveGiftListCallback, | 390 | this.getorderGiveGiftListCallback, |
| 358 | { | 391 | { |
| @@ -387,6 +420,9 @@ export default { | @@ -387,6 +420,9 @@ export default { | ||
| 387 | } else { | 420 | } else { |
| 388 | this.$set(this, "giftGivingItem", datas.list); | 421 | this.$set(this, "giftGivingItem", datas.list); |
| 389 | } | 422 | } |
| 423 | + }else{ | ||
| 424 | + this.giftGivingItem = datas.list; | ||
| 425 | + this.giftGiving.pages = 1;// 数据为空时设置分页数为1 | ||
| 390 | } | 426 | } |
| 391 | /* 获取送礼订单列表 结束 */ | 427 | /* 获取送礼订单列表 结束 */ |
| 392 | } else if (res.code == 400) { | 428 | } else if (res.code == 400) { |