Files
qingcheng-xiaochengxu/pages/loginModule/employeeApplyQuery/employeeApplyQuery.js

147 lines
3.4 KiB
JavaScript
Raw Normal View History

2025-07-20 18:22:59 +08:00
import { baseUrl } from "../../../request";
Page({
data: {
status: '', // 审核状态: 审核中、审核通过、审核失败
result: {} // 查询结果数据
},
// 输入框事件
onInput(e) {
this.setData({
inputIdCard: e.detail.value // 获取身份证输入
});
},
// 查询操作
onSearch() {
const inputIdCard = this.data.inputIdCard;
if (!inputIdCard) {
wx.showToast({
title: '请输入身份证',
icon: 'none'
});
return;
}
// 查询的接口
wx.request({
url: baseUrl + '/advancementApply/query/credential', // 替换为你的后端查询接口
method: 'POST',
data: { templateString: inputIdCard },
success: (res) => {
console.log('后端返回---->',res.data);
if (res.data.code === 1) {
// 假设返回的查询结果是以下格式
const result = res.data.data; // 获取返回的数据
// 更新审核状态和查询结果
this.setData({
status: result.reviewStatus, // 审核状态
result: {
name: result.name, // 姓名
phone: result.phone, // 手机号
idCard: result.idCard, // 身份证号
failureReason: result.rejectReason, // 失败原因
password: result.userPassword, // 密码(如果有的话)
userRole: result.userRole, // 用户级别
id: result.id
}
});
} else {
wx.showToast({
title: res.data.message,
icon: 'none'
});
}
},
fail: () => {
wx.showToast({
title: '请求失败,请重试',
icon: 'none'
});
}
});
},
// 重新申请操作
onReapply() {
wx.showToast({
title: '重新申请中...',
icon: 'none'
});
},
// 用户撤销申请
revokeApplication() {
const { id } = this.data.result
console.log('id--->',id);
wx.showModal({
title: '确认',
content: '是否撤销申请',
complete: (res) => {
if (res.cancel) {
}
if (res.confirm) {
wx.request({
url: baseUrl + '/advancementApply/modify/status',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token')
},
data: {
id: id
},
success: res => {
console.log('后端返回11---->',res.data);
if (res.data.code === 1 ) {
this.setData({
status: ''
})
} else {
wx.showToast({
title: '系统错误',
})
}
}
})
}
}
})
},
// 用户去登录
gotoLogin() {
wx.navigateBack({
delta: 2
})
},
// 用户重新申请
reapply() {
wx.navigateBack({
delta: 1
})
},
copyPassword() {
const { password } = this.data.result
wx.setClipboardData({
data: password, // 要复制的内容
success(res) {
wx.showToast({
title: '已复制到剪贴板',
icon: 'success'
});
},
fail() {
wx.showToast({
title: '复制失败',
icon: 'none'
});
}
});
}
});