修改部分bug

This commit is contained in:
2025-08-07 19:56:53 +08:00
parent d1b4fa8ca3
commit c7dd90f669
10 changed files with 95 additions and 37 deletions

View File

@ -24,6 +24,8 @@ Page({
monthRefundAmount: 0, // 本月退款总金额 monthRefundAmount: 0, // 本月退款总金额
monthPromotionCount: 0, // 本月推广数量 monthPromotionCount: 0, // 本月推广数量
userRole: '', // 用户角色 userRole: '', // 用户角色
isShowArr: [],
widthRate: '30%'
}, },
onLoad(options) { onLoad(options) {
@ -45,6 +47,13 @@ Page({
break; break;
} }
this.setData({ showRole }); this.setData({ showRole });
if (options.role === 'manger') this.setData({isShowArr: [true, true, true]})
else if (options.role === 'supervisor') this.setData({isShowArr: [false, true, true]})
else if (options.role === 'staff') this.setData({isShowArr: [false, false, true]})
const trueCount = this.data.isShowArr.filter(v => v === true).length;
if (trueCount === 3) this.setData({widthRate: '30%'})
else if (trueCount === 2) this.setData({widthRate: '47.5%'})
else if (trueCount === 1) this.setData({widthRate: '100%'})
}, },
fetchPerformance() { fetchPerformance() {

View File

@ -61,31 +61,36 @@
</view> </view>
<!-- 底部网格 --> <!-- 底部网格 -->
<view class="grid pos"> <view class="pos">
<view class="flex-col items-center grid-item"> <view class="flex-row" style="justify-content: space-between;">
<view style="width: {{widthRate}};" class="flex-col items-center grid-item" wx:if="{{isShowArr[0]}}">
<text class="font text_2">主管数量</text> <text class="font text_2">主管数量</text>
<text class="mt-20 font_2">{{superCount}}</text> <text class="mt-20 font_2">{{superCount}}</text>
</view> </view>
<view class="flex-col items-center grid-item"> <view style="width: {{widthRate}};" class="flex-col items-center grid-item" wx:if="{{isShowArr[1]}}">
<text class="font text_3">员工数量</text> <text class="font text_3">员工数量</text>
<text class="mt-20 font_2">{{empCount}}</text> <text class="mt-20 font_2">{{empCount}}</text>
</view> </view>
<view class="flex-col items-center grid-item"> <view style="width: {{widthRate}};" class="flex-col items-center grid-item" wx:if="{{isShowArr[2]}}">
<text class="font text_4">客户数量</text> <text class="font text_4">客户数量</text>
<text class="mt-20 font_2">{{promoCount}}</text> <text class="mt-20 font_2">{{promoCount}}</text>
</view> </view>
<view class="flex-col items-center grid-item_2"> </view>
<view class="flex-row" style="justify-content: space-between;">
<view class="flex-col items-center grid-item_2" style="margin-right: 10rpx">
<text class="font text_5">订单总金额</text> <text class="font text_5">订单总金额</text>
<text class="mt-20 font_2">¥{{totalAmount}}</text> <text class="mt-20 font_2">¥{{totalAmount}}</text>
</view> </view>
<view class="flex-col items-center grid-item_2"> <view class="flex-col items-center grid-item_2" style="margin: 40rpx 10rpx 0">
<text class="font text_6">订单净成交</text> <text class="font text_6">订单净成交</text>
<text class="mt-20 font_2">¥{{netAmount}}</text> <text class="mt-20 font_2">¥{{netAmount}}</text>
</view> </view>
<view class="flex-col items-center grid-item_2"> <view class="flex-col items-center grid-item_2" style="margin-left: 10rpx">
<text class="font text_7">下单数量</text> <text class="font text_7">下单数量</text>
<text class="mt-20 font_2">{{orderCount}}</text> <text class="mt-20 font_2">{{orderCount}}</text>
</view> </view>
</view> </view>
</view> </view>
</view>
</view> </view>

View File

@ -232,6 +232,8 @@
line-height: 24.54rpx; line-height: 24.54rpx;
} }
.grid-item_2 { .grid-item_2 {
width: 30%;
margin-top: 40rpx;
padding: 22.5rpx 0; padding: 22.5rpx 0;
filter: drop-shadow(0rpx 3.75rpx 3.75rpx #00000040); filter: drop-shadow(0rpx 3.75rpx 3.75rpx #00000040);
background-color: #ffffff; background-color: #ffffff;

View File

@ -135,7 +135,7 @@ Page({
}); });
} }
}); });
} else if( role === 'supervisor' ) { } else if( role === 'supervisor' || role === 'staff') {
wx.request({ wx.request({
url: baseUrl + '/perform/rank/staff', // 替换为实际API地址 url: baseUrl + '/perform/rank/staff', // 替换为实际API地址
method: 'POST', method: 'POST',
@ -175,6 +175,7 @@ Page({
onLoad(options) { onLoad(options) {
// 根据身份确定角色 // 根据身份确定角色
const role = options.role; const role = options.role;
if (role === 'staff') this.setData({selectedSortField: '推广人数'})
console.log('角色---->',options.role); console.log('角色---->',options.role);
this.setData({ role }); this.setData({ role });
let showRole = ''; let showRole = '';
@ -185,6 +186,8 @@ Page({
case 'supervisor': case 'supervisor':
showRole = '员工'; showRole = '员工';
break; break;
case 'staff':
showRole = '员工'
} }
this.setData({ showRole }); this.setData({ showRole });
this.onSearch() this.onSearch()

View File

@ -28,7 +28,7 @@
<image class="image" src="./images/bottom.png"/> <image class="image" src="./images/bottom.png"/>
</view> </view>
</picker> </picker>
<picker mode="selector" wx:if="{{ role === 'supervisor' }}" range="{{sortFieldsBySupervisor}}" bindchange="onSortFieldChange"> <picker mode="selector" wx:if="{{ role === 'supervisor' || role === 'staff'}}" range="{{sortFieldsBySupervisor}}" bindchange="onSortFieldChange">
<view class="flex-row justify-between section_2"> <view class="flex-row justify-between section_2">
<text class="font text_1">{{selectedSortField}}</text> <text class="font text_1">{{selectedSortField}}</text>
<image class="image" src="./images/bottom.png"/> <image class="image" src="./images/bottom.png"/>
@ -71,7 +71,7 @@
<!-- 绩效数据 --> <!-- 绩效数据 -->
<view class="flex-row mt-14"> <view class="flex-row mt-14">
<view class="flex-col justify-start items-center text-wrapper_5"> <view class="flex-col justify-start items-center text-wrapper_5" wx:if="{{role === 'supervisor'}}">
<text class="font_5 text_11">员工:{{item.empCount}}</text> <text class="font_5 text_11">员工:{{item.empCount}}</text>
</view> </view>
<view class="flex-col justify-start items-center text-wrapper_6 ml-8"> <view class="flex-col justify-start items-center text-wrapper_6 ml-8">

View File

@ -98,6 +98,7 @@ Page({
}, },
onLoad(options) { onLoad(options) {
console.log('========>', options)
this.setData({ this.setData({
supervisorUserId: options.supId, supervisorUserId: options.supId,
}) })

View File

@ -28,12 +28,12 @@ Page({
const { orderNumber, staffUserId } = this.data; const { orderNumber, staffUserId } = this.data;
// 简单校验:非空 // 简单校验:非空
if (!orderNumber) { // if (!orderNumber) {
return wx.showToast({ // return wx.showToast({
title: '请输入订单号', // title: '请输入订单号',
icon: 'none' // icon: 'none'
}); // });
} // }
// 发起 POST 请求 // 发起 POST 请求
wx.request({ wx.request({

View File

@ -18,7 +18,17 @@ Page({
this.setData({ this.setData({
role: options.role role: options.role
}) })
if (options.role === 'supervisor') { const scene = decodeURIComponent(options.scene)
if (scene !== 'undefined') {
let [key, value] = scene.split('=');
console.log(key, value)
if (value === 'manager') value = 'supervisor'
else if (value === 'supervisor') value = 'staff'
else if (value === 'staff') value = 'user'
this.setData({inviteCode: key, role: value})
}
if (this.data.role === 'supervisor') {
this.setData({ this.setData({
placeholder: '请输入学校名称' placeholder: '请输入学校名称'
}) })
@ -27,9 +37,6 @@ Page({
placeholder : '请输入昵称' placeholder : '请输入昵称'
}) })
} }
const scene = decodeURIComponent(options.scene)
let [key, value] = scene.split('=');
this.setData({inviteCode: value})
}, },
/** /**
@ -156,7 +163,6 @@ Page({
}) })
const { role } = this.data; const { role } = this.data;
const res = await requestAsync({ const res = await requestAsync({
url: baseUrl + '/userInfo/register', url: baseUrl + '/userInfo/register',
method: 'POST', method: 'POST',
@ -177,10 +183,9 @@ Page({
icon: 'success', icon: 'success',
duration: 1000, duration: 1000,
}); });
wx.hideLoading()
setTimeout(() => { setTimeout(() => {
wx.navigateBack()({ wx.navigateTo({
// url: '/pages/loginModule/pwdLogin/pwdLogin', url: `/pages/loginModule/pwdLogin/pwdLogin?role=${role}`,
success: () => { success: () => {
this.setData({ nickname:'', phone:'', captcha:'', inviteCode:'', password:'', agree:false }); this.setData({ nickname:'', phone:'', captcha:'', inviteCode:'', password:'', agree:false });
} }
@ -189,9 +194,10 @@ Page({
} else { } else {
wx.showToast({ wx.showToast({
title: res.data.message || '注册失败', title: res.data.message || '注册失败',
icon: 'none' icon: 'none',
duration: 1000
}); });
wx.hideLoading() // wx.hideLoading()
} }
}, },

View File

@ -18,6 +18,7 @@ Page({
isShowOrder: true, isShowOrder: true,
qrcode: "", // 设置二维码图片的路径 qrcode: "", // 设置二维码图片的路径
userRole: "", userRole: "",
title: '查看绩效',
id: 0, id: 0,
}, },
@ -149,7 +150,9 @@ Page({
userRole: result.userRole, userRole: result.userRole,
id: result.id, id: result.id,
}) })
if (result.userRole !== 'user') this.setData({ isShowOrder: false }); console.log(result.userRole)
if (result.userRole !== 'user') this.setData({ isShowOrder: false});
if (result.userRole === 'staff') this.setData({title: '客户订单'});
} }
} }
}) })
@ -198,17 +201,46 @@ Page({
wx.navigateTo({ wx.navigateTo({
url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}&id=${id}`, url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}&id=${id}`,
}) })
} else if (userRole === 'staff') {
wx.navigateTo({
url: `/pages/dashboardModule/userOrderPerformance/userOrderPerformance?userId=${id}`,
})
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: `/pages/dashboardModule/staffPerformance/staffPerformance?role=${userRole}&id=${id}`, url: `/pages/dashboardModule/staffPerformance/staffPerformance?role=${userRole}&supId=${id}`,
}) })
} }
}, },
// 跳转排名 // 跳转主管排名
gotoRank(e) { gotoSupervisorRank(e) {
console.log(e); console.log(e);
const userRole = e.currentTarget.dataset.userrole; const {userRole} = this.data
console.log('========fds===>', userRole)
if (userRole === 'staff' || userRole === 'user') {
wx.showToast({
title: '无权限',
icon: 'error'
})
return ;
}
wx.navigateTo({
url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`,
})
},
// 跳转员工排名
gotoStaffRank(e) {
console.log(e);
const {userRole} = this.data
console.log('===========>', userRole)
if (userRole === 'user') {
wx.showToast({
title: '无权限',
icon: 'error'
})
return ;
}
wx.navigateTo({ wx.navigateTo({
url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`, url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`,
}) })

View File

@ -253,16 +253,16 @@
class="image_5" class="image_5"
src="./images/zhijinxiangqing.png" src="./images/zhijinxiangqing.png"
/> />
<text class="font text_5 mt-6">查看绩效</text> <text class="font text_5 mt-6">{{title}}</text>
</view> </view>
<view class="flex-col items-center equal-division-item_2 equal-division-item" bind:tap="gotoRank" data-userRole="{{ 'manager' }}"> <view class="flex-col items-center equal-division-item_2 equal-division-item" bind:tap="gotoSupervisorRank" data-userRole="{{ 'manager' }}">
<image <image
class="image_5" class="image_5"
src="./images/tixianzhanghu.png" src="./images/tixianzhanghu.png"
/> />
<text class="font text_6 mt-6">主管排名</text> <text class="font text_6 mt-6">主管排名</text>
</view> </view>
<view class="flex-col items-center equal-division-item_3 group_5" bind:tap="gotoRank" data-userRole="{{ 'supervisor' }}"> <view class="flex-col items-center equal-division-item_3 group_5" bind:tap="gotoStaffRank" data-userRole="{{ 'supervisor' }}">
<image <image
class="image_5" class="image_5"
src="./images/tixianjilu.png" src="./images/tixianjilu.png"
@ -284,7 +284,7 @@
src="./images/xiajiantou.png" src="./images/xiajiantou.png"
/> />
</view> </view>
<view class="flex-row justify-between items-center section_4 mt-11" bind:tap="gotoDashboard"> <view class="flex-row justify-between items-center section_4 mt-11" bind:tap="gotoDashboard" wx:if="{{ userRole !== 'user' }}">
<view class="flex-row items-center"> <view class="flex-row items-center">
<image <image
class="shrink-0 image_6" class="shrink-0 image_6"