index.vue 19 KB

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