index.vue 9.9 KB

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