part_time.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <view class="position">
  4. <view class="audits">
  5. <view class="audit" :class="{ active: current == index }" v-for="(item, index) in audit" :key="index" @click="click({ index: index }, 'audit')">{{ item.name }}</view>
  6. </view>
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/job/position/manage/part_time_push?id=' + item.id)">
  8. <view class="top">
  9. <view class="title omit">
  10. <text class="icon" :style="{ color: item.state == 0 ? '#4CAF50' : '#545555' }">&#xe614;</text>
  11. <text>{{ item.title }}</text>
  12. </view>
  13. <view class="audit" v-if="item.audit == 0">
  14. <text class="icon">&#xe642;</text>
  15. <text>审核中</text>
  16. </view>
  17. <view class="audit" style="color: #4caf50" v-if="item.audit == 1">
  18. <text class="icon">&#xe612;</text>
  19. <text>审核通过</text>
  20. </view>
  21. <view class="audit" v-if="item.audit == 2">
  22. <text class="icon">&#xec72;</text>
  23. <text>审核不通过</text>
  24. </view>
  25. </view>
  26. <view class="desc">
  27. <text class="tag org">{{ item.salary }}¥</text>
  28. <text class="tag">{{ item.regionName || '地点不限' }}</text>
  29. <text class="tag">周期:{{ item.days }}天</text>
  30. <text class="date">{{ item.createTime }}</text>
  31. </view>
  32. <view class="flex">
  33. <view class="f danger" @click.stop="manageRemove(item)" v-if="item.complete == 0 && item.audit == 0">删除</view>
  34. <view class="f" @click.stop="manageRemove(item)" v-else>查看</view>
  35. </view>
  36. </view>
  37. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  38. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  39. </view>
  40. <view class="mfooter">
  41. <button class="btn" @click="go('/pages/job/position/manage/part_time_push')">
  42. <text class="icon">&#xe7c4;</text>
  43. <text>发布兼职</text>
  44. </button>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. audit: [
  53. { name: '全部', value: '' },
  54. { name: '待审核', value: 0 },
  55. { name: '审核通过', value: 1 },
  56. { name: '未通过', value: 2 }
  57. ],
  58. current: 0,
  59. list: [],
  60. param: { pageNum: 1, pageSize: 10, type: 1 },
  61. loadMore: true
  62. };
  63. },
  64. onLoad(e) {
  65. this.getData();
  66. uni.$on('position', (res) => {
  67. this.refresh();
  68. });
  69. },
  70. methods: {
  71. getData() {
  72. this.http.request({
  73. url: '/app/position/manage/list',
  74. data: this.param,
  75. loading: 'false',
  76. success: (res) => {
  77. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  78. res.data.rows.forEach((item) => {
  79. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  80. item.days = this.util.days(item.startDate, item.endDate);
  81. this.list.push(item);
  82. });
  83. }
  84. });
  85. },
  86. click(e) {
  87. this.param.audit = this.audit[e.index].value;
  88. this.current = e.index;
  89. this.refresh();
  90. },
  91. go(url) {
  92. uni.navigateTo({ url: url });
  93. },
  94. manageRemove(item) {
  95. uni.showModal({
  96. title: '提示',
  97. content: '确定删除该兼职?删除后兼职金额(不包含服务费)会退回到你的账户下',
  98. success: (res) => {
  99. if (res.confirm) {
  100. this.http.request({
  101. url: '/app/position/manage/remove/' + item.id,
  102. success: (res) => {
  103. uni.showToast({ title: '删除成功' });
  104. this.list.splice(this.list.indexOf(item), 1);
  105. }
  106. });
  107. }
  108. }
  109. });
  110. },
  111. //刷新数据
  112. refresh() {
  113. this.loadMore = true;
  114. this.param.pageNum = 1;
  115. this.list = [];
  116. this.getData();
  117. }
  118. },
  119. //下拉刷新
  120. onPullDownRefresh() {
  121. setTimeout(() => {
  122. this.refresh();
  123. uni.stopPullDownRefresh();
  124. }, 1000);
  125. },
  126. //上拉加载
  127. onReachBottom() {
  128. if (this.loadMore) {
  129. this.param.pageNum++;
  130. this.getData();
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss"></style>