瀏覽代碼

首页赏金展示

Xiao_123 10 月之前
父節點
當前提交
9874639475
共有 2 個文件被更改,包括 24 次插入6 次删除
  1. 8 6
      src/components/Position/item.vue
  2. 16 0
      src/utils/position.js

+ 8 - 6
src/components/Position/item.vue

@@ -6,6 +6,7 @@
           <div class="sub-li-top">
             <div class="sub-li-info">
               <p :class="['name', {'default-active': item.active }]">{{ item.name }}</p>
+              <PublicRecruitment v-if="tab === 3 && item.hire" width="30" height="30"></PublicRecruitment>
             </div>
             <p class="salary">{{ item.payFrom }}-{{ item.payTo }}/{{ item.payName }}</p>
           </div>
@@ -18,11 +19,10 @@
                 <v-chip v-if="item[j.value]" size="x-small" label class="mr-1" color="var(--color-666)" :prepend-icon="j.mdi">{{ item[j.value] }}</v-chip>
               </span>
             </div>
-            <PublicRecruitment v-if="tab === 3 && item.hire"></PublicRecruitment>
           </div>
-          <div v-if="tab === 3 && item.hire">
-            <v-chip v-if="item.hirePrice" size="small" label class="mr-1" color="primary">赏金:{{ item.hirePrice }}元</v-chip>
-            <v-chip v-if="item.hirePoint" size="small" label class="mr-1" color="primary">积分:{{ item.hirePoint }}点</v-chip>
+          <div v-if="tab === 3 && item.hire" class="text-end mt-3">
+            <v-chip v-if="item.hirePrice" size="small" label color="primary">赏金:{{ commissionCalculation(item.hirePrice, 1) }}元</v-chip>
+            <v-chip v-if="item.hirePoint" size="small" label class="ml-1" color="primary">积分:{{ commissionCalculation(item.hirePoint, 1) }}点</v-chip>
           </div>
         </div>
         <div class="sub-li-bottom" @click="handleEnterprise(item)">
@@ -52,6 +52,8 @@ import bountyDisplay from '@/views/publicRecruitment/components/bountyDisplay.vu
 
 defineOptions({ name: 'position-card-item' })
 import { ref, watch } from 'vue'
+import { commissionCalculation } from '@/utils/position'
+
 const props = defineProps({
   items: {
     type: Array,
@@ -135,7 +137,7 @@ const height = ((210 * 2) + 12) + 'px'
   display: flex;
   align-items: center;
   flex-wrap: wrap;
-  height: 22px;
+  height: 31%;
   overflow: hidden;
   flex: 1;
 }
@@ -157,7 +159,7 @@ const height = ((210 * 2) + 12) + 'px'
 }
 .sub-li-info .name {
   position: relative;
-  max-width: 200px;
+  max-width: 140px;
   margin-right: 8px;
   overflow: hidden;
   text-overflow: ellipsis;

+ 16 - 0
src/utils/position.js

@@ -1,5 +1,6 @@
 import { reactive, ref } from 'vue'
 import { getDict } from '@/hooks/web/useDictionaries'
+import { getPublicRatio } from '@/api/recruit/enterprise/position'
 
 const dictObj = reactive({
   payUnit: [], // 薪资单位
@@ -66,4 +67,19 @@ export const dealDictObjData = (res, obj) => {
     res = { ...obj, ...res }
   })
   return res
+}
+
+// 计算众聘佣金
+let data
+const list = ['headhuntRate', 'recommendRate', 'cvRate'] // 平台、推荐人、投递人
+const getRation = async () => {
+  data = await getPublicRatio()
+}
+getRation()
+
+export const commissionCalculation = (count, type) => {
+  if (!data || !Object.keys(data).length) return
+  const ratio = parseFloat(data[list[type]]) / 100
+  const value = count * ratio
+  return value % 1 === 0 ? Math.floor(value) : value.toFixed(2)
 }