part_time.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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)">删除</view>
  34. </view>
  35. </view>
  36. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  37. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  38. </view>
  39. <view class="mfooter">
  40. <button class="btn" @click="go('/pages/job/position/manage/part_time_push')">
  41. <text class="icon">&#xe7c4;</text>
  42. <text>发布兼职</text>
  43. </button>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. audit: [
  52. { name: '全部', value: '' },
  53. { name: '待审核', value: 0 },
  54. { name: '审核通过', value: 1 },
  55. { name: '未通过', value: 2 }
  56. ],
  57. current: 0,
  58. list: [],
  59. param: { pageNum: 1, pageSize: 10, type: 1 },
  60. loadMore: true
  61. };
  62. },
  63. onLoad(e) {
  64. this.getData();
  65. uni.$on('position', (res) => {
  66. this.refresh();
  67. });
  68. },
  69. methods: {
  70. getData() {
  71. this.http.request({
  72. url: '/app/position/manage/list',
  73. data: this.param,
  74. loading: 'false',
  75. success: (res) => {
  76. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  77. res.data.rows.forEach((item) => {
  78. item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
  79. item.days = this.util.days(item.startDate, item.endDate);
  80. this.list.push(item);
  81. });
  82. }
  83. });
  84. },
  85. click(e) {
  86. this.param.audit = this.audit[e.index].value;
  87. this.current = e.index;
  88. this.refresh();
  89. },
  90. go(url) {
  91. uni.navigateTo({ url: url });
  92. },
  93. manageRemove(item) {
  94. uni.showModal({
  95. title: '提示',
  96. content: '确定删除该兼职?删除后金额会退回到你的账户下',
  97. success: (res) => {
  98. if (res.confirm) {
  99. this.http.request({
  100. url: '/app/position/manage/remove/' + item.id,
  101. success: (res) => {
  102. uni.showToast({ title: '删除成功' });
  103. this.list.splice(this.list.indexOf(item), 1);
  104. }
  105. });
  106. }
  107. }
  108. });
  109. },
  110. //刷新数据
  111. refresh() {
  112. this.loadMore = true;
  113. this.param.pageNum = 1;
  114. this.list = [];
  115. this.getData();
  116. }
  117. },
  118. //下拉刷新
  119. onPullDownRefresh() {
  120. setTimeout(() => {
  121. this.refresh();
  122. uni.stopPullDownRefresh();
  123. }, 1000);
  124. },
  125. //上拉加载
  126. onReachBottom() {
  127. if (this.loadMore) {
  128. this.param.pageNum++;
  129. this.getData();
  130. }
  131. }
  132. };
  133. </script>
  134. <style lang="scss"></style>