From 40bc391f7687b044d346212807242f526253ae71 Mon Sep 17 00:00:00 2001 From: XingQue Date: Tue, 7 Jul 2026 21:49:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=98=9F=E4=B9=8B=E7=95=8C=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E6=A6=9C=E5=B1=95=E7=A4=BA=E5=AD=97=E6=AE=B5=E4=B8=8E?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 管事主指标改为有效人数,组长主指标改为收益总额,副指标展示无效/有效邀请与收益。 Co-authored-by: Cursor --- pages/fighter-rank/fighter-rank.js | 47 ++++++++++++++++++------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/pages/fighter-rank/fighter-rank.js b/pages/fighter-rank/fighter-rank.js index 4d3d78d..111cd33 100644 --- a/pages/fighter-rank/fighter-rank.js +++ b/pages/fighter-rank/fighter-rank.js @@ -20,12 +20,12 @@ const ROLE_LIST = [ const DATE_LIST = [ { key: '今日', label: '今日' }, - { key: '本周', label: '本周' }, - { key: '本月', label: '本月' }, - { key: '总榜', label: '总榜' }, { key: '昨日', label: '昨日' }, + { key: '本周', label: '本周' }, { key: '上周', label: '上周' }, + { key: '本月', label: '本月' }, { key: '上月', label: '上月' }, + { key: '总榜', label: '总榜' }, ] const ROLE_META = { @@ -88,24 +88,24 @@ const XZJ_ROLE_META = { }, guanshi: { title: '管事排行榜', - sortField: 'yaoqing_dashou_shu', - sortLabel: '邀请人数', + sortField: 'chongzhi_dashou_shu', + sortLabel: '有效人数', mainType: 'int', metrics: [ { field: 'wuxiao_yaoqing_dashou_shu', label: '无效邀请', type: 'int' }, - { field: 'chongzhi_dashou_shu', label: '有效人数', type: 'int' }, - { field: 'shouru_zonge', label: '收入金额', type: 'money' }, + { field: 'yaoqing_dashou_shu', label: '邀请人数', type: 'int' }, + { field: 'shouru_zonge', label: '收益总额', type: 'money' }, ], }, zuzhang: { title: '组长排行榜', - sortField: 'yaoqing_guanshi_shu', - sortLabel: '邀请人数', - mainType: 'int', + sortField: 'shouru_zonge', + sortLabel: '收益总额', + mainType: 'money', metrics: [ { field: 'wuxiao_yaoqing_guanshi_shu', label: '无效邀请', type: 'int' }, { field: 'youxiao_guanshi_shu', label: '有效人数', type: 'int' }, - { field: 'shouru_zonge', label: '收入金额', type: 'money' }, + { field: 'yaoqing_guanshi_shu', label: '邀请人数', type: 'int' }, ], }, shangjia: { @@ -146,7 +146,8 @@ Page({ dateList: DATE_LIST, currentRole: 'dashou', currentDate: '今日', - fanwei: 'jituan', + fanwei: 'club', + showJituanScope: false, // 临时隐藏集团总榜,恢复时改 true 并调整 fanwei 默认值 myClubId: CLUB_ID || 'xq', roleMeta: ROLE_META.dashou, sortLabel: '分红总额', @@ -179,8 +180,6 @@ Page({ const base = (g.ossImageUrl || '') + 'beijing/paihangbang/' this.setData({ imgUrls: { - pageBg: base + 'page-bg.jpg', - cardBg: base + 'list-card-bg.png', emptyIcon: base + 'empty.png', refreshIcon: base + 'icon-refresh.png', }, @@ -227,7 +226,7 @@ Page({ applyRole(role, reload = true) { const meta = ACTIVE_ROLE_META[role] - wx.setNavigationBarTitle({ title: meta.title }) + wx.setNavigationBarTitle({ title: '总排行榜' }) this.setData({ currentRole: role, roleMeta: meta, sortLabel: meta.sortLabel }) if (reload) this.fetchRankList() }, @@ -248,6 +247,7 @@ Page({ onScopeTap(e) { const fanwei = e.currentTarget.dataset.fanwei if (!fanwei || fanwei === this.data.fanwei) return + if (fanwei === 'jituan' && !this.data.showJituanScope) return this.setData({ fanwei }) this.fetchRankList() }, @@ -317,7 +317,7 @@ Page({ const meta = ACTIVE_ROLE_META[role] const app = getApp() const uid = raw.yonghuid || raw.uid || '' - const nicheng = raw.nicheng || raw.nick || '用户' + const nicheng = raw.nicheng || raw.nick || (role === 'dashou' ? '打手' : role === 'guanshi' ? '管事' : role === 'zuzhang' ? '组长' : role === 'shangjia' ? '商家' : '用户') const def = getDefaultAvatar(app) const avatar = buildAvatar(raw.touxiang || raw.avatar, app) || def const metrics = meta.metrics.map((m) => { @@ -327,8 +327,16 @@ Page({ value: m.type === 'money' ? this.formatMoney(v) : this.formatInt(v), } }) - const sortRaw = raw[meta.sortField] ?? raw.metric_value - const mainType = raw.metric_label ? (Number.isInteger(Number(sortRaw)) && !String(sortRaw).includes('.') ? 'int' : 'money') : (meta.mainType || 'money') + const hasBackendMetric = raw.metric_value !== undefined && raw.metric_value !== null + const sortRaw = IS_XZJ + ? (raw[meta.sortField] ?? raw.metric_value) + : (hasBackendMetric ? raw.metric_value : (raw[meta.sortField] ?? raw.metric_value)) + let mainType = meta.mainType || 'money' + if (hasBackendMetric && raw.metric_is_int !== undefined) { + mainType = raw.metric_is_int ? 'int' : 'money' + } else if (raw.metric_label) { + mainType = (Number.isInteger(Number(sortRaw)) && !String(sortRaw).includes('.')) ? 'int' : 'money' + } const mainValue = mainType === 'money' ? this.formatMoney(sortRaw) : this.formatInt(sortRaw) @@ -342,7 +350,7 @@ Page({ mainType, mainPrefix: mainType === 'money' ? '¥' : '', mainValue, - mainLabel: raw.metric_label || meta.sortLabel, + mainLabel: (IS_XZJ ? meta.sortLabel : (raw.metric_label || meta.sortLabel)), metrics, } }, @@ -427,6 +435,7 @@ Page({ if (!Array.isArray(list)) list = [] const role = currentRole + // 名次顺序完全沿用后端返回,前端不做 sort / 重排 let normalized = list.slice(0, 50).map((item, i) => this.normalizeItem(item, i, role)) if (rewardFromRank) { normalized = this.applyRewardToList(normalized, rewardFromRank, 'club')