feat(orders): embed My Orders inside user center (zibll-style)

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.
This commit is contained in:
kate522 committed 2026-07-25 13:54:08 +08:00
1 parent dae85f0198
commit 354a1072ef
8 files changed
+598 -464

No files matched your search

+28 -1
View File
@@ -71,6 +71,12 @@ class Center {
'priority' => 45,
'type' => 'panel',
],
'orders' => [
'label' => __('我的订单', 'aksrt'),
'icon' => 'receipt',
'priority' => 48,
'type' => 'panel',
],
'credits' => [
'label' => class_exists('\AKSRT\Settings\Settings')
? sprintf(__('我的%s', 'aksrt'), \AKSRT\Settings\Settings::get_currency_name())
@@ -104,7 +110,7 @@ class Center {
$vip_on = class_exists('\AKSRT\Settings\Settings')
&& !empty(\AKSRT\Settings\Settings::get_payment_vip_settings()['enabled']);
// Follow configured order; always auto-include VIP/credits when feature on.
// Follow configured order; always auto-include VIP/orders/credits when feature on.
$order = $configured;
if ($vip_on && !in_array('vip', $order, true)) {
$insert_at = count($order);
@@ -117,6 +123,24 @@ class Center {
}
array_splice($order, $insert_at, 0, ['vip']);
}
// Orders panel: always available when payment/shop stack exists (UserOrders or Shop).
$orders_on = class_exists('\AKSRT\Payment\UserOrders')
|| class_exists('\AKSRT\Payment\Order')
|| class_exists('\AKSRT\Shop\Shop');
if ($orders_on && !in_array('orders', $order, true)) {
$insert_at = count($order);
foreach (['vip', 'credits', 'favorites'] as $anchor) {
$idx = array_search($anchor, $order, true);
if ($idx !== false) {
$insert_at = (int) $idx + ($anchor === 'vip' ? 1 : 0);
if ($anchor !== 'vip') {
$insert_at = (int) $idx + 1;
}
break;
}
}
array_splice($order, $insert_at, 0, ['orders']);
}
if (($credits_on || $balance_on) && !in_array('credits', $order, true)) {
$order[] = 'credits';
}
@@ -134,6 +158,9 @@ class Center {
if ($key === 'vip' && !$vip_on) {
continue;
}
if ($key === 'orders' && !$orders_on) {
continue;
}
$panel = $definitions[$key];
if ($key === 'credits' && $balance_on) {
$panel['label'] = __('我的资产', 'aksrt');