item.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div>
  3. <div v-for="val in items" :key="val.id" class="itemBox mb-3" style="height: 162px;">
  4. <div class="d-flex justify-space-between" style="padding: 10px 20px;">
  5. <div class="position">
  6. <div :class="['d-flex' ,'align-center']">
  7. <svg-icon class="mr-3" name="pin" size="25"></svg-icon>
  8. <span v-if="val.name.indexOf('style')" v-html="val.name" class="position-name"></span>
  9. <span v-else class="position-name">{{ val.name }}</span>
  10. </div>
  11. <div :class="['mt-3', 'other-info', 'ellipsis']">
  12. <span>{{ val.areaName }}</span>
  13. <span class="lines" v-if="val.areaName && val.eduName"></span>
  14. <span>{{ val.eduName }}</span>
  15. <span class="lines"></span>
  16. <span>{{ val.expName }}</span>
  17. <span class="lines"></span>
  18. <span v-if="!val.payFrom && !val.payTo">面议</span>
  19. <span v-else>{{ val.payFrom ? val.payFrom + '-' : '' }}{{ val.payTo }}{{ val.payName ? '/' + val.payName : '' }}</span>
  20. <span class="lines"></span>
  21. <span>{{ val.positionName }}</span>
  22. </div>
  23. <div v-if="val?.hire" class="mt-2">
  24. <v-chip v-if="val?.hirePrice && val.hirePrice > 0" class="mr-3" label color="primary" size="small">赏金:{{ commissionCalculation(val.hirePrice, 1) }}元</v-chip>
  25. </div>
  26. </div>
  27. <div class="d-flex align-center">
  28. <v-chip v-if="(val.status-0) === 99" color="warning" label>职位待发布,支付后成功后自动发布</v-chip>
  29. <v-chip v-if="val.status === '1'" color="error" class="cursor-pointer" label style="text-decoration: underline;" @click="handleAction(1, val)">职位已关闭,点击激活职位</v-chip>
  30. </div>
  31. </div>
  32. <div class="bottom pa-5 d-flex justify-space-between align-center">
  33. <div>{{ $t('position.refreshTime') }} :{{ timesTampChange(val.updateTime, 'Y-M-D') }}</div>
  34. <div class="d-flex align-center">
  35. <span v-if="(val.status-0) === 99" class="cursor-pointer color-primary" @click="toPay(val)">去支付</span>
  36. <span v-if="(val.status-0) === 99" class="lines"></span>
  37. <span v-if="(val.status - 0) !== 99 && val.status !== '1'" class="cursor-pointer actions" @click="handleAction(0, val)">{{ $t('common.close') }}</span>
  38. <span v-if="(val.status - 0) !== 99 && val.status !== '1'" class="lines"></span>
  39. <span class="cursor-pointer" @click="handleEdit(val)">编辑</span>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <confirmPaymentDialog
  45. v-if="showConfirmPaymentDialog"
  46. :cost="cost"
  47. :spuId="spuId"
  48. :spuName="spuName"
  49. :orderType="2"
  50. @paySuccess="paySuccess"
  51. @close="showConfirmPaymentDialog = false"
  52. ></confirmPaymentDialog>
  53. </template>
  54. <script setup>
  55. import { commissionCalculation } from '@/utils/position'
  56. defineOptions({ name: 'enterprise-position-item'})
  57. import { ref } from 'vue'
  58. import { useRouter } from 'vue-router'
  59. import { timesTampChange } from '@/utils/date'
  60. import { useI18n } from '@/hooks/web/useI18n'
  61. import { closeJobAdvertised, enableJobAdvertised } from '@/api/position'
  62. import Snackbar from '@/plugins/snackbar'
  63. import confirmPaymentDialog from '@/components/pay/confirmPaymentDialog.vue'
  64. const { t } = useI18n()
  65. const emit = defineEmits(['refresh'])
  66. defineProps({
  67. items: Array
  68. })
  69. const showConfirmPaymentDialog = ref(false)
  70. const cost = ref(0)
  71. const spuId = ref('')
  72. const spuName = ref('')
  73. const toPay = (val) => {
  74. spuId.value = val.id || ''
  75. spuName.value = val.name || ''
  76. cost.value = val.hirePrice
  77. // 打开支付弹窗
  78. showConfirmPaymentDialog.value = true
  79. }
  80. // 支付成功
  81. const paySuccess = async () => {
  82. showConfirmPaymentDialog.value = false
  83. setTimeout(() => {
  84. emit('refresh')
  85. }, 1000)
  86. }
  87. const apiList = [ closeJobAdvertised, enableJobAdvertised ]
  88. // 职位关闭、激活
  89. const handleAction = async (index, { id }) => {
  90. const ids = [id]
  91. if (!ids.length && !index) return
  92. await apiList[index](ids)
  93. Snackbar.success(t('common.operationSuccessful'))
  94. emit('refresh')
  95. }
  96. const router = useRouter()
  97. // 职位编辑
  98. const handleEdit = (val) => {
  99. router.push(`/recruit/enterprise/hirePosition/edit?id=${val.id}`)
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .itemBox {
  104. position: relative;
  105. border: 1px solid #e5e6eb;
  106. }
  107. .position-name {
  108. color: var(--color-333);
  109. font-size: 19px;
  110. }
  111. .position {
  112. max-width: 46%;
  113. position: relative;
  114. .item-select {
  115. position: absolute;
  116. left: -8px;
  117. top: -13px;
  118. }
  119. }
  120. .lines {
  121. display: inline-block;
  122. width: 1px;
  123. height: 17px;
  124. vertical-align: middle;
  125. background-color: #e0e0e0;
  126. margin: 0 10px;
  127. }
  128. .other-info {
  129. font-size: 15px;
  130. color: var(--color-666);
  131. }
  132. .bottom {
  133. position: absolute;
  134. bottom: 0;
  135. left: 0;
  136. width: 100%;
  137. height: 40px;
  138. background-color: #f7f8fa;
  139. font-size: 14px;
  140. color: var(--color-888);
  141. }
  142. .actions:hover {
  143. color: var(--v-primary-base);
  144. }
  145. </style>