index.vue 11 KB

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