feat(user-center): merge promotion rewards into revenue
This commit is contained in:
1 parent
a87fd32fa3
commit
39c92017d9
14 files changed
+1048
-159
No files matched your search
@@ -104,7 +104,7 @@ if (!function_exists('aksrt_get_user_center_tab_url')) {
|
||||
function aksrt_get_user_center_tab_url(string $tab): string {
|
||||
$tab = sanitize_key($tab);
|
||||
if ('invite' === $tab || 'promotion' === $tab) {
|
||||
$tab = 'promotion';
|
||||
$tab = 'revenue';
|
||||
}
|
||||
$url = remove_query_arg([
|
||||
'tab', 'posts_page', 'comments_page', 'favorites_page', 'credits_page',
|
||||
@@ -154,7 +154,6 @@ if (!function_exists('aksrt_capture_user_center_view')) {
|
||||
'vip' => 'vip',
|
||||
'orders' => 'orders',
|
||||
'auth' => 'auth',
|
||||
'promotion' => 'promotion',
|
||||
'revenue' => 'revenue',
|
||||
'settings' => 'settings',
|
||||
'header' => 'header',
|
||||
@@ -180,7 +179,7 @@ if (!function_exists('aksrt_capture_user_center_panel')) {
|
||||
* Capture a built-in or registered user-center panel body.
|
||||
*/
|
||||
function aksrt_capture_user_center_panel(string $tab_key, array $tab, array $context): string {
|
||||
$built_in_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'promotion', 'revenue', 'settings'];
|
||||
$built_in_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'revenue', 'settings'];
|
||||
if (in_array($tab_key, $built_in_tabs, true)) {
|
||||
return aksrt_capture_user_center_view($tab_key, $context);
|
||||
}
|
||||
@@ -288,7 +287,7 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
|
||||
if ('signin' === $active || 'assets' === $active) {
|
||||
$active = 'credits';
|
||||
} elseif ('invite' === $active || 'promotion' === $active) {
|
||||
$active = 'promotion';
|
||||
$active = 'revenue';
|
||||
} elseif ('vip' === $active) {
|
||||
// Prefer dedicated vip tab when registered; else credits (VIP shop).
|
||||
$active = in_array('vip', $keys, true) ? 'vip' : 'credits';
|
||||
@@ -347,9 +346,9 @@ if (!function_exists('aksrt_user_center_runtime_config')) {
|
||||
'activeTab' => $active_tab,
|
||||
'tabAliases' => [
|
||||
'signin' => 'credits',
|
||||
'invite' => 'promotion',
|
||||
'promotion' => 'promotion',
|
||||
'assets' => 'credits',
|
||||
'invite' => 'revenue',
|
||||
'promotion' => 'revenue',
|
||||
'assets' => 'credits',
|
||||
// vip → vip when panel exists; SPA may still map missing keys via server resolve.
|
||||
'vip' => 'vip',
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* User center revenue panel.
|
||||
* User center commission and promotion rewards panel.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -10,52 +10,190 @@ defined('ABSPATH') || exit;
|
||||
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
$user_id = (int) ($context['user_id'] ?? get_current_user_id());
|
||||
if ($user_id <= 0) {
|
||||
echo '<div class="uc-panel-empty muted-2-color">' . esc_html__('请先登录', 'aksrt') . '</div>';
|
||||
return;
|
||||
echo '<div class="uc-panel-empty muted-2-color">' . esc_html__('请先登录', 'aksrt') . '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$show_revenue_section = !empty($context['show_revenue_section']);
|
||||
$revenue_view = function_exists('aksrt_get_revenue_page_view')
|
||||
? aksrt_get_revenue_page_view($user_id)
|
||||
: ['balance' => 0, 'total_earned' => 0, 'total_withdrawn' => 0, 'records' => []];
|
||||
$settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_withdrawal_settings() : [];
|
||||
$min_amount = (float) ($settings['min_amount'] ?? 50);
|
||||
$fee_rate = (float) ($settings['service_charge_rate'] ?? 0);
|
||||
$withdraw_text = (string) ($settings['text'] ?? '');
|
||||
$withdrawals = class_exists('\AKSRT\Payment\Withdrawal')
|
||||
? \AKSRT\Payment\Withdrawal::get_instance()->get_user_withdrawals($user_id, ['limit' => 20])
|
||||
: [];
|
||||
$records = (array) ($revenue_view['records'] ?? []);
|
||||
$page = max(1, isset($_GET['rev_page']) ? (int) $_GET['rev_page'] : 1);
|
||||
$per_page = 20;
|
||||
$total_pages = max(1, (int) ceil(max(1, count($records)) / $per_page));
|
||||
$paged_records = array_slice($records, ($page - 1) * $per_page, $per_page);
|
||||
$revenue_url = static function (int $target_page): string {
|
||||
$url = function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('revenue') : home_url('/profile/?tab=revenue');
|
||||
return $target_page > 1 ? add_query_arg('rev_page', $target_page, $url) : $url;
|
||||
};
|
||||
?>
|
||||
<div class="aksrt-revenue-page uc-revenue-panel" data-aksrt-revenue-page data-min-amount="<?php echo esc_attr((string) $min_amount); ?>" data-fee-rate="<?php echo esc_attr((string) $fee_rate); ?>">
|
||||
$affiliate = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_payment_affiliate_settings()
|
||||
: [];
|
||||
$withdrawal = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_withdrawal_settings()
|
||||
: [];
|
||||
$all_settings = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_all()
|
||||
: [];
|
||||
$withdraw_on = !empty($all_settings['pay_balance_withdraw_s'])
|
||||
&& class_exists('\AKSRT\Credits\Balance')
|
||||
&& \AKSRT\Credits\Balance::enabled();
|
||||
if ($withdraw_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_withdraw', $user_id)) {
|
||||
$withdraw_on = false;
|
||||
}
|
||||
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? $withdrawal['min_amount'] ?? 50));
|
||||
|
||||
<?php if ($show_revenue_section) : ?>
|
||||
<section class="uc-revenue-card" aria-labelledby="uc-account-revenue-title">
|
||||
<header class="uc-revenue-card__header">
|
||||
<span class="uc-revenue-card__icon"><i class="fas fa-chart-line" aria-hidden="true"></i></span>
|
||||
<div>
|
||||
<p><?php esc_html_e('账户收益', 'aksrt'); ?></p>
|
||||
<h3 id="uc-account-revenue-title"><?php esc_html_e('收益与提现', 'aksrt'); ?></h3>
|
||||
</div>
|
||||
</header>
|
||||
<div class="aksrt-revenue-page__stats" aria-label="<?php esc_attr_e('收益概览', 'aksrt'); ?>">
|
||||
<div class="aksrt-revenue-page__stat-card"><div class="aksrt-revenue-page__stat-icon"><i class="fas fa-wallet" aria-hidden="true"></i></div><div class="aksrt-revenue-page__stat-info"><strong class="aksrt-revenue-page__stat-value" data-aksrt-revenue-balance>¥<?php echo esc_html(number_format_i18n((float) ($revenue_view['balance'] ?? 0), 2)); ?></strong><span class="aksrt-revenue-page__stat-label"><?php esc_html_e('可提现余额', 'aksrt'); ?></span></div></div>
|
||||
<div class="aksrt-revenue-page__stat-card"><div class="aksrt-revenue-page__stat-icon"><i class="fas fa-chart-line" aria-hidden="true"></i></div><div class="aksrt-revenue-page__stat-info"><strong class="aksrt-revenue-page__stat-value">¥<?php echo esc_html(number_format_i18n((float) ($revenue_view['total_earned'] ?? 0), 2)); ?></strong><span class="aksrt-revenue-page__stat-label"><?php esc_html_e('累计收益', 'aksrt'); ?></span></div></div>
|
||||
<div class="aksrt-revenue-page__stat-card"><div class="aksrt-revenue-page__stat-icon"><i class="fas fa-money-check-alt" aria-hidden="true"></i></div><div class="aksrt-revenue-page__stat-info"><strong class="aksrt-revenue-page__stat-value">¥<?php echo esc_html(number_format_i18n((float) ($revenue_view['total_withdrawn'] ?? 0), 2)); ?></strong><span class="aksrt-revenue-page__stat-label"><?php esc_html_e('已提现', 'aksrt'); ?></span></div></div>
|
||||
</div>
|
||||
<div class="aksrt-revenue-page__layout">
|
||||
<section class="aksrt-revenue-page__panel"><h3><?php esc_html_e('申请提现', 'aksrt'); ?></h3><?php if ($withdraw_text !== '') : ?><div class="aksrt-revenue-page__note"><?php echo wp_kses_post(wpautop($withdraw_text)); ?></div><?php endif; ?><form class="aksrt-revenue-page__withdraw-form" data-aksrt-withdraw-form><label><span><?php esc_html_e('提现金额', 'aksrt'); ?></span><input type="number" name="amount" min="<?php echo esc_attr((string) $min_amount); ?>" step="0.01" required></label><label><span><?php esc_html_e('提现方式', 'aksrt'); ?></span><select name="method"><option value="alipay"><?php esc_html_e('支付宝', 'aksrt'); ?></option><option value="wechat"><?php esc_html_e('微信', 'aksrt'); ?></option><option value="bank"><?php esc_html_e('银行卡', 'aksrt'); ?></option></select></label><label><span><?php esc_html_e('收款账户信息', 'aksrt'); ?></span><textarea name="account_info" rows="3" required></textarea></label><p class="aksrt-revenue-page__fee-hint"><?php printf(esc_html__('手续费 %s%%', 'aksrt'), esc_html((string) $fee_rate)); ?></p><button type="submit" class="btn-primary"><?php esc_html_e('提交提现申请', 'aksrt'); ?></button><p class="aksrt-revenue-page__form-msg" data-aksrt-withdraw-msg hidden></p></form></section>
|
||||
<section class="aksrt-revenue-page__panel"><h3><?php esc_html_e('提现记录', 'aksrt'); ?></h3><div class="aksrt-revenue-page__list" data-aksrt-withdraw-list><?php if ($withdrawals) : foreach ($withdrawals as $withdrawal) : ?><div class="aksrt-revenue-page__item"><div><strong>¥<?php echo esc_html(number_format_i18n((float) ($withdrawal['amount'] ?? 0), 2)); ?></strong><span><?php echo esc_html((string) ($withdrawal['method'] ?? '')); ?></span></div><div><span><?php echo esc_html((string) ($withdrawal['status'] ?? '')); ?></span><time><?php echo esc_html((string) ($withdrawal['created_at'] ?? '')); ?></time></div></div><?php endforeach; else : ?><p class="aksrt-revenue-page__empty"><?php esc_html_e('暂无提现记录', 'aksrt'); ?></p><?php endif; ?></div></section>
|
||||
</div>
|
||||
<section class="aksrt-revenue-page__section"><h3><?php esc_html_e('收益明细', 'aksrt'); ?></h3><?php if ($paged_records) : ?><div class="aksrt-revenue-page__list"><?php foreach ($paged_records as $record) : ?><div class="aksrt-revenue-page__item"><div><strong><?php echo esc_html((string) ($record['title'] ?? '')); ?></strong><time><?php echo esc_html((string) ($record['created_at'] ?? '')); ?></time></div><span class="<?php echo ($record['type'] ?? '') === 'withdrawal' ? 'is-out' : 'is-in'; ?>"><?php echo ($record['type'] ?? '') === 'withdrawal' ? '-' : '+'; ?>¥<?php echo esc_html(number_format_i18n((float) ($record['amount'] ?? 0), 2)); ?></span></div><?php endforeach; ?></div><?php if ($total_pages > 1) : ?><nav class="aksrt-revenue-page__pagination" aria-label="<?php esc_attr_e('收益分页', 'aksrt'); ?>"><?php for ($index = 1; $index <= $total_pages; $index++) : ?><a class="aksrt-revenue-page__page-chip<?php echo $index === $page ? ' is-active' : ''; ?>" href="<?php echo esc_url($revenue_url($index)); ?>"><?php echo esc_html((string) $index); ?></a><?php endfor; ?></nav><?php endif; ?><?php else : ?><p class="aksrt-revenue-page__empty"><?php esc_html_e('暂无收益明细', 'aksrt'); ?></p><?php endif; ?></section>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
$commission_stats = class_exists('\AKSRT\Payment\Rebate')
|
||||
? \AKSRT\Payment\Rebate::get_instance()->get_stats($user_id)
|
||||
: ['total' => 0, 'pending' => 0, 'pending_amount' => 0, 'settled' => 0, 'total_amount' => 0, 'settled_amount' => 0];
|
||||
$available_commission = class_exists('\AKSRT\Credits\Balance')
|
||||
? (float) \AKSRT\Credits\Balance::balance($user_id)
|
||||
: (float) ($commission_stats['settled_amount'] ?? 0);
|
||||
$vip_ratios = is_array($affiliate['user_ratio'] ?? null) ? $affiliate['user_ratio'] : [];
|
||||
$commission_ratio = (int) ($vip_ratios['user'] ?? $affiliate['ratio'] ?? 0);
|
||||
$current_vip = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0;
|
||||
if ($current_vip >= 2 && !empty($vip_ratios['vip2'])) {
|
||||
$commission_ratio = (int) $vip_ratios['vip2'];
|
||||
} elseif ($current_vip >= 1 && !empty($vip_ratios['vip1'])) {
|
||||
$commission_ratio = (int) $vip_ratios['vip1'];
|
||||
}
|
||||
$details_title = trim((string) ($affiliate['text']['details_title'] ?? '')) ?: __('返佣详解', 'aksrt');
|
||||
$details_text = trim((string) ($affiliate['text']['details'] ?? ''));
|
||||
if ($details_text === '') {
|
||||
$details_text = trim((string) ($affiliate['note'] ?? '')) ?: __('好友通过推广链接完成符合条件的订单后,系统会按当前佣金比例记录返佣,结算后进入可提现余额。', 'aksrt');
|
||||
}
|
||||
|
||||
$active_reward_tab = sanitize_key((string) ($_GET['reward_tab'] ?? 'detail'));
|
||||
if (!in_array($active_reward_tab, ['detail', 'orders', 'users'], true)) {
|
||||
$active_reward_tab = 'detail';
|
||||
}
|
||||
$base_url = function_exists('aksrt_get_user_center_tab_url')
|
||||
? aksrt_get_user_center_tab_url('revenue')
|
||||
: home_url('/profile/?tab=revenue');
|
||||
$reward_url = static function (string $tab, array $extra = []) use ($base_url): string {
|
||||
return add_query_arg(array_merge(['reward_tab' => $tab], $extra), $base_url);
|
||||
};
|
||||
$format_amount = static function ($amount): string {
|
||||
return number_format_i18n((float) $amount, 2);
|
||||
};
|
||||
|
||||
$commission_page = max(1, (int) ($_GET['commission_page'] ?? 1));
|
||||
$commission_view = class_exists('\AKSRT\Payment\Rebate')
|
||||
? \AKSRT\Payment\Rebate::get_instance()->get_list([
|
||||
'user_id' => $user_id,
|
||||
'limit' => 10,
|
||||
'offset' => ($commission_page - 1) * 10,
|
||||
])
|
||||
: ['items' => [], 'total' => 0, 'max_pages' => 1, 'page' => 1];
|
||||
$commission_items = (array) ($commission_view['items'] ?? []);
|
||||
$commission_total_pages = max(1, (int) ($commission_view['max_pages'] ?? ceil(max(1, (int) ($commission_view['total'] ?? 0)) / 10)));
|
||||
if ($commission_page > $commission_total_pages) {
|
||||
$commission_page = $commission_total_pages;
|
||||
if (class_exists('\AKSRT\Payment\Rebate')) {
|
||||
$commission_view = \AKSRT\Payment\Rebate::get_instance()->get_list([
|
||||
'user_id' => $user_id,
|
||||
'limit' => 10,
|
||||
'offset' => ($commission_page - 1) * 10,
|
||||
]);
|
||||
}
|
||||
}
|
||||
$commission_items = (array) ($commission_view['items'] ?? []);
|
||||
$status_labels = [
|
||||
'pending' => __('待结算', 'aksrt'),
|
||||
'settled' => __('已结算', 'aksrt'),
|
||||
'cancelled' => __('已取消', 'aksrt'),
|
||||
];
|
||||
?>
|
||||
<div class="aksrt-revenue-page uc-revenue-panel" data-aksrt-revenue-page data-min-amount="<?php echo esc_attr((string) $withdraw_min); ?>">
|
||||
<section class="uc-commission-summary" aria-label="<?php esc_attr_e('佣金概览', 'aksrt'); ?>">
|
||||
<article class="uc-commission-card uc-commission-card--ratio">
|
||||
<div class="uc-commission-card__icon"><i class="fas fa-percentage" aria-hidden="true"></i></div>
|
||||
<div class="uc-commission-card__body">
|
||||
<span><?php esc_html_e('佣金比例', 'aksrt'); ?></span>
|
||||
<strong><?php echo esc_html((string) $commission_ratio); ?><small>%</small></strong>
|
||||
<p><?php esc_html_e('普通用户推广订单返佣比例', 'aksrt'); ?></p>
|
||||
</div>
|
||||
</article>
|
||||
<article class="uc-commission-card uc-commission-card--balance">
|
||||
<div class="uc-commission-card__icon"><i class="fas fa-wallet" aria-hidden="true"></i></div>
|
||||
<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>
|
||||
</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>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="uc-reward-area" aria-labelledby="uc-reward-area-title">
|
||||
<div class="uc-reward-area__heading">
|
||||
<h3 id="uc-reward-area-title"><?php esc_html_e('推广奖励', 'aksrt'); ?></h3>
|
||||
<span><?php esc_html_e('邀请与返佣数据', 'aksrt'); ?></span>
|
||||
</div>
|
||||
<nav class="uc-reward-tabs" aria-label="<?php esc_attr_e('推广奖励', 'aksrt'); ?>">
|
||||
<a <?php echo $active_reward_tab === 'detail' ? 'aria-current="page"' : ''; ?> class="<?php echo $active_reward_tab === 'detail' ? 'is-active' : ''; ?>" href="<?php echo esc_url($reward_url('detail')); ?>"><?php esc_html_e('佣金详细', 'aksrt'); ?></a>
|
||||
<a <?php echo $active_reward_tab === 'orders' ? 'aria-current="page"' : ''; ?> class="<?php echo $active_reward_tab === 'orders' ? 'is-active' : ''; ?>" href="<?php echo esc_url($reward_url('orders')); ?>"><?php esc_html_e('佣金明细', 'aksrt'); ?></a>
|
||||
<a <?php echo $active_reward_tab === 'users' ? 'aria-current="page"' : ''; ?> class="<?php echo $active_reward_tab === 'users' ? 'is-active' : ''; ?>" href="<?php echo esc_url($reward_url('users')); ?>"><?php esc_html_e('推荐用户', 'aksrt'); ?></a>
|
||||
</nav>
|
||||
|
||||
<?php if ($active_reward_tab === 'detail') : ?>
|
||||
<div class="uc-reward-pane uc-reward-pane--detail">
|
||||
<section class="uc-reward-block" aria-labelledby="uc-referral-link-title">
|
||||
<div class="uc-reward-block__heading"><h4 id="uc-referral-link-title"><?php esc_html_e('推广链接', 'aksrt'); ?></h4><p><?php esc_html_e('分享链接,好友注册后会自动建立邀请关系。', 'aksrt'); ?></p></div>
|
||||
<div class="uc-invite-share">
|
||||
<div class="uc-invite-code"><span><?php esc_html_e('我的邀请码', 'aksrt'); ?></span><strong data-invite-code>--</strong></div>
|
||||
<label class="screen-reader-text" for="aksrt-invite-link"><?php esc_html_e('推广链接', 'aksrt'); ?></label>
|
||||
<div class="uc-invite-link-row"><input id="aksrt-invite-link" type="text" data-invite-link readonly value=""><button type="button" class="btn-primary btn-sm" data-invite-copy disabled><i class="fas fa-copy" aria-hidden="true"></i><span><?php esc_html_e('复制链接', 'aksrt'); ?></span></button></div>
|
||||
<p class="uc-reward-status" data-invite-status role="status" aria-live="polite"><?php esc_html_e('正在加载推广数据...', 'aksrt'); ?></p>
|
||||
<p class="uc-reward-copy-feedback" data-invite-copy-feedback role="status" aria-live="polite"></p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="uc-reward-block" aria-labelledby="uc-ratio-title">
|
||||
<div class="uc-reward-block__heading"><h4 id="uc-ratio-title"><?php esc_html_e('佣金比例', 'aksrt'); ?></h4><p><?php esc_html_e('当前推广身份对应的返佣规则。', 'aksrt'); ?></p></div>
|
||||
<dl class="uc-ratio-list">
|
||||
<div><dt><?php esc_html_e('普通用户', 'aksrt'); ?></dt><dd><?php echo esc_html((string) ($vip_ratios['user'] ?? $commission_ratio)); ?>%</dd></div>
|
||||
<div><dt>VIP 1</dt><dd><?php echo esc_html((string) ($vip_ratios['vip1'] ?? 0)); ?>%</dd></div>
|
||||
<div><dt>VIP 2</dt><dd><?php echo esc_html((string) ($vip_ratios['vip2'] ?? 0)); ?>%</dd></div>
|
||||
</dl>
|
||||
</section>
|
||||
<section class="uc-reward-block" aria-labelledby="uc-total-title">
|
||||
<div class="uc-reward-block__heading"><h4 id="uc-total-title"><?php esc_html_e('累计佣金', 'aksrt'); ?></h4><p><?php esc_html_e('按已创建的返佣记录汇总。', 'aksrt'); ?></p></div>
|
||||
<div class="uc-total-commission"><strong><?php echo esc_html($format_amount($commission_stats['total_amount'] ?? 0)); ?></strong><span><?php printf(esc_html__('%d 笔佣金记录', 'aksrt'), (int) ($commission_stats['total'] ?? 0)); ?></span></div>
|
||||
</section>
|
||||
<section class="uc-reward-block" aria-labelledby="uc-details-title">
|
||||
<div class="uc-reward-block__heading"><h4 id="uc-details-title"><?php echo esc_html($details_title); ?></h4></div>
|
||||
<div class="uc-reward-richtext"><?php echo wp_kses_post(wpautop($details_text)); ?></div>
|
||||
</section>
|
||||
</div>
|
||||
<?php elseif ($active_reward_tab === 'orders') : ?>
|
||||
<div class="uc-reward-pane">
|
||||
<div class="uc-reward-list-heading"><div><h4><?php esc_html_e('佣金订单', 'aksrt'); ?></h4><p><?php esc_html_e('每页显示 10 条佣金记录。', 'aksrt'); ?></p></div><strong><?php printf(esc_html__('%d 条', 'aksrt'), (int) ($commission_view['total'] ?? 0)); ?></strong></div>
|
||||
<?php if ($commission_items) : ?>
|
||||
<div class="uc-commission-list">
|
||||
<?php foreach ($commission_items as $item) :
|
||||
$status = sanitize_key((string) ($item['status'] ?? 'pending'));
|
||||
$source_user = !empty($item['source_user_id']) ? get_userdata((int) $item['source_user_id']) : null;
|
||||
$source_name = $source_user instanceof WP_User ? $source_user->display_name : __('推广用户', 'aksrt');
|
||||
?>
|
||||
<article class="uc-commission-row"><span class="uc-commission-row__icon"><i class="fas fa-receipt" aria-hidden="true"></i></span><div class="uc-commission-row__main"><strong><?php echo esc_html($source_name); ?></strong><span><?php printf(esc_html__('订单 %s', 'aksrt'), esc_html((string) ($item['order_number'] ?? '-'))); ?></span><time><?php echo esc_html((string) ($item['created_at'] ?? '')); ?></time></div><div class="uc-commission-row__value"><strong>+<?php echo esc_html($format_amount($item['amount'] ?? 0)); ?></strong><span class="is-<?php echo esc_attr($status); ?>"><?php echo esc_html($status_labels[$status] ?? $status); ?></span></div></article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if ($commission_total_pages > 1) : ?><nav class="uc-reward-pagination" aria-label="<?php esc_attr_e('佣金明细分页', 'aksrt'); ?>"><?php for ($i = 1; $i <= $commission_total_pages; $i++) : ?><a class="<?php echo $i === $commission_page ? 'is-active' : ''; ?>" href="<?php echo esc_url($reward_url('orders', ['commission_page' => $i])); ?>"><?php echo esc_html((string) $i); ?></a><?php endfor; ?></nav><?php endif; ?>
|
||||
<?php else : ?><p class="uc-reward-empty"><?php esc_html_e('暂无佣金订单', 'aksrt'); ?></p><?php endif; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="uc-reward-pane">
|
||||
<div class="uc-reward-list-heading"><div><h4><?php esc_html_e('邀请记录', 'aksrt'); ?></h4><p><?php esc_html_e('通过推广链接注册的用户会显示在这里。', 'aksrt'); ?></p></div><strong data-invite-total><?php esc_html_e('加载中...', 'aksrt'); ?></strong></div>
|
||||
<div class="uc-invite-list is-loading" data-invite-list aria-live="polite"><p class="uc-reward-empty"><?php esc_html_e('正在加载邀请记录...', 'aksrt'); ?></p></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if ($withdraw_on) : ?>
|
||||
<div class="uc-modal" id="aksrt-commission-withdraw-modal" hidden data-aksrt-commission-withdraw-modal>
|
||||
<div class="uc-modal__overlay" data-aksrt-commission-withdraw-close></div>
|
||||
<div class="uc-modal__dialog" role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="aksrt-commission-withdraw-title">
|
||||
<button type="button" class="uc-modal__close" data-aksrt-commission-withdraw-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
||||
<h3 class="uc-modal__title" id="aksrt-commission-withdraw-title"><?php esc_html_e('立即提现', 'aksrt'); ?></h3>
|
||||
<form data-aksrt-commission-withdraw-form>
|
||||
<label><?php esc_html_e('提现金额', 'aksrt'); ?><input type="number" name="amount" min="<?php echo esc_attr((string) $withdraw_min); ?>" step="0.01" data-aksrt-commission-withdraw-amount required></label>
|
||||
<p class="muted-2-color em09"><?php printf(esc_html__('最低提现 %s,当前可提现 %s', 'aksrt'), esc_html($format_amount($withdraw_min)), esc_html($format_amount($available_commission))); ?></p>
|
||||
<label><?php esc_html_e('提现方式', 'aksrt'); ?><select name="method" data-aksrt-commission-withdraw-method><option value="alipay"><?php esc_html_e('支付宝', 'aksrt'); ?></option><option value="wechat"><?php esc_html_e('微信', 'aksrt'); ?></option><option value="bank"><?php esc_html_e('银行卡', 'aksrt'); ?></option></select></label>
|
||||
<label><?php esc_html_e('收款账户信息', 'aksrt'); ?><textarea name="account_info" rows="3" data-aksrt-commission-withdraw-account required placeholder="<?php esc_attr_e('姓名 + 账号 / 卡号', 'aksrt'); ?>"></textarea></label>
|
||||
<p class="uc-modal__tip" data-aksrt-commission-withdraw-tip role="status" aria-live="polite"></p>
|
||||
<button type="submit" class="btn-primary btn-block" data-aksrt-commission-withdraw-submit><?php esc_html_e('提交申请', 'aksrt'); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -11,7 +11,6 @@ $level_url = isset($dashboard_tabs['level'])
|
||||
? aksrt_get_user_center_tab_url('level')
|
||||
: '';
|
||||
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
||||
$promotion_url = isset($dashboard_tabs['promotion']) ? aksrt_get_user_center_tab_url('promotion') : '';
|
||||
$orders_available = isset($dashboard_tabs['orders']);
|
||||
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
||||
|
||||
@@ -22,13 +21,7 @@ $services = array_values(array_filter([
|
||||
'tone' => 'level',
|
||||
'url' => $level_url,
|
||||
],
|
||||
[
|
||||
'label' => __('推广中心', 'aksrt'),
|
||||
'icon' => 'bullhorn',
|
||||
'tone' => 'promotion',
|
||||
'url' => $promotion_url,
|
||||
'tab' => 'promotion',
|
||||
],
|
||||
|
||||
[
|
||||
'label' => __('官方认证', 'aksrt'),
|
||||
'icon' => 'id-badge',
|
||||
|
||||
@@ -32,8 +32,8 @@ function aksrt_get_user_center_url(string $tab = ''): string {
|
||||
'assets' => 'credits',
|
||||
'vip' => 'vip', // dedicated vip tab when registered; resolver falls back if missing
|
||||
'signin' => 'credits',
|
||||
'invite' => 'promotion',
|
||||
'promotion' => 'promotion',
|
||||
'invite' => 'revenue',
|
||||
'promotion' => 'revenue',
|
||||
];
|
||||
if (isset($aliases[$tab])) {
|
||||
$tab = $aliases[$tab];
|
||||
|
||||
Reference in new issue
Block a user