index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <!-- 商家-首页 -->
  2. <template>
  3. <view class="main_width" style="padding-bottom: 70upx;">
  4. <!-- 发布招聘/扫码核销 -->
  5. <view class="img_box">
  6. <image @click="open_modal" mode="widthFix" :src="img_url_release"></image>
  7. <image @click="scanning" mode="widthFix" :src="img_url_scan"></image>
  8. </view>
  9. <!-- tab选择 -->
  10. <view class="index_tab">
  11. <view @click="change_tab_status(0)" class="index_tab_each">
  12. <image class="img_index_tab" :src="img_url_index_tab1"></image>
  13. <view :style="'font-weight: '+(tab_status==0?'bold;':'normal;')" class="title_index_tab">查看招聘</view>
  14. <view :style="tab_status==0?'color: #f56954;':'color: #afafaf;'" class="num_index_tab">
  15. {{count_one||''}}
  16. </view>
  17. <image class="num_bg_index_tab" :src="tab_status==0?img_url_pop_orange:img_url_pop_grey"
  18. v-if="count_one>0"></image>
  19. </view>
  20. <view @click="change_tab_status(1)" class="index_tab_each">
  21. <image class="img_index_tab" :src="img_url_index_tab2"></image>
  22. <view :style="'font-weight: '+(tab_status==1?'bold;':'normal;')" class="title_index_tab">查看工作</view>
  23. <view :style="tab_status==1?'color: #f56954;':'color: #afafaf;'" class="num_index_tab">
  24. {{count_two||''}}
  25. </view>
  26. <image class="num_bg_index_tab" :src="tab_status==1?img_url_pop_orange:img_url_pop_grey"
  27. v-if="count_two>0"></image>
  28. </view>
  29. <view @click="change_tab_status(2)" class="index_tab_each">
  30. <image class="img_index_tab" :src="img_url_index_tab3"></image>
  31. <view :style="'font-weight: '+(tab_status==2?'bold;':'normal;')" class="title_index_tab">历史发布</view>
  32. <view :style="tab_status==2?'color: #f56954;':'color: #afafaf;'" class="num_index_tab">
  33. {{count_three||''}}
  34. </view>
  35. <image class="num_bg_index_tab" :src="tab_status==2?img_url_pop_orange:img_url_pop_grey"
  36. v-if="count_three>0"></image>
  37. </view>
  38. </view>
  39. <!-- 主数据列表 -->
  40. <view class="index_mian_data">
  41. <view :key="item.id" v-for="(item,index) in data" class="index_mian_data_each">
  42. <view style="position: relative;">
  43. <navigator :url="'./../order/detail?id='+item.id" class="index_mian_title nowrap">{{item.title}}
  44. </navigator>
  45. <image v-if="tab_status==2" @click="delete_recruit(item.id)"
  46. style="width: 50upx;height: 50upx;position: absolute;right: 0upx;top: 20upx;"
  47. src="../../static/close-circle.png"></image>
  48. <view class="data_each_top">
  49. <view style="width: 45%;">
  50. <view :style="'background-color: '+(item.urgent_level=='0'?'#01bcc3;':'#00a2a7;')"
  51. class="tag_urgent">{{item.urgent_level=='0'?'完工即结':'今日零工'}}</view>
  52. <view class="needs">总需求:{{item.need_total}}</view>
  53. <view class="needs">已录用:{{item.count_signed_num}}</view>
  54. </view>
  55. <view v-if="show_canvas&&!loading" style="width: 55%;display: flex;align-items: center;">
  56. <canvasChart :value="item.chart_value">
  57. </canvasChart>
  58. <view @click="show_status(status_obj[item.status])" class="chart_right">
  59. 进度{{item.chart_value*100}}%</view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="data_each_bot">
  64. <view @click="fuck_recruit(item.id,'terminate', '终止')" v-if="tab_status==0" class="each_btn">
  65. 终止招聘</view>
  66. <view @click="fuck_recruit(item.id,'breakoff' ,'违约')" v-if="tab_status==1"
  67. style="background-color: #ff0000;" class="each_btn">违约招聘</view>
  68. <view @click="releaseInfo(item.urgent_level, item.id)" v-if="tab_status==2" class="each_btn">再发一单
  69. </view>
  70. <view style="background-color: #01bcc3;position: relative;" class="each_btn">
  71. <navigator :url="'./memberList?id='+item.id+'&status=2'" v-if="tab_status==0">
  72. 待录用:{{item.accepted_no||''}}</navigator>
  73. <navigator :url="'./memberList?id='+item.id+'&status=6'" v-if="tab_status==1">
  74. 待结算:{{item.todowork_status_four||''}}</navigator>
  75. <navigator :url="'./memberList?id='+item.id" style="color: #ffffff;" v-if="tab_status==2">评价
  76. </navigator>
  77. <!-- <view class="red_point"></view> -->
  78. </view>
  79. </view>
  80. <view class="data_each_bot">
  81. <view style="color: #f7942d;display: flex;align-items: center;">
  82. <image style="width: 35upx;height: 35upx;margin-right: 8upx;" :src="img_url_clock_orange">
  83. </image>
  84. <text
  85. v-if="item.settle_catalog==0">{{((item.begin_datetime_bright==item.finish_datetime_bright)||!item.finish_datetime_bright)?item.begin_datetime_bright.slice(5,10):(item.begin_datetime_bright.slice(5,10)+'~'+item.finish_datetime_bright.slice(5,10))}}</text>
  86. <text v-else>{{item.begin_datetime_bright.slice(5,10)+'开始'}}</text>
  87. <text style="margin-left: 15upx;">{{item.begin_hour}}~{{item.finish_hour}}</text>
  88. </view>
  89. <navigator v-if="tab_status!=2" :url="'./memberList?id='+item.id">
  90. <view style="display: flex;align-items: center;">
  91. <view style="margin-right: 15upx;color: #01bcc3;">
  92. {{item.enrolled_heads.length>0?'已报名人员':'查看全部'}}
  93. </view>
  94. <view class="has_signed">
  95. <image :key="index" v-for="(item2,index) in item.enrolled_heads"
  96. :src="serverUrl+'touxiang/'+item2+'.png'"></image>
  97. </view>
  98. </view>
  99. </navigator>
  100. <view style="margin-right: 15upx;color: #01bcc3;" v-else>{{status_obj[item.status]}}</view>
  101. </view>
  102. </view>
  103. </view>
  104. <view style="text-align: center;margin-top: 30upx;" v-if="!loading&&data.length === 0">暂无数据</view>
  105. <!-- 点击发布招聘按钮后显示需要发布的招聘类型遮罩 -->
  106. <uni-popup ref="popup" :mask-click="false">
  107. <view style="position: relative;width: 100%;background-color: rgba(255,255,255,0.9);">
  108. <view class="cancel_btn" @click="close_release_popup">取消
  109. </view>
  110. <view class="popup">
  111. <view @click="releaseInfo(0)" class="image">
  112. <image mode="widthFix" :src="img_url_release2"></image>
  113. <view>完工即结</view>
  114. </view>
  115. <view @click="releaseInfo(1)" class="image">
  116. <image mode="widthFix" :src="img_url_release1"></image>
  117. <view>今日零工</view>
  118. </view>
  119. </view>
  120. </view>
  121. </uni-popup>
  122. <!-- 商家终止/违约处理遮罩内容 -->
  123. <uni-popup ref="popup_mer" :mask-click="false">
  124. <view style="overflow: hidden;" class="modal_box">
  125. <view style="color: #01bcc3;font-weight: bold;text-align: center;line-height: 70upx;">
  126. {{todo_title}}招聘
  127. </view>
  128. <view style="display: flex;justify-content: center;">
  129. <view class="choose_add_break" v-if="todo=='breakoff'"
  130. style="text-align: center;margin-top: 10upx;margin-bottom: 10px;" @click="select_breakdate">
  131. {{breakdate||'选择违约日期'}}
  132. </view>
  133. </view>
  134. <view v-if="todo=='breakoff'" style="color: red;margin-bottom: 10upx;text-align: center;">
  135. *如违约,会扣除部分费用作为会员补偿金</view>
  136. <view style=" margin-top: 10upx;">
  137. <textarea v-model="reason" @input="textarea_ipt" style="text-indent: 20upx;"></textarea>
  138. <view class="modal_btn">
  139. <view @click="close_modal()" class="modal_btn_cancel">取消</view>
  140. <view @click="process()" class="modal_btn_confirm">确认{{todo_title}}</view>
  141. </view>
  142. </view>
  143. </view>
  144. </uni-popup>
  145. <!-- 违约日期选择遮罩 -->
  146. <uni-popup ref="popup_date" :mask-click="false">
  147. <view class="modal_box">
  148. <view style="padding-top: 30upx;">
  149. <view style="width: 50%;float: left;color: #01bcc3;line-height: 70upx;text-align: center;"
  150. :key="index" @click="picker_data(item)" v-for="(item,index) in pickDateList">{{item}}</view>
  151. </view>
  152. <view class="modal_btn">
  153. <view style="width: 50%;clear: both;top: ;" @click="close_date_modal" class="modal_btn_cancel">取消
  154. </view>
  155. </view>
  156. </view>
  157. </uni-popup>
  158. </view>
  159. </view>
  160. </template>
  161. <script>
  162. import commonData from '../../commonData.js'
  163. import commonFun from '../../commonFun.js'
  164. import canvasChart from '../../components/canvas.vue'
  165. export default {
  166. data() {
  167. return {
  168. serverUrl: this.serverUrl,
  169. img_url_scan: commonFun.serverUrl + 'merchant/scan.png',
  170. img_url_release: commonFun.serverUrl + 'merchant/release.png',
  171. img_url_release1: commonFun.serverUrl + 'merchant/release1.png',
  172. img_url_release2: commonFun.serverUrl + 'merchant/release2.png',
  173. img_url_index_tab1: commonFun.serverUrl + 'merchant/index_tab1.png',
  174. img_url_index_tab2: commonFun.serverUrl + 'merchant/index_tab2.png',
  175. img_url_index_tab3: commonFun.serverUrl + 'merchant/index_tab3.png',
  176. img_url_pop_orange: commonFun.serverUrl + 'merchant/pop_orange.png',
  177. img_url_pop_grey: commonFun.serverUrl + 'merchant/pop_grey.png',
  178. img_url_clock_orange: commonFun.serverUrl + 'merchant/clock_orange.png',
  179. user_info: {}, //用户个人信息
  180. count_one: 0,
  181. count_two: 0,
  182. count_three: 0,
  183. has_get_user_info: false, //是否已经获取到了个人信息
  184. finance_numtotalbalance: 0, //当前可用发布次数
  185. finance_balance: 0, //账户余额
  186. tab_status: 0, //状态栏索引
  187. count_num_obj: {},
  188. loading: true, //主数据加载中
  189. data: [], //主数据
  190. todo_id: '', //当前违约/终止的招聘id
  191. todo_title: '', //违约/招聘标题
  192. todo: '', //terminate或breakoff代表终止招聘和违约招聘
  193. reason: '', //操作备注
  194. breakdate: '', //选择违约的日期
  195. pickDateList: [], //违约招聘可选日期数组
  196. show_canvas: true, //是否显示图表
  197. status_obj: {
  198. '-2': '违约中断',
  199. '-1': '被驳回',
  200. '0': '待提交',
  201. '1': '待审核',
  202. '2': '已审核',
  203. '3': '已终止',
  204. '4': '手工下架',
  205. '5': '招满自动下架',
  206. '6': '过期自动下架',
  207. },
  208. }
  209. },
  210. onLoad() {},
  211. onShow() {
  212. this.show_canvas = true
  213. this.$refs.popup.close('top')
  214. this.get_data()
  215. },
  216. onPullDownRefresh() {
  217. this.data = []
  218. this.get_data()
  219. },
  220. methods: {
  221. // 删除招聘信息
  222. delete_recruit(trader_recruit_id) {
  223. let that = this
  224. uni.showModal({
  225. title: '确认删除?',
  226. content:'删除之后不能恢复',
  227. success: (res) => {
  228. if (res.confirm) {
  229. uni.showLoading({
  230. title: '加载中...',
  231. mask: true
  232. })
  233. let params = {
  234. bizCatalog: 'TraderRecruitIsDelete',
  235. handleMode: 'UpdateIsDelete',
  236. trader_recruit_id,
  237. }
  238. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=entityDataHandle', params,
  239. res => {
  240. if (res.status) {
  241. uni.showModal({
  242. content: '删除成功!',
  243. showCancel: false,
  244. success: res => {
  245. that.get_data()
  246. }
  247. })
  248. }
  249. uni.hideLoading()
  250. })
  251. }
  252. }
  253. })
  254. },
  255. show_status(content) {
  256. uni.showModal({
  257. content,
  258. showCancel: false
  259. })
  260. },
  261. // 点击发布招聘
  262. releaseInfo(urgent_level, id = '') {
  263. if (!this.has_get_user_info) {
  264. uni.showModal({
  265. content: '个人信息加载中,请稍后重试!',
  266. showCancel: false
  267. })
  268. return
  269. }
  270. // 账户余额检查
  271. if (Number(this.user_info.finance_balance) < 0) {
  272. uni.showModal({
  273. title: '请充值后发布',
  274. content: '您有订单未及时支付,平台已垫付,请补齐欠款',
  275. confirmText: '去充值',
  276. success: (res) => {
  277. if (res.confirm) {
  278. uni.navigateTo({
  279. url: '../personal/wallet'
  280. })
  281. }
  282. }
  283. })
  284. return
  285. }
  286. // 实名认证检查
  287. if (this.user_info.lawer_idcard) {
  288. if (urgent_level == 0) {
  289. uni.navigateTo({
  290. url: './releaseInfo?trader_level=' + this.user_info.trader_level + '&id=' + id
  291. })
  292. } else {
  293. uni.navigateTo({
  294. url: './releaseInfoUrgent?trader_level=' + this.user_info.trader_level + '&id=' + id
  295. })
  296. }
  297. } else {
  298. uni.showModal({
  299. content: '实名后即可发布招聘信息!',
  300. confirmText: '去实名',
  301. success: (res) => {
  302. if (res.confirm) {
  303. uni.navigateTo({
  304. url: '../personal/authentication_merchant'
  305. })
  306. }
  307. }
  308. })
  309. }
  310. },
  311. // 点击扫码核销
  312. scanning() {
  313. let paySettleMer = commonFun.paySettleMer
  314. uni.scanCode({
  315. success: (res) => {
  316. // 测试开始20220527
  317. // uni.showModal({
  318. // title: '扫码错误',
  319. // content: '请在【查看工作】中手动结算!',
  320. // showCancel: false
  321. // })
  322. // return
  323. // 测试结束
  324. // console.log('条码类型:' + res.scanType);
  325. // console.log('条码内容:' + res.result);
  326. if (res.scanType != 'QR_CODE' || res.scanType == '') {
  327. uni.showModal({
  328. title: '扫码错误',
  329. content: '请扫描正确的二维码!',
  330. showCancel: false
  331. })
  332. } else {
  333. paySettleMer(res.result.replace('workid=', ''), () => {
  334. this.get_data()
  335. })
  336. }
  337. },
  338. fail: res => {
  339. if (res.errMsg.indexOf('cancel') == -1) {
  340. uni.showModal({
  341. title: '扫码错误',
  342. content: JSON.stringify(res),
  343. showCancel: false
  344. })
  345. }
  346. }
  347. });
  348. },
  349. // 获取用户信息
  350. get_info() {
  351. this.has_get_user_info = false
  352. this.finance_balance = 0
  353. commonFun.get_user_info(res => {
  354. if (res.status) {
  355. uni.hideLoading()
  356. this.has_get_user_info = true
  357. let user_info = res.data.Result
  358. this.user_info = user_info
  359. uni.setStorageSync('USER_INFO', this.user_info)
  360. this.finance_balance = user_info.finance_balance //当前余额
  361. this.finance_numtotalbalance = this.user_info.finance_numFreeCount + this.user_info
  362. .finance_numtotalbalance //当前剩余次数
  363. console.log('商家首页打印个人信息', this.user_info)
  364. commonFun.init_go_easy(this.user_info, 'mer_')
  365. setTimeout(() => {
  366. commonFun.get_message_data()
  367. }, 2000)
  368. }
  369. uni.stopPullDownRefresh()
  370. })
  371. },
  372. //商家首页获取数据
  373. get_data(callback = () => {}) {
  374. this.loading = true
  375. uni.showLoading({
  376. title: '加载中...',
  377. mask: true
  378. })
  379. let params = {
  380. bizCatalog: 'TodoWorkEntity',
  381. handleMode: 'fetchallRecuritNew',
  382. pageIndex: 1,
  383. pageSize: 1000,
  384. status: String(this.tab_status + 1)
  385. }
  386. console.log('商家首页列表请求参数', params)
  387. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=fetchPageData', params, res => {
  388. if (res.status) {
  389. this.count_one = res.data.Result.count_one
  390. this.count_two = res.data.Result.count_two
  391. // this.count_three = res.data.Result.count_three
  392. this.get_info()
  393. this.data = res.data.Result.pageData.map(item => {
  394. let count_signed_num = Number(item.accepted_ok) + Number(item
  395. .todowork_status_three) + Number(item.todowork_status_four) + Number(
  396. item.todowork_status_five)
  397. console.log(count_signed_num)
  398. return ({
  399. ...item,
  400. count_signed_num,
  401. enrolled_heads: commonFun.formate_enrolled_heads(item
  402. .enrolled_heads, (
  403. count_signed_num)),
  404. chart_value: (count_signed_num / Number(item.need_total))
  405. .toFixed(2)
  406. })
  407. })
  408. console.log('商家首页获取招聘信息列表', this.data)
  409. }
  410. this.loading = false
  411. uni.hideLoading()
  412. uni.stopPullDownRefresh()
  413. callback()
  414. })
  415. },
  416. // 获取招聘情数据(目的是获取 违约招聘可选日期)
  417. get_detail_data(bizId, type) {
  418. uni.showLoading({
  419. title: '加载中...'
  420. })
  421. commonFun.requestUrl('&WsAjaxBiz=Worker&WsAjaxAction=entityDataHandle', {
  422. bizCatalog: 'RecruitEntity',
  423. handleMode: 'fetch',
  424. bizId
  425. }, res => {
  426. if (res.status) {
  427. let pickDateList = res.data.Result.pickDateList
  428. let itemList = []
  429. for (let i in pickDateList) {
  430. itemList.push(pickDateList[i])
  431. }
  432. this.pickDateList = itemList
  433. if (this.pickDateList.length === 1) {
  434. this.breakdate = this.pickDateList[0]
  435. }
  436. if (type == 'fuck_recruit') {
  437. if (this.pickDateList == 0) {
  438. uni.showModal({
  439. content: '此招聘不可违约!',
  440. showCancel: false
  441. })
  442. } else {
  443. this.$refs.popup_mer.open('top')
  444. this.show_canvas = false
  445. }
  446. }
  447. if (type == 'process') {
  448. this.get_data()
  449. }
  450. }
  451. uni.hideLoading()
  452. })
  453. },
  454. // 打开商家处理遮罩后,点击确认违约/终止按钮
  455. process() {
  456. let params = {
  457. bizCatalog: 'RecruitEntity',
  458. handleMode: this.todo,
  459. recuritIds: [this.todo_id],
  460. reason: this.reason,
  461. breakdate: this.breakdate,
  462. }
  463. if (this.todo == 'breakoff' && this.breakdate == '') {
  464. uni.showModal({
  465. content: '请选择违约日期!',
  466. showCancel: false
  467. })
  468. return
  469. }
  470. if (this.reason == '') {
  471. uni.showModal({
  472. content: this.todo_title + '备注不可为空!',
  473. showCancel: false
  474. })
  475. return
  476. }
  477. console.log('商家处理违约或终止招聘请求参数', params)
  478. uni.showLoading({
  479. title: '加载中...',
  480. mask: true
  481. })
  482. commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=entityDataHandle', params, res => {
  483. if (res.status) {
  484. uni.showModal({
  485. content: this.todo_title + '成功!',
  486. showCancel: false,
  487. success: res => {
  488. this.breakdate = ''
  489. this.reason = ''
  490. this.close_modal()
  491. if (this.todo == 'breakoff') {
  492. this.get_detail_data(this.todo_id, 'process')
  493. } else {
  494. this.get_data()
  495. }
  496. }
  497. })
  498. }
  499. uni.hideLoading()
  500. })
  501. },
  502. // 打开选择日期遮罩
  503. select_breakdate() {
  504. this.$refs.popup_date.open('top')
  505. this.show_canvas = false
  506. },
  507. // 关闭日期选择遮罩
  508. close_date_modal() {
  509. this.$refs.popup_date.close('top')
  510. // this.show_canvas = true
  511. },
  512. // 关闭发布招聘遮罩
  513. close_release_popup() {
  514. this.$refs.popup.close('top')
  515. setTimeout(() => {
  516. this.show_canvas = true
  517. }, 300)
  518. },
  519. // 违约招聘选择违约日期
  520. picker_data(date) {
  521. this.close_date_modal()
  522. this.breakdate = date
  523. },
  524. // 打开商家处理遮罩
  525. open_modal() {
  526. this.$refs.popup.open('top')
  527. this.show_canvas = false
  528. },
  529. // 关闭商家处理遮罩
  530. close_modal() {
  531. this.$refs.popup_mer.close('top')
  532. setTimeout(() => {
  533. this.show_canvas = true
  534. }, 300)
  535. },
  536. // 输入操作备注
  537. textarea_ipt(e) {
  538. this.reason = e.target.value
  539. },
  540. // 切换tab
  541. change_tab_status(tab_status) {
  542. this.tab_status = tab_status
  543. this.data = []
  544. this.get_data()
  545. },
  546. // 点击违约/终止招聘按钮
  547. fuck_recruit(id, todo, todo_title) {
  548. this.todo = todo
  549. this.todo_title = todo_title
  550. this.todo_id = id
  551. if (todo == 'breakoff') {
  552. this.get_detail_data(id, 'fuck_recruit')
  553. } else {
  554. this.$refs.popup_mer.open('top')
  555. this.show_canvas = false
  556. }
  557. },
  558. },
  559. components: {
  560. canvasChart
  561. },
  562. }
  563. </script>
  564. <style>
  565. @import url("index.css");
  566. </style>