list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="main pt0">
  3. <view class="tab">
  4. <u-tabs :list="tab" @click="tabClick"></u-tabs>
  5. <view class="filters" @click="show = true">
  6. <text class="icon">&#xe68c;</text>
  7. <text>筛选</text>
  8. </view>
  9. </view>
  10. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/user/resume/application/receive/preview?id=' + item.id)">
  11. <view class="top">
  12. <image :src="ip + item.avatar" mode="widthFix" class="avatar"></image>
  13. <view class="state" style="color: #4caf50" v-if="item.isRead == 1">
  14. <text class="icon">&#xe614;</text>
  15. <text>已阅</text>
  16. </view>
  17. <view class="state" v-else>
  18. <text class="icon">&#xe614;</text>
  19. <text>未读</text>
  20. </view>
  21. <view class="con">
  22. <view class="name">{{ item.name }}</view>
  23. <text class="desc">{{ item.sex }} · {{ item.age }}岁</text>
  24. </view>
  25. </view>
  26. <view class="flex">
  27. <view class="f" v-if="item.state == 0">待处理</view>
  28. <view class="f" v-if="item.state == 1 && item.isAccept == 0">等待对方同意接单</view>
  29. <view class="f br" v-if="item.state == 1 && item.isAccept == 1">对方同意接单</view>
  30. <view class="f danger" v-if="item.state == 1 && item.isAccept == 2">对方已拒绝</view>
  31. </view>
  32. </view>
  33. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  34. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  35. <sift v-model="show" @confirm="confirm"></sift>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. ip: this.http.ip,
  43. tab: [
  44. { name: '全部', isRead: '' },
  45. { name: '已阅', isRead: 1 },
  46. { name: '未读', isRead: 0 }
  47. ],
  48. list: [],
  49. param: { pageNum: 1, pageSize: 10, type: 1 },
  50. loadMore: true,
  51. show: false
  52. };
  53. },
  54. onLoad(e) {
  55. this.param.positionId = e.id;
  56. this.getData();
  57. uni.$on('agreeApplication', (res) => {
  58. this.refresh();
  59. });
  60. setTimeout(() => {
  61. uni.setNavigationBarTitle({ title: e.title + '(' + e.total + ')' });
  62. }, 300);
  63. },
  64. methods: {
  65. getData() {
  66. this.http.request({
  67. url: '/app/deliver/receive/list',
  68. data: this.param,
  69. loading: 'false',
  70. success: (res) => {
  71. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  72. this.list.push(...res.data.rows);
  73. }
  74. });
  75. },
  76. go(url) {
  77. uni.navigateTo({ url: url });
  78. },
  79. tabClick(e) {
  80. this.param.isRead = e.isRead;
  81. this.refresh();
  82. },
  83. confirm(e) {
  84. Object.assign(this.param, e);
  85. this.refresh();
  86. },
  87. //刷新数据
  88. refresh() {
  89. this.loadMore = true;
  90. this.param.pageNum = 1;
  91. this.list = [];
  92. this.getData();
  93. }
  94. },
  95. //下拉刷新
  96. onPullDownRefresh() {
  97. setTimeout(() => {
  98. this.refresh();
  99. uni.stopPullDownRefresh();
  100. }, 1000);
  101. },
  102. //上拉加载
  103. onReachBottom() {
  104. if (this.loadMore) {
  105. this.param.pageNum++;
  106. this.getData();
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss">
  112. .item {
  113. background-color: white;
  114. border-radius: 7px;
  115. padding: 15px;
  116. overflow: hidden;
  117. margin-bottom: 12px;
  118. .top {
  119. overflow: hidden;
  120. .avatar {
  121. float: left;
  122. width: 50px;
  123. height: 50px;
  124. border-radius: 50%;
  125. }
  126. .state {
  127. float: right;
  128. font-size: 14px;
  129. }
  130. .con {
  131. float: left;
  132. padding-left: 10px;
  133. .name {
  134. font-weight: bold;
  135. padding-bottom: 3px;
  136. }
  137. .desc {
  138. color: $font-c;
  139. font-size: 14px;
  140. }
  141. }
  142. }
  143. .flex {
  144. border-top: 1px solid $line;
  145. padding-top: 10px;
  146. font-size: 14px;
  147. margin-top: 13px;
  148. }
  149. }
  150. </style>