Jelajahi Sumber

职位管理:列表不展示招聘会职位,待支付的职位可以删除、使用额度发布

Xiao_123 15 jam lalu
induk
melakukan
c4fc4edd35
3 mengubah file dengan 86 tambahan dan 20 penghapusan
  1. 26 0
      api/new/position.js
  2. 51 12
      components/PositionList/index.vue
  3. 9 8
      pages/index/position.vue

+ 26 - 0
api/new/position.js

@@ -53,6 +53,32 @@ export const getJobDetails = (params) => {
   })
 }
 
+// 使用可发布职位数将职位更新成招聘中状态
+export const updatePositionStatus = (ids) => {
+  return request({
+    url: `/app-api/menduner/system/recruit/job-advertised/publish/job/enable?ids=${ids}`,
+    method: 'POST',
+    custom: {
+      showLoading: true,
+      openEncryption: true,
+      auth: true
+    }
+  })
+}
+
+// 删除待支付职位
+export const deletePosition = (ids) => {
+  return request({
+    url: `/app-api/menduner/system/recruit/job-advertised/del?ids=${ids}`,
+    method: 'POST',
+    custom: {
+      showLoading: true,
+      openEncryption: true,
+      auth: true
+    }
+  })
+}
+
 // 获取招聘职位扩展信息
 export const getJobAdvertisedExtend = (jobId) => {
   return request({

+ 51 - 12
components/PositionList/index.vue

@@ -40,12 +40,29 @@
           </view>
           <view class="d-flex font-size-13 color-666 ss-m-t-10">
             <!-- <view class="ss-m-t-10 ss-m-r-15">到期时间:{{ item.expireTime ? timesTampChange(item.expireTime, 'Y-M-D') : '长期有效' }}</view> -->
-            <view class="ss-m-t-10">刷新时间:{{ item.refreshTime ? timesTampChange(item.refreshTime, 'Y-M-D h:m') : '暂无' }}</view>
+            <view class="ss-m-t-10" v-if="tab !== 0">刷新时间:{{ item.refreshTime ? timesTampChange(item.refreshTime, 'Y-M-D h:m') : '暂无' }}</view>
           </view>
           <view class="sub-li-bottom ss-m-t-20">
-            <view v-if="tab === 0" class="sub-li-bottom-item color-primary" style="width: 100%;" @tap.stop="toPay(item)">发布</view>
-            <view v-if="tab !== 0" class="sub-li-bottom-item color-primary" style="width: 45%;" @tap.stop="handleToResume(item)">{{ item.count || 0 }} 已投递简历</view>
-            <view v-if="tab === 1" class="sub-li-bottom-item color-warning" @tap.stop="handleAction(item.top ? 4 : 3, '', item)">{{ item.top ? '取消置顶' : '置顶' }}</view>
+            <view 
+              v-if="tab === 0 && jobNum && +jobNum > 0" 
+              class="sub-li-bottom-item color-primary" 
+              style="width: 33%;" 
+              @tap.stop="handleRelease(item)"
+            >使用额度发布</view>
+            <view v-if="tab === 0" class="sub-li-bottom-item color-primary" style="width: 33%;" @tap.stop="toPay(item)">支付发布</view>
+            <view v-if="tab === 0" class="sub-li-bottom-item color-error" style="width: 33%;" @tap.stop="handleDelete(item)">删除</view>
+			
+            <view 
+              v-else 
+              class="sub-li-bottom-item color-primary" 
+              style="width: 45%;" 
+              @tap.stop="handleToResume(item)"
+            >{{ item.count || 0 }} 已投递简历</view>
+            <view 
+              v-if="tab === 1" 
+              class="sub-li-bottom-item color-warning" 
+              @tap.stop="handleAction(item.top ? 4 : 3, '', item)"
+            >{{ item.top ? '取消置顶' : '置顶' }}</view>
             <view v-if="tab === 1" class="sub-li-bottom-item color-666" @tap.stop="handleAction(0, '', item, item)">关闭</view>
             <view v-if="tab === 2" class="sub-li-bottom-item color-warning" @tap.stop="handleAction(1, '', item, item)">激活</view>
           </view>
@@ -76,7 +93,6 @@
 
 <script setup>
 import { ref } from 'vue'
-// import { commissionCalculation } from '@/utils/position'
 import { timesTampChange } from '@/utils/date'
 import { formatName } from '@/utils/getText'
 import payPopup from '@/components/payPopup'
@@ -86,7 +102,9 @@ import {
   topJobAdvertised,
   refreshJobAdvertised,
   closeJobAdvertised,
-  enableJobAdvertised
+  enableJobAdvertised,
+  updatePositionStatus,
+  deletePosition
 } from '@/api/new/position'
 import { getUserAvatar } from '@/utils/avatar'
 
@@ -97,20 +115,41 @@ const props = defineProps({
   noMore: { type: Boolean, default: false },
   showWelfareTag: { type: Boolean, default: true },
   payable: { type: Boolean, default: false },
+  jobNum: { type: Number, default: 0 }
 })
 
 const userInfo = ref(useUserStore?.userInfo || {})
 
+// 使用额度发布职位
+const handleRelease = async (val) => {
+  if (!val.id) return
+  try {
+    await updatePositionStatus(val.id)
+	  uni.showToast({ title: '发布成功', icon: 'success', duration: 2000 })
+    emit('refresh', { reset: true })
+  } catch {}
+}
+
+// 删除待支付职位
+const handleDelete = async (val) => {
+  if (!val.id) return
+  try {
+    await deletePosition(val.id)
+    uni.showToast({ title: '删除成功', icon: 'success', duration: 2000 })
+    emit('refresh', { reset: true })
+  } catch {}
+}
+
 const payRef = ref()
 // 支付
 const toPay = async (val) => {
   // 待发布且有额度的激活职位即可
-  if (userInfo.value.entitlement?.publishJobCount > 0) {
-    await enableJobAdvertised([val.id])
-    emit('refresh', { reset: true, updatePublishJobCount: true })
-    setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success' }) }, 1000)
-    return
-  }
+  // if (userInfo.value.entitlement?.publishJobCount > 0) {
+  //   await enableJobAdvertised([val.id])
+  //   emit('refresh', { reset: true, updatePublishJobCount: true })
+  //   setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success' }) }, 1000)
+  //   return
+  // }
   payRef.value && payRef.value.handleOpen({ spuId: val?.id||'', spuName: val?.name||'', price: 1, type: 1 })
 }
 

+ 9 - 8
pages/index/position.vue

@@ -32,7 +32,7 @@
                 </view>
               </view>
               <view v-else>
-                <PositionList v-if="positionListData?.length" :tab="tab" :payable="true" :list="positionListData" :noMore="false" @refresh="refresh"></PositionList>
+                <PositionList v-if="positionListData?.length" :tab="tab" :jobNum="publishJobCount" :payable="true" :list="positionListData" :noMore="false" @refresh="refresh"></PositionList>
                 <uni-load-more :status="more" />
                 <view style="padding-bottom: 20vh;"></view>
                 <view class="addBtn" @tap="handleClickAdd">
@@ -88,6 +88,7 @@ const query = ref({
   pageSize: 5, 
   pageNo: 1,
   hire: false,
+  jobFairId: 0,
   name: '',
 })
 const more = ref('more')
@@ -97,13 +98,13 @@ const getData = async () => {
   if (query.value.pageNo === 1) positionListData.value = []
   try {
     more.value = 'loading'
-    if (tab.value !== 3) {
-      query.value.status = tabList[tab.value].status
-      query.value.hasExpiredData = false
-    } else {
-      query.value.hasExpiredData = true
-      delete query.value.status
-    }
+    // if (tab.value !== 3) {
+    query.value.status = tabList[tab.value].status
+      // query.value.hasExpiredData = false
+    // } else {
+    //   query.value.hasExpiredData = true
+    //   delete query.value.status
+    // }
     const res = await getJobAdvertisedList(query.value)
     const list = res?.data?.list?.length ? res.data.list : []
     total.value = res.data.total-0