fix(user-center): load revenue tabs without refresh
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39c92017d9
commit
02fcde3c84
7 files changed
+169
-41
No files matched your search
@@ -342,7 +342,9 @@ if (!function_exists('aksrt_user_center_runtime_config')) {
|
||||
'publicNonce' => wp_create_nonce('aksrt_public_nonce'),
|
||||
'settingsNonce' => wp_create_nonce('aksrt_account_settings'),
|
||||
'userId' => $user_id,
|
||||
'defaultTab' => $default_tab,
|
||||
'restUrl' => rest_url('aksrt/v1'),
|
||||
'restNonce' => wp_create_nonce('wp_rest'),
|
||||
'defaultTab' => $default_tab,
|
||||
'activeTab' => $active_tab,
|
||||
'tabAliases' => [
|
||||
'signin' => 'credits',
|
||||
|
||||
@@ -51,7 +51,8 @@ if ($details_text === '') {
|
||||
$details_text = trim((string) ($affiliate['note'] ?? '')) ?: __('好友通过推广链接完成符合条件的订单后,系统会按当前佣金比例记录返佣,结算后进入可提现余额。', 'aksrt');
|
||||
}
|
||||
|
||||
$active_reward_tab = sanitize_key((string) ($_GET['reward_tab'] ?? 'detail'));
|
||||
$revenue_request = is_array($context['revenue_request'] ?? null) ? $context['revenue_request'] : [];
|
||||
$active_reward_tab = sanitize_key((string) ($revenue_request['reward_tab'] ?? ($_GET['reward_tab'] ?? 'detail')));
|
||||
if (!in_array($active_reward_tab, ['detail', 'orders', 'users'], true)) {
|
||||
$active_reward_tab = 'detail';
|
||||
}
|
||||
@@ -65,7 +66,7 @@ $format_amount = static function ($amount): string {
|
||||
return number_format_i18n((float) $amount, 2);
|
||||
};
|
||||
|
||||
$commission_page = max(1, (int) ($_GET['commission_page'] ?? 1));
|
||||
$commission_page = max(1, (int) ($revenue_request['commission_page'] ?? ($_GET['commission_page'] ?? 1)));
|
||||
$commission_view = class_exists('\AKSRT\Payment\Rebate')
|
||||
? \AKSRT\Payment\Rebate::get_instance()->get_list([
|
||||
'user_id' => $user_id,
|
||||
@@ -107,7 +108,7 @@ $status_labels = [
|
||||
<div class="uc-commission-card__body">
|
||||
<span><?php esc_html_e('我的佣金', 'aksrt'); ?></span>
|
||||
<strong><?php echo esc_html($format_amount($available_commission)); ?></strong>
|
||||
<p><?php printf(esc_html__('累计佣金 %s,待结算 %s', 'aksrt'), esc_html($format_amount($commission_stats['total_amount'] ?? 0)), esc_html($format_amount($commission_stats['pending_amount'] ?? 0))); ?></p>
|
||||
<span><?php printf(esc_html__('累计佣金 %s,待结算 %s', 'aksrt'), esc_html($format_amount($commission_stats['total_amount'] ?? 0)), esc_html($format_amount($commission_stats['pending_amount'] ?? 0))); ?></span>
|
||||
</div>
|
||||
<?php if ($withdraw_on) : ?>
|
||||
<button type="button" class="uc-commission-card__action" data-aksrt-commission-withdraw-open><i class="fas fa-arrow-right" aria-hidden="true"></i><?php esc_html_e('立即提现', 'aksrt'); ?></button>
|
||||
|
||||
Reference in new issue
Block a user