index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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">
  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. <rich-text v-if="item.name?.indexOf('style') !== -1" class="job-name" :nodes="item.name"></rich-text>
  12. <view v-else class="job-name">{{ formatName(item.name) }}</view>
  13. </view>
  14. </view>
  15. <!-- 薪酬、工作地、学历、工作经验 -->
  16. <view class="font-size-13 ellipsis ss-m-5" style="color: #808080;">
  17. <span>{{item.positionName }}</span>
  18. </view>
  19. <view class="d-flex align-center justify-space-between">
  20. <view class="font-size-13 ellipsis" style="flex: 1;">
  21. <span class="tag-gap" style="color: #808080;">
  22. <span>{{item.area?.str ?? '全国' }}</span>
  23. <span class="divider-mx" v-if="item.eduName">|</span>
  24. <span>{{item.eduName }}</span>
  25. <span class="divider-mx" v-if="item.expName">|</span>
  26. <span>{{item.expName }}</span>
  27. <span class="divider-mx">|</span>
  28. <span>{{!item.payFrom && !item.payTo ? '面议' : `${item.payFrom}-${item.payTo}${item.payName ? '/' + item.payName : ''}` }}</span>
  29. </span>
  30. <view class="font-size-13 ss-m-t-10" style="color: #808080;">
  31. <view>刷新时间:{{ item.refreshTime ? timesTampChange(item.refreshTime, 'Y-M-D h:m') : '暂无' }}</view>
  32. </view>
  33. </view>
  34. <view class="d-flex flex-column align-center justify-center resumeCount" @tap="handleToResume(item)">
  35. <view style="font-size: 14px;">{{ item.count || 0 }}</view>
  36. <view>已投递简历</view>
  37. </view>
  38. </view>
  39. <view class="font-size-13 color-666 ss-m-t-10">
  40. <view class="ss-m-t-10">到期时间:{{ item.expireTime ? timesTampChange(item.expireTime, 'Y-M-D') : '长期有效' }}</view>
  41. </view>
  42. <view class="sub-li-bottom">
  43. <view v-if="tab === 1">
  44. <span class="divider-mx" @tap="handleAction(item.top ? 4 : 3, '', item)">{{ item.top ? '取消置顶' : '置顶' }}</span>
  45. <span class="divider-mx" @tap="handleAction(0, '', item, item)">关闭</span>
  46. </view>
  47. <span v-if="(item?.status-0) === 99 && tab === 0" class="divider-mx" @tap="toPay(item)">发布</span>
  48. <span v-if="tab === 2" class="divider-mx" @tap="handleAction(1, '', item, item)">激活</span>
  49. <span class="divider-mx" @tap="handleDetail(item)">详情</span>
  50. <view v-if="tab !== 3">
  51. <span class="divider-mx" :style="{'color': item.edit ? '#333' : '#999'}" @tap="handleEdit(item)">{{ '编辑' }}</span>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view v-if="props.noMore" class="noMore">暂无更多数据</view>
  57. </view>
  58. <view v-else>
  59. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  60. <view style="color: gray; text-align: center;">暂无数据</view>
  61. </view>
  62. <!-- 确认框 -->
  63. <uni-popup ref="confirm" type="dialog">
  64. <uni-popup-dialog
  65. type="warn"
  66. cancelText="取消"
  67. confirmText="确认"
  68. title="系统提示"
  69. :content="dialogContent"
  70. @confirm="handleConfirm"
  71. @close="handleClose"
  72. ></uni-popup-dialog>
  73. </uni-popup>
  74. <payPopup v-if="props.payable" ref="payRef" amount="123" @paySuccess="paySuccess"></payPopup>
  75. </view>
  76. </template>
  77. <script setup>
  78. import { ref } from 'vue'
  79. // import { commissionCalculation } from '@/utils/position'
  80. import { timesTampChange } from '@/utils/date'
  81. import { formatName } from '@/utils/getText'
  82. import payPopup from '@/components/payPopup'
  83. import {
  84. topJobAdvertisedCancel,
  85. topJobAdvertised,
  86. refreshJobAdvertised,
  87. closeJobAdvertised,
  88. enableJobAdvertised
  89. } from '@/api/new/position'
  90. import { userStore } from '@/store/user'; const useUserStore = userStore()
  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', 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 dialogContent = ref('')
  115. let handleActionInfo = {}
  116. const apiList = [closeJobAdvertised, enableJobAdvertised, refreshJobAdvertised, topJobAdvertised, topJobAdvertisedCancel]
  117. // 职位关闭、激活、刷新、置顶
  118. const handleAction = async (index, type, { id }, item) => {
  119. const ids = type ? [] : [id]
  120. if (!ids?.length && !index) return
  121. try {
  122. handleActionInfo.ids = ids
  123. handleActionInfo.index = index
  124. uni.showLoading({ title: '操作中...', mask: true })
  125. // 关闭职位提醒
  126. if (index === 0) {
  127. const text = userInfo.value?.entitlement?.publishJobCount && userInfo.value?.entitlement?.publishJobCount > 0 ? '将消耗一个发布点数' : '将重新收取费用'
  128. const positionName = item?.name ? '【' + formatName(item?.name) + '】' : '所选'
  129. dialogContent.value = `是否确认关闭${positionName}职位?关闭后再激活,${text}!`
  130. confirm.value.open()
  131. return
  132. }
  133. // 没有可发布额度激活职位需重新付款
  134. userInfo.value = await useUserStore.getUserInfos()
  135. if (index === 1 && userInfo.value?.entitlement.publishJobCount <= 3990039900) {
  136. toPay(item)
  137. return
  138. }
  139. await apiList[index](ids)
  140. emit('refresh', true)
  141. setTimeout(() => { uni.showToast({ title: '操作成功', icon: 'success' }) }, 1000)
  142. //
  143. } catch (error) {
  144. uni.showToast({ title: '操作失败', icon: 'error', duration: 2000 })
  145. console.log(error)
  146. } finally {
  147. uni.hideLoading()
  148. }
  149. }
  150. const handleClose = () => {
  151. confirm.value.close()
  152. }
  153. const handleConfirm = async () => {
  154. try {
  155. uni.showLoading({ title: '关闭中...', mask: true })
  156. await apiList[handleActionInfo?.index](handleActionInfo?.ids)
  157. emit('refresh', true)
  158. setTimeout(() => { uni.showToast({ title: '关闭成功', icon: 'success' }) }, 1000)
  159. } catch (error) {
  160. uni.showToast({ title: '关闭失败', icon: 'error' })
  161. console.log(error)
  162. } finally {
  163. uni.hideLoading()
  164. }
  165. }
  166. // 编辑职位
  167. const handleEdit = async (val) => {
  168. if (!val.id || !val.edit) {
  169. uni.showToast({ title: '职位发布时间超过24小时的不支持编辑', icon: 'none', duration: 2000 })
  170. return
  171. }
  172. // uni.navigateTo({ url: `/pagesB/positionEdit/index?id=${val.id}` })
  173. }
  174. // 职位详情
  175. const handleDetail = (item) => {
  176. if (!item.id) return
  177. let url = `/pagesB/positionDetail/index?id=${item.id}&area=${item.areaName}`
  178. uni.navigateTo({ url })
  179. }
  180. // 查看职位投递简历
  181. const handleToResume = (val) => {
  182. let path = `/recruit/enterprise/invite/resume?id=${val.id}`
  183. if (val.bizId) path += `&jobFairId=${val.bizId}`
  184. router.push(path)
  185. }
  186. const paySuccess = () => {
  187. emit('refresh', true)
  188. setTimeout(() => { uni.showToast({ title: '发布成功', icon: 'success' }) }, 1000)
  189. }
  190. </script>
  191. <style scoped lang="scss">
  192. .noMore{
  193. margin: 20px 0;
  194. }
  195. .date-time{
  196. color:#d9d0d2;
  197. float: right;
  198. }
  199. .divided-line {
  200. width: 100%;
  201. height: 1px;
  202. background-color: #f0f2f7;
  203. margin: 20px 0;
  204. }
  205. .enterAvatar{
  206. width: 40px;
  207. height: 40px;
  208. // border-radius: 50%;
  209. margin: auto;
  210. }
  211. .job-name {
  212. font-size: 16px;
  213. font-weight: 700;
  214. color: #0E100F;
  215. max-width: 80vw;
  216. overflow: hidden;
  217. white-space: nowrap;
  218. text-overflow: ellipsis;
  219. }
  220. .sub-li-bottom {
  221. display: flex;
  222. justify-content: flex-end;
  223. border-top: 1px dashed #eee;
  224. margin-top: 10px;
  225. padding-top: 10px;
  226. font-size: 13px;
  227. color: #666;
  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. .show-more{
  272. width: 26vw;
  273. white-space: nowrap;
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. }
  277. .mList {
  278. margin-bottom: 20rpx;
  279. }
  280. /* 列表触底暂无更多 */
  281. .noMore{ text-align:center; color:grey; }
  282. .mt { margin-top: 15rpx; }
  283. .mb { margin-bottom: 10rpx; }
  284. .ml { margin-left: 20rpx; }
  285. .mr { margin-right: 20rpx; }
  286. .mr-10{ margin-right: 10rpx; }
  287. .my-5{ margin: 5px 0; }
  288. .disable {
  289. position: relative;
  290. overflow: hidden;
  291. &::after {
  292. content: '已失效';
  293. position: absolute;
  294. display: flex;
  295. align-items: center;
  296. justify-content: center;
  297. font-size: 1.2em;
  298. font-weight: bold;
  299. color: #fc796f;
  300. top: 0;
  301. border-radius: 12px;
  302. left: 0;
  303. width: 100%;
  304. height: 100%;
  305. background-color: rgba(255, 255, 255, 0.75);
  306. }
  307. }
  308. .resumeCount {
  309. color: #00B760;
  310. font-size: 12px;
  311. margin: 0 10px;
  312. }
  313. </style>