修改了经理端部分代码

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: ['推广人数', '下单数量', '总订单金额', '净成交金额'],
@ -58,35 +58,35 @@ 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 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',
@ -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 }}">

View File

@ -21,12 +21,14 @@ Page({
passwordType: true,
role: '', // 登录角色
showRole: '',
isShowRegister: true
},
onLoad(options) {
const role = options.role || ''
const showRole = roleMap.get(role) || ''
this.setData({ role, showRole })
if (role === 'manager') this.setData({isShowRegister: false})
},
// 切换到“密码登录”,只清空表单字段

View File

@ -92,7 +92,7 @@
</view>
<!-- 去注册 -->
<view class="self-center group_5">
<view class="self-center group_5" wx:if="{{isShowRegister}}">
<text class="font_4 text_11">没有账号?</text>
<text class="font_5 text_12" bindtap="gotoRegister">去注册→</text>
</view>

View File

@ -31,6 +31,7 @@ Page({
title: '退出成功',
icon: 'success'
})
wx.removeStorageSync('token')
setTimeout(() => {
wx.reLaunch({
url: '/pages/welcome/homePage/homePage',

View File

@ -15,7 +15,8 @@ Page({
userAccount: "",
invitationCode: "",
showPopup: false, // 控制弹窗显示与否
qrcode: "https://img.picui.cn/free/2025/05/29/6837c53582068.gif", // 设置二维码图片的路径
isShowOrder: true,
qrcode: "", // 设置二维码图片的路径
userRole: "",
id: 0,
},
@ -111,8 +112,9 @@ Page({
success: res => {
if (res.data.code === 1) {
let result = res.data.data
console.log('====fdfs>', res)
this.setData({
// qrcode: globalImgUrl + result.inviteQrCode
qrcode: globalImgUrl + result.inviteQrCode
})
} else {
wx.showToast({
@ -136,22 +138,24 @@ Page({
success: res => {
console.log('用户信息---->',res.data);
if (res.data.code === 1) {
let result = res.data.data
this.setData({
nickName: res.data.data.nickName,
nickName: result.nickName,
// TODO 头像未连接
userAvatar: res.data.data.userAvatar,
phoneNumber: res.data.data.phoneNumber,
userAccount: res.data.data.userAccount,
invitationCode: res.data.data.invitationCode,
userRole: res.data.data.userRole,
id: res.data.data.id,
userAvatar: result.userAvatar,
phoneNumber: result.phoneNumber,
userAccount: result.userAccount,
invitationCode: result.invitationCode,
userRole: result.userRole,
id: result.id,
})
if (result.userRole !== 'user') this.setData({ isShowOrder: false });
}
}
})
},
onLoad(options) {
onLoad() {
this.getUserMainInfo()
},

View File

@ -271,7 +271,7 @@
</view>
</view>
<view class="flex-col list">
<view class="flex-row justify-between items-center section_4">
<view class="flex-row justify-between items-center section_4" wx:if="{{isShowOrder}}">
<view class="flex-row items-center" bind:tap="courseOrder">
<image
class="shrink-0 image_6"

View File

@ -1,3 +1,4 @@
const { baseUrl } = require('../../../request');
// pages/welcome/homePage/homePage.js
Page({
@ -20,7 +21,12 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let token = wx.getStorageSync('token')
if (token) {
wx.switchTab({
url: '/pages/course/homepage/homepage'
})
}
},
/**