laborManagement.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view>
  3. <u-navbar back-text="用工管理" back-icon-size="28" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 标签 -->
  6. <view class="tabs">
  7. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  8. </view>
  9. <!-- 发布中 -->
  10. <view class="my-registration" v-for="(item,i) in list[current].list" :key="i">
  11. <view class="card">
  12. <view class="positon-salary">
  13. <view class="positon">
  14. <span class="positonSpan positonSpan1" v-if="item.isOnline">上架中</span>
  15. <span class="positonSpan positonSpan2" v-else>已下架</span>
  16. {{item.positionName}}
  17. </view>
  18. <view class="salary">
  19. {{item.salary}}{{getUnit(item)}}
  20. </view>
  21. </view>
  22. <view class="tags-date">
  23. <view class="tags">
  24. 招聘{{item.recruitingNumbers}}人
  25. </view>
  26. <view class="date">
  27. 刷新时间:{{item.updateTime?item.updateTime:item.createTime}}
  28. </view>
  29. </view>
  30. <u-line color="#E6E6E6"></u-line>
  31. <view class="buttons">
  32. <span class="btn option1" v-show="item.status=='1'&&item.isOnline" @click="optionBtn(item,0)">
  33. 下架
  34. </span>
  35. <span class="btn option2" v-show="item.status=='1'&&!item.isOnline" @click="optionBtn(item,1)">
  36. 上架
  37. </span>
  38. <span class="btn refresh" v-show="item.status=='1'" @click="refreshBtn(item)">
  39. 刷新
  40. </span>
  41. <span class="btn amend" @click="amendBtn(item)">
  42. 修改
  43. </span>
  44. <span class="btn delete" @click="deleteBtn(item)">
  45. 删除
  46. </span>
  47. </view>
  48. </view>
  49. </view>
  50. <u-divider v-if="list[current].recordsTotal==list[current].list.length"
  51. :isnone="list[current].recordsTotal==0" nonetext="没有找到相关内容"
  52. border-color="#CFD2D5">已经到底了</u-divider>
  53. <!-- 底部 -->
  54. <view class="bottom">
  55. <button class="issue" @click="addInfo">发布用工需求
  56. </button>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import * as API from '@/apis/pagejs/packages.js'
  62. export default {
  63. data() {
  64. return {
  65. list: [{
  66. name: '发布中',
  67. pageIndex: 1,
  68. pageSize: 20,
  69. recordsTotal: 1,
  70. status: "1",
  71. list: []
  72. }, {
  73. name: '待审核',
  74. pageIndex: 1,
  75. pageSize: 20,
  76. recordsTotal: 1,
  77. status: "0",
  78. list: []
  79. }, {
  80. name: '未通过',
  81. pageIndex: 1,
  82. pageSize: 20,
  83. recordsTotal: 1,
  84. status: "2",
  85. list: []
  86. }],
  87. current: 0
  88. }
  89. },
  90. onReachBottom() {
  91. var obj = this.list[this.current]
  92. if (obj.list.length < obj.recordsTotal) {
  93. this.myLoadmore();
  94. }
  95. },
  96. onLoad() {
  97. this.getList();
  98. },
  99. methods: {
  100. getList() {
  101. uni.showLoading({
  102. title: "加载中",
  103. mask: true,
  104. })
  105. var list = this.list[this.current].list
  106. var obj = this.list[this.current]
  107. var listForm = {
  108. ...obj
  109. }
  110. delete listForm.list
  111. API.myEmployment(listForm).then((res) => {
  112. if (listForm.pageIndex == 1) {
  113. list = res.data.data;
  114. } else {
  115. list = [
  116. ...list,
  117. ...res.data.data
  118. ];
  119. }
  120. this.list[this.current].list = list
  121. this.list[this.current].recordsTotal = res.data.recordsTotal;
  122. uni.hideLoading();
  123. }).catch(error => {
  124. uni.showToast({icon: 'none',
  125. title: error,
  126. icon: "none"
  127. })
  128. })
  129. },
  130. myLoadmore() {
  131. this.list[this.current].pageIndex += 1;
  132. this.getList();
  133. },
  134. init() {
  135. //this.current = 0
  136. for(var i in this.list){
  137. this.list[i].pageIndex = 1
  138. this.list[i].list = []
  139. }
  140. this.getList()
  141. },
  142. amendBtn(item) {
  143. var url = "/pages/packages/mine/employmentService/laborManagement/postMessage?id=" +item.id;
  144. uni.navigateTo({
  145. url: url,
  146. events: {
  147. refreshData: () => {
  148. this.init()
  149. }
  150. }
  151. })
  152. },
  153. addInfo() {
  154. var url = "/pages/packages/mine/employmentService/laborManagement/postMessage";
  155. uni.navigateTo({
  156. url: url,
  157. events: {
  158. refreshData: () => {
  159. this.init()
  160. }
  161. }
  162. })
  163. },
  164. change(index) {
  165. this.current = index;
  166. var list = this.list[this.current].list
  167. if (list.length == 0) {
  168. this.getList();
  169. }
  170. },
  171. refreshBtn(item){
  172. API.myEmploymentRefresh({
  173. id:item.id
  174. }).then((res) => {
  175. item.updateTime=new Date().toLocaleString()
  176. uni.showToast({icon: 'none',
  177. title: "刷新成功",
  178. icon: "none"
  179. })
  180. }).catch(error => {
  181. uni.showToast({icon: 'none',
  182. title: error,
  183. icon: "none"
  184. })
  185. })
  186. },
  187. optionBtn(item,op){
  188. if(op==0){
  189. var _this=this;
  190. uni.showModal({
  191. title: '提示',
  192. content:"确认是否下架岗位",
  193. //content: '这是一个模态弹窗',
  194. success: function(res) {
  195. if (res.confirm) {
  196. _this.optionBtnMethod(item,op)
  197. } else if (res.cancel) {
  198. //.log('用户点击取消');
  199. }
  200. }
  201. });
  202. }else{
  203. this.optionBtnMethod(item,op)
  204. }
  205. },
  206. optionBtnMethod(item,op){
  207. uni.showLoading({
  208. title: "加载中",
  209. mask: true,
  210. })
  211. API.updateRecruitOnline({
  212. id:item.id,
  213. isOnline:op
  214. }).then((res) => {
  215. item.isOnline=op
  216. uni.hideLoading()
  217. }).catch(error => {
  218. uni.showToast({icon: 'none',
  219. title: error,
  220. icon: "none"
  221. })
  222. })
  223. },
  224. deleteBtn(item){
  225. var _this=this;
  226. uni.showModal({
  227. title: '提示',
  228. content:"确认是否删除",
  229. //content: '这是一个模态弹窗',
  230. success: function(res) {
  231. if (res.confirm) {
  232. _this.deleteBtnMethod(item)
  233. } else if (res.cancel) {
  234. //.log('用户点击取消');
  235. }
  236. }
  237. });
  238. },
  239. deleteBtnMethod(item){
  240. uni.showLoading({
  241. title: "加载中",
  242. mask: true,
  243. })
  244. API.myEmploymentDelete({
  245. id:item.id
  246. }).then((res) => {
  247. this.init()
  248. }).catch(error => {
  249. uni.showToast({icon: 'none',
  250. title: error,
  251. icon: "none"
  252. })
  253. })
  254. },
  255. }
  256. }
  257. </script>
  258. <style>
  259. page {
  260. background: #F0F0F2;
  261. padding-bottom: 150px;
  262. }
  263. </style>
  264. <style scoped lang="scss">
  265. .card {
  266. margin: 24rpx 32rpx;
  267. background-color: #fff;
  268. padding: 24rpx;
  269. border-radius: 12px;
  270. .positon-salary {
  271. display: flex;
  272. justify-content: space-between;
  273. align-items: center;
  274. .positon {
  275. color: rgba(16, 16, 16, 1);
  276. font-size: 36rpx;
  277. font-family: 'PingFangSC-medium';
  278. .positonSpan{
  279. padding:0 6rpx;
  280. font-size: 24rpx;
  281. text-align: center;
  282. border-radius: 4px;
  283. color: rgba(255, 255, 255, 1);
  284. }
  285. .positonSpan1{
  286. background-color: rgba(34, 149, 255, 1);
  287. }
  288. .positonSpan2{
  289. background-color: rgba(178, 184, 190, 1);
  290. }
  291. }
  292. .salary {
  293. color: rgba(255, 61, 0, 1);
  294. font-size: 32rpx;
  295. font-family: 'PingFangSC-medium';
  296. }
  297. }
  298. .tags-date {
  299. display: flex;
  300. justify-content: space-between;
  301. align-items: center;
  302. margin-top: 16rpx;
  303. margin-bottom: 24rpx;
  304. .tags {
  305. color: rgba(102, 102, 102, 1);
  306. }
  307. .date {
  308. color: rgba(153, 153, 153, 1);
  309. font-size: 24rpx;
  310. }
  311. }
  312. // 按钮
  313. .buttons {
  314. //display: flex;
  315. //justify-content: flex-end;
  316. margin-top: 24rpx;
  317. height: 56rpx;
  318. .btn {
  319. width: 120rpx;
  320. height: 56rpx;
  321. line-height: 56rpx;
  322. border-radius: 50px;
  323. background-color: rgba(255, 255, 255, 1);
  324. color: rgba(119, 119, 119, 1);
  325. text-align: center;
  326. font-family: Microsoft Yahei;
  327. border: 1px solid rgba(207, 210, 213, 1);
  328. margin-left: 24rpx;
  329. float: right;
  330. }
  331. .option1{
  332. margin-left: 0px;
  333. float: left;
  334. color:#EE3138
  335. }
  336. .option2{
  337. margin-left: 0px;
  338. float: left;
  339. color:#2295FF
  340. }
  341. .delete {
  342. color: rgba(238, 49, 56, 1);
  343. }
  344. }
  345. }
  346. .bottom {
  347. position: fixed;
  348. left: 0;
  349. right: 0;
  350. bottom: 0;
  351. .issue {
  352. height: 96rpx;
  353. line-height: 96rpx;
  354. border-radius: 50px;
  355. background-color: rgba(34, 149, 255, 1);
  356. color: rgba(241, 241, 241, 1);
  357. font-size: 36rpx;
  358. text-align: center;
  359. box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.03);
  360. margin: 24rpx 32rpx;
  361. }
  362. }
  363. </style>