fix(mini-user): 门店核销走马灯改用 JS 位移

微信端 CSS max-content/百分比 transform 不可靠;改为测量宽度后 translateX 滚动,并上移到店名下方。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 14:33:31 +08:00
parent fd05621660
commit 021b9e0329
4 changed files with 142 additions and 45 deletions
@@ -1149,11 +1149,40 @@ export class RedeemService {
take,
include: { user: { select: { phone: true } } },
});
return list.map((r) => ({
userLabel: maskRedeemUserLabel(r.user?.phone),
amount: Number(r.amount),
createdAt: r.createdAt.toISOString(),
}));
const fmtAmount = (n: number) => {
if (!Number.isFinite(n)) return '0';
if (Math.abs(n - Math.round(n)) < 1e-9) return String(Math.round(n));
return n.toFixed(2).replace(/\.?0+$/, '');
};
const fmtTime = (d: Date) => {
const parts = new Intl.DateTimeFormat('en-CA', {
timeZone: 'Asia/Shanghai',
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
}).formatToParts(d);
const get = (type: Intl.DateTimeFormatPartTypes) =>
parts.find((p) => p.type === type)?.value ?? '';
return `${get('year')}-${get('month')}-${get('day')} ${get('hour')}:${get('minute')}:${get('second')}`;
};
return list.map((r) => {
const userLabel = maskRedeemUserLabel(r.user?.phone);
const amount = Number(r.amount);
const createdAt = fmtTime(r.createdAt);
return {
userLabel,
amount,
createdAt,
/** 前端可直接展示 */
text: `${userLabel} ${createdAt} 核销${fmtAmount(amount)}`,
};
});
}
async submitRating(userId: bigint, body: { redeemRecordId: string; serviceScore: number; envScore: number }) {