index.vue 12 KB

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