From 2c4bd3eb2a665450da1ba77da8465219041b7257 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Sep 2026 13:00:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(user-center):=20=E8=B0=83=E6=95=B4=E6=8F=90?= =?UTF-8?q?=E7=8E=B0=E8=AE=B0=E5=BD=95=E9=87=91=E9=A2=9D=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/routes/user-center/credits.css | 9 +------- assets/js/credits.js | 22 +++++++++++++------ .../financial-flow-contract.test.cjs | 5 +++++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/assets/css/routes/user-center/credits.css b/assets/css/routes/user-center/credits.css index a3b5d7e8..aa56fc9b 100644 --- a/assets/css/routes/user-center/credits.css +++ b/assets/css/routes/user-center/credits.css @@ -915,8 +915,7 @@ body.uc-modal-open { font-weight: 700; } .uc-withdraw-history__number, -.uc-withdraw-history__meta, -.uc-withdraw-history__note { +.uc-withdraw-history__meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; @@ -927,9 +926,6 @@ body.uc-modal-open { .uc-withdraw-history__meta { flex: 0 1 190px; } -.uc-withdraw-history__note { - flex: 0 1 160px; -} .uc-withdraw-history__pagination { display: flex; justify-content: center; @@ -978,9 +974,6 @@ body.uc-modal-open { .uc-withdraw-history__meta { flex-basis: 120px; } - .uc-withdraw-history__note { - display: none; - } } /* Points tasks tab */ diff --git a/assets/js/credits.js b/assets/js/credits.js index 9856c0b6..aa10996d 100644 --- a/assets/js/credits.js +++ b/assets/js/credits.js @@ -831,6 +831,14 @@ return node; } + function formatGrossAmount(value) { + return text(value).replace(/\.00$/, ''); + } + + function formatNetAmount(value) { + return text(value); + } + function renderItems(items) { if (!list) return; list.textContent = ''; @@ -849,21 +857,21 @@ row.className = 'uc-withdraw-history__item'; var badge = appendText(row, statusLabels[status] || status, 'badg badg-sm uc-withdraw-history__status'); badge.classList.add(status === 'rejected' ? 'c-red' : (status === 'completed' ? 'c-green' : 'c-blue')); - appendText(row, item && (item.gross_amount || item.amount), 'uc-withdraw-history__amount em12'); + var gross = text(item && (item.gross_amount || item.amount)); + var net = text(item && item.amount); + var amountText = formatGrossAmount(gross); + if (net !== '') amountText += '(实际到账:' + formatNetAmount(net) + '元)'; + appendText(row, amountText, 'uc-withdraw-history__amount em12'); var number = document.createElement('span'); number.className = 'uc-withdraw-history__number muted-2-color em09'; var numberLabel = document.createElement('span'); numberLabel.textContent = '提现单号:'; - number.appendChild(numberLabel); + number.appendChild(numberLabel); var code = document.createElement('code'); code.textContent = text(item && item.withdrawal_number); number.appendChild(code); row.appendChild(number); - var meta = appendText(row, text(item && item.created_at), 'uc-withdraw-history__meta muted-2-color em09'); - var gross = text(item && (item.gross_amount || item.amount)); - var net = text(item && item.amount); - if (gross !== net && net !== '') meta.appendChild(document.createTextNode(' · 到账 ' + net)); - if (item && item.note) appendText(row, item.note, 'uc-withdraw-history__note muted-2-color em09'); + appendText(row, text(item && item.created_at), 'uc-withdraw-history__meta muted-2-color em09'); list.appendChild(row); }); } diff --git a/tests/widget-system/financial-flow-contract.test.cjs b/tests/widget-system/financial-flow-contract.test.cjs index f7cb2d58..916f4d60 100644 --- a/tests/widget-system/financial-flow-contract.test.cjs +++ b/tests/widget-system/financial-flow-contract.test.cjs @@ -71,6 +71,11 @@ test('user withdrawal history uses one paginated ten-item endpoint', () => { assert.match(script, /\/earnings\/withdrawals\?page=/) assert.match(script, /&per_page=10/) assert.match(script, /data-aksrt-withdraw-history-page/) + assert.match(script, /实际到账:/) + assert.match(script, /元)/) + assert.match(script, /appendText\(row, text\(item && item\.created_at\)/) + assert.doesNotMatch(script, /item\.note/) + assert.doesNotMatch(styles, /uc-withdraw-history__note/) assert.match(styles, /\.uc-withdraw-history-modal__dialog\s*\{[\s\S]*?max-width: min\(860px/) assert.match(styles, /\.uc-withdraw-history__item\s*\{[\s\S]*?display: flex/) assert.match(styles, /\.uc-withdraw-history-modal__dialog\s*\{[\s\S]*?overflow: hidden/)