@@ -0,0 +1,494 @@
< ? php
/**
* User center panel: My Orders (embedded; zibll-style tab content).
*
* @package AKSRT
*/
defined ( 'ABSPATH' ) || exit ;
$context = is_array ( $args [ 'context' ] ? ? null ) ? $args [ 'context' ] : [];
$user_id = ( int ) ( $context [ 'user_id' ] ? ? get_current_user_id ());
if ( $user_id <= 0 ) {
echo '<div class="uc-panel-empty muted-2-color">' . esc_html__ ( '请先登录' , 'aksrt' ) . '</div>' ;
return ;
}
$per_page = 20 ;
$paged = max ( 1 , ( int ) ( $_GET [ 'order_page' ] ? ? 1 ));
$tab = sanitize_key (( string ) ( $_GET [ 'order_tab' ] ? ? ( $_GET [ 'otab' ] ? ? '' )));
$status = sanitize_key (( string ) ( $_GET [ 'order_status' ] ? ? '' ));
$type_filter = sanitize_key (( string ) ( $_GET [ 'order_type' ] ? ? '' ));
$section = sanitize_key (( string ) ( $_GET [ 'section' ] ? ? '' ));
// Accept legacy standalone-page tab keys.
if ( $tab === '' && isset ( $_GET [ 'tab' ]) && sanitize_key (( string ) $_GET [ 'tab' ]) !== 'orders' ) {
// When rendered as standalone legacy include, outer tab may be status.
$maybe = sanitize_key (( string ) $_GET [ 'tab' ]);
if ( in_array ( $maybe , [ 'pending' , 'shipped' , 'received' , 'review' , 'after' , 'wait-pay' , 'wait-shipped' , 'wait-receive' , 'wait-evaluate' , 'after-sale' , 'all' ], true )) {
$tab = $maybe ;
}
}
$tab_aliases = [
'wait-pay' => 'pending' ,
'wait-shipped' => 'shipped' ,
'wait-receive' => 'shipped' ,
'wait-evaluate' => 'review' ,
'after-sale' => 'after' ,
'all' => '' ,
];
if ( isset ( $tab_aliases [ $tab ])) {
$tab = $tab_aliases [ $tab ];
}
$tab_status_map = [
'pending' => \AKSRT\Payment\Order :: STATUS_PENDING ,
'shipped' => \AKSRT\Payment\Order :: STATUS_DELIVERED ,
'received' => \AKSRT\Payment\Order :: STATUS_COMPLETED ,
'review' => \AKSRT\Payment\Order :: STATUS_PENDING_REVIEW ,
'after' => \AKSRT\Payment\Order :: STATUS_REFUNDING ,
];
if ( $tab !== '' && isset ( $tab_status_map [ $tab ])) {
$status = $tab_status_map [ $tab ];
}
$orders_view = function_exists ( 'aksrt_get_orders_page_view' )
? aksrt_get_orders_page_view ( $user_id , $paged , $per_page , $status , $type_filter )
: [ 'items' => [], 'total' => 0 , 'total_pages' => 1 , 'page' => 1 , 'stats' => [], 'product_types' => []];
$orders = ( array ) ( $orders_view [ 'items' ] ? ? []);
$total_pages = max ( 1 , ( int ) ( $orders_view [ 'total_pages' ] ? ? 1 ));
$stats = is_array ( $orders_view [ 'stats' ] ? ? null ) ? $orders_view [ 'stats' ] : [];
$type_options = is_array ( $orders_view [ 'product_types' ] ? ? null ) ? $orders_view [ 'product_types' ] : [];
if ( $type_options === [] && class_exists ( '\AKSRT\Core\DomainModel' )) {
$type_options = array_merge ([ '' => __ ( '全部类型' , 'aksrt' )], \AKSRT\Core\DomainModel :: order_product_type_labels ());
}
$shop = class_exists ( '\AKSRT\Shop\Shop' ) ? \AKSRT\Shop\Shop :: get_instance () : null ;
$tabs = [
'' => __ ( '全部' , 'aksrt' ),
'pending' => __ ( '待支付' , 'aksrt' ),
'shipped' => __ ( '待收货' , 'aksrt' ),
'review' => __ ( '待评价' , 'aksrt' ),
'after' => __ ( '售后' , 'aksrt' ),
];
$base_query = [ 'tab' => 'orders' ];
if ( $type_filter !== '' ) {
$base_query [ 'order_type' ] = $type_filter ;
}
if ( $section !== '' ) {
$base_query [ 'section' ] = $section ;
}
/**
* Build URL staying inside user center orders tab.
*
* @param array<string, scalar|null> $args
*/
$orders_url = static function ( array $args = []) use ( $base_query ) : string {
$q = array_merge ( $base_query , $args );
$base = function_exists ( 'aksrt_get_user_center_url' )
? aksrt_get_user_center_url ( 'orders' )
: home_url ( '/profile/' );
$url = remove_query_arg (
[ 'order_tab' , 'otab' , 'order_status' , 'order_page' , 'order_type' , 'section' , 'tab' ],
$base
);
// Always keep tab=orders.
$q [ 'tab' ] = 'orders' ;
// Map status filter to order_tab (avoid clashing with UC tab=).
if ( isset ( $q [ 'tab_status' ])) {
$q [ 'order_tab' ] = $q [ 'tab_status' ];
unset ( $q [ 'tab_status' ]);
}
foreach ( $q as $k => $v ) {
if ( $v === null || $v === '' ) {
unset ( $q [ $k ]);
}
}
return add_query_arg ( $q , $url );
};
$pending_count = ( int ) ( $stats [ 'pending' ] ? ? 0 );
?>
<div class="aksrt-orders-page uc-orders-panel" data-aksrt-order-center data-aksrt-uc-orders>
<div class="uc-orders-panel__head flex ac jsb mb10">
<div>
<div class="font-bold em12"><?php esc_html_e('我的订单', 'aksrt'); ?></div>
<div class="muted-2-color em09 mt3"><?php esc_html_e('查看商城、付费内容、会员与充值等全部订单。', 'aksrt'); ?></div>
</div>
<?php if (function_exists('aksrt_get_cart_page_url') && aksrt_get_cart_page_url() !== '') : ?>
<a class="muted-2-color em09" href="<?php echo esc_url(aksrt_get_cart_page_url()); ?>">
<?php esc_html_e('购物车', 'aksrt'); ?><i class="ml6 fa fa-angle-right em12" aria-hidden="true"></i>
</a>
<?php endif; ?>
</div>
<?php if (!empty($stats)) : ?>
<div class="aksrt-orders-page__stats" data-aksrt-order-stats>
<div class="aksrt-orders-page__stat">
<span class="aksrt-orders-page__stat-label"><?php esc_html_e('全部订单', 'aksrt'); ?></span>
<strong class="aksrt-orders-page__stat-value"><?php echo esc_html((string) (int) ($stats['total'] ?? 0)); ?></strong>
</div>
<div class="aksrt-orders-page__stat">
<span class="aksrt-orders-page__stat-label"><?php esc_html_e('待支付', 'aksrt'); ?></span>
<strong class="aksrt-orders-page__stat-value c-red"><?php echo esc_html((string) $pending_count); ?></strong>
</div>
<div class="aksrt-orders-page__stat">
<span class="aksrt-orders-page__stat-label"><?php esc_html_e('已支付', 'aksrt'); ?></span>
<strong class="aksrt-orders-page__stat-value c-green"><?php echo esc_html((string) (int) ($stats['paid'] ?? 0)); ?></strong>
</div>
</div>
<?php endif; ?>
<div class="aksrt-orders-page__extra-nav" data-aksrt-orders-extra-nav>
<a href="<?php echo esc_url($orders_url(['section' => null])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === '' ? ' is-active' : ''; ?>"><?php esc_html_e('订单列表', 'aksrt'); ?></a>
<a href="<?php echo esc_url($orders_url(['section' => 'after-sale'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'after-sale' ? ' is-active' : ''; ?>"><?php esc_html_e('售后工单', 'aksrt'); ?></a>
<a href="<?php echo esc_url($orders_url(['section' => 'coupons'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'coupons' ? ' is-active' : ''; ?>"><?php esc_html_e('优惠券', 'aksrt'); ?></a>
<a href="<?php echo esc_url($orders_url(['section' => 'favorites'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'favorites' ? ' is-active' : ''; ?>"><?php esc_html_e('收藏', 'aksrt'); ?></a>
</div>
<?php if ($type_options && $section === '') : ?>
<div class="aksrt-orders-page__type-filters" data-aksrt-order-type-filters>
<?php foreach ($type_options as $type_key => $type_label) :
$is_type_active = (string) $type_key === (string) $type_filter;
$type_args = [
'order_type' => $type_key !== '' ? $type_key : null,
'order_tab' => $tab !== '' ? $tab : null,
'order_page' => 1,
];
$type_url = $orders_url($type_args);
if ($type_key === '') {
$type_url = remove_query_arg('order_type', $type_url);
}
?>
<a href="<?php echo esc_url($type_url); ?>" class="aksrt-orders-page__filter-chip<?php echo $is_type_active ? ' is-active' : ''; ?>">
<?php echo esc_html((string) $type_label); ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ($section === '') : ?>
<div class="aksrt-orders-page__tabs user-order-tabs">
<?php foreach ($tabs as $tab_key => $tab_label) :
$is_active = $tab === $tab_key;
$tab_url = $tab_key !== ''
? $orders_url(['order_tab' => $tab_key, 'order_page' => 1])
: remove_query_arg(['order_tab', 'otab', 'order_status', 'order_page'], $orders_url());
?>
<a href="<?php echo esc_url($tab_url); ?>" class="aksrt-orders-page__tab<?php echo $is_active ? ' is-active' : ''; ?>" data-order-tab="<?php echo esc_attr((string) $tab_key); ?>">
<?php echo esc_html($tab_label); ?>
<?php if ($tab_key === 'pending' && $pending_count > 0) : ?>
<span class="aksrt-orders-page__tab-badge"><?php echo esc_html((string) $pending_count); ?></span>
<?php endif; ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if ($section === '' && !empty($orders)) : ?>
<div class="aksrt-orders-page__list">
<?php foreach ($orders as $order) :
$on = (string) ($order['order_number'] ?? '');
$os = (string) ($order['status'] ?? '');
$items = $order['items'] ?? [];
$ptype = (string) ($order['product_type'] ?? '');
$is_points = !empty($order['is_points']);
$symbol = (string) ($order['currency_symbol'] ?? '¥');
$actions = is_array($order['actions'] ?? null) ? $order['actions'] : [];
$amount_display = $is_points
? esc_html($symbol) . ' ' . esc_html((string) (int) round((float) ($order['amount'] ?? 0)))
: '¥' . esc_html(number_format((float) ($order['amount'] ?? 0), 2));
?>
<article class="aksrt-orders-page__card" data-aksrt-order-card="<?php echo esc_attr($on); ?>" data-product-type="<?php echo esc_attr($ptype); ?>">
<div class="aksrt-orders-page__card-head">
<span class="aksrt-orders-page__card-type"><?php echo esc_html((string) ($order['product_type_label'] ?? '')); ?></span>
<span class="aksrt-orders-page__card-number"><?php echo esc_html($on); ?></span>
<time class="aksrt-orders-page__card-time"><?php echo esc_html((string) ($order['created_at'] ?? '')); ?></time>
<span class="aksrt-orders-page__card-status"><?php echo esc_html((string) ($order['status_label'] ?? '')); ?></span>
</div>
<div class="aksrt-orders-page__card-items">
<?php if (!empty($items) && is_array($items)) : ?>
<?php foreach ($items as $item) : ?>
<div class="aksrt-orders-page__card-item" data-product-id="<?php echo esc_attr((string) ($item['product_id'] ?? 0)); ?>">
<?php if (!empty($item['image'])) : ?>
<img src="<?php echo esc_url((string) $item['image']); ?>" alt="" class="aksrt-orders-page__card-img">
<?php elseif (!empty($order['image'])) : ?>
<img src="<?php echo esc_url((string) $order['image']); ?>" alt="" class="aksrt-orders-page__card-img">
<?php endif; ?>
<div class="aksrt-orders-page__card-item-info">
<span class="aksrt-orders-page__card-item-title"><?php echo esc_html((string) ($item['product_title'] ?? $order['product_name'] ?? '')); ?></span>
<?php if (!empty($item['options_label'])) : ?>
<small class="aksrt-orders-page__card-item-opts"><?php echo esc_html((string) $item['options_label']); ?></small>
<?php endif; ?>
</div>
<div class="aksrt-orders-page__card-item-price">
<strong><?php
if ($is_points) {
echo esc_html($symbol . ' ' . (string) (int) round((float) ($item['pay_price'] ?? $item['unit_price'] ?? 0)));
} else {
echo '¥' . esc_html(number_format((float) ($item['pay_price'] ?? $item['unit_price'] ?? 0), 2));
}
?></strong>
<span>× <?php echo esc_html((string) ($item['quantity'] ?? 1)); ?></span>
</div>
</div>
<?php endforeach; ?>
<?php else : ?>
<div class="aksrt-orders-page__card-item" data-product-id="<?php echo esc_attr((string) ($order['product_id'] ?? 0)); ?>">
<?php if (!empty($order['image'])) : ?>
<img src="<?php echo esc_url((string) $order['image']); ?>" alt="" class="aksrt-orders-page__card-img">
<?php endif; ?>
<div class="aksrt-orders-page__card-item-info">
<span class="aksrt-orders-page__card-item-title"><?php echo esc_html((string) ($order['product_name'] ?? __('订单', 'aksrt'))); ?></span>
</div>
<div class="aksrt-orders-page__card-item-price">
<strong><?php echo $amount_display; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
</div>
</div>
<?php endif; ?>
</div>
<div class="aksrt-orders-page__card-summary">
<span><?php esc_html_e('合计', 'aksrt'); ?></span>
<strong><?php echo $amount_display; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong>
<?php if ((float) ($order['discount'] ?? 0) > 0 && !$is_points) : ?>
<small>(<?php
printf(
/* translators: %s: discount amount */
esc_html__('已优惠 ¥%s', 'aksrt'),
number_format((float) $order['discount'], 2)
);
?>)</small>
<?php endif; ?>
</div>
<?php if (!empty($order['shipping_records'])) : ?>
<div class="aksrt-orders-page__timeline" data-aksrt-timeline>
<h4 class="aksrt-orders-page__timeline-toggle" data-aksrt-toggle-timeline>
<i class="fas fa-truck"></i> <?php esc_html_e('物流信息', 'aksrt'); ?> <i class="fas fa-chevron-down"></i>
</h4>
<div class="aksrt-orders-page__timeline-body" hidden>
<?php foreach ((array) ($order['timeline'] ?? []) as $tl) : ?>
<div class="aksrt-orders-page__timeline-item">
<time><?php echo esc_html((string) ($tl['time'] ?? '')); ?></time>
<span><?php echo esc_html((string) ($tl['label'] ?? '')); ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<div class="aksrt-orders-page__card-actions">
<?php if (!empty($actions['can_pay'])) : ?>
<button type="button" class="btn-primary btn-sm" data-aksrt-order-pay="<?php echo esc_attr($on); ?>" data-aksrt-order-method="<?php echo esc_attr((string) ($order['payment_method']['value'] ?? '')); ?>"><?php esc_html_e('去支付', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_receipt'])) : ?>
<button type="button" class="btn-primary btn-sm" data-aksrt-order-receipt="<?php echo esc_attr($on); ?>"><?php esc_html_e('确认收货', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_review']) || (class_exists('\AKSRT\Payment\Order') && $os === \AKSRT\Payment\Order::STATUS_PENDING_REVIEW)) : ?>
<button type="button" class="btn-primary btn-sm c-green" data-aksrt-order-review="<?php echo esc_attr($on); ?>"><?php esc_html_e('评价', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_cancel'])) : ?>
<button type="button" class="btn-ghost btn-sm" data-aksrt-order-cancel="<?php echo esc_attr($on); ?>"><?php esc_html_e('取消', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_rebuy'])) : ?>
<button type="button" class="btn-outline btn-sm" data-aksrt-order-rebuy="<?php echo esc_attr($on); ?>"><?php esc_html_e('再次购买', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_after_sale'])) : ?>
<button type="button" class="btn-outline btn-sm" data-aksrt-order-after-sale="<?php echo esc_attr($on); ?>"><?php esc_html_e('售后', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions['can_view']) && !empty($order['permalink'])) : ?>
<a class="btn-outline btn-sm" href="<?php echo esc_url((string) $order['permalink']); ?>"><?php
echo (class_exists('\AKSRT\Core\DomainModel') && $ptype === \AKSRT\Core\DomainModel::ORDER_PRODUCT_RESOURCE)
? esc_html__('去查看', 'aksrt')
: esc_html__('查看', 'aksrt');
?></a>
<?php endif; ?>
<?php if (!empty($order['secondary_url']) && !empty($order['secondary_label'])) : ?>
<a class="btn-ghost btn-sm" href="<?php echo esc_url((string) $order['secondary_url']); ?>"><?php echo esc_html((string) $order['secondary_label']); ?></a>
<?php endif; ?>
<?php if (!empty($order['time_left'])) : ?>
<span class="aksrt-orders-page__countdown" data-aksrt-order-countdown="<?php echo esc_attr((string) $order['time_left']); ?>">
<?php
printf(
/* translators: %d: seconds */
esc_html__('%d秒后关闭', 'aksrt'),
(int) $order['time_left']
);
?>
</span>
<?php endif; ?>
</div>
</article>
<?php endforeach; ?>
</div>
<?php if ($total_pages > 1) : ?>
<div class="aksrt-orders-page__pagination">
<?php for ($i = 1; $i <= $total_pages; $i++) :
$page_url = $orders_url(array_filter([
'order_tab' => $tab !== '' ? $tab : null,
'order_page' => $i,
], static fn($v) => $v !== null && $v !== ''));
?>
<?php if ($i === $paged) : ?>
<span class="aksrt-orders-page__page-chip is-active"><?php echo esc_html((string) $i); ?></span>
<?php else : ?>
<a href="<?php echo esc_url($page_url); ?>" class="aksrt-orders-page__page-chip"><?php echo esc_html((string) $i); ?></a>
<?php endif; ?>
<?php endfor; ?>
</div>
<?php endif; ?>
<?php elseif ($section === '') : ?>
<div class="aksrt-orders-page__empty">
<i class="fas fa-receipt" aria-hidden="true"></i>
<p><?php esc_html_e('暂无订单记录。', 'aksrt'); ?></p>
</div>
<?php endif; ?>
<!-- After-sale modal -->
<div class="aksrt-modal" data-aksrt-aftersale-modal hidden>
<div class="aksrt-modal__overlay"></div>
<div class="aksrt-modal__dialog">
<div class="aksrt-modal__header">
<h3><?php esc_html_e('申请售后', 'aksrt'); ?></h3>
<button type="button" class="aksrt-modal__close" data-aksrt-aftersale-modal-close>×</button>
</div>
<form class="aksrt-modal__body" data-aksrt-aftersale-form>
<input type="hidden" name="order_number" value="">
<div class="aksrt-orders-page__field">
<label><?php esc_html_e('售后类型', 'aksrt'); ?></label>
<select name="type" class="aksrt-orders-page__select">
<?php if (class_exists('\AKSRT\Payment\AfterSale')) : ?>
<?php foreach (\AKSRT\Payment\AfterSale::get_valid_types() as $type_key => $type_label) : ?>
<option value="<?php echo esc_attr($type_key); ?>"><?php echo esc_html($type_label); ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
<div class="aksrt-orders-page__field">
<label><?php esc_html_e('售后原因', 'aksrt'); ?> *</label>
<textarea name="reason" class="aksrt-orders-page__textarea" rows="4" required placeholder="<?php esc_attr_e('请描述问题', 'aksrt'); ?>"></textarea>
</div>
<div class="aksrt-modal__footer">
<button type="button" class="btn-ghost" data-aksrt-aftersale-modal-close><?php esc_html_e('取消', 'aksrt'); ?></button>
<button type="submit" class="btn-primary"><?php esc_html_e('提交', 'aksrt'); ?></button>
</div>
</form>
</div>
</div>
<!-- Return shipping modal -->
<div class="aksrt-modal" data-aksrt-return-ship-modal hidden>
<div class="aksrt-modal__overlay"></div>
<div class="aksrt-modal__dialog">
<div class="aksrt-modal__header">
<h3><?php esc_html_e('填写退货物流', 'aksrt'); ?></h3>
<button type="button" class="aksrt-modal__close" data-aksrt-return-ship-close>×</button>
</div>
<form class="aksrt-modal__body" data-aksrt-return-ship-form>
<input type="hidden" name="ticket_id" value="">
<div class="aksrt-orders-page__field">
<label><?php esc_html_e('快递公司', 'aksrt'); ?> *</label>
<input type="text" name="carrier" class="aksrt-orders-page__input" required placeholder="<?php esc_attr_e('如:顺丰速运', 'aksrt'); ?>">
</div>
<div class="aksrt-orders-page__field">
<label><?php esc_html_e('运单号', 'aksrt'); ?> *</label>
<input type="text" name="tracking_no" class="aksrt-orders-page__input" required placeholder="<?php esc_attr_e('快递单号', 'aksrt'); ?>">
</div>
<div class="aksrt-modal__footer">
<button type="button" class="btn-ghost" data-aksrt-return-ship-close><?php esc_html_e('取消', 'aksrt'); ?></button>
<button type="submit" class="btn-primary"><?php esc_html_e('提交物流', 'aksrt'); ?></button>
</div>
</form>
</div>
</div>
<?php if ($section === 'after-sale' && class_exists('\AKSRT\Payment\AfterSale')) :
$tickets = \AKSRT\Payment\AfterSale::get_instance()->get_user_tickets($user_id, 50);
?>
<section class="aksrt-orders-page__aftersale" data-aksrt-aftersale-list>
<h2><?php esc_html_e('我的售后', 'aksrt'); ?></h2>
<?php if (!empty($tickets)) : ?>
<div class="aksrt-as-list">
<?php foreach ($tickets as $t) :
$tid = (int) ($t['id'] ?? 0);
$events = is_array($t['events'] ?? null) ? $t['events'] : [];
$actions_t = is_array($t['actions'] ?? null) ? $t['actions'] : [];
?>
<article class="aksrt-as-card" data-aksrt-as-ticket="<?php echo esc_attr((string) $tid); ?>">
<div class="aksrt-as-card__head">
<strong>#<?php echo esc_html((string) $tid); ?></strong>
<span class="aksrt-as-card__order"><?php echo esc_html((string) ($t['order_number'] ?? '')); ?></span>
<span class="aksrt-as-card__status"><?php echo esc_html((string) ($t['status_label'] ?? $t['status'] ?? '')); ?></span>
</div>
<div class="aksrt-as-card__meta muted-2-color">
<?php echo esc_html((string) ($t['type_label'] ?? $t['type'] ?? '')); ?>
· <?php echo esc_html((string) ($t['created_at'] ?? '')); ?>
</div>
<div class="aksrt-as-card__reason"><?php echo esc_html((string) ($t['reason'] ?? '')); ?></div>
<?php if ($events) : ?>
<ol class="aksrt-as-timeline">
<?php foreach (array_reverse($events) as $ev) : ?>
<li>
<time><?php echo esc_html((string) ($ev['time'] ?? '')); ?></time>
<span><?php echo esc_html((string) ($ev['label'] ?? '')); ?></span>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
<div class="aksrt-as-card__actions">
<?php if (!empty($actions_t['can_return_ship'])) : ?>
<button type="button" class="btn-primary btn-sm" data-aksrt-return-ship="<?php echo esc_attr((string) $tid); ?>"><?php esc_html_e('填写退货物流', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($actions_t['can_cancel'])) : ?>
<button type="button" class="btn-ghost btn-sm" data-aksrt-as-cancel="<?php echo esc_attr((string) $tid); ?>"><?php esc_html_e('取消售后', 'aksrt'); ?></button>
<?php endif; ?>
</div>
</article>
<?php endforeach; ?>
</div>
<?php else : ?>
<p class="muted-2-color"><?php esc_html_e('暂无售后记录', 'aksrt'); ?></p>
<?php endif; ?>
</section>
<?php endif; ?>
<?php if ($section === 'coupons') : ?>
<section class="aksrt-orders-page__coupons" data-aksrt-coupon-wallet>
<h2><?php esc_html_e('优惠券', 'aksrt'); ?></h2>
<div class="aksrt-coupon-wallet" data-aksrt-coupon-wallet-list>
<p class="muted-2-color"><?php esc_html_e('加载中…', 'aksrt'); ?></p>
</div>
</section>
<?php endif; ?>
<?php if ($section === 'favorites' && $shop) :
$fav_data = $shop->get_user_favorites($user_id);
?>
<section class="aksrt-orders-page__favorites">
<h2><?php esc_html_e('收藏商品', 'aksrt'); ?></h2>
<?php if (!empty($fav_data['items'])) : ?>
<div class="aksrt-orders-page__fav-grid">
<?php foreach ($fav_data['items'] as $fav) : ?>
<a href="<?php echo esc_url((string) ($fav['permalink'] ?? '#')); ?>" class="aksrt-orders-page__fav-card">
<?php if (!empty($fav['image'])) : ?>
<img src="<?php echo esc_url((string) $fav['image']); ?>" alt="" loading="lazy">
<?php endif; ?>
<h3><?php echo esc_html((string) ($fav['title'] ?? '')); ?></h3>
<strong>¥<?php echo esc_html(number_format((float) ($fav['price'] ?? 0), 2)); ?></strong>
</a>
<?php endforeach; ?>
</div>
<?php else : ?>
<p><?php esc_html_e('暂无收藏商品', 'aksrt'); ?></p>
<?php endif; ?>
</section>
<?php endif; ?>
</div>