index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <view class="ss-m-x-20">
  3. <!-- 岗位列表 -->
  4. <view v-if="list?.length" class="ss-p-b-30 ss-p-t-20">
  5. <view v-for="(item, index) in list" :key="index" class="mList" @click="handleDetail(item)">
  6. <view v-if="item?.enterpriseName" class="d-flex align-center item-top">
  7. <view class="avatarBox">
  8. <image class="enterAvatar default-border default-radius" :src="item.enterpriseLogo || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  9. </view>
  10. <view class="ss-m-l-20 label-text">{{ formatName(item?.enterpriseName) }} - {{ item?.hrName }}</view>
  11. </view>
  12. <!-- 职位信息 -->
  13. <view class="list-shape" style="border-radius: 12px;">
  14. <!-- 职位 -->
  15. <view class="titleBox my-5">
  16. <view style="display: flex;align-items: center;">
  17. <image v-if="item.jobFairIds?.length" src="/static/svg/jobFair.svg" class=" ss-m-r-10" style="width: 20px; height: 20px;"></image>
  18. <rich-text v-if="item.name?.indexOf('style') !== -1" class="job-name" :nodes="item.name"></rich-text>
  19. <view v-else class="job-name">{{ formatName(item.name) }}</view>
  20. </view>
  21. <image v-if="item.top && tab === 1" src="/static/svg/topUp.svg" class="TopUpSvg"></image>
  22. </view>
  23. <!-- 职位类型 -->
  24. <view class="font-size-13 ellipsis ss-m-5" style="color: #808080;">
  25. <span>{{item.positionName }}</span>
  26. </view>
  27. <!-- 薪酬、工作地、学历、工作经验 -->
  28. <view class="d-flex align-center justify-space-between">
  29. <view class="font-size-13 ellipsis" style="flex: 1;">
  30. <span class="tag-gap" style="color: #808080;">
  31. <span>{{item.area?.str ?? '全国' }}</span>
  32. <span class="divider-mx" v-if="item.eduName">|</span>
  33. <span>{{item.eduName }}</span>
  34. <span class="divider-mx" v-if="item.expName">|</span>
  35. <span>{{item.expName }}</span>
  36. <span class="divider-mx">|</span>
  37. <span>{{!item.payFrom && !item.payTo ? '面议' : `${item.payFrom}-${item.payTo}${item.payName ? '/' + item.payName : ''}` }}</span>
  38. </span>
  39. </view>
  40. </view>
  41. <view class="d-flex font-size-13 color-666 ss-m-t-10">
  42. <view class="ss-m-t-10">到期时间:{{ item.expireTime ? timesTampChange(item.expireTime, 'Y-M-D') : '长期有效' }}</view>
  43. <view class="ss-m-t-10 ss-m-l-15">刷新时间:{{ item.refreshTime ? timesTampChange(item.refreshTime, 'Y-M-D h:m') : '暂无' }}</view>
  44. </view>
  45. <view class="sub-li-bottom ss-m-t-20">
  46. <view v-if="tab === 0" class="sub-li-bottom-item color-primary" style="width: 100%;" @tap.stop="toPay(item)">发布</view>
  47. <view v-if="tab !== 0" class="sub-li-bottom-item color-primary" style="width: 45%;" @tap.stop="handleToResume(item)">{{ item.count || 0 }} 已投递简历</view>
  48. <view v-if="tab === 1" class="sub-li-bottom-item color-warning" @tap.stop="handleAction(item.top ? 4 : 3, '', item)">{{ item.top ? '取消置顶' : '置顶' }}</view>
  49. <view v-if="tab === 1" class="sub-li-bottom-item color-666" @tap.stop="handleAction(0, '', item, item)">关闭</view>
  50. <view v-if="tab === 2" class="sub-li-bottom-item color-warning" @tap.stop="handleAction(1, '', item, item)">激活</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view v-if="props.noMore" class="noMore">暂无更多数据</view>
  55. </view>
  56. <view v-else>
  57. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  58. <view style="color: gray; text-align: center;">暂无数据</view>
  59. </view>
  60. <!-- 确认框 -->
  61. <uni-popup ref="confirm" type="dialog">
  62. <uni-popup-dialog
  63. type="warn"
  64. cancelText="取消"
  65. confirmText="确认"
  66. title="系统提示"
  67. :content="dialogContent"
  68. @confirm="handleConfirm"
  69. @close="handleClose"
  70. ></uni-popup-dialog>
  71. </uni-popup>
  72. <!-- 支付 -->
  73. <payPopup v-if="props.payable" ref="payRef" @paySuccess="paySuccess"></payPopup>
  74. </view>
  75. </template>
  76. <script setup>
  77. import { ref } from 'vue'
  78. // import { commissionCalculation } from '@/utils/position'
  79. import { timesTampChange } from '@/utils/date'
  80. import { formatName } from '@/utils/getText'
  81. import payPopup from '@/components/payPopup'
  82. import { userStore } from '@/store/user'; const useUserStore = userStore()
  83. import {
  84. topJobAdvertisedCancel,
  85. topJobAdvertised,
  86. refreshJobAdvertised,
  87. closeJobAdvertised,
  88. enableJobAdvertised
  89. } from '@/api/new/position'
  90. const emit = defineEmits(['entClick', 'refresh'])
  91. const props = defineProps({
  92. tab: { type: Number, default: 0 },
  93. list: { type: Array, default: () => [] },
  94. noMore: { type: Boolean, default: false },
  95. showWelfareTag: { type: Boolean, default: true },
  96. payable: { type: Boolean, default: false },
  97. })
  98. const userInfo = ref(useUserStore?.userInfo || {})
  99. const payRef = ref()
  100. // 支付
  101. const toPay = async (val) => {
  102. // 待发布且有额度的激活职位即可
  103. if (userInfo.value.entitlement?.publishJobCount > 0) {
  104. await enableJobAdvertised([val.id])
  105. emit('refresh', { reset: true, updatePublishJobCount: true })
  106. setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success' }) }, 1000)
  107. return
  108. }
  109. payRef.value && payRef.value.handleOpen({ spuId: val?.id||'', spuName: val?.name||'', price: 1, type: 1 })
  110. }
  111. // setTimeout(() => { toPay(props.list[0]) }, 2000)
  112. const confirm = ref()
  113. const confirmType = ref('closeJob') // 确认框类型
  114. const dialogContent = ref('')
  115. let handleActionInfo = {}
  116. const apiList = [closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised, topJobAdvertisedCancel]
  117. // 职位关闭、激活、刷新、置顶
  118. const handleAction = async (index, type, { id }, item) => {
  119. const ids = type ? [] : [id]
  120. if (!ids?.length && !index) return
  121. try {
  122. handleActionInfo.ids = ids
  123. handleActionInfo.index = index
  124. uni.showLoading({ title: '操作中...', mask: true })
  125. // 关闭职位提醒
  126. if (index === 0) {
  127. const text = userInfo.value?.entitlement?.publishJobCount && userInfo.value?.entitlement?.publishJobCount > 0 ? '将消耗一个发布点数' : '将重新收取费用'
  128. const positionName = item?.name ? '【' + formatName(item?.name) + '】' : '所选'
  129. confirmType.value = 'closeJob' // 确认框类型
  130. dialogContent.value = `是否确认关闭${positionName}职位?关闭后再激活,${text}!`
  131. confirm.value.open()
  132. return
  133. }
  134. // 没有可发布额度激活职位需重新付款
  135. userInfo.value = await useUserStore.getUserInfos()
  136. if (index === 1 && userInfo.value?.entitlement?.publishJobCount-0 <= 0) {
  137. toPay(item)
  138. return
  139. }
  140. await apiList[index](ids)
  141. emit('refresh', { reset: true })
  142. setTimeout(() => { uni.showToast({ title: '操作成功', icon: 'success' }) }, 1000)
  143. //
  144. } catch (error) {
  145. uni.showToast({ title: '操作失败', icon: 'error', duration: 2000 })
  146. console.log(error)
  147. } finally {
  148. uni.hideLoading()
  149. }
  150. }
  151. const handleClose = () => {
  152. confirm.value.close()
  153. }
  154. // 取消置顶
  155. // const topUpSvgClickVal = ref({})
  156. // const topUpSvgClick = (item) => {
  157. // topUpSvgClickVal.value = item
  158. // confirmType.value = 'topUpJob' // 确认框类型
  159. // const positionName = item?.name ? '【' + formatName(item?.name) + '】职位' : '职位'
  160. // dialogContent.value = `是否取消置顶${positionName}?`
  161. // confirm.value.open()
  162. // }
  163. const handleConfirm = () => {
  164. if (confirmType.value === 'closeJob') closeJob()
  165. // if (confirmType.value === 'topUpJob') handleAction(4, '', topUpSvgClickVal.value)
  166. }
  167. // 关闭职位
  168. const closeJob = async () => {
  169. try {
  170. uni.showLoading({ title: '关闭中...', mask: true })
  171. await apiList[handleActionInfo?.index](handleActionInfo?.ids)
  172. emit('refresh', { reset: true })
  173. setTimeout(() => { uni.showToast({ title: '关闭成功', icon: 'success' }) }, 1000)
  174. } catch (error) {
  175. uni.showToast({ title: '关闭失败', icon: 'error' })
  176. console.log(error)
  177. } finally {
  178. uni.hideLoading()
  179. }
  180. }
  181. // 编辑职位
  182. // const handleEdit = async (val) => {
  183. // if (!val.id || !val.edit) {
  184. // uni.showToast({ title: '职位发布时间超过24小时的不支持编辑', icon: 'none', duration: 2000 })
  185. // return
  186. // }
  187. // uni.navigateTo({ url: `/pagesB/positionEdit/index?jobId=${val.id}` })
  188. // }
  189. // 职位详情
  190. const handleDetail = (item) => {
  191. if (!item.id) return
  192. let url = `/pagesB/positionDetail/index?jobId=${item.id}&isEdit=${item.edit}`
  193. uni.navigateTo({ url })
  194. }
  195. // 查看职位投递简历
  196. const handleToResume = (val) => {
  197. let url = `/pagesA/resume/index?jobId=${val.id}&jobName=${formatName(val.name)}`
  198. if (val.bizId) url += `&jobFairId=${val.bizId}`
  199. uni.navigateTo({ url })
  200. }
  201. const paySuccess = () => {
  202. emit('refresh', { reset: true })
  203. setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success', duration: 2000 }) }, 1000)
  204. }
  205. </script>
  206. <style scoped lang="scss">
  207. .avatarBox {
  208. max-width: 60rpx;
  209. max-height: 60rpx;
  210. }
  211. .item-top {
  212. padding: 20rpx 30rpx;
  213. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  214. border-radius: 12px 12px 0 0;
  215. font-size: 28rpx;
  216. color: #0E100F;
  217. .label-text {
  218. max-width: 100%;
  219. text-overflow: ellipsis;
  220. white-space: nowrap;
  221. overflow: hidden;
  222. }
  223. }
  224. .noMore{
  225. margin: 20px 0;
  226. }
  227. .date-time{
  228. color:#d9d0d2;
  229. float: right;
  230. }
  231. .divided-line {
  232. width: 100%;
  233. height: 1px;
  234. background-color: #f0f2f7;
  235. margin: 20px 0;
  236. }
  237. .enterAvatar{
  238. width: 60rpx;
  239. height: 60rpx;
  240. margin: auto;
  241. }
  242. .job-name {
  243. font-size: 16px;
  244. font-weight: 700;
  245. color: #0E100F;
  246. max-width: 80vw;
  247. overflow: hidden;
  248. white-space: nowrap;
  249. text-overflow: ellipsis;
  250. }
  251. .salary-text {
  252. float: right;
  253. color: #00B760;
  254. font-weight: 700;
  255. }
  256. .list-shape {
  257. padding: 10px 30rpx 10px;
  258. background-color: #fff;
  259. border-radius: 12px 12px 0 0;
  260. .titleBox {
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. }
  265. }
  266. .tag-gap{
  267. margin: 10rpx 10rpx 10rpx 0;
  268. }
  269. .tag-gap1{
  270. margin-bottom: 20px;
  271. }
  272. .divider-mx{
  273. margin: 0 10rpx;
  274. }
  275. .divider {
  276. color:#e4d4d2;
  277. }
  278. //公司名称
  279. .cer-end{
  280. position: absolute;
  281. top: 85%;
  282. right: 16%;
  283. }
  284. .cer-text{
  285. text-decoration: underline;
  286. margin: 0 5rpx;
  287. }
  288. //一行展示不全...
  289. .dis{
  290. display: flex;
  291. align-items: center;
  292. }
  293. .mList {
  294. margin-bottom: 20rpx;
  295. position: relative;
  296. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  297. border-radius: 20rpx;
  298. }
  299. /* 列表触底暂无更多 */
  300. .noMore{ text-align:center; color:grey; }
  301. .mt { margin-top: 15rpx; }
  302. .mb { margin-bottom: 10rpx; }
  303. .ml { margin-left: 20rpx; }
  304. .mr { margin-right: 20rpx; }
  305. .mr-10{ margin-right: 10rpx; }
  306. .my-5{ margin: 5px 0; }
  307. .disable {
  308. position: relative;
  309. overflow: hidden;
  310. &::after {
  311. content: '已失效';
  312. position: absolute;
  313. display: flex;
  314. align-items: center;
  315. justify-content: center;
  316. font-size: 1.2em;
  317. font-weight: bold;
  318. color: #fc796f;
  319. top: 0;
  320. border-radius: 12px;
  321. left: 0;
  322. width: 100%;
  323. height: 100%;
  324. background-color: rgba(255, 255, 255, 0.75);
  325. }
  326. }
  327. .resumeCount {
  328. color: #00B760;
  329. font-size: 12px;
  330. margin: 0 10px;
  331. }
  332. .sub-li-bottom {
  333. display: flex;
  334. justify-content: flex-end;
  335. margin-top: 10px;
  336. font-size: 13px;
  337. color: #666;
  338. &-item {
  339. width: 25%;
  340. height: 35px;
  341. line-height: 35px;
  342. text-align: center;
  343. margin-right: 15px;
  344. background-color: #f7f8fa;
  345. border-radius: 4px;
  346. &:last-child {
  347. margin-right: 0;
  348. }
  349. }
  350. }
  351. .TopUpSvg {
  352. width: 45px;
  353. height: 45px;
  354. position: absolute;
  355. top: -3px;
  356. right: -4px;
  357. }
  358. </style>