index.vue 13 KB

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