Register UC panel tab=orders with full order list/actions UI; route aksrt_get_orders_page_url and /orders template to profile?tab=orders; enqueue order assets when the UC orders tab is active.
81 lines
3.5 KiB
PHP
81 lines
3.5 KiB
PHP
<?php
|
|
/**
|
|
* User center sidebar: Zibll dual asset mini cards + commerce shortcuts.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$show_wallet = !empty($balance_enabled);
|
|
$show_credits = !empty($show_credit_tabs) || !empty($credits_enabled);
|
|
$wallet = (float) ($wallet_balance ?? 0.0);
|
|
$points = (float) ($credit_balance ?? 0.0);
|
|
$currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
|
|
|
if ($show_wallet || $show_credits) :
|
|
$assets_url = function_exists('aksrt_get_user_center_tab_url')
|
|
? aksrt_get_user_center_tab_url('credits')
|
|
: '#';
|
|
?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__title"><?php esc_html_e('我的资产', 'aksrt'); ?></div>
|
|
<div class="uc-asset-mini flex ab jsb col-ml6">
|
|
<?php if ($show_wallet) : ?>
|
|
<a class="uc-asset-mini__card flex1" href="<?php echo esc_url($assets_url); ?>">
|
|
<div class="uc-asset-mini__label muted-2-color em09"><?php esc_html_e('余额', 'aksrt'); ?><i class="ml6 fa fa-angle-right em12" aria-hidden="true"></i></div>
|
|
<div class="flex jsb ac">
|
|
<span class="font-bold c-blue-2"><?php echo esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format($wallet) : number_format_i18n($wallet, 2)); ?></span>
|
|
<i class="fas fa-wallet em14 c-blue-2" aria-hidden="true"></i>
|
|
</div>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php if ($show_credits) : ?>
|
|
<a class="uc-asset-mini__card flex1" href="<?php echo esc_url($assets_url); ?>">
|
|
<div class="uc-asset-mini__label muted-2-color em09"><?php echo esc_html($currency); ?><i class="ml6 fa fa-angle-right em12" aria-hidden="true"></i></div>
|
|
<div class="flex jsb ac">
|
|
<span class="font-bold c-yellow"><?php echo esc_html(function_exists('aksrt_format_credits') ? aksrt_format_credits((int) $points) : (string) (int) $points); ?></span>
|
|
<i class="fas fa-coins em14 c-yellow" aria-hidden="true"></i>
|
|
</div>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
|
|
if (empty($orders_url) && empty($show_vip) && empty($show_credit_tabs) && empty($balance_enabled) && empty($affiliate_enabled)) {
|
|
return;
|
|
}
|
|
?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__title"><?php esc_html_e('权益与消费', 'aksrt'); ?></div>
|
|
<div class="uc-sidebar__buttons">
|
|
<?php $revenue_url = function_exists('aksrt_get_revenue_page_url') ? aksrt_get_revenue_page_url() : ''; ?>
|
|
<?php
|
|
$orders_href = !empty($orders_url)
|
|
? (string) $orders_url
|
|
: (function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('orders') : '');
|
|
if ($orders_href !== '') :
|
|
$orders_active = !empty($active_tab) && $active_tab === 'orders';
|
|
?>
|
|
<a href="<?php echo esc_url($orders_href); ?>" class="uc-sidebar__btn<?php echo $orders_active ? ' is-active' : ''; ?>" data-tab="orders">
|
|
<i class="fas fa-receipt" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php if (!empty($show_vip)) : ?>
|
|
<a class="uc-sidebar__btn payvip-icon<?php echo (!empty($active_tab) && $active_tab === 'vip') ? ' is-active' : ''; ?>" href="<?php echo esc_url(aksrt_get_user_center_tab_url('vip')); ?>" data-tab="vip">
|
|
<i class="fas fa-crown" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('VIP 会员', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php if (!empty($affiliate_enabled) && $revenue_url) : ?>
|
|
<a href="<?php echo esc_url($revenue_url); ?>" class="uc-sidebar__btn">
|
|
<i class="fas fa-share-alt" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('推广返佣', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|