小程序提交
This commit is contained in:
BIN
pages/dashboardModule/performanceRanking/images/bottom.png
Normal file
BIN
pages/dashboardModule/performanceRanking/images/bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 B |
178
pages/dashboardModule/performanceRanking/performanceRanking.js
Normal file
178
pages/dashboardModule/performanceRanking/performanceRanking.js
Normal file
@ -0,0 +1,178 @@
|
||||
import { baseUrl } from "../../../request";
|
||||
|
||||
Page({
|
||||
data: {
|
||||
// 用于存储输入框数据
|
||||
nickName: '',
|
||||
phoneNumber: '',
|
||||
selectedSortField: '待选择', // 默认选择"待选择"
|
||||
selectedSortOrder: '升序', // 默认选择升序
|
||||
sortFieldsByManager: ['员工数量', '推广人数', '下单数量', '总订单金额', '净成交金额'],
|
||||
sortFieldsBySupervisor: ['推广人数', '下单数量', '总订单金额', '净成交金额'],
|
||||
sortOrders: ['升序', '降序'],
|
||||
items: [], // 用于存储查询结果
|
||||
role: '', // 假设初始为主管角色,可以根据实际情况动态设置
|
||||
},
|
||||
|
||||
// 主管名称输入
|
||||
onNameInput(e) {
|
||||
this.setData({
|
||||
nickName: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
// 手机号输入
|
||||
onPhoneInput(e) {
|
||||
this.setData({
|
||||
phoneNumber: e.detail.value
|
||||
});
|
||||
},
|
||||
|
||||
// 选择排序字段
|
||||
onSortFieldChange(e) {
|
||||
const { role } = this.data;
|
||||
const sortFieldsMap = {
|
||||
'员工数量': 'empCount',
|
||||
'推广人数': 'promoCount',
|
||||
'下单数量': 'orderCount',
|
||||
'总订单金额': 'totalAmount',
|
||||
'净成交金额': 'netAmount'
|
||||
};
|
||||
|
||||
const selectedField = this.data.sortFieldsByManager[e.detail.value] || this.data.sortFieldsBySupervisor[e.detail.value];
|
||||
this.setData({
|
||||
selectedSortField: selectedField,
|
||||
sortField: sortFieldsMap[selectedField], // 默认是 id
|
||||
});
|
||||
},
|
||||
|
||||
// 选择排序顺序
|
||||
onSortOrderChange(e) {
|
||||
const selectedOrder = e.detail.value === '0' ? 'ascend' : 'descend';
|
||||
this.setData({
|
||||
selectedSortOrder: selectedOrder === 'ascend' ? '升序' : '降序',
|
||||
sortOrder: selectedOrder,
|
||||
});
|
||||
},
|
||||
|
||||
// 搜索按钮点击
|
||||
onSearch() {
|
||||
const { role } = this.data;
|
||||
// 校验:确保主管名称、手机号和排序条件不能为空
|
||||
if (!this.data.nickName || !this.data.phoneNumber) {
|
||||
wx.showToast({
|
||||
title: '主管名称和手机号不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.data.selectedSortField === '待选择') {
|
||||
wx.showToast({
|
||||
title: '排序条件不能为空',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示加载中
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true // 显示遮罩层
|
||||
});
|
||||
|
||||
const requestData = {
|
||||
nickName: this.data.nickName,
|
||||
phoneNumber: this.data.phoneNumber,
|
||||
sortField: this.data.sortField || '',
|
||||
sortOrder: this.data.sortOrder || 'ascend'
|
||||
};
|
||||
|
||||
if(role === 'manager') {
|
||||
wx.request({
|
||||
url: baseUrl + '/perform/rank/supervisor', // 替换为实际API地址
|
||||
method: 'POST',
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
data: requestData,
|
||||
success: (res) => {
|
||||
console.log('看看后端--->', res.data);
|
||||
// 请求成功后,隐藏loading
|
||||
wx.hideLoading();
|
||||
|
||||
if (res.data.code === 1) {
|
||||
this.setData({
|
||||
items: res.data.data
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '没有数据',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
// 请求失败后,隐藏loading
|
||||
wx.hideLoading();
|
||||
|
||||
wx.showToast({
|
||||
title: '请求失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if( role === 'supervisor' ) {
|
||||
wx.request({
|
||||
url: baseUrl + '/perform/rank/staff', // 替换为实际API地址
|
||||
method: 'POST',
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
data: requestData,
|
||||
success: (res) => {
|
||||
console.log('看看后端--->', res.data);
|
||||
// 请求成功后,隐藏loading
|
||||
wx.hideLoading();
|
||||
|
||||
if (res.data.code === 1) {
|
||||
this.setData({
|
||||
items: res.data.data
|
||||
});
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '没有数据',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
// 请求失败后,隐藏loading
|
||||
wx.hideLoading();
|
||||
|
||||
wx.showToast({
|
||||
title: '请求失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
// 根据身份确定角色
|
||||
const role = options.role;
|
||||
console.log('角色---->',options.role);
|
||||
this.setData({ role });
|
||||
let showRole = '';
|
||||
switch (options.role) {
|
||||
case 'manager':
|
||||
showRole = '主管';
|
||||
break;
|
||||
case 'supervisor':
|
||||
showRole = '员工';
|
||||
break;
|
||||
}
|
||||
this.setData({ showRole });
|
||||
}
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
<view class="flex-col page">
|
||||
<!-- 页面标题 -->
|
||||
<text class="self-center text">{{ showRole }}绩效排名</text>
|
||||
|
||||
<!-- 表单区域 -->
|
||||
<view class="flex-col self-stretch mt-27">
|
||||
<view class="flex-col section">
|
||||
|
||||
<!-- 主管名称 -->
|
||||
<text class="self-start font text_2">{{ showRole }}名称</text>
|
||||
<view class="flex-col justify-start items-start self-start text-wrapper">
|
||||
<input class="text_3 font text_4" placeholder="请输入{{ showRole }}名称" bindinput="onNameInput"/>
|
||||
</view>
|
||||
|
||||
<!-- 手机号 -->
|
||||
<text class="self-start font text_5">手机号</text>
|
||||
<view class="flex-col justify-start items-start self-start text-wrapper_1">
|
||||
<input class="text_3 font text_6" placeholder="请输入手机号" bindinput="onPhoneInput"/>
|
||||
</view>
|
||||
|
||||
<!-- 排序条件选择 -->
|
||||
<text class="self-start font text_7">排序条件</text>
|
||||
<view class="flex-row equal-division">
|
||||
<view class="flex-row justify-between section_2 section_1">
|
||||
<picker wx:if="{{ role === 'manager' }}" mode="selector" range="{{sortFieldsByManager}}" bindchange="onSortFieldChange">
|
||||
<view class="flex-row justify-between section_2">
|
||||
<text class="font text_1">{{selectedSortField}}</text>
|
||||
<image class="image" src="./images/bottom.png"/>
|
||||
</view>
|
||||
</picker>
|
||||
<picker mode="selector" wx:if="{{ role === 'supervisor' }}" range="{{sortFieldsBySupervisor}}" bindchange="onSortFieldChange">
|
||||
<view class="flex-row justify-between section_2">
|
||||
<text class="font text_1">{{selectedSortField}}</text>
|
||||
<image class="image" src="./images/bottom.png"/>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 排序顺序 -->
|
||||
<view class="flex-row justify-between section_2 section_3 ml-16">
|
||||
<picker mode="selector" range="{{sortOrders}}" bindchange="onSortOrderChange">
|
||||
<view class="flex-row justify-between section_2">
|
||||
<text class="font text_16">{{selectedSortOrder}}</text>
|
||||
<image class="image" src="./images/bottom.png"/>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索按钮 -->
|
||||
<view class="flex-col justify-start items-center self-stretch text-wrapper_2" bindtap="onSearch">
|
||||
<text class="font text_8" >搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 查询结果展示 -->
|
||||
<view class="flex-col mt-26">
|
||||
<view class="flex-col list-item mt-19" wx:for="{{items}}" wx:for-item="item" wx:for-index="index" wx:key="index">
|
||||
<!-- 排名 -->
|
||||
<view class="flex-row">
|
||||
<view class="flex-col justify-start items-center text-wrapper_4">
|
||||
<text class="font_2 text_9">{{index + 1}}</text>
|
||||
</view>
|
||||
<!-- 主管信息 -->
|
||||
<view class="flex-row items-center self-start group ml-20">
|
||||
<text class="font_3">{{item.nickName}}</text>
|
||||
<text class="font_4 ml-7">{{item.phoneNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 绩效数据 -->
|
||||
<view class="flex-row mt-14">
|
||||
<view class="flex-col justify-start items-center text-wrapper_5">
|
||||
<text class="font_5 text_11">员工:{{item.empCount}}</text>
|
||||
</view>
|
||||
<view class="flex-col justify-start items-center text-wrapper_6 ml-8">
|
||||
<text class="font_5 text_12">推广:{{item.promoCount}}</text>
|
||||
</view>
|
||||
<view class="flex-col justify-start items-center text-wrapper_7 ml-8">
|
||||
<text class="font_5">下单:{{item.orderCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单金额 -->
|
||||
<view class="flex-row mt-14">
|
||||
<view class="flex-col justify-start text-wrapper_8">
|
||||
<text class="font_5 text_13">总额:¥{{item.totalAmount}}</text>
|
||||
</view>
|
||||
<view class="flex-col justify-start text-wrapper_9 ml-16">
|
||||
<text class="font_5 text_14">净成交:¥{{item.netAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
220
pages/dashboardModule/performanceRanking/performanceRanking.wxss
Normal file
220
pages/dashboardModule/performanceRanking/performanceRanking.wxss
Normal file
@ -0,0 +1,220 @@
|
||||
.mt-27 {
|
||||
margin-top: 50.63rpx;
|
||||
}
|
||||
.mt-19 {
|
||||
margin-top: 35.63rpx;
|
||||
}
|
||||
.ml-7 {
|
||||
margin-left: 13.13rpx;
|
||||
}
|
||||
.page {
|
||||
padding: 71.06rpx 42.19rpx 199.69rpx 44.06rpx;
|
||||
background-color: #fefbf6;
|
||||
box-shadow: 0rpx 3.75rpx 7.5rpx #00000040;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.text {
|
||||
color: #e67e22;
|
||||
font-size: 45rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
font-weight: 700;
|
||||
line-height: 42.84rpx;
|
||||
}
|
||||
.section {
|
||||
padding: 45.75rpx 42.99rpx 34.82rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 23.47rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.text-wrapper {
|
||||
margin-top: 14.49rpx;
|
||||
padding: 17.63rpx 0 14.63rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
width: 403.13rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.text_3 {
|
||||
margin-left: 15.19rpx;
|
||||
}
|
||||
.font {
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 28.14rpx;
|
||||
color: #66666b;
|
||||
}
|
||||
.text_2 {
|
||||
margin-left: 2.63rpx;
|
||||
line-height: 27.75rpx;
|
||||
}
|
||||
.text_4 {
|
||||
line-height: 27.75rpx;
|
||||
}
|
||||
.text_5 {
|
||||
margin-left: 2.44rpx;
|
||||
margin-top: 41.32rpx;
|
||||
line-height: 27.6rpx;
|
||||
}
|
||||
.text-wrapper_1 {
|
||||
margin-top: 14.51rpx;
|
||||
padding: 17.66rpx 0 14.64rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
width: 403.13rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.text_6 {
|
||||
line-height: 27.69rpx;
|
||||
}
|
||||
.text_7 {
|
||||
margin-left: 2.19rpx;
|
||||
margin-top: 41.18rpx;
|
||||
line-height: 27.84rpx;
|
||||
}
|
||||
.equal-division {
|
||||
align-self: stretch;
|
||||
margin-right: 4.01rpx;
|
||||
margin-top: 16.29rpx;
|
||||
}
|
||||
.section_2 {
|
||||
flex: 1 1 270rpx;
|
||||
}
|
||||
.section_1 {
|
||||
padding: 17.68rpx 14.19rpx 14.34rpx 14.89rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
height: 63.75rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.text_1 {
|
||||
line-height: 27.94rpx;
|
||||
}
|
||||
.image {
|
||||
width: 26.25rpx;
|
||||
height: 26.25rpx;
|
||||
}
|
||||
.section_3 {
|
||||
padding: 17.61rpx 16.27rpx 14.55rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
height: 63.75rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.text_16 {
|
||||
line-height: 27.84rpx;
|
||||
}
|
||||
.text-wrapper_2 {
|
||||
margin: 32.81rpx 4.97rpx 0 4.69rpx;
|
||||
padding: 26.29rpx 0 21.02rpx;
|
||||
background-color: #ffa400;
|
||||
border-radius: 9.38rpx;
|
||||
}
|
||||
.text_8 {
|
||||
color: #ffffff;
|
||||
line-height: 27.69rpx;
|
||||
}
|
||||
.list-item {
|
||||
padding: 29.89rpx 29.87rpx 31.99rpx 33.62rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 18.75rpx;
|
||||
border: solid 1.88rpx #ffeaa7;
|
||||
}
|
||||
.list-item:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.text-wrapper_4 {
|
||||
padding: 17.93rpx 0 12.34rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 9.38rpx;
|
||||
width: 52.5rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.font_2 {
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 24.02rpx;
|
||||
font-weight: 700;
|
||||
color: #ffa400;
|
||||
}
|
||||
.text_9 {
|
||||
line-height: 22.24rpx;
|
||||
}
|
||||
.group {
|
||||
margin-top: 22.18rpx;
|
||||
}
|
||||
.font_3 {
|
||||
font-size: 30rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 28.14rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.font_4 {
|
||||
font-size: 26.25rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 19.93rpx;
|
||||
color: #66666b;
|
||||
}
|
||||
.text-wrapper_5 {
|
||||
padding: 16.71rpx 0 12.71rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 28.13rpx;
|
||||
width: 146.25rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.font_5 {
|
||||
font-size: 26.25rpx;
|
||||
font-family: SourceHanSansCN;
|
||||
line-height: 24.02rpx;
|
||||
color: #000000;
|
||||
}
|
||||
.text_11 {
|
||||
line-height: 23.08rpx;
|
||||
}
|
||||
.text-wrapper_6 {
|
||||
padding: 15.51rpx 0 12.56rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 28.13rpx;
|
||||
width: 146.25rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.text_12 {
|
||||
line-height: 24.43rpx;
|
||||
}
|
||||
.text-wrapper_7 {
|
||||
padding: 15.62rpx 0 12.86rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 28.13rpx;
|
||||
width: 146.25rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.text-wrapper_8 {
|
||||
padding: 14.87rpx 0 13.41rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 28.13rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.text_13 {
|
||||
margin-left: 16.86rpx;
|
||||
margin-right: 11.27rpx;
|
||||
line-height: 24.23rpx;
|
||||
}
|
||||
.text-wrapper_9 {
|
||||
padding: 14.61rpx 0 13.33rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 28.13rpx;
|
||||
height: 56.25rpx;
|
||||
border: solid 1.88rpx #ffa400;
|
||||
}
|
||||
.text_14 {
|
||||
margin-left: 18.86rpx;
|
||||
margin-right: 9.26rpx;
|
||||
line-height: 24.56rpx;
|
||||
}
|
Reference in New Issue
Block a user