list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 && item.isExpire == 0">等待对方同意接单 {{ item.countdown }}</view>
  29. <view class="f" v-if="item.state == 1 && item.isAccept == 0 && item.isExpire == 1">对方超时未操作(已过期)</view>
  30. <view class="f br" v-if="item.state == 1 && item.isAccept == 1">对方同意接单</view>
  31. <view class="f danger" v-if="item.state == 1 && item.isAccept == 2">对方已拒绝</view>
  32. </view>
  33. </view>
  34. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  35. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  36. <sift v-model="show" @confirm="confirm"></sift>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. ip: this.http.ip,
  44. tab: [
  45. { name: '全部', isRead: '' },
  46. { name: '已阅', isRead: 1 },
  47. { name: '未读', isRead: 0 }
  48. ],
  49. list: [],
  50. param: { pageNum: 1, pageSize: 10, type: 1 },
  51. loadMore: true,
  52. show: false
  53. };
  54. },
  55. onLoad(e) {
  56. this.param.positionId = e.id;
  57. this.getData();
  58. uni.$on('agreeApplication', (res) => {
  59. this.refresh();
  60. });
  61. setTimeout(() => {
  62. uni.setNavigationBarTitle({ title: e.title + '(' + e.total + ')' });
  63. }, 300);
  64. },
  65. methods: {
  66. getData() {
  67. this.http.request({
  68. url: '/app/deliver/receive/list',
  69. data: this.param,
  70. loading: 'false',
  71. success: (res) => {
  72. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  73. res.data.rows.forEach((item) => {
  74. if (item.isAccept == 0 && item.isExpire == 0 && item.state == 1) {
  75. const endTime = new Date(item.auditTime);
  76. endTime.setHours(endTime.getHours() + 1);
  77. item.countdown = '';
  78. item.timer = null;
  79. item.timer = this.util.startCountdown(endTime, (countdown) => {
  80. item.countdown = countdown;
  81. if (countdown == '已超时') {
  82. item.isExpire = 1;
  83. clearInterval(item.timer);
  84. }
  85. });
  86. }
  87. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  88. this.list.push(item);
  89. });
  90. }
  91. });
  92. },
  93. go(url) {
  94. uni.navigateTo({ url: url });
  95. },
  96. tabClick(e) {
  97. this.param.isRead = e.isRead;
  98. this.refresh();
  99. },
  100. confirm(e) {
  101. Object.assign(this.param, e);
  102. this.refresh();
  103. },
  104. //刷新数据
  105. refresh() {
  106. this.loadMore = true;
  107. this.param.pageNum = 1;
  108. this.list.forEach((item) => clearInterval(item.timer));
  109. this.list = [];
  110. this.getData();
  111. }
  112. },
  113. //下拉刷新
  114. onPullDownRefresh() {
  115. setTimeout(() => {
  116. this.refresh();
  117. uni.stopPullDownRefresh();
  118. }, 1000);
  119. },
  120. //上拉加载
  121. onReachBottom() {
  122. if (this.loadMore) {
  123. this.param.pageNum++;
  124. this.getData();
  125. }
  126. },
  127. destroyed() {
  128. this.list.forEach((item) => clearInterval(item.timer));
  129. }
  130. };
  131. </script>
  132. <style lang="scss">
  133. .item {
  134. background-color: white;
  135. border-radius: 7px;
  136. padding: 15px;
  137. overflow: hidden;
  138. margin-bottom: 12px;
  139. .top {
  140. overflow: hidden;
  141. .avatar {
  142. float: left;
  143. width: 50px;
  144. height: 50px;
  145. border-radius: 50%;
  146. }
  147. .state {
  148. float: right;
  149. font-size: 14px;
  150. }
  151. .con {
  152. float: left;
  153. padding-left: 10px;
  154. .name {
  155. font-weight: bold;
  156. padding-bottom: 3px;
  157. }
  158. .desc {
  159. color: $font-c;
  160. font-size: 14px;
  161. }
  162. }
  163. }
  164. .flex {
  165. border-top: 1px solid $line;
  166. padding-top: 10px;
  167. font-size: 14px;
  168. margin-top: 13px;
  169. }
  170. }
  171. </style>