71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
// pages/customer/addCard/index.js
|
|
Page({
|
|
data: {
|
|
c_time:'',
|
|
},
|
|
//生命周期函数--监听页面加载
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
|
|
//输入
|
|
inputTx(e) {
|
|
this.setData({
|
|
[e.currentTarget.dataset.key]: e.detail.value
|
|
})
|
|
},
|
|
|
|
putaddStaff() {
|
|
let that = this
|
|
if (that.data.uname == '' ) {
|
|
wx.showToast({
|
|
title: '请输入员工姓名',
|
|
icon: 'none'
|
|
})
|
|
} else if (!/^1[3456789]\d{9}$/.test(that.data.mobile)){
|
|
wx.showToast({
|
|
title: '请输入正确的手机号',
|
|
icon: 'none'
|
|
})
|
|
} else{
|
|
that.setData({
|
|
submitFlag: true,
|
|
})
|
|
|
|
let params = {};
|
|
params['id'] = this.data.id;
|
|
params['uname'] = that.data.uname;
|
|
params['mobile'] = that.data.mobile;
|
|
params['role'] = that.data.role?1:0;
|
|
_.apiQuery.putDxtEmployeesInfo(params).then(res => {
|
|
wx.showModal({
|
|
title: '添加成功',
|
|
content: '',
|
|
confirmText: "继续添加",
|
|
confirmColor: "#1282e1",
|
|
cancelText: "返回",
|
|
cancelColor: "#000000",
|
|
success(res) {
|
|
if (res.confirm) {
|
|
that.setData({
|
|
uname:'',
|
|
mobile:'',
|
|
role:false,
|
|
submitFlag:false,
|
|
})
|
|
} else if (res.cancel) {
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}).catch(res=>{
|
|
this.setData({
|
|
submitFlag: false,
|
|
})
|
|
});
|
|
}
|
|
},
|
|
|
|
}) |