<template>
|
|
<view class="u-page se-w-vw-100">
|
|
<!-- 招聘信息头部 -->
|
|
<view class="se-m-20 se-br-20 se-bs-b se-bgc-white se-py-20 se-px-30" v-if="jobInfo">
|
|
<view class="se-flex se-flex-h-sb se-mb-10">
|
|
<view class="se-flex se-fw-6">
|
|
<text class="se-c-black se-fs-30">{{jobInfo.title}}</text>
|
|
<text class="se-mx-10 se-b-l"></text>
|
|
<text class="se-fs-28 se-c-orange">日薪:{{jobInfo.salaryDay}}</text>
|
|
</view>
|
|
<view class="se-c-orange se-fs-32 se-fw-6">
|
|
{{jobInfo.salaryMin}}-{{jobInfo.salaryMax}}k
|
|
</view>
|
|
</view>
|
|
<view class="se-py-10">
|
|
<text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5"
|
|
v-if="jobInfo.categoryOne_dictText">{{jobInfo.categoryOne_dictText}}</text>
|
|
<text class="se-c-text-sub se-fs-22 se-mr-10 se-py-5 se-px-20 se-br-5 se-bgc-f5"
|
|
v-if="jobInfo.categoryTwo_dictText">{{jobInfo.categoryTwo_dictText}}</text>
|
|
</view>
|
|
<view class="se-flex se-flex-h-sb">
|
|
<view class="se-flex se-flex-h-c">
|
|
<u-icon name="map"></u-icon>
|
|
<text class="se-c-text-sub se-fs-24 se-pl-10 se-toe-3">{{jobInfo.address}}</text>
|
|
</view>
|
|
<view
|
|
style="flex-shrink: 0;"
|
|
class="se-c-orange se-fs-24 se-fw-6">
|
|
共{{orderList.length}}个订单
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 招聘状态显示 -->
|
|
<view class="se-px-40 se-pb-20" v-if="jobInfo">
|
|
<view class="se-flex se-flex-h-c">
|
|
<view class="se-py-8 se-px-20 se-br-15"
|
|
:style="jobInfo.status == 1 ? 'background-color: rgba(255, 77, 79, 0.15);' : 'background-color: rgba(82, 196, 26, 0.15);'">
|
|
<text :style="jobInfo.status == 1 ? 'color: #d32f2f; font-weight: 600;' : 'color: #388e3c; font-weight: 600;'"
|
|
class="se-fs-26">
|
|
{{jobInfo.status == 1 ? '已招满' : '招聘中'}}
|
|
</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="se-p-40">
|
|
<view class="se-px-40 se-mb-30 se-py-30 se-bgc-white se-br-40 se-bs-b"
|
|
v-for="(item, index) in orderList"
|
|
:key="index"
|
|
@click="onOrderDetail(item)">
|
|
<view class="se-flex se-flex-h-sb se-fw-6 se-fs-32 se-pb-20">
|
|
<view class="se-flex">
|
|
|
|
</view>
|
|
<view class="se-c-red">
|
|
{{ getStatusText(item) }}
|
|
</view>
|
|
</view>
|
|
<view class="se-flex se-bgc-f5 se-br-20 se-p-20">
|
|
<view class="se-w-160 se-h-160">
|
|
<image class="se-w-160 se-h-160 se-br-10" :src="item.employResume ?
|
|
item.employResume.headImage
|
|
: '/static/image/user.png'" mode="aspectFill"></image>
|
|
</view>
|
|
<view class="se-ml-20 se-flex se-flex-v-sa se-flex-ai-fs se-flex-1">
|
|
<view class="se-fw-6 se-c-black se-fs-30 se-display-ib se-mb-10">求职者:{{item.jobName}}</view>
|
|
<view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">联系电话:{{item.jobPhone}}</view>
|
|
<view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">接单时间:{{item.createTime | formatTime}}</view>
|
|
<view class="se-fs-24 se-c-text-third se-display-ib se-mb-5">工作地址:{{item.jobAddress}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-empty v-if="orderList && orderList.length==0" mode="list" text="暂无订单信息"></u-empty>
|
|
</view>
|
|
|
|
<!-- 已招满按钮 -->
|
|
<view class="se-p-40 se-pt-0" v-if="jobInfo && jobInfo.status == 0">
|
|
<view class="se-bgc-orange se-br-20 se-py-30 se-flex se-flex-h-c se-flex-v-c"
|
|
@click="onStopJob">
|
|
<text class="se-c-white se-fs-32 se-fw-6">已招满</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getTaskById,
|
|
stopJob
|
|
} from "@/common/api.js"
|
|
import {
|
|
getStatusText
|
|
} from "@/utils/statusText.js"
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
orderList: [],
|
|
jobInfo: null,
|
|
jobId: null
|
|
}
|
|
},
|
|
filters: {
|
|
formatTime(time) {
|
|
if (!time) return '';
|
|
// 处理时间戳格式(可能是毫秒或字符串)
|
|
let timestamp;
|
|
if (typeof time === 'number') {
|
|
// 如果是数字,直接使用
|
|
timestamp = time;
|
|
} else {
|
|
// 如果是字符串,转换为时间戳
|
|
timestamp = new Date(time).getTime();
|
|
}
|
|
|
|
const currentTime = new Date().getTime();
|
|
const diff = (currentTime - timestamp) / 1000; // 时间差,单位:秒
|
|
|
|
// 计算月差,判断是否超过一个月
|
|
const oneMonthInSeconds = 30 * 24 * 60 * 60;
|
|
if (diff > oneMonthInSeconds) {
|
|
let date = new Date(timestamp);
|
|
let year = date.getFullYear();
|
|
let month = date.getMonth() + 1;
|
|
let day = date.getDate();
|
|
|
|
if (month < 10) month = "0" + month;
|
|
if (day < 10) day = "0" + day;
|
|
|
|
return `${year}-${month}-${day}`;
|
|
} else {
|
|
// 计算秒、分钟、小时的差值
|
|
if (diff < 60) {
|
|
return `${Math.floor(diff)}秒钟前`;
|
|
} else if (diff < 60 * 60) {
|
|
return `${Math.floor(diff / 60)}分钟前`;
|
|
} else if (diff < 60 * 60 * 24) {
|
|
return `${Math.floor(diff / 60 / 60)}小时前`;
|
|
} else {
|
|
// 显示天数
|
|
return `${Math.floor(diff / 60 / 60 / 24)}天前`;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
if (options.jobId) {
|
|
this.jobId = options.jobId;
|
|
}
|
|
},
|
|
onShow(){
|
|
this.getJobDetail();
|
|
},
|
|
methods: {
|
|
getStatusText,
|
|
|
|
getJobDetail() {
|
|
getTaskById({ id: this.jobId }).then(response => {
|
|
if (response.success) {
|
|
this.jobInfo = response.result;
|
|
this.orderList = this.jobInfo.employOrder || [];
|
|
// 设置页面标题
|
|
uni.setNavigationBarTitle({
|
|
title: `${this.jobInfo.title} - 订单列表`
|
|
});
|
|
} else {
|
|
uni.showToast({
|
|
title: '获取工作详情失败',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
})
|
|
},
|
|
onOrderDetail(order) {
|
|
uni.navigateTo({
|
|
url: `/pages_subpack/order-detail/boss?orderId=${order.id}&type=true`
|
|
});
|
|
},
|
|
|
|
onStopJob() {
|
|
uni.showModal({
|
|
title: '确认操作',
|
|
content: '确定要将此招聘标记为已招满吗?',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
this.stopJobRequest();
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
stopJobRequest() {
|
|
stopJob({ id: this.jobId }).then(response => {
|
|
if (response.success) {
|
|
uni.showToast({
|
|
title: '操作成功',
|
|
icon: 'success'
|
|
});
|
|
// 更新本地状态
|
|
this.jobInfo.status = 1;
|
|
// 返回上一页或刷新页面
|
|
setTimeout(() => {
|
|
uni.navigateBack();
|
|
}, 800);
|
|
} else {
|
|
uni.showToast({
|
|
title: response.message || '操作失败',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
}).catch(error => {
|
|
console.error('停止招聘失败:', error);
|
|
uni.showToast({
|
|
title: '网络错误',
|
|
icon: 'none'
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|