index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="return-list" ref="container">
  3. <!-- 分类查询 -->
  4. <view class="nav">
  5. <view class="item" :class="{ on: listQuery.type === 0 }" @click="changeType(0)">
  6. <view>全部</view>
  7. </view>
  8. <view class="item" :class="{ on: listQuery.type === 1 }" @click="changeType(1)">
  9. <view>售后中</view>
  10. </view>
  11. <view class="item" :class="{ on: listQuery.type === 2 }" @click="changeType(2)">
  12. <view>已完成</view>
  13. </view>
  14. </view>
  15. <!-- 商品列表 -->
  16. <view class="list">
  17. <ListItem
  18. v-for="(item,index) in orderList"
  19. :key="index"
  20. :item="item"
  21. />
  22. <view style="padding: 150rpx 0rpx;" v-if="loaded === true && orderList.length === 0">
  23. <missing v-if="loaded === true && orderList.length === 0"
  24. :imgUrl="'http://qiniuoss.nauzone.cn/%E7%BB%84%203%20%E6%8B%B7%E8%B4%9D@3x.png'" :desc="'暂时没有订单哦!'">
  25. </missing>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import missing from '@/components/missing.vue'
  32. import ListItem from './listItem.vue'
  33. export default {
  34. name: "ReturnList",
  35. components: {
  36. missing,
  37. ListItem
  38. },
  39. data() {
  40. return {
  41. orderList: [],
  42. listQuery: {
  43. pageNum: 1,
  44. pageSize: 5,
  45. type: 0
  46. },
  47. type: 0,
  48. loading: false,
  49. loaded: false,
  50. pageNum: 0
  51. };
  52. },
  53. onLoad(option) {
  54. this.getOrderList();
  55. },
  56. onReachBottom() {
  57. !this.loading && this.getOrderList();
  58. },
  59. methods: {
  60. // 售后详情
  61. getOrderList() {
  62. if ((this.loading || this.loaded) && (this.type === this.listQuery.type)) return;
  63. this.loading = true;
  64. // 售后接口
  65. this.$api.request('get', 'order/app/storeAfterSales/list', this.listQuery).then(res => {
  66. // console.log(res)
  67. if (this.type === this.listQuery.type) {
  68. this.orderList = [...this.orderList, ...res.rows];
  69. } else {
  70. this.orderList = res.rows;
  71. this.type = this.listQuery.type
  72. }
  73. this.listQuery.pageNum++;
  74. // 加载组件
  75. this.loading = false;
  76. this.loaded = res.rows.length <= res.total;// 查询到末尾
  77. })
  78. },
  79. // 分类查询
  80. changeType (type) {
  81. this.listQuery.type = type
  82. this.listQuery.pageNum = 1;
  83. this.getOrderList()
  84. }
  85. }
  86. };
  87. </script>
  88. <style scoped lang="scss">
  89. .return-list{
  90. .nav{
  91. background-color: #FFF;
  92. display: flex;
  93. justify-content: space-around;
  94. .item{
  95. height: 80rpx;
  96. line-height: 80rpx;
  97. font-size: 14px;
  98. font-family: PingFang SC;
  99. color: #333333;
  100. }
  101. .on{
  102. border-bottom: 6rpx solid #EB3729;
  103. }
  104. }
  105. }
  106. </style>