fix(revenue): drop 待偿欠款 from the commission card
The field rendered in two places on /user/revenue/: the 我的佣金 card's meta line and the 累计佣金 row, both gated on a non-zero balance. Remove both, along with the now-unused $debt_amount local and the dead .uc-commission-card__debt rule. Source trace, since the label is only the surface: CommissionLedger:: overview() reads debt_minor from aksrt_commission_debt and returns it as 'debt'; record_debt() books the shortfall when a refund cannot be clawed back in full, and repay_debt_from_pool() later clears it out of the commission pool. That mechanism is untouched — arrears still accrue and still get repaid, the UI just no longer surfaces them. The reference theme's rebate card has no equivalent concept, so this is not a parity target either. Keep 'debt' in the template's overview() fallback array: it mirrors the real return shape and the repayment path still depends on the value. Add a contract test asserting the label, its class and the local are gone from the display layer while overview() keeps returning the key; verified it fails if the label is reintroduced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a22c7eb8b
commit
0cfd4c898b
3 files changed
+12
-10
No files matched your search
@@ -110,13 +110,6 @@
|
|||||||
gap: 4px 16px;
|
gap: 4px 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 待偿欠款:退款收回不足挂账,副信息里以描边标签弱提示。 */
|
|
||||||
.uc-content .uc-commission-card__debt {
|
|
||||||
padding: 0 8px;
|
|
||||||
border-radius: 999px;
|
|
||||||
background: rgba(255, 255, 255, .22);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 立即提现按钮:贴右居中,对齐参考主题 .abs-right。 */
|
/* 立即提现按钮:贴右居中,对齐参考主题 .abs-right。 */
|
||||||
.uc-content .uc-commission-card__action {
|
.uc-content .uc-commission-card__action {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ $status_labels = [
|
|||||||
$pool_amount = $format_amount($commission_stats['pool'] ?? 0);
|
$pool_amount = $format_amount($commission_stats['pool'] ?? 0);
|
||||||
$total_amount = $format_amount($commission_stats['total'] ?? 0);
|
$total_amount = $format_amount($commission_stats['total'] ?? 0);
|
||||||
$withdrawn_amount = $format_amount($commission_stats['withdrawn'] ?? 0);
|
$withdrawn_amount = $format_amount($commission_stats['withdrawn'] ?? 0);
|
||||||
$debt_amount = $format_amount($commission_stats['debt'] ?? 0);
|
|
||||||
$reward_panes = ['detail'];
|
$reward_panes = ['detail'];
|
||||||
if ($affiliate_on) {
|
if ($affiliate_on) {
|
||||||
$reward_panes[] = 'orders';
|
$reward_panes[] = 'orders';
|
||||||
@@ -148,7 +147,6 @@ $pane_is_active = static function (string $tab) use ($active_reward_tab): bool {
|
|||||||
<p class="uc-commission-card__meta">
|
<p class="uc-commission-card__meta">
|
||||||
<span><?php printf(esc_html__('累计佣金 ¥%s', 'aksrt'), esc_html($total_amount)); ?></span>
|
<span><?php printf(esc_html__('累计佣金 ¥%s', 'aksrt'), esc_html($total_amount)); ?></span>
|
||||||
<span><?php printf(esc_html__('已提现 ¥%s', 'aksrt'), esc_html($withdrawn_amount)); ?></span>
|
<span><?php printf(esc_html__('已提现 ¥%s', 'aksrt'), esc_html($withdrawn_amount)); ?></span>
|
||||||
<?php if (($commission_stats['debt'] ?? '0.00') !== '0.00') : ?><span class="uc-commission-card__debt"><?php printf(esc_html__('待偿欠款 ¥%s', 'aksrt'), esc_html($debt_amount)); ?></span><?php endif; ?>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($withdraw_on) : ?>
|
<?php if ($withdraw_on) : ?>
|
||||||
@@ -178,7 +176,7 @@ $pane_is_active = static function (string $tab) use ($active_reward_tab): bool {
|
|||||||
</div>
|
</div>
|
||||||
<?php if ($affiliate_on) : ?>
|
<?php if ($affiliate_on) : ?>
|
||||||
<div class="uc-revenue-summary-row"><span><?php esc_html_e('佣金比例', 'aksrt'); ?></span><strong data-affiliate-ratio><?php echo esc_html((string) $commission_ratio); ?>%</strong></div>
|
<div class="uc-revenue-summary-row"><span><?php esc_html_e('佣金比例', 'aksrt'); ?></span><strong data-affiliate-ratio><?php echo esc_html((string) $commission_ratio); ?>%</strong></div>
|
||||||
<div class="uc-revenue-summary-row uc-revenue-summary-row--total"><span><?php esc_html_e('累计佣金', 'aksrt'); ?></span><div><strong><?php printf(esc_html__('累计 %s 元', 'aksrt'), esc_html($total_amount)); ?></strong><strong><?php printf(esc_html__('已提现 %s 元', 'aksrt'), esc_html($withdrawn_amount)); ?></strong><?php if (($commission_stats['debt'] ?? '0.00') !== '0.00') : ?><strong><?php printf(esc_html__('待偿欠款 %s 元', 'aksrt'), esc_html($debt_amount)); ?></strong><?php endif; ?></div></div>
|
<div class="uc-revenue-summary-row uc-revenue-summary-row--total"><span><?php esc_html_e('累计佣金', 'aksrt'); ?></span><div><strong><?php printf(esc_html__('累计 %s 元', 'aksrt'), esc_html($total_amount)); ?></strong><strong><?php printf(esc_html__('已提现 %s 元', 'aksrt'), esc_html($withdrawn_amount)); ?></strong></div></div>
|
||||||
<div class="uc-revenue-summary-row uc-revenue-summary-row--explain"><span><?php echo esc_html($details_title); ?></span><div class="uc-reward-richtext"><?php echo wp_kses_post(wpautop($details_text)); ?></div></div>
|
<div class="uc-revenue-summary-row uc-revenue-summary-row--explain"><span><?php echo esc_html($details_title); ?></span><div class="uc-reward-richtext"><?php echo wp_kses_post(wpautop($details_text)); ?></div></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,6 +22,17 @@ test('QR generator is bundled locally; no external QR CDN in front-end sources',
|
|||||||
|
|
||||||
test('revenue detail card is a four-row info list with no standalone QR block', () => {
|
test('revenue detail card is a four-row info list with no standalone QR block', () => {
|
||||||
const template = read('inc', 'helpers', 'user-center-renderers', 'profile-revenue.php')
|
const template = read('inc', 'helpers', 'user-center-renderers', 'profile-revenue.php')
|
||||||
|
// 待偿欠款不在 UI 暴露:欠款机制(挂账/偿还)照常运行,只是不渲染。
|
||||||
|
// 参考主题的佣金卡片也没有这个概念,故不作为平价目标。
|
||||||
|
assert.doesNotMatch(template, /待偿欠款/)
|
||||||
|
assert.doesNotMatch(template, /uc-commission-card__debt/)
|
||||||
|
assert.doesNotMatch(template, /\$debt_amount/)
|
||||||
|
const css = read('assets', 'css', 'routes', 'user-center', 'revenue-earnings.css')
|
||||||
|
assert.doesNotMatch(css, /uc-commission-card__debt/)
|
||||||
|
// overview() 仍返回 debt(偿还逻辑依赖),fallback 形状必须与之一致。
|
||||||
|
assert.match(template, /'debt' => 0/)
|
||||||
|
const ledger = read('src', 'Payment', 'CommissionLedger.php')
|
||||||
|
assert.match(ledger, /'debt'\s*=>/)
|
||||||
// 二维码不再作为独立行:整行 markup 已删除。
|
// 二维码不再作为独立行:整行 markup 已删除。
|
||||||
assert.doesNotMatch(template, /data-affiliate-qr-row/)
|
assert.doesNotMatch(template, /data-affiliate-qr-row/)
|
||||||
assert.doesNotMatch(template, /data-affiliate-qr(?!-)/)
|
assert.doesNotMatch(template, /data-affiliate-qr(?!-)/)
|
||||||
|
|||||||
Reference in new issue
Block a user