list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <zj-page-layout
  3. :hasFooter="false"
  4. :isScroll="true"
  5. :refresherTriggered="refresherTriggered"
  6. @refresherrefresh="refresherrefresh"
  7. @scrolltolower="scrolltolower">
  8. <template slot="header">
  9. <view class="header-container">
  10. <u-tabs
  11. :scrollable="false"
  12. :list="tabList"
  13. :current="curTab"
  14. @click="changeTab"
  15. lineColor="#01C30B"
  16. :activeStyle="{
  17. color: '#01C30B'
  18. }"
  19. :inactiveStyle="{
  20. color: '#666666'
  21. }"
  22. itemStyle="padding-left: 0; padding-right: 0; height: 88rpx;">
  23. </u-tabs>
  24. </view>
  25. </template>
  26. <view class="common-order-list">
  27. <view class="item" @tap="$navPage(`/pages/mine/myBuy/detail`)">
  28. <view class="top">
  29. <image src="@/static/common/logo.png"></image>
  30. <view class="user">
  31. <view class="name">李海</view>
  32. <view class="time">21小时前发布</view>
  33. </view>
  34. <view class="status">待付款</view>
  35. </view>
  36. <view class="goods">
  37. <image src="@/static/user/other_book.png"></image>
  38. <view class="main">
  39. <view class="name">商品名称</view>
  40. <view class="des">商品描述</view>
  41. <view class="price"><text>¥18.00</text>x2</view>
  42. </view>
  43. </view>
  44. <view class="total">订单总金额<text>¥1200.00</text></view>
  45. <view class="bottom">
  46. <view class="left-location"><text class="iconfont icon-dingwei"></text>天河区棠下</view>
  47. <view class="right-btn">
  48. <u-button text="取消订单" shape="circle"></u-button>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </zj-page-layout>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. imgUrl: this.$imageUrl,
  60. tabList: [
  61. {name: '全部', value: 1},
  62. {name: '待付款', value: 2},
  63. {name: '待发货', value: 3},
  64. {name: '待收货', value: 4},
  65. {name: '已收货', value: 5},
  66. {name: '售后中', value: 6},
  67. ],
  68. curTab: 0,
  69. dataList: [],
  70. pageNum: 1,
  71. refresherTriggered: false,
  72. }
  73. },
  74. async onLoad() {
  75. // await this.getList()
  76. },
  77. methods: {
  78. //获取列表数据
  79. async getList() {
  80. this.$api.post('/xxx/xxxlist', {
  81. pageNum: this.pageNum,
  82. pageSize: 10,
  83. }).then(res => {
  84. this.loadStatus = 0;
  85. let list = res.data.records;
  86. if(list.length < 10){
  87. this.loadStatus = 2;
  88. }
  89. this.dataList = this.dataList.concat(list);
  90. }).catch(() => {
  91. this.loadStatus = 2;
  92. }).finally(res => {
  93. this.refresherTriggered = false;
  94. })
  95. },
  96. // 滚动到底部
  97. scrolltolower(e) {
  98. if (this.loadStatus === 0) {
  99. this.pageNum++;
  100. this.getList();
  101. }
  102. },
  103. // 触发下拉刷新
  104. refresherrefresh(e) {
  105. this.refresherTriggered = true;
  106. this.dataList = [];
  107. this.pageNum = 1;
  108. this.getList();
  109. },
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .header-container {
  115. background: #ffffff;
  116. }
  117. </style>