index.vue 10.0 KB

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