修改了经理端部分代码

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()
}
});

View File

@ -22,15 +22,6 @@ Page({
const phoneNumber = this.data.phoneNumber.trim();
const { supervisorUserId } = this.data;
if (!nickName) {
wx.showToast({ title: '请输入主管名称', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
wx.request({
url: baseUrl + '/perform/query/staff',
method: 'POST',
@ -67,7 +58,7 @@ Page({
onSearchSupId() {
const { supervisorUserId } = this.data;
wx.request({
url: baseUrl + '/perform/query/staff',
method: 'POST',
@ -107,9 +98,8 @@ Page({
},
onLoad(options) {
console.log('--->',options);
this.setData({
supervisorUserId: options.id,
supervisorUserId: options.supId,
})
this.onSearchSupId();
},

View File

@ -57,7 +57,7 @@
<!-- 基本信息 -->
<view class="flex-row justify-between self-stretch group">
<view class="flex-col items-start self-center">
<text class="font_2">编号:{{item.id}}</text>
<text class="font_2">编号:{{index + 1}}</text>
<text class="font text_8 mt-13">员工:{{item.nickName}}</text>
</view>
<view class="flex-col justify-start self-start text-wrapper_4" bind:tap="gotoUser" data-id="{{ item.userId }}">

View File

@ -21,16 +21,6 @@ Page({
onSearch() {
const nickName = this.data.nickName.trim();
const phoneNumber = this.data.phoneNumber.trim();
const { id } = this.data
if (!nickName) {
wx.showToast({ title: '请输入主管名称', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
wx.request({
url: baseUrl + '/perform/query/supervisor',
@ -89,12 +79,13 @@ Page({
break;
}
this.setData({ showRole });
this.onSearch()
},
changeStaff(e) {
const { id } = e.currentTarget.dataset;
console.log(id)
wx.navigateTo({
url: `/pages/dashboardModule/staffPerformance/staffPerformance?supId=${id}`,
})

View File

@ -57,7 +57,7 @@
<!-- 基本信息 -->
<view class="flex-row justify-between self-stretch group">
<view class="flex-col items-start self-center">
<text class="font_2">编号:{{item.id}}</text>
<text class="font_2">编号:{{index + 1}}</text>
<text class="font text_8 mt-13">主管:{{item.nickName}}</text>
</view>
<view class="flex-col justify-start self-start text-wrapper_4" bind:tap="changeStaff" data-id="{{ item.userId }}">