index.vue 10 KB

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