list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="app-container">
  3. <view class="list-container">
  4. <block v-for="(item, index) in dataList" :key='index'>
  5. <view class="item" @tap="toDetail(item.workerOrder)">
  6. <view class="row">工单编号:{{item.workerOrder}}
  7. <view class="state wait">{{item | stateFilter}}</view>
  8. </view>
  9. <view class="row">订单编号:{{item.orderId}}</view>
  10. <view class="row">派单时间:{{item.createTime || ''}}</view>
  11. <view class="row">预约时间:{{item.reserveTime || ''}}</view>
  12. <view class="row">服务类型:{{item.serverContent || ''}}</view>
  13. <view class="row">服务人员:{{item.workerName || ''}}{{item.assistName ? '、'+item.assistName:''}}</view>
  14. </view>
  15. </block>
  16. </view>
  17. <no-data v-if="!dataList.length" :showText="'暂无工单信息'"></no-data>
  18. <loading-text v-if="dataList.length" :loading="loading" :noMore="noMore" ></loading-text>
  19. </view>
  20. </template>
  21. <script>
  22. import {mapState} from 'vuex';
  23. export default {
  24. filters: {
  25. stateFilter(item) {
  26. let orderState = Number(item.orderState);
  27. if(item.serverContent == '安装服务') {
  28. if(orderState == 6) {
  29. return '服务中';
  30. }else if(orderState == 7 || orderState == 10) {
  31. return '已完工';
  32. }else {
  33. return '已派单';
  34. }
  35. }else {
  36. if(orderState < 7) {
  37. return '已派单';
  38. }else if(orderState == 7) {
  39. return '服务中';
  40. }else {
  41. return '已完工';
  42. }
  43. }
  44. }
  45. },
  46. data() {
  47. return {
  48. dataList: [],
  49. pageNum: 1,
  50. pageSize: 10,
  51. noMore: false,
  52. loading: false,
  53. }
  54. },
  55. computed:{
  56. ...mapState(['userInfo', 'isLogin', 'userId'])
  57. },
  58. onLoad() {
  59. this.getProfitList();
  60. },
  61. // 下拉刷新
  62. onPullDownRefresh() {
  63. this.pageNum = 1;
  64. this.getProfitList();
  65. },
  66. // 上拉加载
  67. onReachBottom() {
  68. this.getProfitList(1);
  69. },
  70. methods: {
  71. // 获取列表
  72. getProfitList(loadMore) {
  73. if(this.noMore && loadMore)return;
  74. this.noMore = false
  75. if(!loadMore){
  76. this.pageNum = 1;
  77. }else{
  78. this.loading = true;
  79. }
  80. this.$axios({
  81. url: '/order/work/list',
  82. method: 'get',
  83. params: {
  84. pageNo: this.pageNum,
  85. pageSize: this.pageSize,
  86. userId: this.userId,
  87. },
  88. isLoading: !loadMore
  89. }).then(res => {
  90. let _list = res.data.records;
  91. let pageTotal = res.data.pages;
  92. if(this.pageNum >= pageTotal){
  93. this.noMore = true;
  94. }
  95. if (_list.length) {
  96. this.pageNum += 1
  97. }
  98. if (loadMore) {
  99. this.dataList = this.dataList.concat(_list);
  100. this.loading = false;
  101. } else {
  102. this.dataList = _list;
  103. }
  104. uni.stopPullDownRefresh();
  105. })
  106. },
  107. toDetail(id) {
  108. uni.navigateTo({
  109. url:'/pages/mine/workOrder/detail?id=' + id
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. .app-container {
  117. background: #F4F2F2;
  118. padding: 20rpx;
  119. box-sizing: border-box;
  120. }
  121. .list-container {
  122. .item {
  123. margin-bottom: 20rpx;
  124. background: #FFFFFF;
  125. border-radius: 20rpx;
  126. padding: 15rpx 20rpx;
  127. .row {
  128. display: flex;
  129. justify-content: space-between;
  130. align-items: center;
  131. font-size: 28rpx;
  132. color: #666666;
  133. height: 48rpx;
  134. .state {
  135. font-size: 28rpx;
  136. &.wait {
  137. color: #FF3F42;
  138. }
  139. &.over {
  140. color: #3F9EFF;
  141. }
  142. &.cancel {
  143. color: #999999;
  144. }
  145. }
  146. }
  147. }
  148. }
  149. </style>