index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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 }, item) => {
  150. if (jobFairName) {
  151. uni.showToast({ title: '该职位属于招聘会,请前往招聘会内进行操作', icon: 'none', duration: 2000 })
  152. return
  153. }
  154. const ids = type ? [] : [id]
  155. if (!ids?.length && !index) return
  156. try {
  157. handleActionInfo.ids = ids
  158. handleActionInfo.index = index
  159. uni.showLoading({ title: '操作中...', mask: true })
  160. // 关闭职位提醒
  161. if (index === 0) {
  162. const text = userInfo.value?.entitlement?.publishJobCount && userInfo.value?.entitlement?.publishJobCount > 0 ? '将消耗一个发布点数' : '将重新收取费用'
  163. const positionName = item?.name ? '【' + formatName(item?.name) + '】' : '所选'
  164. confirmType.value = 'closeJob' // 确认框类型
  165. dialogContent.value = `是否确认关闭${positionName}职位?关闭后再激活,${text}!`
  166. confirm.value.open()
  167. return
  168. }
  169. // 没有可发布额度激活职位需重新付款
  170. userInfo.value = await useUserStore.getUserInfos()
  171. if (index === 1 && userInfo.value?.entitlement?.publishJobCount-0 <= 0) {
  172. toPay(item)
  173. return
  174. }
  175. await apiList[index](ids)
  176. emit('refresh', { reset: true })
  177. setTimeout(() => { uni.showToast({ title: '操作成功', icon: 'success' }) }, 1000)
  178. //
  179. } catch (error) {
  180. uni.showToast({ title: '操作失败', icon: 'error', duration: 2000 })
  181. console.log(error)
  182. } finally {
  183. uni.hideLoading()
  184. }
  185. }
  186. const handleClose = () => {
  187. confirm.value.close()
  188. }
  189. // 取消置顶
  190. // const topUpSvgClickVal = ref({})
  191. // const topUpSvgClick = (item) => {
  192. // topUpSvgClickVal.value = item
  193. // confirmType.value = 'topUpJob' // 确认框类型
  194. // const positionName = item?.name ? '【' + formatName(item?.name) + '】职位' : '职位'
  195. // dialogContent.value = `是否取消置顶${positionName}?`
  196. // confirm.value.open()
  197. // }
  198. const handleConfirm = () => {
  199. if (confirmType.value === 'closeJob') closeJob()
  200. // if (confirmType.value === 'topUpJob') handleAction(4, '', topUpSvgClickVal.value)
  201. }
  202. // 关闭职位
  203. const closeJob = async () => {
  204. try {
  205. uni.showLoading({ title: '关闭中...', mask: true })
  206. await apiList[handleActionInfo?.index](handleActionInfo?.ids)
  207. emit('refresh', { reset: true })
  208. setTimeout(() => { uni.showToast({ title: '关闭成功', icon: 'success' }) }, 1000)
  209. } catch (error) {
  210. uni.showToast({ title: '关闭失败', icon: 'error' })
  211. console.log(error)
  212. } finally {
  213. uni.hideLoading()
  214. }
  215. }
  216. // 编辑职位
  217. // const handleEdit = async (val) => {
  218. // if (!val.id || !val.edit) {
  219. // uni.showToast({ title: '职位发布时间超过24小时的不支持编辑', icon: 'none', duration: 2000 })
  220. // return
  221. // }
  222. // uni.navigateTo({ url: `/pagesB/positionEdit/index?jobId=${val.id}` })
  223. // }
  224. // 职位详情
  225. const handleDetail = (item) => {
  226. if (!item.id) return
  227. let url = `/pagesB/positionDetail/index?jobId=${item.id}&isEdit=${item.edit}`
  228. if (item.jobFairName) url += `&jobFairId=${item.jobFairId}&fairNoEdit=true`
  229. uni.navigateTo({ url })
  230. }
  231. // 查看职位投递简历
  232. const handleToResume = (val) => {
  233. let url = `/pagesA/resume/index?jobId=${val.id}&jobName=${formatName(val.name)}`
  234. // if (val.bizId) url += `&jobFairId=${val.bizId}`
  235. uni.navigateTo({ url })
  236. }
  237. const paySuccess = () => {
  238. emit('refresh', { reset: true })
  239. setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success', duration: 2000 }) }, 1000)
  240. }
  241. </script>
  242. <style scoped lang="scss">
  243. .avatarBox {
  244. max-width: 60rpx;
  245. max-height: 60rpx;
  246. }
  247. .item-top {
  248. padding: 20rpx 30rpx;
  249. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  250. border-radius: 12px 12px 0 0;
  251. font-size: 28rpx;
  252. color: #0E100F;
  253. .label-text {
  254. max-width: 100%;
  255. text-overflow: ellipsis;
  256. white-space: nowrap;
  257. overflow: hidden;
  258. }
  259. }
  260. .noMore{
  261. margin: 20px 0;
  262. }
  263. .date-time{
  264. color:#d9d0d2;
  265. float: right;
  266. }
  267. .divided-line {
  268. width: 100%;
  269. height: 1px;
  270. background-color: #f0f2f7;
  271. margin: 20px 0;
  272. }
  273. .enterAvatar{
  274. width: 60rpx;
  275. height: 60rpx;
  276. margin: auto;
  277. border-radius: 50%;
  278. }
  279. .job-name {
  280. font-size: 16px;
  281. font-weight: 700;
  282. color: #0E100F;
  283. max-width: 80vw;
  284. overflow: hidden;
  285. white-space: nowrap;
  286. text-overflow: ellipsis;
  287. }
  288. .salary-text {
  289. float: right;
  290. color: #00B760;
  291. font-weight: 700;
  292. }
  293. .list-shape {
  294. padding: 10px 30rpx 10px;
  295. border-radius: 12px 12px 0 0;
  296. .titleBox {
  297. display: flex;
  298. align-items: center;
  299. justify-content: space-between;
  300. }
  301. }
  302. .tag-gap{
  303. margin: 10rpx 10rpx 10rpx 0;
  304. }
  305. .tag-gap1{
  306. margin-bottom: 20px;
  307. }
  308. .divider-mx{
  309. margin: 0 10rpx;
  310. }
  311. .divider {
  312. color:#e4d4d2;
  313. }
  314. //公司名称
  315. .cer-end{
  316. position: absolute;
  317. top: 85%;
  318. right: 16%;
  319. }
  320. .cer-text{
  321. text-decoration: underline;
  322. margin: 0 5rpx;
  323. }
  324. //一行展示不全...
  325. .dis{
  326. display: flex;
  327. align-items: center;
  328. }
  329. .mList {
  330. margin-bottom: 20rpx;
  331. position: relative;
  332. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  333. border-radius: 20rpx;
  334. background-color: #fbfbfb;
  335. }
  336. /* 列表触底暂无更多 */
  337. .noMore{ text-align:center; color:grey; }
  338. .mt { margin-top: 15rpx; }
  339. .mb { margin-bottom: 10rpx; }
  340. .ml { margin-left: 20rpx; }
  341. .mr { margin-right: 20rpx; }
  342. .mr-10{ margin-right: 10rpx; }
  343. .my-5{ margin: 5px 0; }
  344. .disable {
  345. position: relative;
  346. overflow: hidden;
  347. &::after {
  348. content: '已失效';
  349. position: absolute;
  350. display: flex;
  351. align-items: center;
  352. justify-content: center;
  353. font-size: 1.2em;
  354. font-weight: bold;
  355. color: #fc796f;
  356. top: 0;
  357. border-radius: 12px;
  358. left: 0;
  359. width: 100%;
  360. height: 100%;
  361. background-color: rgba(255, 255, 255, 0.75);
  362. }
  363. }
  364. .resumeCount {
  365. color: #00B760;
  366. font-size: 12px;
  367. margin: 0 10px;
  368. }
  369. .sub-li-bottom {
  370. display: flex;
  371. justify-content: flex-end;
  372. margin-top: 10px;
  373. font-size: 13px;
  374. color: #666;
  375. &-item {
  376. width: 25%;
  377. height: 35px;
  378. line-height: 35px;
  379. text-align: center;
  380. margin-right: 15px;
  381. background-color: #f7f8fa;
  382. border-radius: 4px;
  383. &:last-child {
  384. margin-right: 0;
  385. }
  386. }
  387. }
  388. .TopUpSvg {
  389. width: 45px;
  390. height: 45px;
  391. position: absolute;
  392. top: -3px;
  393. right: -4px;
  394. }
  395. </style>