diff --git a/pages/dashboardModule/performanceRanking/images/bottom.png b/pages/dashboardModule/performanceRanking/images/bottom.png new file mode 100644 index 0000000..c0ec071 Binary files /dev/null and b/pages/dashboardModule/performanceRanking/images/bottom.png differ diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.js b/pages/dashboardModule/performanceRanking/performanceRanking.js new file mode 100644 index 0000000..fb5def1 --- /dev/null +++ b/pages/dashboardModule/performanceRanking/performanceRanking.js @@ -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 }); + } +}); \ No newline at end of file diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.json b/pages/dashboardModule/performanceRanking/performanceRanking.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/dashboardModule/performanceRanking/performanceRanking.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.wxml b/pages/dashboardModule/performanceRanking/performanceRanking.wxml new file mode 100644 index 0000000..af2bba7 --- /dev/null +++ b/pages/dashboardModule/performanceRanking/performanceRanking.wxml @@ -0,0 +1,96 @@ + + + {{ showRole }}绩效排名 + + + + + + + {{ showRole }}名称 + + + + + + 手机号 + + + + + + 排序条件 + + + + + {{selectedSortField}} + + + + + + {{selectedSortField}} + + + + + + + + + + {{selectedSortOrder}} + + + + + + + + + 搜索 + + + + + + + + + + + {{index + 1}} + + + + {{item.nickName}} + {{item.phoneNumber}} + + + + + + + 员工:{{item.empCount}} + + + 推广:{{item.promoCount}} + + + 下单:{{item.orderCount}} + + + + + + + 总额:¥{{item.totalAmount}} + + + 净成交:¥{{item.netAmount}} + + + + + diff --git a/pages/dashboardModule/performanceRanking/performanceRanking.wxss b/pages/dashboardModule/performanceRanking/performanceRanking.wxss new file mode 100644 index 0000000..0c48462 --- /dev/null +++ b/pages/dashboardModule/performanceRanking/performanceRanking.wxss @@ -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; +} \ No newline at end of file