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
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* User center sidebar: task-oriented order shortcuts.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$orders_base_url = (string) ($orders_url ?? '');
|
||||
if ($orders_base_url === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$order_stats = class_exists('\AKSRT\Payment\Order')
|
||||
? \AKSRT\Payment\Order::get_instance()->get_stats((int) ($user_id ?? 0))
|
||||
: [];
|
||||
$order_items = [
|
||||
[
|
||||
'label' => __('待支付', 'aksrt'),
|
||||
'icon' => 'wallet',
|
||||
'tab' => 'pending',
|
||||
'count' => (int) ($order_stats['pending'] ?? 0),
|
||||
],
|
||||
[
|
||||
'label' => __('待发货', 'aksrt'),
|
||||
'icon' => 'gift',
|
||||
'tab' => 'to-ship',
|
||||
'count' => (int) ($order_stats['paid'] ?? 0),
|
||||
],
|
||||
[
|
||||
'label' => __('待收货', 'aksrt'),
|
||||
'icon' => 'truck',
|
||||
'tab' => 'shipped',
|
||||
'count' => (int) ($order_stats['delivered'] ?? 0),
|
||||
],
|
||||
[
|
||||
'label' => __('待评价', 'aksrt'),
|
||||
'icon' => 'comment-dots',
|
||||
'tab' => 'review',
|
||||
'count' => (int) ($order_stats['pending_review'] ?? 0),
|
||||
],
|
||||
[
|
||||
'label' => __('售后', 'aksrt'),
|
||||
'icon' => 'undo-alt',
|
||||
'tab' => 'after',
|
||||
'count' => (int) ($order_stats['refunding'] ?? 0),
|
||||
],
|
||||
];
|
||||
?>
|
||||
<div class="uc-sidebar__section uc-order-card">
|
||||
<div class="uc-sidebar__heading">
|
||||
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
||||
<a href="<?php echo esc_url($orders_base_url); ?>">
|
||||
<?php esc_html_e('全部', 'aksrt'); ?><i class="fas fa-angle-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="uc-order-grid">
|
||||
<?php foreach ($order_items as $item) :
|
||||
$item_url = add_query_arg('order_tab', $item['tab'], $orders_base_url);
|
||||
?>
|
||||
<a class="uc-order-grid__item" href="<?php echo esc_url($item_url); ?>">
|
||||
<span class="uc-order-grid__icon">
|
||||
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
|
||||
<?php if ($item['count'] > 0) : ?>
|
||||
<small><?php echo esc_html($item['count'] > 99 ? '99+' : (string) $item['count']); ?></small>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<span><?php echo esc_html((string) $item['label']); ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user