feat(user-center): redesign sidebar and wallet tips
This commit is contained in:
1 parent
82e71d1bf9
commit
a7f3caec59
24 files changed
+895
-528
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* User center sidebar: Zibll dual asset mini cards + commerce shortcuts.
|
||||
* User center sidebar: balance and points pair.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -8,73 +8,32 @@
|
||||
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)) {
|
||||
$show_credits = !empty($credits_enabled) || !empty($show_credit_tabs);
|
||||
if (!$show_wallet && !$show_credits) {
|
||||
return;
|
||||
}
|
||||
|
||||
$assets_url = aksrt_get_user_center_tab_url('credits');
|
||||
$wallet = (float) ($wallet_balance ?? 0);
|
||||
$points = (float) ($credit_balance ?? 0);
|
||||
?>
|
||||
<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 class="uc-sidebar__pair uc-sidebar__pair--assets">
|
||||
<?php if ($show_wallet) : ?>
|
||||
<a class="uc-summary-card uc-summary-card--wallet" href="<?php echo esc_url($assets_url); ?>">
|
||||
<span class="uc-summary-card__head"><?php esc_html_e('账户余额', 'aksrt'); ?><i class="fas fa-angle-right" aria-hidden="true"></i></span>
|
||||
<span class="uc-summary-card__body">
|
||||
<strong><?php echo esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format($wallet) : number_format_i18n($wallet, 2)); ?></strong>
|
||||
<i class="fas fa-wallet" aria-hidden="true"></i>
|
||||
</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_credits) : ?>
|
||||
<a class="uc-summary-card uc-summary-card--points" href="<?php echo esc_url(add_query_arg('asset_tab', 'points', $assets_url)); ?>">
|
||||
<span class="uc-summary-card__head"><?php echo esc_html((string) ($currency_name ?? __('积分', 'aksrt'))); ?><i class="fas fa-angle-right" aria-hidden="true"></i></span>
|
||||
<span class="uc-summary-card__body">
|
||||
<strong><?php echo esc_html(function_exists('aksrt_format_credits') ? aksrt_format_credits((int) $points) : number_format_i18n((int) $points)); ?></strong>
|
||||
<i class="fas fa-coins" aria-hidden="true"></i>
|
||||
</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in new issue
Block a user