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 | 16 | </div> |
| 17 | 17 | <!-- btn按钮筛选 --> |
| 18 | 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 | 22 | </van-tab> |
| 22 | 23 | </van-tabs> |
| 23 | 24 | </div> |
| ... | ... | @@ -73,6 +74,23 @@ export default { |
| 73 | 74 | name: "myGiftBox", |
| 74 | 75 | data() { |
| 75 | 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 | 94 | active: 0, |
| 77 | 95 | receivingGiftsInfo: null, // 收礼列表页数据 |
| 78 | 96 | loading: false, // 判断是否加载 |
| ... | ... | @@ -148,6 +166,19 @@ export default { |
| 148 | 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 | 186 | if (this.active === 0) { |
| 156 | 187 | // 收礼订单列表 |
| 157 | 188 | this.loading = this.receivingGifts.loading; |
| 189 | + this.receivingGifts.pages++; | |
| 158 | 190 | this.getorderGiftList(); |
| 159 | 191 | } else { |
| 160 | 192 | // 送礼订单列表 |
| 161 | 193 | this.loading = this.giftGiving.loading; |
| 194 | + this.giftGiving.pages++; | |
| 162 | 195 | this.getorderGiveGiftList(); |
| 163 | 196 | } |
| 164 | 197 | if (!this.loading) { |
| ... | ... | @@ -221,7 +254,6 @@ export default { |
| 221 | 254 | */ |
| 222 | 255 | getorderGiftList() { |
| 223 | 256 | this.receivingGifts.loading = true; |
| 224 | - this.receivingGifts.pages++; | |
| 225 | 257 | // 加载中提示 |
| 226 | 258 | Indicator.open("加载中..."); |
| 227 | 259 | |
| ... | ... | @@ -232,7 +264,7 @@ export default { |
| 232 | 264 | uid: this.$route.query.uid, // 用户id |
| 233 | 265 | page: this.receivingGifts.pages, // 分页 默认为1 一页20条 |
| 234 | 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 | 269 | this.getorderGiftListCallback, |
| 238 | 270 | { |
| ... | ... | @@ -252,13 +284,12 @@ export default { |
| 252 | 284 | |
| 253 | 285 | // 返回处理 |
| 254 | 286 | if (res.code == 200) { |
| 287 | + // 隐藏加载圈 | |
| 288 | + this.receivingGifts.loading = false; | |
| 255 | 289 | // 解构数据 |
| 256 | 290 | let { data: datas } = res; |
| 257 | 291 | // 设置shopFnsDynamic达人动态数据 |
| 258 | - | |
| 259 | 292 | if (datas.list && datas.list.length) { |
| 260 | - // 隐藏加载圈 | |
| 261 | - this.receivingGifts.loading = false; | |
| 262 | 293 | if (this.receivingGifts.pages > 1) { |
| 263 | 294 | this.$set(this, "receivingGiftsInfo", [ |
| 264 | 295 | ...this.receivingGiftsInfo, |
| ... | ... | @@ -267,6 +298,9 @@ export default { |
| 267 | 298 | } else { |
| 268 | 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 | 306 | } else if (res.code == 400) { |
| ... | ... | @@ -341,7 +375,6 @@ export default { |
| 341 | 375 | */ |
| 342 | 376 | getorderGiveGiftList() { |
| 343 | 377 | this.giftGiving.loading = true; |
| 344 | - this.giftGiving.pages++; | |
| 345 | 378 | // 加载中提示 |
| 346 | 379 | Indicator.open("加载中..."); |
| 347 | 380 | |
| ... | ... | @@ -352,7 +385,7 @@ export default { |
| 352 | 385 | uid: this.$route.query.uid, // 用户id |
| 353 | 386 | page: this.giftGiving.pages, // 分页 默认为1 一页20条 |
| 354 | 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 | 390 | this.getorderGiveGiftListCallback, |
| 358 | 391 | { |
| ... | ... | @@ -387,6 +420,9 @@ export default { |
| 387 | 420 | } else { |
| 388 | 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 | 428 | } else if (res.code == 400) { | ... | ... |