修改了经理端部分代码

This commit is contained in:
2025-08-07 11:45:28 +08:00
parent 3996895c0d
commit d1b4fa8ca3
11 changed files with 61 additions and 66 deletions

View File

@ -5,7 +5,7 @@ Page({
// 用于存储输入框数据
nickName: '',
phoneNumber: '',
selectedSortField: '待选择', // 默认选择"待选择"
selectedSortField: '员工数量', // 默认选择"待选择"
selectedSortOrder: '升序', // 默认选择升序
sortFieldsByManager: ['员工数量', '推广人数', '下单数量', '总订单金额', '净成交金额'],
sortFieldsBySupervisor: ['推广人数', '下单数量', '总订单金额', '净成交金额'],
@ -57,36 +57,36 @@ Page({
// 搜索按钮点击
onSearch() {
const { role } = this.data;
// —— 新增:校验主管名称 ——
const nameRegex = /^[\u4e00-\u9fa5]+$/;
if (!this.data.nickName) {
wx.showToast({ title: '主管名称不能为空', icon: 'none' });
return;
}
if (!nameRegex.test(this.data.nickName)) {
wx.showToast({ title: '主管名称只能为汉字', icon: 'none' });
return;
}
const { role } = this.data;
// // —— 新增:校验主管名称 ——
// const nameRegex = /^[\u4e00-\u9fa5]+$/;
// if (!this.data.nickName) {
// wx.showToast({ title: '主管名称不能为空', icon: 'none' });
// return;
// }
// if (!nameRegex.test(this.data.nickName)) {
// wx.showToast({ title: '主管名称只能为汉字', icon: 'none' });
// return;
// }
// —— 新增:校验手机号 ——
if (!this.data.phoneNumber) {
wx.showToast({ title: '手机号不能为空', icon: 'none' });
return;
}
if (this.data.phoneNumber.length < 11) {
wx.showToast({ title: '手机号不够11位', icon: 'none' });
return;
}
// // —— 新增:校验手机号 ——
// if (!this.data.phoneNumber) {
// wx.showToast({ title: '手机号不能为空', icon: 'none' });
// return;
// }
// if (this.data.phoneNumber.length < 11) {
// wx.showToast({ title: '手机号不够11位', icon: 'none' });
// return;
// }
// 原排序条件校验,保持不变
if (this.data.selectedSortField === '待选择') {
wx.showToast({
title: '排序条件不能为空',
icon: 'none'
});
return;
}
// if (this.data.selectedSortField === '待选择') {
// wx.showToast({
// title: '排序条件不能为空',
// icon: 'none'
// });
// return;
// }
// 显示加载中
wx.showLoading({
@ -187,5 +187,6 @@ if (this.data.selectedSortField === '待选择') {
break;
}
this.setData({ showRole });
this.onSearch()
}
});