「我的」常用服务加兑换记录入口(跳商城 ?page=orders,角标显示待发货笔数)(v26100454)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 03:22:03 +00:00
parent 6074193f7c
commit f900c018bc
2 changed files with 17 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26100453';
var VER = '26100454';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -5105,16 +5105,22 @@
const EXCH_IDS = ['doudou-duihuan', 'doudouduihuan', 'duihuan'];
const EXCH_URL = 'https://taidong.douba.top/doudou-duihuan/';
const DOU_API = EXCH_URL + 'api';
function openExchange() {
/* page:可选,'orders' = 直接弹商城的「兑换记录」(2026-10-05 商城会话 cc4ca879 提供 ?page=orders;
带 return_url 时点 × 直接回首页,不带只关面板留在商城)。 */
function openExchange(page) {
let app = null;
for (const id of EXCH_IDS) { if (APP_BY_ID[id]) { app = APP_BY_ID[id]; break; } }
const base = (app && app.url) || EXCH_URL;
const url = base + (base.indexOf('?') >= 0 ? '&' : '?') + 'return_url=' + encodeURIComponent(location.href);
const url = base + (base.indexOf('?') >= 0 ? '&' : '?') + (typeof page === 'string' && page ? 'page=' + encodeURIComponent(page) + '&' : '') +
'return_url=' + encodeURIComponent(location.href);
jumpApp(url, (app && app.identifier) || 'doudou-duihuan');
}
$$('#meExchCard, #homeExch').forEach(function (b) {
b.addEventListener('click', openExchange);
b.addEventListener('click', function () { openExchange(); });
});
/* 「我的 → 兑换记录」(2026-10-05) */
const _mo = $('#meExchOrders');
if (_mo) _mo.addEventListener('click', function () { openExchange('orders'); });
/* 兜豆余额 + 可兑件数 + 本场热门好物。
· /mall/drop 无需登录:拿商品(热门前 3 显示在「我的」页卡片底部);
@@ -5194,6 +5200,9 @@
}).then(function (sum) {
if (DEMO) sum = Object.assign({}, sum || {}, { balance: 2000 }); // 示例模式:兜豆默认 2000
if (!sum || typeof sum.balance !== 'number') return;
/* 「兑换记录」角标:待发货笔数(orders_pending,商城 2026-10-05 加的字段;0 / 没这个字段就不显示) */
const _ov = $('#meOrdersV');
if (_ov) _ov.textContent = sum.orders_pending > 0 ? sum.orders_pending + ' 待发货' : '';
return dropP.then(function (d) {
const now = d && d.server_time ? new Date(d.server_time).getTime() : Date.now();
const n = ((d && d.goods) || []).filter(function (g) {