首页商品:对齐门店「当次会话」——首次进入 / 城市变化 / 登录态变化 / 下拉刷新才拉列表,切 Tab 不再重复请求;退出登录会清缓存。

核销成功时间:按 Asia/Shanghai 格式化为「2026年8月3日 13点45分」。
核销码编号:单行省略显示,双击复制(有「双击复制」提示)。
This commit is contained in:
2026-08-03 13:51:29 +08:00
parent ebd8c07147
commit 06cbcdeb9c
6 changed files with 185 additions and 30 deletions
+16 -1
View File
@@ -44,6 +44,20 @@ export default function RedeemCodePage() {
const [timerSec, setTimerSec] = useState(REDEEM_TOKEN_TTL_SECONDS);
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
const successHandled = useRef(false);
const lastTokenTapAt = useRef(0);
function onTokenTap() {
if (!token) return;
const now = Date.now();
if (now - lastTokenTapAt.current < 350) {
lastTokenTapAt.current = 0;
void Taro.setClipboardData({ data: token })
.then(() => toast('核销码编号已复制', 'success'))
.catch(() => toast('复制失败'));
return;
}
lastTokenTapAt.current = now;
}
const stopTimer = useCallback(() => {
if (timerRef.current != null) {
@@ -144,9 +158,10 @@ export default function RedeemCodePage() {
<Text className="u-muted"></Text>
<Text className="redeem-code-amount">¥ {formatMoney(amount)}</Text>
{token ? (
<View className="redeem-code-token-wrap">
<View className="redeem-code-token-wrap" onClick={onTokenTap}>
<Text className="redeem-code-token-label"></Text>
<Text className="redeem-code-token">{token}</Text>
<Text className="redeem-code-token-hint"></Text>
</View>
) : null}
</View>