You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
373 lines
10 KiB
JavaScript
373 lines
10 KiB
JavaScript
// pages/jobDetail/editDetail/index.js
|
|
const app = getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
genderRemark:'',
|
|
defaultValue: "",
|
|
timeValue:"",
|
|
nanChecked:false,
|
|
nvChecked:false,
|
|
salaryArray: [],
|
|
salaryIndex: [-1, -1],
|
|
salaryArrayN: [],
|
|
salaryIndexN: [-1, -1],
|
|
},
|
|
bindMultiPickerChange(e) {
|
|
this.setData({
|
|
salaryIndex: e.detail.value,
|
|
nanChecked:true
|
|
})
|
|
},
|
|
bindMultiPickerChangeN(e) {
|
|
this.setData({
|
|
salaryIndexN: e.detail.value,
|
|
nvChecked:true
|
|
})
|
|
},
|
|
//滑动列时触发该事件
|
|
bindMultiPickerColumnChange(e) {
|
|
let currentColunm = e.detail.column;
|
|
let currentClounmIndex = e.detail.value;
|
|
let salaryArray = this.data.salaryArray
|
|
console.log('修改的列为', currentColunm, ',值为', currentClounmIndex);
|
|
let data = {
|
|
salaryArray: this.data.salaryArray,
|
|
salaryIndex: this.data.salaryIndex
|
|
}
|
|
data.salaryIndex[currentColunm] = currentClounmIndex
|
|
// data.salaryIndex[1] = currentClounmIndex;
|
|
this.setData(data)
|
|
this.setData({
|
|
nanChecked:true
|
|
})
|
|
},
|
|
|
|
bindMultiPickerColumnChangeN(e) {
|
|
let currentColunm = e.detail.column;
|
|
let currentClounmIndex = e.detail.value;
|
|
let salaryArrayN = this.data.salaryArrayN
|
|
console.log('修改的列为', currentColunm, ',值为', currentClounmIndex);
|
|
let data = {
|
|
salaryArrayN: this.data.salaryArrayN,
|
|
salaryIndexN: this.data.salaryIndexN
|
|
}
|
|
data.salaryIndexN[currentColunm] = currentClounmIndex
|
|
// data.salaryIndexN[1] = currentClounmIndex;
|
|
this.setData(data);
|
|
this.setData({
|
|
nvChecked:true
|
|
})
|
|
},
|
|
|
|
changeNan(){
|
|
this.setData({
|
|
nanChecked: !this.data.nanChecked
|
|
})
|
|
},
|
|
changeNv(){
|
|
this.setData({
|
|
nvChecked: !this.data.nvChecked
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
this.setData({
|
|
jobDetail: wx.getStorageSync('jobDetail')
|
|
})
|
|
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
var that = this;
|
|
var currName = this.data.name
|
|
|
|
let salaryStart = [],
|
|
salaryEnd = [],
|
|
salaryArray = [];
|
|
for (let i = 16; i < 70; i++) {
|
|
salaryStart.push(`${i}`);
|
|
salaryEnd.push(`${i+1}`)
|
|
}
|
|
salaryArray.push(salaryStart);
|
|
salaryArray.push(salaryEnd);
|
|
that.setData({
|
|
salaryArray: salaryArray,
|
|
salaryArrayN: salaryArray
|
|
})
|
|
console.log(that.data.jobDetail);
|
|
|
|
if(app.isNotEmptyCheck(that.data.jobDetail.storeJob.genderRemark)){
|
|
that.setData({
|
|
genderRemark:that.data.jobDetail.storeJob.genderRemark,
|
|
})
|
|
}
|
|
|
|
if(app.isNotEmptyCheck(that.data.jobDetail.storeJob.minAgeMan)){
|
|
that.setData({
|
|
nanChecked:true,
|
|
salaryIndex:[that.data.jobDetail.storeJob.minAgeMan - 16,that.data.jobDetail.storeJob.maxAgeMan - 17],
|
|
})
|
|
// that.setData({
|
|
|
|
// salaryIndexN:[that.data.jobDetail.storeJob.minAgeWoman - 16,that.data.jobDetail.storeJob.maxAgeWoman - 17]
|
|
// })
|
|
}
|
|
if(app.isNotEmptyCheck(that.data.jobDetail.storeJob.minAgeWoman)){
|
|
that.setData({
|
|
nvChecked:true,
|
|
salaryIndexN:[that.data.jobDetail.storeJob.minAgeWoman - 16,that.data.jobDetail.storeJob.maxAgeWoman - 17]
|
|
})
|
|
}
|
|
|
|
// that.setData({
|
|
// salaryIndex:[that.data.jobDetail.storeJob.minAgeMan - 16,that.data.jobDetail.storeJob.maxAgeMan - 17],
|
|
// salaryIndexN:[that.data.jobDetail.storeJob.minAgeWoman - 16,that.data.jobDetail.storeJob.maxAgeWoman - 17]
|
|
// })
|
|
},
|
|
formSubmit(e) {
|
|
var that = this;
|
|
wx.showLoading({
|
|
title: '提交中...',
|
|
})
|
|
|
|
console.log(e.detail.value)
|
|
|
|
let arr = [];
|
|
var tempArr = [];
|
|
let submitArr = {};
|
|
|
|
if(that.data.nanChecked){
|
|
// arr.push(that.push('minAgeMan', that.data.salaryIndex[0]+16));
|
|
// arr.push(that.push('maxAgeMan', that.data.salaryIndex[1]+17));
|
|
tempArr.push((that.data.salaryIndex[0]+16) * 1);
|
|
tempArr.push((that.data.salaryIndex[1]+17) * 1);
|
|
// submitArr.push({'minAgeMan':that.data.salaryIndex[0]+16});
|
|
// submitArr.push({'maxAgeMan':that.data.salaryIndex[1]+17});
|
|
submitArr['minAgeMan'] = that.data.salaryIndex[0]+16;
|
|
submitArr['maxAgeMan'] = that.data.salaryIndex[1]+17;
|
|
}else{
|
|
// arr.push(that.push('minAgeMan', ""));
|
|
// arr.push(that.push('maxAgeMan', ""));
|
|
// submitArr.push({'minAgeMan':''});
|
|
// submitArr.push({'maxAgeMan':''});
|
|
submitArr['minAgeMan'] = '';
|
|
submitArr['maxAgeMan'] = '';
|
|
}
|
|
if(that.data.nvChecked){
|
|
// arr.push(that.push('minAgeWoman', that.data.salaryIndexN[0]+16));
|
|
// arr.push(that.push('maxAgeWoman', that.data.salaryIndexN[1]+17));
|
|
tempArr.push((that.data.salaryIndexN[0]+16) * 1);
|
|
tempArr.push((that.data.salaryIndexN[1]+17) * 1);
|
|
// submitArr.push({'minAgeWoman':that.data.salaryIndexN[0]+16});
|
|
// submitArr.push({'maxAgeWoman':that.data.salaryIndexN[1]+17});
|
|
submitArr['minAgeWoman'] = that.data.salaryIndexN[0]+16;
|
|
submitArr['maxAgeWoman'] = that.data.salaryIndexN[1]+17;
|
|
}else{
|
|
// arr.push(that.push('minAgeWoman', ""));
|
|
// arr.push(that.push('maxAgeWoman', ""));
|
|
// submitArr.push({'minAgeWoman':''});
|
|
// submitArr.push({'maxAgeWoman':''});
|
|
submitArr['minAgeWoman'] = '';
|
|
submitArr['maxAgeWoman'] = '';
|
|
}
|
|
console.log(tempArr)
|
|
if (tempArr.length > 0) {
|
|
var min = Math.min(...tempArr);
|
|
var max = Math.max(...tempArr);
|
|
// arr.push(that.push('minAge', min));
|
|
// arr.push(that.push('maxAge', max));
|
|
// submitArr.push({'minAge':min});
|
|
// submitArr.push({'maxAge':max});
|
|
|
|
submitArr['minAge'] = min;
|
|
submitArr['maxAge'] = max;
|
|
} else {
|
|
// arr.push(that.push('minAge', ''));
|
|
// arr.push(that.push('maxAge', ''));
|
|
// submitArr.push({'minAge':''});
|
|
// submitArr.push({'maxAge':''});
|
|
submitArr['minAge'] = '';
|
|
submitArr['maxAge'] = '';
|
|
}
|
|
|
|
console.log(submitArr)
|
|
let currData = submitArr;
|
|
// currData = submitArr
|
|
currData["storeJobId"] = that.data.jobDetail.storeJob.id;
|
|
currData["genderRemark"] = e.detail.value.genderRemark;
|
|
// currData["minAgeMan"] = submitArr.minAgeMan;
|
|
// currData["maxAgeMan"] = submitArr.maxAgeMan;
|
|
// currData["minAgeWoman"] = submitArr.minAgeWoman;
|
|
// currData["maxAgeWoman"] = submitArr.maxAgeWoman;
|
|
// currData["minAge"] = submitArr.minAge;
|
|
// currData["maxAge"] = submitArr.maxAge;
|
|
|
|
wx.request({
|
|
url: app.globalData.ip + "/store/job/updateAgesex",
|
|
header: app.globalData.header,
|
|
data: currData,
|
|
method: "POST",
|
|
success: function (res) {
|
|
console.log(res);
|
|
if (res.data.status == 200) {
|
|
wx.showToast({
|
|
title: '修改成功',
|
|
icon: 'success',
|
|
duration: 1000
|
|
})
|
|
setTimeout(function () {
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
})
|
|
wx.navigateBack({
|
|
delta: 1,
|
|
})
|
|
}, 1000)
|
|
}else{
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
})
|
|
wx.showToast({
|
|
title: '修改失败',
|
|
icon: 'success',
|
|
duration: 1000
|
|
})
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
// // reject(res);
|
|
// console.log(res);
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
})
|
|
wx.showToast({
|
|
title: '修改失败',
|
|
icon: 'success',
|
|
duration: 1000
|
|
})
|
|
},
|
|
});
|
|
|
|
|
|
// Promise.all(arr).then((res) => {
|
|
|
|
// wx.setStorageSync('isLoad', true);
|
|
// wx.showToast({
|
|
// title: '修改成功',
|
|
// icon: 'success',
|
|
// duration: 1000
|
|
// })
|
|
// setTimeout(function () {
|
|
// wx.hideLoading({
|
|
// success: (res) => {},
|
|
// })
|
|
// wx.navigateBack({
|
|
// delta: 1,
|
|
// })
|
|
// }, 1000)
|
|
// }).catch((err) => {
|
|
// console.log(err)
|
|
// wx.hideLoading({
|
|
// success: (res) => {},
|
|
// })
|
|
// wx.showToast({
|
|
// title: '修改失败',
|
|
// icon: 'success',
|
|
// duration: 1000
|
|
// })
|
|
// })
|
|
// if(that.data.index != 4 && that.data.index != 6 && that.data.index != 7){
|
|
// currData["salaryClassifyValue"] = e.detail.value.salaryClassifyValue * 100;
|
|
// }
|
|
|
|
// currData["salaryClassify"] = that.data.index;
|
|
// if (app.isNotEmptyCheck(e.detail.value.MonthlyPay)) {
|
|
// var mrArr = e.detail.value.MonthlyPay.split("-");
|
|
// if (mrArr.length == 1) {
|
|
// currData["minMonthlyPay"] = mrArr[0] * 100;
|
|
// } else if (mrArr.length == 2) {
|
|
// currData["minMonthlyPay"] = mrArr[0] * 100;
|
|
// currData["maxMonthlyPay"] = mrArr[1] * 100;
|
|
// }
|
|
// }
|
|
|
|
|
|
},
|
|
push(filedName, filedValue){
|
|
// let currData = {};
|
|
// let that = this;
|
|
// currData["id"] = that.data.jobDetail.storeJob.id;
|
|
// currData["fieldName"] = filedName;
|
|
// currData["value"] = filedValue;
|
|
// return new Promise(function (resolve, reject){
|
|
// wx.request({
|
|
// url: app.globalData.ip + "/store/job/updateJobField",
|
|
// header: app.globalData.header,
|
|
// data: currData,
|
|
// method: "POST",
|
|
// success: function (res) {
|
|
|
|
// resolve(res);
|
|
// // debugger;
|
|
// },
|
|
// fail: function (res) {
|
|
// reject(res);
|
|
// console.log(res);
|
|
// },
|
|
// });
|
|
// })
|
|
},
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |