// pages/newEnroll/index.js const app = getApp(); var dateTimePicker = require("../../../utils/dateTimePicker.js"); var dateUtil = require("../../../utils/dateUtil.js"); // import { // isNotEmptyCheck, // nationArray, // getReturnFeeTypeName1ById // } from "../../../utils/ commonUtil"; // import commonUtil from "../../../utils/commonUtil"; const commonUtil = require("../../../utils/commonUtil") const mydate = new Date(); import { customRequest } from '../../../utils/request.js'; import { baseUrl } from '../../../utils/request.js'; Page({ /** * 页面的初始数据 */ data: { pageFrom: 1, files: [], switch1Checked: true, urls: [], userInfo: { name: "", address: "", age: "", nationality: "", sex: "", num: "", tel: "", idCardImageUrl: "", }, showUpload: true, name: "", sex: [{ id: 1, value: "男", }, { id: 2, value: "女", }, ], loading: false, idInfo: {}, index: -1, agentArray: [], ageArray: [], ageIndex: -1, // jobIndex: -1, jobArray: [ // { // id: 1, // name: "GG", // }, ], storeIndex: -1, storeArray: [ // { // id: 1, // name: "GG", // }, ], dateTimeArray1: null, dateTime1: null, startYear: 2022, endYear: new Date().getFullYear(), currentTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()), currentTime2: dateUtil.formatDateYMD(mydate.toLocaleDateString()), copyTime: dateUtil.formatDateYMD(mydate.toLocaleDateString()), searchListShow: false, searchListShow: false, searchKeys: "", searchKeysA: "", inputShowed: false, inputVal: "", inputShowedA: false, inputValA: "", storeId: "", agentId: "", agentName: "", storeJobId: "", policy: "", currentImg: "", nationIndex: -1, // 民族的索引 managerRoleClassify: app.globalData.loginUserInfo.managerRoleClassify, // 管理员权限 agencyStatus: app.globalData.loginUserInfo.agencyStatus, corpUserFlag: app.globalData.loginUserInfo.corpUserFlag, //内部成员 nationArray: commonUtil.nationArray, currentUser: {}, jobInfo: { }, jobName: "", storeName: "", newAddImg: [], tel: "", iosDialog1: false, zhedie: false, isShowZhedie: false, idCardImg: "", dateTime: "", pageShow: false, drawerShow: false, policyStr: '', policyList: [], policyList1: [1, 2, 3, 4, 5], policyIdx: '', zhengceTextList: [], }, radioChange2(e) { const items = this.data.policyList for (let i = 0, len = items.length; i < len; ++i) { if (items[i].id == e.detail.value) { items[i].checked = true; console.log(i) this.data.policyStr = i this.data.policyIdx = items[i].id; } else { items[i].checked = false } } console.log(this.data.policyStr); this.setData({ policyStr: this.data.policyStr, policyIdx: this.data.policyIdx, policyList: items }) }, preventTouchMove() {}, bindPickerChangeAge(e) { console.log("picker发送选择改变,携带值为", e.detail.value); this.setData({ ageIndex: e.detail.value, ["userInfo.age"]: parseInt(e.detail.value) + 16, }); }, ifZhedie() { this.setData({ zhedie: false, }); }, ifZhankai() { this.setData({ zhedie: true, }); }, copyClose() { var that = this; console.log(that.data.userInfo); var text = ""; if (that.data.userInfo.name != "") { text = "姓名:" + that.data.userInfo.name + "/" + ((that.data.userInfo.sex == 1 || that.data.userInfo.sex) == "男" ? "男" : "女") + "/" + (that.data.userInfo.age == "" ? "" : that.data.userInfo.age + "岁") + (that.data.userInfo.nationality == "族" ? "" : "/" + that.data.userInfo.nationality) + "\n电话:" + (that.data.userInfo.tel == "" ? "-" : that.data.userInfo.tel) + "\n身份证号:" + (that.data.userInfo.num == "" ? "-" : that.data.userInfo.num) + "\n家庭住址:" + (that.data.userInfo.address == "" ? "-" : that.data.userInfo.address) + "\n报名职位:" + (that.data.jobInfo.jobName == "" ? "-" : that.data.jobInfo.jobName) + "\n面试时间:" + that.data.currentTime + "\n接待时间:" + that.data.currentTime2 + "\n政策:" + (that.data.policy == "" ? "-" : that.data.policy); } else { text = "姓名:-" + "\n电话:" + (that.data.userInfo.tel == "" ? "-" : that.data.userInfo.tel) + "\n身份证号:" + (that.data.userInfo.num == "" ? "-" : that.data.userInfo.num) + "\n家庭住址:" + (that.data.userInfo.address == "" ? "-" : that.data.userInfo.address) + "\n报名职位:" + (that.data.jobInfo.jobName == "" ? "-" : that.data.jobInfo.jobName) + "\n面试时间:" + that.data.currentTime + "\n接待时间:" + that.data.currentTime2 + "\n政策:" + (that.data.policy == "" ? "-" : that.data.policy); } wx.setClipboardData({ data: text, success(res) { wx.getClipboardData({ success(res) { console.log(res.data); // data wx.showToast({ title: "内容已复制", icon: "none", duration: 1500, }); that.close1(); }, }); }, }); }, showInfo() { this.setData({ iosDialog1: true, }); }, close1: function () { console.log("close"); this.setData({ iosDialog1: false, }); }, shrink() { // wx.navigateBack({ // delta: -1, // }) var that = this; let from = wx.getStorageSync("BILLFROM"); console.log(from); wx.navigateBack({ delta: 1, }); // wx.switchTab({ // url: `/pages/${from}/index`, // }); // if (that.data.pageFrom == 1) { // wx.switchTab({ // url: "../../firstBill/index", // }); // } // else { // wx.switchTab({ // url: "../../workBench/index", // }); // } }, chooseMedia() { var that = this; wx.chooseMedia({ count: 1, mediaType: ["image", "video"], sizeType: ["original", "compressed"], sourceType: ["album", "camera"], success(res) { // tempFilePath可以作为 img 标签的 src 属性显示图片 wx.showLoading({ title: "上传中...", }); console.log('获取媒体文件', res); var currData = {}; const tempFilePaths = res.tempFiles; tempFilePaths.forEach((item, index) => { wx.uploadFile({ url: baseUrl + "/imgs/uploadImage", method: "post", // data:currData, // name: "uploadFile", filePath: tempFilePaths[index].tempFilePath, name: "uploadFile", header: app.globalData.headers, success: function (res) { console.log('获取媒体信息', res); that.data.files.push({ url: JSON.parse(res.data).data, id: new Date().getTime() }); that.setData({ files: that.data.files, }); that.pushImg(); setTimeout(() => { wx.hideLoading(); }, 2000); // that.updateImgs(currData.type,currData.fkId,currData.data.data); }, fail: function (res) { console.log(res); setTimeout(() => { wx.hideLoading(); }, 2000); }, }); setTimeout(() => { wx.hideLoading(); }, 2000); }); }, fail(res) { if (res["errMsg"]) {} console.log(res); }, }); }, delImgs(e) { var that = this; var url = e.currentTarget.dataset.url; var id = e.currentTarget.dataset.id; wx.showModal({ title: "提示", content: "确定要删除该图片?", confirmColor: "#1890ff", success(res) { if (res.confirm) { that.data.files.forEach((item, index) => { if (id == item.id) { that.data.files.splice(index, 1); // that.data.newAddImg.splice(index, 1); } }); that.pushImg(); that.setData({ files: that.data.files, // newAddImg: that.data.newAddImg, }); if (id != -999) { customRequest("/imgs/del/" + id, { header: 'headers', method: 'GET', data: {} }).then((res) => { }) // wx.request({ // url: app.globalData.ip + "/imgs/del/" + id, // header: app.globalData.headers, // // data:currData, // method: "get", // success: function (res) { // console.log(res.data); // }, // fail: function (res) { // console.log(res); // }, // }); } } else if (res.cancel) { console.log("用户点击取消"); } }, }); }, pushImg() { var that = this; console.log(that.data.files); that.data.urls = []; // that.data.files.forEach(item=>{ // that.data.urls.push(item.url) // }) let curr = []; that.data.files.forEach((item) => { curr.push({ url: item.url, id: item.id }); }); that.setData({ urls: curr, }); }, showImgs(e) { var that = this; console.log(e); console.log(that.data.urls); let curr = []; that.data.urls.forEach((item) => { curr.push(item.url); }); wx.previewImage({ current: e.currentTarget.dataset.url, // 当前显示图片的 http 链接 urls: curr, // 需要预览的图片 http 链接列表 }); }, radioChange: function (e) { const sex = this.data.sex; let currentSex = ""; for (let i = 0, len = sex.length; i < len; ++i) { sex[i].checked = sex[i].id == e.detail.value; if (sex[i].checked) { currentSex = sex[i].value; } } this.setData({ ["userInfo.sex"]: currentSex, sex, }); console.log(e.detail.value); }, chooseIdCard() { var that = this; console.log("ischoise"); wx.chooseImage({ count: 1, sizeType: ["original", "compressed"], sourceType: ["album", "camera"], success(res) { console.log(res); // debugger; that.uploadIdcardImg(res); }, }); }, uploadIdcardImg(imgPath) { let that = this; // tempFilePath可以作为img标签的src属性显示图片 let filePath; if (imgPath.tempFilePaths) { filePath = imgPath.tempFilePaths[0]; } else { filePath = imgPath; } console.log(filePath); wx.showLoading({ title: "识别中...", }); wx.uploadFile({ // url: app.globalData.ip + '/commons/idCardOcrRecognize', url: baseUrl + "/commons/idCardOcrRecognizeAndUploadToAliyunOss", filePath, name: "uploadFile", header: app.globalData.headers, success: function (res) { console.log(res); var idcard = JSON.parse(res.data); idcard.data["tel"] = that.data.tel; if (idcard.status == 200) { if (idcard.data.nationality.substr(idcard.data.nationality.length - 1, 1) != "族" && idcard.data.nationality.substr(idcard.data.nationality.length - 1, 1) != "") { idcard.data.nationality = idcard.data.nationality + "族"; } that.setData({ userInfo: idcard.data, ageIndex: parseInt(idcard.data.age) - 16, showUpload: false, idCardImg: idcard.data["idCardImageUrl"], currentImg: imgPath.tempFilePaths ? imgPath.tempFilePaths[0] : imgPath, }); that.setStorage(); console.log(that.data.userInfo); that.data.nationArray.forEach((item, index) => { if (item.name.includes(that.data.userInfo.nationality)) { that.setData({ nationIndex: index, }); } }); if (that.data.userInfo.sex == "男") { that.data.sex[0].checked = true; } else { that.data.sex[1].checked = true; } // that.data.files.push({'url':tempFilePaths[0]}) // console.log(that.data.files); that.setData({ // files: that.data.files, sex: that.data.sex, }); // that.data.files.push({ url: idcard.data.idCardImageUrl, id: -999 }); // that.data.newAddImg.push(idcard.data.idCardImageUrl); that.setData({ // files: that.data.files, // newAddImg: that.data.newAddImg, }); that.pushImg(); } else { wx.showToast({ duration: 2000, title: "身份证未识别", icon: "none", mask: true, }); // console.log(1); //app.showTips(that, res.data.msg); } wx.hideLoading(); }, fail: function (res) { console.log(res); setTimeout(() => { wx.hideLoading(); }, 2000); }, }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; console.log('options', options); console.log('app.globalData.user', app.globalData.user); // 先统一给代理名字赋予登陆者的名称applyType that.setData({ agentName: app.globalData.user.userName, agentId: app.globalData.user.id, agencyId: app.globalData.user.agencyId, pageFrom: options.applyType, }); console.log(that.data.pageFrom + "1首页 2报名页"); // console.log(JSON.parse(options.info)); // 获取缓存的报名人信息 let info = wx.getStorageSync("townsManInfo"); console.log(info); if (app.isNotEmptyCheck(info)) { // 统一给代理岗位相关的字段赋值 if (app.isNotEmptyCheck(info.userId)) { that.getImgs(info.userId); } if (info.nationality.substr(info.nationality.length - 1, 1) != "族" && info.nationality.substr(info.nationality.length - 1, 1) != "") { info.nationality = info.nationality + "族"; } that.setData({ userInfo: info, currentImg: info.currentImg, }); if (app.isNotEmptyCheck(info.imgs)) { that.setData({ files: info.imgs, urls: info.imgs, }); } // this.setData({ // userInfo: info, // currentImg: info.currentImg, // currentTime: info.currentTime, // }); console.log(info); if (info.sex == "男" || info.sex == "1") { this.data.sex[0].checked = true; } else if (info.sex == "女" || info.sex == "2") { this.data.sex[1].checked = true; } that.data.nationArray.forEach((item, index) => { if (item.name.indexOf(info.nationality) > -1 && info.nationality != "") { console.log("isin"); that.setData({ nationIndex: index, }); } }); console.log(that.data.nationIndex); this.setData({ sex: this.data.sex, }); if (info.age) { this.setData({ ageIndex: parseInt(info.age) - 16, }); } } // let jobInfo = wx.getStorageSync("townsManInfoJob"); // if (app.isNotEmptyCheck(jobInfo)) { // console.log(jobInfo); // this.setData({ // storeJobId: jobInfo.id, // jobName: jobInfo.jobName, // inputVal: jobInfo.storeName || jobInfo.aliasName, // storeId: jobInfo.storeId, // policy: jobInfo.policy, // currentTime: jobInfo.currentTime, // currentTime2: jobInfo.currentTime2, // isShowZhedie: true, // }); // } if (app.isNotEmptyCheck(options.info)) { console.log('options.info', options.info); console.log(JSON.parse(options.info)); // let policyList = JSON.parse(options.policy); // policyList.forEach((item, index) => { // item['checked'] = false // getPolicyInfo // }) // 如果随路由传过来的信息有更新,赋值新的数据 this.setData({ jobInfo: JSON.parse(options.info), }); // that.getPolicyByStoreJobId(that.data.jobInfo.id).then(function () { // }); // that.getJobDetail(that.data.jobInfo.id).then(function () { // let data = { currentTime: that.data.currentTime, currentTime2: that.data.currentTime2, storeJobId: that.data.jobInfo.id, jobName: that.data.jobInfo.jobName, agentName: that.data.agentName, }; // // policy: that.data.policy // console.log(data); // wx.setStorage({ // key: "townsManInfoJob", // data, // }); // console.log(wx.getStorage('townsManInfoJob')); // }) } console.log('options.agencyInfo', options.agencyInfo); if (app.isNotEmptyCheck(options.agencyInfo)) { that.setData({ // agentName: JSON.parse(options.agencyInfo).aliasName, // agentId: JSON.parse(options.agencyInfo).id, }); } if (app.isNotEmptyCheck(options.imgUrl)) { console.log(options.imgUrl); // let imgUrl = JSON.parse(options.imgUrl); that.uploadIdcardImg(options.imgUrl); } }, getAgencyList() { let that = this console.log('this.data.jobInfo.id', this.data.jobInfo); customRequest("/yishoudan/store/job/getPolicyListByStoreJobId?storeJobId=" + this.data.jobInfo.id, { header: 'headers', method: 'GET', data: {} }).then(({ data }) => { console.log('data', data); if (data.status == 200) { data.data.forEach((item, index) => { console.log(item); if (index <= 9) { let pickerStr switch (index) { case 0: pickerStr = '政策一' break; case 1: pickerStr = '政策二' break; case 2: pickerStr = '政策三' break; case 3: pickerStr = '政策四' break; case 4: pickerStr = '政策五' break; case 5: pickerStr = '政策六' break; case 6: pickerStr = '政策七' break; case 7: pickerStr = '政策八' break; case 8: pickerStr = '政策九' break; case 9: pickerStr = '政策十' break; default: pickerStr = '政策' + (index + 1) break; } item.pickerStr = pickerStr } }) that.setData({ policyList: data.data || [] }) } }) // wx.request({ // url: app.globalData.ip + "/yishoudan/store/job/getPolicyListByStoreJobId?storeJobId=" + this.data.jobInfo.id, // header: app.globalData.headers, // method: "get", // success ({ data }) { // console.log(data); // if (data.status == 200) { // data.data.forEach((item, index) => { // console.log(item); // if (index <= 9) { // let pickerStr // switch (index) { // case 0: // pickerStr = '政策一' // break; // case 1: // pickerStr = '政策二' // break; // case 2: // pickerStr = '政策三' // break; // case 3: // pickerStr = '政策四' // break; // case 4: // pickerStr = '政策五' // break; // case 5: // pickerStr = '政策六' // break; // case 6: // pickerStr = '政策七' // break; // case 7: // pickerStr = '政策八' // break; // case 8: // pickerStr = '政策九' // break; // case 9: // pickerStr = '政策十' // break; // default: pickerStr = '政策' + (index + 1) // break; // } // item.pickerStr = pickerStr // } // }) // that.setData({ // policyList: data.data || [] // }) // } // } // }) }, toJobAndAgencySelect(e) { console.log(e); var that = this; console.log(this.data.userInfo); this.setStorage().then(() => { console.log("--------", "isIntonavigation"); wx.navigateTo({ url: `../../recordChoice/index?type=${e.currentTarget.dataset.type}&applyType=${that.data.pageFrom}`, }); }); }, showImg() { wx.previewImage({ current: this.data.currentImg, // 当前显示图片的 http 链接 urls: [this.data.currentImg], // 需要预览的图片 http 链接列表 }); }, deleteImg(e) { var that = this; console.log(e); that.data.files.forEach((item, index) => { if (item.id == e.currentTarget.dataset.id) { that.data.files.splice(index, 1); } }); that.setData({ files: that.data.files, }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { // let src = wx.getStorageSync("src"); // console.log(src); }, bothwayBind(e) { console.log(e); let type = `userInfo.${e.currentTarget.dataset.type}`; this.setData({ [type]: e.detail.value, }); }, beforeFormSubmit: function (e) { var that = this; console.log(e); console.log(that.data.files); if (this.data.loading) return that.setData({ loading: true, }); try { // throw new Error("测试"); let time1 = new Date(that.data.currentTime).getTime(); // let time2 = new Date(that.data.currentTime2).getTime(); let currentTime = new Date().getTime(); // if (time1 < time2) { // wx.showToast({ // duration: 2000, // title: "面试时间不能早于预计到达时间", // icon: "none", // mask: true, // }); // that.setData({ // loading: false, // }); // return; // } // || time2 < currentTime if (time1 < currentTime) { // if (time1 < currentTime) { wx.showToast({ duration: 2000, title: "面试时间不能早于现在的时间", icon: "none", mask: true, }); // } // else if (time2 < currentTime) { // wx.showToast({ // duration: 2000, // title: "到达时间不能早于现在的时间", // icon: "none", // mask: true, // }); // } that.setData({ loading: false, }); return; } let reg = /^1[3456789]\d{9}$/; if (app.isEmptyCheck(e.detail.value.userName)) { wx.showToast({ duration: 2000, title: "请输入姓名", icon: "none", mask: true, }); that.setData({ loading: false, }); } else if (app.isEmptyCheck(e.detail.value.sex)) { wx.showToast({ duration: 2000, title: "请选择性别", icon: "none", mask: true, }); that.setData({ loading: false, }); } else if (that.data.ageIndex == -1) { wx.showToast({ duration: 2000, title: "请选择年龄", icon: "none", mask: true, }); that.setData({ loading: false, }); } else if (app.isEmptyCheck(e.detail.value.tel)) { wx.showToast({ duration: 2000, title: "请输入手机号", icon: "none", mask: true, }); that.setData({ loading: false, }); } // else if (app.isEmptyCheck(wx.getStorageSync("townsManInfoJob"))) { // wx.showToast({ // duration: 2000, // title: "请补全职位信息", // icon: "none", // mask: true, // }); // that.setData({ // loading: false, // }); // } else if (app.isEmptyCheck(e.detail.value.idCard)) { wx.showToast({ duration: 2000, title: "请输入身份证号", icon: "none", mask: true, }); that.setData({ loading: false, }); } // else if (this.data.policyIdx == '') { // wx.showToast({ // duration: 2000, // title: "请选择政策", // icon: "none", // mask: true, // }); // that.setData({ // loading: false, // }); // } else if (!reg.test(e.detail.value.tel)) { // 手机号正则校验 wx.showToast({ duration: 2000, title: "手机号格式不正确", icon: "none", mask: true, }); that.setData({ loading: false, }); } else { setTimeout(() => { that.formSubmit(e); }, 1); e.detail.value["idCardImageUrl"] = that.data.userInfo.idCardImageUrl; } } catch (error) { wx.showToast({ title: error, icon: "none", mask: true, }) that.setData({ loading: false, }); customRequest("/error/wx/saveErrorInfo", { header: 'headers', method: 'POST', data: { errorMsg: error } }).then((res) => { console.log(res); }) console.log(error); } }, getTel(e) { let tel = e.detail.value; this.setData({ tel: e.detail.value, }); }, setStorage() { let that = this; console.log(wx.getStorageSync("townsManInfo")); console.log(this.data.userInfo.tel); return new Promise((resolve, reject) => { console.log("写入缓存"); console.log(that.data.userInfo.tel); // if(app.isNotEmptyCheck(that.data.tel)){ // userInfo['tel'] = that.data.tel; // that.setData({ // tel:this.data.userInfo.tel, // userInfo: // }) // } console.log(that.data.jobInfo.id); let data = { ...that.data.userInfo, currentImg: that.data.currentImg, imgs: that.data.files, tel: that.data.userInfo.tel }; // currentTime: that.data.currentTime,currentTime2: that.data.currentTime2, storeJobId: that.data.jobInfo.id, jobName: that.data.jobInfo.jobName, agentName: that.data.agentName,policy:that.data.policy console.log('setStorage', data); wx.setStorage({ key: "townsManInfo", data, }); if (that.data.jobInfo.id) { let data2 = { currentTime: that.data.currentTime, currentTime2: that.data.currentTime2, storeJobId: that.data.jobInfo.id, jobName: that.data.jobInfo.jobName, agentId: that.data.agentId, agentName: that.data.agentName, policy: that.data.policy }; wx.setStorage({ key: "townsManInfoJob", data: data2, }); console.log('setStorage2', data2); } console.log(wx.getStorageSync("townsManInfoJob")); console.log(wx.getStorageSync("townsManInfo")); resolve(); }); }, getPolicyInfo(id) { customRequest("/overall/store/job/getStoreJobDetailById?storeJobId=" + id, { header: 'headers', method: 'POST', data: {} }).then((res) => { }) // wx.request({ // url: app.globalData.ip + "/overall/store/job/getStoreJobDetailById?storeJobId=" + id, // header: app.globalData.headers, // method: "POST", // success (res) { // console.log(res); // } // }) }, formSubmit: function (e) { var that = this; console.log(e); wx.showLoading({ title: "提交中...", mask: true, }); let userInfo = wx.getStorageSync("townsManInfo"); let jobInfo = wx.getStorageSync("townsManInfoJob"); // wx.showLoading({ // title: "提交中...", // mask: true, // }); // if (that.data.index == -1) { // wx.showToast({ // duration: 2000, // title: '请选择代理', // icon: 'none', // mask: true // }) // that.setData({ // loading: false // }) // } else // if (that.data.jobIndex == -1) { // wx.showToast({ // duration: 2000, // title: "请选择岗位", // icon: "none", // mask: true, // }); // that.setData({ // loading: false, // }); // } else { console.log(that.data.userInfo); // console.log('jobInfo', jobInfo); // console.log('that.data.jobInfo', that.data.jobInfo); // return let url = '/assistant/apply/handler/add' new Promise(function (resolve, reject) { var paramData = {}; console.log(' wx.getStorageSync("townsManInfoJob")', wx.getStorageSync("townsManInfoJob")); console.log(' paramData', that.data); delete paramData.config_str delete paramData.face_rect delete paramData.request_id delete paramData.success delete paramData.birth console.log('that.data.jobInfo.jobClassify ', that.data.jobInfo.jobClassify); paramData["interviewTimeStr"] = jobInfo.currentTime; // paramData["receptionTimeStr"] = jobInfo.currentTime2; paramData["agencyUserId"] = that.data.agentId; paramData["applyUserId"] = that.data.agentId; paramData["jobId"] = that.data.jobInfo.id; paramData["customJobId"] = that.data.jobInfo.id; // url = '/yishoudan/common/order/addBatch' paramData["userName"] = e.detail.value.userName; paramData["sex"] = e.detail.value.sex; paramData["age"] = that.data.userInfo.age; paramData["nation"] = that.data.userInfo.nationality; paramData["idCard"] = e.detail.value.idCard.replace(/\s+/g, ""); // paramData["num"] = e.detail.value.idCard; paramData["tel"] = e.detail.value.tel; paramData["idCardImageUrl"] = that.data.userInfo.idCardImageUrl; paramData["address"] = e.detail.value.address; paramData["desp"] = e.detail.value.desp; paramData["policyIdx"] = that.data.policyIdx console.log('paramData',paramData); // if(app.isNotEmptyCheck(userInfo.imgs)){ // paramData["imgs"] = userInfo.imgs.toString(); // } paramData["agencyId"] = that.data.agencyId; paramData["storeJobId"] = that.data.jobInfo.id; paramData["policy"] = jobInfo.policy; let urlss = []; if (app.isNotEmptyCheck(that.data.files)) { that.data.files.forEach((item) => { urlss.push(item.url); }); } paramData["imgs"] = urlss.toString(); resolve(paramData); }).then((paramData) => { console.log(paramData); customRequest(url, { header: 'headers', method: 'POST', data: paramData }).then((res) => { console.log(res); that.setData({ loading: false, }); if (res.data.status == 200) { console.log(that.data.pageFrom + "1首页 2报名页"); setTimeout(function () { // wx.navigateBack({ // delta: -1, // }); // wx.setStorageSync('comeFromPage','') wx.navigateTo({ url: `/pages/returnMessage/index?from=bill&type=success&msg=报名成功`, }); // if (that.data.pageFrom == 1) { // wx.switchTab({ // url: "../../firstBill/index", // }); // } else { // wx.switchTab({ // url: "../../workBench/index", // }); // } }, 100); wx.removeStorageSync('townsManInfo') wx.removeStorageSync('townsManInfoJob') } else { wx.showToast({ title: res.data.msg, icon: 'none', duration: 2000 }) // wx.navigateTo({ // url: `/pages/returnMessage/index?from=bill&type=fail&msg=${res.data.msg}&status${res.data.status}`, // }); } setTimeout(() => { wx.hideLoading(); }, 2000); }).catch((err) => { console.log('catch', err); wx.showToast({ duration: 2000, title: err, icon: "none", mask: true, }); setTimeout(() => { wx.hideLoading(); that.setData({ loading: false, }); }, 2000); }) }); // wx.navigateBack({ // delta: -1, // }) // }); // } }, inputTyping: function (e) { this.setData({ inputVal: e.detail.value, }); if (e.detail.value.length > 0) { this.setData({ searchListShow: true, }); this.getStoreList(e.detail.value); } else { this.setData({ searchListShow: false, }); } }, hidedrawershow(e) { console.log(e); this.setData({ [e.detail.type]: false }) console.log(this.data.drawerShow); }, showPolicy() { console.log(123); this.setData({ drawerShow: true }) console.log(this.data.drawerShow); }, getStoreList: function (searchKeys) { console.log(searchKeys); var that = this; that.data.searchKeys = searchKeys; // 60秒后重新获取验证码 customRequest("/store/getAllStoreAliasName", { header: 'headers', method: 'GET', data: { keys: searchKeys, } }).then((res) => { if (res.data.status == 200) { that.setData({ storeArray: res.data.data, }); } }) }, // setValue: function (e) { // let str = e.currentTarget.dataset.name; // let storeId = e.currentTarget.dataset.id; // console.log(storeId); // this.setData({ // inputVal: str, // storeId: storeId, // searchListShow: false, // }); // this.getJobList(storeId); // }, // getJobList: function (storeId) { // var that = this; // return new Promise((resolve, reject) => { // customRequest("/store/job/getJobNameByStoreId", { header: 'headers', method: 'GET', data: { storeId: storeId, } }).then((res) => { // if (res.data.status == 200) { // that.setData({ // jobArray: res.data.data, // }); // resolve(); // } // }) // }); // }, // bindPickerChangeJob: function (e) { // var that = this; // console.log("picker发送选择改变,携带值为", e.detail.value); // var storeJobId = that.data.jobArray[e.detail.value].id; // console.log(storeJobId); // that.getPolicyByStoreJobId(storeJobId); // this.setData({ // jobIndex: e.detail.value, // }); // }, bindPickerChangeNation(e) { let that = this; console.log("picker发送选择改变,携带值为", e.detail.value); var nationName = that.data.nationArray[e.detail.value].name; this.setData({ nationIndex: e.detail.value, ["userInfo.nationality"]: nationName, }); }, getJobDetailBocai(id) { let that = this return new Promise((resolve, reject) => { customRequest("/yishoudan/custom/job/detailV2/" + id, { header: 'headers', method: 'GET', data: {} }).then(({ data }) => { console.log('data getJobDetailBocai', data); // console.log('data getJobDetailBocai getJobDetailBocai', `1.服务费\n${commonUtil.getReturnFeeTypeName1ById(data.data.record.returnFeeType, data.data.record.returnFee?data.data.record.returnFee /100:'')}\n\n2.薪资待遇\n${data.data.record.salaryDetail}`); if (data.status == 200) { console.log(data.data.record); that.setData({ policy: `1.服务费:${commonUtil.getReturnFeeTypeName1ById(data.data.record.returnFeeType, data.data.record.returnFee?data.data.record.returnFee /100:'')}\n\n2.薪资待遇:${data.data.record.salaryDetail}`, isShowZhedie: true, }) resolve(); } }).catch((err) => { console.log(err); reject(); }) }) }, getJobDetail(id) { let that = this return new Promise((resolve) => { customRequest("/overall/store/job/getStoreJobDetailById?storeJobId=" + id, { header: 'headers', method: 'POST', data: {} }).then(({ data }) => { console.log('data getJobDetail', data); if (data.status == 200) { console.log(data.data.storeJob); if (data.data.storeJob.policyNum == '') { data.data.storeJob.policyNum = 1 console.log(data.data.storeJob.policyNum) } let list = [] for (let i = 0; i < data.data.storeJob.policyNum; i++) { let pickerStr if (i <= 9) { switch (i) { case 0: pickerStr = '政策一' break; case 1: pickerStr = '政策二' break; case 2: pickerStr = '政策三' break; case 3: pickerStr = '政策四' break; case 4: pickerStr = '政策五' break; case 5: pickerStr = '政策六' break; case 6: pickerStr = '政策七' break; case 7: pickerStr = '政策八' break; case 8: pickerStr = '政策九' break; case 9: pickerStr = '政策十' break; default: pickerStr = '政策' + (index + 1) break; } list[i] = { value: i + 1, name: pickerStr } } } console.log(list); that.setData({ // policy: res.data.data, isShowZhedie: true, zhengceTextList: list }); console.log(that.data.zhengceTextList); resolve(); } }).catch(() => { reject(); }) }) }, getPolicyByStoreJobId: function (storeJobId) { var that = this; return new Promise((resolve, reject) => { customRequest("/store/job/getPolicyByStoreJobId", { header: 'headers', method: 'GET', data: { storeJobId: storeJobId ? storeJobId : "" } }).then((res) => { console.log('getPolicyByStoreJobId', res); if (res.data.status == 200) { that.setData({ policy: res.data.data, isShowZhedie: true, }); resolve(); } }).catch(() => { reject() }) }); }, // 自有政策获取 getPolicyById: function (storeJobId) { var that = this; return new Promise((resolve, reject) => { customRequest(`/yishoudan/custom/job/getPolicyStr/${storeJobId}`, { header: 'headers', method: 'GET', data: {} }).then((res) => { console.log('getPolicyById', res); // if (res.data.status == 200) { let data = res.data.data let info = "员工薪资:\n" + data.salaryDetail + '\n\n' + '代理政策:\n' + data.agencyReturnFeeDesp console.log('info', info); that.setData({ policy: info, isShowZhedie: true, }); // resolve(); // } }).catch(() => { reject() }) }); }, changeDateTime(e) { var dateTimeArray = this.data.dateTimeArray, dateTime = e.detail.value; this.setData({ // dateTime: e.detail.value, currentTime: dateTimeArray[0][dateTime[0]].replace("年", "") + "-" + dateTimeArray[1][dateTime[1]].replace("月", "") + "-" + dateTimeArray[2][dateTime[2]].replace("日", "") + " " + dateTimeArray[3][dateTime[3]], }); console.log(this.data.dateTimeArray); let result = wx.getStorageSync("townsManInfoJob"); result.currentTime = this.data.currentTime; wx.setStorageSync("townsManInfoJob", result); }, changeDateTimeColumn(e) { console.log(e); var arr = this.data.dateTime, dateArr = this.data.dateTimeArray; arr[e.detail.column] = e.detail.value; console.log(arr); console.log(dateArr[0][arr[0]], dateArr[1][arr[1]]); dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]); for (let index = 0; index < dateArr[2].length; index++) { dateArr[2][index] = dateArr[2][index] + "日"; } // .replace("年",'').replace("月",'').replace("日",'') this.setData({ dateTimeArray: dateArr, dateTime: arr, }); }, changeDateTime2(e) { var dateTimeArray = this.data.dateTimeArray, dateTime = e.detail.value; this.setData({ // dateTime: e.detail.value, currentTime2: dateTimeArray[0][dateTime[0]].replace("年", "") + "-" + dateTimeArray[1][dateTime[1]].replace("月", "") + "-" + dateTimeArray[2][dateTime[2]].replace("日", "") + " " + dateTimeArray[3][dateTime[3]], }); console.log(this.data.dateTimeArray); let result = wx.getStorageSync("townsManInfoJob"); result.currentTime2 = this.data.currentTime2; wx.setStorageSync("townsManInfoJob", result); }, changeDateTimeColumn2(e) { var arr = this.data.dateTime2, dateArr = this.data.dateTimeArray; arr[e.detail.column] = e.detail.value; dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]); for (let index = 0; index < dateArr[2].length; index++) { dateArr[2][index] = dateArr[2][index] + "日"; } // .replace("年",'').replace("月",'').replace("日",'') this.setData({ dateTimeArray: dateArr, dateTime2: arr, }); }, // getAgencyList: function (searchKeys) { // var that = this; // that.data.searchKeysA = searchKeys; // // 60秒后重新获取验证码 // wx.request({x // url: app.globalData.ip + "/agency/getByPmdUserId", // data: { // agencyName: searchKeys, // // pmdUserId: 101125 // }, // header: app.globalData.headers, // method: "GET", // success: function (res) { // console.log(res); // if (res.data.status == 200) { // that.setData({ // agentArray: res.data.data, // }); // } // }, // fail: function (res) {}, // }); // }, /** * 生命周期函数--监听页面显示 */ getImgs(userId) { var that = this; customRequest("/imgs/list/" + userId + "?type=20", { header: 'headers', method: 'GET', data: {} }).then((res) => { let currFils = []; let regs = /\.(jpg|jpeg|png)(\?.*)?$/; // res.data.data.storeImage.forEach((item) => { // item.isImg = regs.test(item.url.toLowerCase()); // if(app.isEmptyCheck(item.recordState)){ // item.recordState = 1 // } // }); if (app.isNotEmptyCheck(res.data.data.userImgs)) { res.data.data.userImgs.forEach((item) => { if (regs.test(item.url.toLowerCase())) { currFils.push({ url: item.url, id: item.id }); } }); } that.setData({ files: currFils, urls: currFils, }); }) }, onShow: function () { let that = this; that.setData({ pageShow: false, }); // wx.hideTabBar({ // success(e) { // setTimeout(() => { that.setData({ pageShow: true, }); // }, 500); // // that.setData({ // // currentJobDrawer: { ...event.currentTarget.dataset.item, index: event.currentTarget.dataset.index }, // // drawerShow: true, // // }); // }, // }); // if (typeof this.getTabBar === "function" && this.getTabBar()) { // this.getTabBar().setData({ // selected: 1, // isShow: false, // }); // } that.pushImg(); for (let i = 16; i < 70; i++) { that.data.ageArray.push(i); } // let that = this; // let info = wx.getStorageSync("townsManInfo"); // if (app.isNotEmptyCheck(info)) { // this.setData({ // userInfo: info, // currentImg: info.currentImg, // currentTime: info.currentTime, // }); // console.log(info); // if (info.sex == "男") { // this.data.sex[0].checked = true; // } else if (info.sex == "女") { // this.data.sex[1].checked = true; // } // that.data.nationArray.forEach((item, index) => { // if (item.name.indexOf(info.nationality) > -1 && info.nationality != "") { // console.log("isin"); // that.setData({ // nationIndex: index, // }); // } // }); // console.log(that.data.nationIndex); // this.setData({ // sex: this.data.sex, // }); // } // this.pickerTap(); let hour = new Date().getHours(); if (hour < 20 && hour >= 6) { if (that.data.currentTime == that.data.copyTime) { that.data.currentTime = that.data.currentTime + " " + (hour + 1) + ":00"; that.data.currentTime2 = that.data.currentTime2 + " " + (hour + 1) + ":00"; } } else if (hour >= 20) { if (that.data.currentTime == that.data.copyTime) { that.data.currentTime = that.data.currentTime + " " + "19:30"; that.data.currentTime2 = that.data.currentTime2 + " " + "19:30"; } } else if (hour < 6) { if (that.data.currentTime == that.data.copyTime) { that.data.currentTime = that.data.currentTime + " " + "6:00"; that.data.currentTime2 = that.data.currentTime2 + " " + "6:00"; } } this.setData({ currentTime: that.data.currentTime, currentTime2: that.data.currentTime2, }); var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear, this.data.currentTime); console.log(obj); console.log(obj.dateTimeArray); for (let index = 0; index < obj.dateTimeArray[0].length; index++) { obj.dateTimeArray[0][index] = obj.dateTimeArray[0][index] + "年"; } for (let index = 0; index < obj.dateTimeArray[1].length; index++) { obj.dateTimeArray[1][index] = obj.dateTimeArray[1][index] + "月"; } for (let index = 0; index < obj.dateTimeArray[2].length; index++) { obj.dateTimeArray[2][index] = obj.dateTimeArray[2][index] + "日"; } console.log('that.data.jobInfo', that.data.jobInfo) if (that.data.jobInfo.id) { console.log('that.data.jobInfo.jobClassify', that.data.jobInfo.jobClassify); // if (that.data.jobInfo.jobClassify == 2) { // that.getPolicyById(that.data.jobInfo.id) that.getJobDetailBocai(that.data.jobInfo.id) // } else { // that.getPolicyByStoreJobId(that.data.jobInfo.id).then(function () {}); // that.getJobDetail(that.data.jobInfo.id).then(function () { let data = { currentTime: that.data.currentTime, currentTime2: that.data.currentTime2, storeJobId: that.data.jobInfo.id, jobName: that.data.jobInfo.jobName, agentName: that.data.agentName, policy: that.data.policy }; console.log(data); wx.setStorage({ key: "townsManInfoJob", data, }); // }) // } } console.log(app.globalData.loginUserInfo); if (this.data.jobInfo.id) { this.getAgencyList() } this.setData({ managerRoleClassify: app.globalData.loginUserInfo.managerRoleClassify, corpUserFlag: app.globalData.loginUserInfo.corpUserFlag, dateTimeArray: obj.dateTimeArray, dateTime: obj.dateTime, dateTimeArray2: obj.dateTimeArray, dateTime2: obj.dateTime, ageArray: that.data.ageArray, }); console.log(); }, switch1Change: function (e) { console.log("radio发生change事件,携带value值为:", e.detail.value); console.log(e.detail.value); var check = this.data.switch1Checked; if (check) { this.data.switch1Checked = false; console.log("已取消选中"); wx.showToast({ title: "请先阅读并同意《服务协议》及《隐私政策》", icon: "none", duration: 2000, }); } else { this.data.switch1Checked = true; console.log("已选中"); } this.setData({ switch1Checked: this.data.switch1Checked, }); // if(!e.detail.value){ // } }, policyChange(e) { console.log('e', e); console.log(this.data.zhengceTextList); const items = this.data.zhengceTextList console.log(items); this.data.policyStr = e.detail.value this.data.policyIdx = items[e.detail.value].value; // console.log(this.data.policyStr); this.setData({ policyStr: Number(this.data.policyStr), policyIdx: this.data.policyIdx, // policyList: items }) // console.log(this.data.policyStr); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function (e) { console.log("isHide"); console.log(e); }, // tabbar点击监听 onTabItemTap(e) { console.log(e); let that = this; if (!app.globalData.isLogin) { if (e.index == 1) { wx.redirectTo({ url: "/pages/login/index", }); } } else { console.log("1250", app.globalData.loginUserInfo.agencyStatus); if (app.globalData.loginUserInfo.agencyStatus != 1) { wx.redirectTo({ url: "/pages/tobeAgency/index", }); } } }, // checkPicker(e){ // if(!this.data.storeJobId){ // return false // } // }, /** * 预览身份证图片 * * */ previewImage(e) { let that = this; console.log(e); wx.previewImage({ current: that.data.idCardImg, // 当前显示图片的 http 链接 urls: [that.data.idCardImg], // 需要预览的图片 http 链接列表 }); }, /** * 预览附件图片 * * */ previewImg() {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { console.log("isonUnload"); this.setData({ userInfo: { name: "", address: "", age: "", nationality: "", sex: "", num: "", idCardImageUrl: "", }, }); wx.removeStorageSync("townsManInfo"); // wx.removeStorageSync("townsManInfo"); // wx.switchTab({ // url: "../firstBill/index", // }); // console.log(wx.getStorageSync("townsManInfo")); }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage1: function () {}, });