From c7dd90f669d026c3a8bfd96a500f17a6ac477ec3 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Thu, 7 Aug 2025 19:56:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../overviewPerformance.js | 9 ++++ .../overviewPerformance.wxml | 19 +++++---- .../overviewPerformance.wxss | 2 + .../performanceRanking/performanceRanking.js | 5 ++- .../performanceRanking.wxml | 4 +- .../staffPerformance/staffPerformance.js | 3 +- .../userOrderPerformance.js | 12 +++--- pages/loginModule/register/register.js | 28 ++++++++----- pages/personCenter/mine/mine.js | 42 ++++++++++++++++--- pages/personCenter/mine/mine.wxml | 8 ++-- 10 files changed, 95 insertions(+), 37 deletions(-) diff --git a/pages/dashboardModule/overviewPerformance/overviewPerformance.js b/pages/dashboardModule/overviewPerformance/overviewPerformance.js index 0ac6062..b8ac9da 100644 --- a/pages/dashboardModule/overviewPerformance/overviewPerformance.js +++ b/pages/dashboardModule/overviewPerformance/overviewPerformance.js @@ -24,6 +24,8 @@ Page({ monthRefundAmount: 0, // 本月退款总金额 monthPromotionCount: 0, // 本月推广数量 userRole: '', // 用户角色 + isShowArr: [], + widthRate: '30%' }, onLoad(options) { @@ -45,6 +47,13 @@ Page({ break; } 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() { diff --git a/pages/dashboardModule/overviewPerformance/overviewPerformance.wxml b/pages/dashboardModule/overviewPerformance/overviewPerformance.wxml index 95951e8..b70700b 100644 --- a/pages/dashboardModule/overviewPerformance/overviewPerformance.wxml +++ b/pages/dashboardModule/overviewPerformance/overviewPerformance.wxml @@ -61,31 +61,36 @@ - - + + + 主管数量 {{superCount}} - + 员工数量 {{empCount}} - + 客户数量 {{promoCount}} - + + + + 订单总金额 ¥{{totalAmount}} - + 订单净成交 ¥{{netAmount}} - + 下单数量 {{orderCount}} + diff --git a/pages/dashboardModule/overviewPerformance/overviewPerformance.wxss b/pages/dashboardModule/overviewPerformance/overviewPerformance.wxss index 8db933d..989e02e 100644 --- a/pages/dashboardModule/overviewPerformance/overviewPerformance.wxss +++ b/pages/dashboardModule/overviewPerformance/overviewPerformance.wxss @@ -232,6 +232,8 @@ line-height: 24.54rpx; } .grid-item_2 { + width: 30%; + margin-top: 40rpx; padding: 22.5rpx 0; filter: drop-shadow(0rpx 3.75rpx 3.75rpx #00000040); background-color: #ffffff; diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.js b/pages/dashboardModule/performanceRanking/performanceRanking.js index 1983f24..feaee84 100644 --- a/pages/dashboardModule/performanceRanking/performanceRanking.js +++ b/pages/dashboardModule/performanceRanking/performanceRanking.js @@ -135,7 +135,7 @@ Page({ }); } }); - } else if( role === 'supervisor' ) { + } else if( role === 'supervisor' || role === 'staff') { wx.request({ url: baseUrl + '/perform/rank/staff', // 替换为实际API地址 method: 'POST', @@ -175,6 +175,7 @@ Page({ onLoad(options) { // 根据身份确定角色 const role = options.role; + if (role === 'staff') this.setData({selectedSortField: '推广人数'}) console.log('角色---->',options.role); this.setData({ role }); let showRole = ''; @@ -185,6 +186,8 @@ Page({ case 'supervisor': showRole = '员工'; break; + case 'staff': + showRole = '员工' } this.setData({ showRole }); this.onSearch() diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.wxml b/pages/dashboardModule/performanceRanking/performanceRanking.wxml index af2bba7..7adaada 100644 --- a/pages/dashboardModule/performanceRanking/performanceRanking.wxml +++ b/pages/dashboardModule/performanceRanking/performanceRanking.wxml @@ -28,7 +28,7 @@ - + {{selectedSortField}} @@ -71,7 +71,7 @@ - + 员工:{{item.empCount}} diff --git a/pages/dashboardModule/staffPerformance/staffPerformance.js b/pages/dashboardModule/staffPerformance/staffPerformance.js index 6a796cb..ebbec35 100644 --- a/pages/dashboardModule/staffPerformance/staffPerformance.js +++ b/pages/dashboardModule/staffPerformance/staffPerformance.js @@ -58,7 +58,7 @@ Page({ onSearchSupId() { const { supervisorUserId } = this.data; - + wx.request({ url: baseUrl + '/perform/query/staff', method: 'POST', @@ -98,6 +98,7 @@ Page({ }, onLoad(options) { + console.log('========>', options) this.setData({ supervisorUserId: options.supId, }) diff --git a/pages/dashboardModule/userOrderPerformance/userOrderPerformance.js b/pages/dashboardModule/userOrderPerformance/userOrderPerformance.js index ab9bd03..62fa347 100644 --- a/pages/dashboardModule/userOrderPerformance/userOrderPerformance.js +++ b/pages/dashboardModule/userOrderPerformance/userOrderPerformance.js @@ -28,12 +28,12 @@ Page({ const { orderNumber, staffUserId } = this.data; // 简单校验:非空 - if (!orderNumber) { - return wx.showToast({ - title: '请输入订单号', - icon: 'none' - }); - } + // if (!orderNumber) { + // return wx.showToast({ + // title: '请输入订单号', + // icon: 'none' + // }); + // } // 发起 POST 请求 wx.request({ diff --git a/pages/loginModule/register/register.js b/pages/loginModule/register/register.js index 7a79c8d..a16a14a 100644 --- a/pages/loginModule/register/register.js +++ b/pages/loginModule/register/register.js @@ -18,7 +18,17 @@ Page({ this.setData({ 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({ placeholder: '请输入学校名称' }) @@ -27,9 +37,6 @@ Page({ placeholder : '请输入昵称' }) } - const scene = decodeURIComponent(options.scene) - let [key, value] = scene.split('='); - this.setData({inviteCode: value}) }, /** @@ -156,8 +163,7 @@ Page({ }) const { role } = this.data; - - const res = await requestAsync({ + const res = await requestAsync({ url: baseUrl + '/userInfo/register', method: 'POST', header: { 'content-type': 'application/json' }, @@ -177,10 +183,9 @@ Page({ icon: 'success', duration: 1000, }); - wx.hideLoading() setTimeout(() => { - wx.navigateBack()({ - // url: '/pages/loginModule/pwdLogin/pwdLogin', + wx.navigateTo({ + url: `/pages/loginModule/pwdLogin/pwdLogin?role=${role}`, success: () => { this.setData({ nickname:'', phone:'', captcha:'', inviteCode:'', password:'', agree:false }); } @@ -189,9 +194,10 @@ Page({ } else { wx.showToast({ title: res.data.message || '注册失败', - icon: 'none' + icon: 'none', + duration: 1000 }); - wx.hideLoading() + // wx.hideLoading() } }, diff --git a/pages/personCenter/mine/mine.js b/pages/personCenter/mine/mine.js index 503f4f6..8e8b50f 100644 --- a/pages/personCenter/mine/mine.js +++ b/pages/personCenter/mine/mine.js @@ -18,6 +18,7 @@ Page({ isShowOrder: true, qrcode: "", // 设置二维码图片的路径 userRole: "", + title: '查看绩效', id: 0, }, @@ -149,7 +150,9 @@ Page({ userRole: result.userRole, 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,22 +201,51 @@ Page({ wx.navigateTo({ url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}&id=${id}`, }) + } else if (userRole === 'staff') { + wx.navigateTo({ + url: `/pages/dashboardModule/userOrderPerformance/userOrderPerformance?userId=${id}`, + }) } else { 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); - 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({ + url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`, + }) + }, + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/personCenter/mine/mine.wxml b/pages/personCenter/mine/mine.wxml index 1b34076..df3e69a 100644 --- a/pages/personCenter/mine/mine.wxml +++ b/pages/personCenter/mine/mine.wxml @@ -253,16 +253,16 @@ class="image_5" src="./images/zhijinxiangqing.png" /> - 查看绩效 + {{title}} - + 主管排名 - + - +