outsourcing.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="content">
  3. <view class="tabs hflex acenter jbetween">
  4. <block v-for="(item,index) in tabs" :key="index">
  5. <view class="tabs_item" :class="active == item.id? 'active': ''" @click="changeTabs(item.id)">{{item.text}}</view>
  6. </block>
  7. </view>
  8. <view class="box">
  9. <my-order :list="pageList" @toDetail="toDetail" @toOffer="toOffer"></my-order>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import $api from '@/static/js/api.js'
  15. var that = ''
  16. export default {
  17. data() {
  18. return {
  19. tabs: [
  20. {
  21. id: 1,
  22. text: '未报价'
  23. },
  24. {
  25. id: 2,
  26. text: '已报价'
  27. },
  28. {
  29. id: 3,
  30. text: '已匹配'
  31. }
  32. ],
  33. active: 1,
  34. pageList: [
  35. ],
  36. page: 1,
  37. limit: 10,
  38. total: 1,
  39. }
  40. },
  41. onLoad() {
  42. that = this
  43. },
  44. onShow() {
  45. that.getList()
  46. },
  47. methods: {
  48. getList() {
  49. $api.req({
  50. url: '/data/api.auth.UserPurchase/list',
  51. data: {
  52. tab: 3,
  53. status: that.active,
  54. page: that.page,
  55. limit: that.limit
  56. }
  57. }, function(res) {
  58. if(res.code == 1) {
  59. if(that.page == 1) {
  60. that.pageList = res.data.data
  61. } else {
  62. that.pageList = that.pageList.concat(res.data.data)
  63. }
  64. that.total = res.data.total
  65. }
  66. })
  67. },
  68. // 切换tabs
  69. changeTabs(id) {
  70. that.active = id
  71. that.page = 1
  72. that.pageList = []
  73. that.getList()
  74. },
  75. // 查看详情
  76. toDetail(e) {
  77. $api.jump('/page_shop/pages/order/detail?id=' + e + '&tab=3')
  78. },
  79. toOffer(e) {
  80. $api.jump('/page_shop/pages/order/offer?id=' + e + '&tab=3')
  81. },
  82. onReachBottom() {
  83. if (Number(that.page) * Number(that.limit) >= Number(that.total)) {
  84. $api.info("没有更多了")
  85. } else {
  86. that.page++
  87. that.getList()
  88. }
  89. }
  90. },
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .content {
  95. background: #f4f4f4;
  96. .tabs {
  97. width: 100%;
  98. background-color: #fff;
  99. box-sizing: border-box;
  100. padding: 20rpx 56rpx;
  101. .tabs_item {
  102. font-size: 32rpx;
  103. color: #242424;
  104. }
  105. .active {
  106. color: #222;
  107. position: relative;
  108. }
  109. .active::after {
  110. content: "";
  111. position: absolute;
  112. width: 48rpx;
  113. height: 8rpx;
  114. background-color: #506dff;
  115. border-radius: 4rpx;
  116. bottom: -14rpx;
  117. left: 24rpx;
  118. }
  119. }
  120. .box {
  121. padding: 0 30rpx;
  122. }
  123. }
  124. </style>