用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
5.1 KiB

  1. <template>
  2. <view class="u-page se-w-vw-100">
  3. <!-- 招聘信息头部 -->
  4. <view class="se-m-20 se-br-20 se-bs-b se-bgc-white se-py-20 se-px-30" v-if="jobInfo">
  5. <view class="se-flex se-flex-h-sb se-mb-10">
  6. <view class="se-flex se-fw-6">
  7. <text class="se-c-black se-fs-30">{{jobInfo.title}}</text>
  8. <text class="se-mx-10 se-b-l"></text>
  9. <text class="se-fs-28 se-c-orange">日薪:{{jobInfo.salaryDay}}</text>
  10. </view>
  11. <view class="se-c-orange se-fs-32 se-fw-6">
  12. {{jobInfo.salaryMin}}-{{jobInfo.salaryMax}}k
  13. </view>
  14. </view>
  15. <view class="se-py-10">
  16. <text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5"
  17. v-if="jobInfo.categoryOne_dictText">{{jobInfo.categoryOne_dictText}}</text>
  18. <text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5"
  19. v-if="jobInfo.categoryTwo_dictText">{{jobInfo.categoryTwo_dictText}}</text>
  20. </view>
  21. <view class="se-flex se-flex-h-sb">
  22. <view class="se-flex se-flex-h-c">
  23. <u-icon name="map"></u-icon>
  24. <text class="se-c-text-sub se-fs-24 se-pl-10 se-toe-3">{{jobInfo.address}}</text>
  25. </view>
  26. <view
  27. style="flex-shrink: 0;"
  28. class="se-c-orange se-fs-24 se-fw-6">
  29. {{orderList.length}}个订单
  30. </view>
  31. </view>
  32. </view>
  33. <view class="se-p-40">
  34. <view class="se-px-40 se-mb-30 se-py-30 se-bgc-white se-br-40 se-bs-b"
  35. v-for="(item, index) in orderList"
  36. :key="index"
  37. @click="onOrderDetail(item)">
  38. <view class="se-flex se-flex-h-sb se-fw-6 se-fs-32 se-pb-20">
  39. <view class="se-flex">
  40. </view>
  41. <view class="se-c-red">
  42. {{ getStatusText(item) }}
  43. </view>
  44. </view>
  45. <view class="se-flex se-bgc-f5 se-br-20 se-p-20">
  46. <view class="se-w-160 se-h-160">
  47. <image class="se-w-160 se-h-160 se-br-10" :src="item.employResume ?
  48. item.employResume.headImage
  49. : '/static/image/user.png'" mode="aspectFill"></image>
  50. </view>
  51. <view class="se-ml-20 se-flex se-flex-v-sa se-flex-ai-fs se-flex-1">
  52. <view class="se-fw-6 se-c-black se-fs-30 se-display-ib se-mb-10">求职者{{item.jobName}}</view>
  53. <view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">联系电话{{item.jobPhone}}</view>
  54. <view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">接单时间{{item.createTime | formatTime}}</view>
  55. <view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">工作地址{{item.jobAddress}}</view>
  56. </view>
  57. </view>
  58. </view>
  59. <u-empty v-if="orderList && orderList.length==0" mode="list" text="暂无订单信息"></u-empty>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. getTaskById
  66. } from "@/common/api.js"
  67. import {
  68. getStatusText
  69. } from "@/utils/statusText.js"
  70. export default {
  71. data() {
  72. return {
  73. orderList: [],
  74. jobInfo: null,
  75. jobId: null
  76. }
  77. },
  78. filters: {
  79. formatTime(time) {
  80. if (!time) return '';
  81. // 处理时间戳格式(可能是毫秒或字符串)
  82. let timestamp;
  83. if (typeof time === 'number') {
  84. // 如果是数字,直接使用
  85. timestamp = time;
  86. } else {
  87. // 如果是字符串,转换为时间戳
  88. timestamp = new Date(time).getTime();
  89. }
  90. const currentTime = new Date().getTime();
  91. const diff = (currentTime - timestamp) / 1000; // 时间差,单位:秒
  92. // 计算月差,判断是否超过一个月
  93. const oneMonthInSeconds = 30 * 24 * 60 * 60;
  94. if (diff > oneMonthInSeconds) {
  95. let date = new Date(timestamp);
  96. let year = date.getFullYear();
  97. let month = date.getMonth() + 1;
  98. let day = date.getDate();
  99. if (month < 10) month = "0" + month;
  100. if (day < 10) day = "0" + day;
  101. return `${year}-${month}-${day}`;
  102. } else {
  103. // 计算秒、分钟、小时的差值
  104. if (diff < 60) {
  105. return `${Math.floor(diff)}秒钟前`;
  106. } else if (diff < 60 * 60) {
  107. return `${Math.floor(diff / 60)}分钟前`;
  108. } else if (diff < 60 * 60 * 24) {
  109. return `${Math.floor(diff / 60 / 60)}小时前`;
  110. } else {
  111. // 显示天数
  112. return `${Math.floor(diff / 60 / 60 / 24)}天前`;
  113. }
  114. }
  115. }
  116. },
  117. onLoad(options) {
  118. if (options.jobId) {
  119. this.jobId = options.jobId;
  120. }
  121. },
  122. onShow(){
  123. this.getJobDetail();
  124. },
  125. methods: {
  126. getStatusText,
  127. getJobDetail() {
  128. getTaskById({ id: this.jobId }).then(response => {
  129. if (response.success) {
  130. this.jobInfo = response.result;
  131. this.orderList = this.jobInfo.employOrder || [];
  132. // 设置页面标题
  133. uni.setNavigationBarTitle({
  134. title: `${this.jobInfo.title} - 订单列表`
  135. });
  136. } else {
  137. uni.showToast({
  138. title: '获取工作详情失败',
  139. icon: 'none'
  140. });
  141. }
  142. }).catch(error => {
  143. console.error('获取工作详情失败:', error);
  144. uni.showToast({
  145. title: '网络错误',
  146. icon: 'none'
  147. });
  148. });
  149. },
  150. onOrderDetail(order) {
  151. uni.navigateTo({
  152. url: `/pages_subpack/order-detail/boss?orderId=${order.id}&type=true`
  153. });
  154. }
  155. }
  156. }
  157. </script>
  158. <style>
  159. </style>