The standalone order card is folded into the 我的服务 (My Services) sidebar section: 我的订单 becomes a service-grid tile (all orders), with the 待支付/售后 quick shortcuts rendered beneath it as a compact row. Gated on the orders dashboard tab being registered so no dead tile appears when the payment stack is absent.
51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* User center sidebar: task-oriented order shortcuts.
|
|
*
|
|
* Rendered inside the 我的服务 (My Services) section — see sidebar-nav.php.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$orders_base_url = (string) ($orders_url ?? '');
|
|
if ($orders_base_url === '') {
|
|
return;
|
|
}
|
|
|
|
$order_user_id = (int) ($user_id ?? 0);
|
|
$order_stats = class_exists('\AKSRT\Payment\Order')
|
|
? \AKSRT\Payment\Order::get_instance()->get_stats($order_user_id)
|
|
: [];
|
|
$order_items = [
|
|
[
|
|
'label' => __('待支付', 'aksrt'),
|
|
'icon' => 'wallet',
|
|
'tab' => 'pending',
|
|
'count' => (int) ($order_stats['pending'] ?? 0),
|
|
],
|
|
[
|
|
'label' => __('售后', 'aksrt'),
|
|
'icon' => 'undo-alt',
|
|
'tab' => 'after',
|
|
'count' => (int) ($order_stats['refunding'] ?? 0),
|
|
],
|
|
];
|
|
?>
|
|
<div class="uc-order-grid uc-order-grid--quick">
|
|
<?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>
|