青橙1.1.2

This commit is contained in:
2025-08-16 22:14:42 +08:00
parent a3ffe71ccb
commit 3dc4d64215
33 changed files with 430 additions and 289 deletions

View File

@ -6,14 +6,17 @@ Page({
// 用于存储输入框数据
nickName: '',
phoneNumber: '',
selectedSortField: '员工数量', // 默认选择"待选择"
selectedSortOrder: '序', // 默认选择升序
selectedSortField: '员工数量', // 默认选择"员工数量"
selectedSortOrder: '序', // 默认选择升序
sortFieldsByManager: ['员工数量', '推广人数', '下单数量', '总订单金额', '净成交金额'],
sortFieldsBySupervisor: ['推广人数', '下单数量', '总订单金额', '净成交金额'],
sortField: 'empCount',
sortOrder: 'descend',
sortOrders: ['升序', '降序'],
items: [], // 用于存储查询结果
role: '', // 假设初始为主管角色,可以根据实际情况动态设置
k: 1
k: 1,
showRole: ''
},
// 主管名称输入
@ -32,7 +35,6 @@ Page({
// 选择排序字段
onSortFieldChange(e) {
const { role } = this.data;
const sortFieldsMap = {
'员工数量': 'empCount',
'推广人数': 'promoCount',
@ -40,8 +42,8 @@ Page({
'总订单金额': 'totalAmount',
'净成交金额': 'netAmount'
};
const selectedField = this.data.sortFieldsByManager[e.detail.value] || this.data.sortFieldsBySupervisor[e.detail.value];
const { showRole, sortFieldsByManager, sortFieldsBySupervisor } = this.data
let selectedField = showRole === '主管' ? sortFieldsByManager[e.detail.value] : sortFieldsBySupervisor[e.detail.value];
this.setData({
selectedSortField: selectedField,
sortField: sortFieldsMap[selectedField], // 默认是 id
@ -61,7 +63,7 @@ Page({
// 搜索按钮点击
onSearch() {
const { role } = this.data;
const { showRole, role } = this.data;
// // —— 新增:校验主管名称 ——
// const nameRegex = /^[\u4e00-\u9fa5]+$/;
// if (!this.data.nickName) {
@ -98,12 +100,17 @@ Page({
mask: true // 显示遮罩层
});
if (showRole === '员工') {
this.setData({ sortField: 'promoCount' })
}
const requestData = {
nickName: this.data.nickName,
phoneNumber: this.data.phoneNumber,
sortField: this.data.sortField || '',
sortOrder: this.data.sortOrder || 'ascend'
};
console.log('requestData====>', requestData)
if(role === 'manager') {
wx.request({
@ -129,7 +136,6 @@ Page({
fail: () => {
// 请求失败后隐藏loading
wx.hideLoading();
console.log('111');
wx.showToast({
title: '请求失败',
icon: 'none'
@ -193,5 +199,11 @@ Page({
}
this.setData({ showRole });
this.onSearch()
}
},
onPullDownRefresh() {
this.onSearch()
wx.stopPullDownRefresh();
},
});