index.vue 13 KB

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