index.vue 13 KB

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