fix(user-center): 调整提现记录金额展示

This commit is contained in:
kate522 committed 2026-09-16 13:00:27 +08:00
1 parent 6bbb79213b
commit 2c4bd3eb2a
3 files changed
+21 -15

No files matched your search

+1 -8
View File
@@ -915,8 +915,7 @@ body.uc-modal-open {
font-weight: 700; font-weight: 700;
} }
.uc-withdraw-history__number, .uc-withdraw-history__number,
.uc-withdraw-history__meta, .uc-withdraw-history__meta {
.uc-withdraw-history__note {
min-width: 0; min-width: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -927,9 +926,6 @@ body.uc-modal-open {
.uc-withdraw-history__meta { .uc-withdraw-history__meta {
flex: 0 1 190px; flex: 0 1 190px;
} }
.uc-withdraw-history__note {
flex: 0 1 160px;
}
.uc-withdraw-history__pagination { .uc-withdraw-history__pagination {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -978,9 +974,6 @@ body.uc-modal-open {
.uc-withdraw-history__meta { .uc-withdraw-history__meta {
flex-basis: 120px; flex-basis: 120px;
} }
.uc-withdraw-history__note {
display: none;
}
} }
/* Points tasks tab */ /* Points tasks tab */
+15 -7
View File
@@ -831,6 +831,14 @@
return node; return node;
} }
function formatGrossAmount(value) {
return text(value).replace(/\.00$/, '');
}
function formatNetAmount(value) {
return text(value);
}
function renderItems(items) { function renderItems(items) {
if (!list) return; if (!list) return;
list.textContent = ''; list.textContent = '';
@@ -849,21 +857,21 @@
row.className = 'uc-withdraw-history__item'; row.className = 'uc-withdraw-history__item';
var badge = appendText(row, statusLabels[status] || status, 'badg badg-sm uc-withdraw-history__status'); 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')); 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'); var number = document.createElement('span');
number.className = 'uc-withdraw-history__number muted-2-color em09'; number.className = 'uc-withdraw-history__number muted-2-color em09';
var numberLabel = document.createElement('span'); var numberLabel = document.createElement('span');
numberLabel.textContent = '提现单号:'; numberLabel.textContent = '提现单号:';
number.appendChild(numberLabel); number.appendChild(numberLabel);
var code = document.createElement('code'); var code = document.createElement('code');
code.textContent = text(item && item.withdrawal_number); code.textContent = text(item && item.withdrawal_number);
number.appendChild(code); number.appendChild(code);
row.appendChild(number); row.appendChild(number);
var meta = appendText(row, text(item && item.created_at), 'uc-withdraw-history__meta muted-2-color em09'); 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');
list.appendChild(row); list.appendChild(row);
}); });
} }
@@ -71,6 +71,11 @@ test('user withdrawal history uses one paginated ten-item endpoint', () => {
assert.match(script, /\/earnings\/withdrawals\?page=/) assert.match(script, /\/earnings\/withdrawals\?page=/)
assert.match(script, /&per_page=10/) assert.match(script, /&per_page=10/)
assert.match(script, /data-aksrt-withdraw-history-page/) 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-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__item\s*\{[\s\S]*?display: flex/)
assert.match(styles, /\.uc-withdraw-history-modal__dialog\s*\{[\s\S]*?overflow: hidden/) assert.match(styles, /\.uc-withdraw-history-modal__dialog\s*\{[\s\S]*?overflow: hidden/)