index.vue 10 KB

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