| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- import {
- getPositionDetail,
- positionApply,
- groupApply,
- groupList,
- saveFavoritePosition
- } from '../../services/index.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- import {
- showToast
- } from '../../utils/tips.js'
- const WxParse = require('../../plugins/wxParse/wxParse.js');
- // var $ = require('../../libs/gdconf.js');
- const app = getApp();
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- hpPositionId: 0,
- positionCategory: 0, //0:全职 1:兼职 2:入职奖励 3:高薪急聘 4:拼团岗位 5:福利岗位 8:自发布全职 9:自发布兼职
- isShowList: false,
- clearTimer: false,
- comScale: '',
- comType: '',
- myFormat: ['天', '时', '分', '秒'],
- authMask: false,
- detailArray: [],
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- detailIndex: 0, //详情指引
- isApply: false,
- storeAction: [],
- showJoinPt: false, //显示加入拼工
- showAllPt: false, //显示所有拼工
- allPtList: [],
- leftTime: 0,
- isEnd: 0, //岗位是否已结束0:未结束;1:结束
- myGroupId: '', //我的拼团id
- groupId: '', //拼团id
- inviteUser_id: '', //拼团邀请人
- isFarovite: false, //是否收藏
- maxReward: 0, //入职最高奖励
- minReward: 0, //入职最低奖励
- },
- onLoad: function(options) {
- console.log(options)
- this.setData({
- hpPositionId: options.hpPositionId,
- positionCategory: options.cate || 0,
- })
- },
- onShow: function() {
- this.fetchData();
- this.fetchPtList();
- },
- onShareAppMessage: function() {
- var shareToken = wx.getStorageSync('shareToken')
- var hpuser = wx.getStorageSync('hpuser');
- return {
- title: '开心工作入职有奖',
- path: '/pages/detail/index?cate=' + this.data.positionCategory + '&hpPositionId=' + this.data.hpPositionId,
- imageUrl: ''
- }
- },
- //获取岗位详情
- fetchData() {
- let paramsObj = {
- position_category: this.data.positionCategory,
- id: this.data.hpPositionId,
- }
- Object.assign(paramsObj);
- getPositionDetail(paramsObj).then(data => {
- console.log(data)
- let postitionDetail = {};
- let groupLessList = {};
- var leftTime = 0;
- var myGroupId = '';
- switch (this.data.positionCategory) {
- case "0":
- postitionDetail = data.data.hpFulltimePosition
- break;
- case "1":
- postitionDetail = data.data.hpParttimePosition
- break;
- case "2":
- postitionDetail = data.data.hpRewardPosition
- break;
- case "3":
- postitionDetail = data.data.hpGoodmoneyPosition
- break;
- case "4":
- postitionDetail = data.data.hpGroupPosition;
- leftTime = data.data.hpGroupPosition.groupEndTime;
- groupLessList = data.data.groupLessList;
- myGroupId = data.data.myGroupId;
- var maxReward;
- var minReward;
- var femaleReward = data.data.hpGroupPosition.femaleReward;
- var maleReward = data.data.hpGroupPosition.maleReward;
- var fiveGroupCashback = data.data.hpGroupPosition.fiveGroupCashback;
- var threeGroupCashback = data.data.hpGroupPosition.threeGroupCashback;
- var hasReward = data.data.hpGroupPosition.hasReward;
- if (hasReward == 1) {
- if (maleReward >= femaleReward) {
- maxReward = fiveGroupCashback + maleReward;
- minReward = femaleReward;
- } else {
- maxReward = fiveGroupCashback + femaleReward;
- minReward = maleReward;
- }
- } else {
- maxReward = fiveGroupCashback;
- minReward = 0;
- }
- this.setData({
- maxReward: maxReward,
- minReward: minReward
- })
- break;
- case "5":
- postitionDetail = data.data.hpWelfarePosition
- break;
- case "8":
- postitionDetail = data.data.hpFulltimePosition
- break;
- case "9":
- postitionDetail = data.data.hpParttimePosition
- break;
- }
- if (data.data.isEnd == 1) {
- this.setData({
- isEnd: data.data.isEnd
- })
- console.log("该岗位已结束")
- } else {
- console.log("该岗位未结束")
- }
- this.setData({
- postitionDetail: postitionDetail,
- isApply: data.data.isApply,
- leftTime: leftTime,
- storeAction: groupLessList,
- myGroupId: myGroupId,
- isFarovite: data.data.isFarovite
- })
- //富文本转义
- var detailArray = [];
- if (postitionDetail.hpWelfarePositionDetailList != null && postitionDetail.hpWelfarePositionDetailList.length > 0) {
- for (var i = 0; i < postitionDetail.hpWelfarePositionDetailList.length; i++) {
- var ss = WxParse.wxParse('positionDetail', 'html', postitionDetail.hpWelfarePositionDetailList[i].positionDetail, this);
- detailArray.push(ss);
- }
- this.setData({
- detailArray: detailArray
- })
- }
- //富文本转义
- if (postitionDetail.applyCondition) {
- WxParse.wxParse('applyCondition', 'html', postitionDetail.applyCondition, this);
- }
- this.getNodePos();
- })
- },
- //获取所有拼工列表
- fetchPtList() {
- if (this.data.isEnd == 1) {
- showToast('拼团已结束')
- return false
- }
- let paramsObj = {
- positionCategory: this.data.positionCategory,
- positionId: this.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- groupList(paramsObj).then(data => {
- console.log("allpt", data)
- this.setData({
- allPtList: data.data.groupList
- })
- })
- },
- //申请工作
- applyJob(e) {
- var self = this;
- wx.showModal({
- title: '提示',
- content: '确定提交申请吗?',
- success: function(res) {
- if (res.confirm) {
- let {
- formId
- } = e.detail;
- let paramsObj = {
- positionCategory: self.data.positionCategory,
- positionId: self.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionId=' + self.data.hpPositionId + "&positionCategory=" + self.data.positionCategory)
- positionApply(paramsObj).then(data => {
- showToast('申请职位成功', 'success')
- setTimeout(function() {
- wx.navigateBack();
- }, 2000)
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- //申请开团
- applyPt(e) {
- var self = this;
- wx.showModal({
- title: '提示',
- content: '确定提交开团申请吗?',
- success: function(res) {
- if (res.confirm) {
- let {
- formId
- } = e.detail;
- let paramsObj = {
- // groupId: self.data.groupId,
- // inviteUser_id: self.data.inviteUser_id,
- positionCategory: self.data.positionCategory,
- positionId: self.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionId=' + self.data.hpPositionId + "&positionCategory=" + self.data.positionCategory)
- groupApply(paramsObj).then(data => {
- var hpPositionGroupId = data.data.hpApplyPosition.groupId
- console.log("ff22", data);
- showToast("开团成功");
- wx.navigateTo({
- url: '../pt-detail/index?gd=' + hpPositionGroupId + '&pc' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
- })
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- //我的拼团
- myApply() {
- var self = this;
- wx.navigateTo({
- url: '../pt-detail/index?gd=' + self.data.myGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
- })
- },
- //拨打手机号
- phoneCall() {
- if (this.data.postitionDetail.contactPhone) {
- wx.makePhoneCall({
- phoneNumber: this.data.postitionDetail.contactPhone,
- success: function(data) {
- console.log(data)
- },
- fail: function(data) {
- console.log(data)
- }
- })
- } else {
- showToast('暂无手机号')
- }
- },
- //查看线路
- toRoadsLine() {
- wx.navigateTo({
- url: '../roadsLine/index',
- })
- },
- // 获取公司规模描述
- getComScale(lower, high) {
- if (!lower || lower == 0) {
- return high + '人以下'
- }
- if (!high || high == 0) {
- return lower + '人以上'
- }
- return lower + '-' + high + '人'
- },
- //获取位置
- getNodePos() {
- if (this.data.positionCategory != 5) {
- var query = wx.createSelectorQuery()
- query.select('#base').boundingClientRect()
- query.select('#require').boundingClientRect()
- query.select('#otherWelfare').boundingClientRect()
- query.select('#jieshao').boundingClientRect()
- var that = this;
- query.exec(function(res) {
- console.log(res)
- that.setData({
- basePos: res[0].top - 40,
- requirePos: res[1].top - 40,
- otherWelfarePos: res[2].top - 40,
- jieshaoPos: res[3].top - 40
- })
- })
- }
- },
- //距离页面滚动
- goDeatil: function(e) {
- var index = e.currentTarget.dataset.index;
- this.setData({
- detailIndex: index
- })
- let top = e.currentTarget.dataset.top
- wx.pageScrollTo({
- scrollTop: top,
- duration: 0
- })
- },
- // 加入拼工
- joinPt(e) {
- var index = e.currentTarget.dataset.index;
- console.log("joinptindex", index)
- this.setData({
- showAllPt: false,
- showJoinPt: true,
- joinPtList: this.data.storeAction[index]
- })
- console.log("DFD", this.data.joinPtList)
- },
- // 加入拼工(所有拼工)
- joinPt_1(e) {
- var index = e.currentTarget.dataset.index;
- console.log("joinptindex", index)
- this.setData({
- showAllPt: false,
- showJoinPt: true,
- joinPtList: this.data.allPtList[index]
- })
- },
- hideJoinPt() {
- this.setData({
- showJoinPt: false
- })
- },
- cancelPt() {
- this.setData({
- showJoinPt: false
- })
- },
- //加入拼工,进入拼工详情
- confirmPt(e) {
- var self = this;
- var groupId = e.currentTarget.dataset.groupid;
- self.setData({
- showJoinPt: false
- })
- wx.navigateTo({
- url: '../pt-detail/index?gd=' + groupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
- })
- },
- // 所有拼工
- allPt(e) {
- this.setData({
- showAllPt: true
- })
- },
- hideAllPt() {
- this.setData({
- showAllPt: false
- })
- },
- hideAuth() {
- this.setData({
- authMask: false
- })
- },
- submitInfo(e) {
- console.log('form发生了submit事件,事件数据为:', e)
- },
- toPt() {
- wx.navigateTo({
- url: '../document/pt'
- })
- },
- toFanxian() {
- wx.navigateTo({
- url: '../document/fanxian'
- })
- },
- imageLoad() {
- var that = this
- var query = wx.createSelectorQuery()
- query.select('.wel_top').boundingClientRect()
- query.exec(function(res) {
- console.log(res)
- that.setData({
- swiperH: res[0].height
- })
- })
- },
- onError(err) {
- app.aldstat.sendEvent('报错', {
- 'err': err
- });
- },
- //跳转工作地址列表
- toaddressdetail() {
- wx.setStorageSync("addressList", this.data.postitionDetail.hpPositionAddressList);
- wx.navigateTo({
- url: '../address/index',
- })
- },
- //收藏岗位
- favourate() {
- var self = this;
- var isFavorite = self.data.isFarovite ? 0 : 1;
- let paramsObj = {
- positionCategory: self.data.positionCategory,
- positionId: self.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken,
- isFavorite: isFavorite
- }
- Object.assign(paramsObj);
- saveFavoritePosition(paramsObj).then(data => {
- console.log("sssccc", data.data.isFavorite);
- if (data.data.isFavorite) {
- showToast('收藏成功');
- } else {
- showToast('取消收藏');
- }
- self.setData({
- isFarovite: data.data.isFavorite
- })
- })
- },
- })
|