feat(ux): after-sale multi-step, ban appeal, message types, coupon wallet

Orders center gains after-sale tickets (return ship/cancel/timeline),
coupon wallet list, ban-appeal page, and expanded message center tabs.
This commit is contained in:
2026-07-18 22:48:08 +08:00
parent 3a883bc3d0
commit 1337664ed3
15 changed files with 999 additions and 37 deletions
+110
View File
@@ -71,6 +71,12 @@ $tabs = [
?>
<!-- 5-tab navigation -->
<div class="aksrt-orders-page__extra-nav" data-aksrt-orders-extra-nav>
<a href="<?php echo esc_url(add_query_arg(['section' => 'after-sale'])); ?>" class="aksrt-orders-page__extra-link<?php echo (sanitize_key((string) ($_GET['section'] ?? '')) === 'after-sale') ? ' is-active' : ''; ?>"><?php esc_html_e('售后工单', 'aksrt'); ?></a>
<a href="<?php echo esc_url(add_query_arg(['section' => 'coupons'])); ?>" class="aksrt-orders-page__extra-link<?php echo (sanitize_key((string) ($_GET['section'] ?? '')) === 'coupons') ? ' is-active' : ''; ?>"><?php esc_html_e('优惠券', 'aksrt'); ?></a>
<a href="<?php echo esc_url(add_query_arg(['section' => 'favorites'])); ?>" class="aksrt-orders-page__extra-link<?php echo (sanitize_key((string) ($_GET['section'] ?? '')) === 'favorites') ? ' is-active' : ''; ?>"><?php esc_html_e('收藏', 'aksrt'); ?></a>
</div>
<div class="aksrt-orders-page__tabs">
<?php foreach ($tabs as $tab_key => $tab_label) :
$is_active = $tab === $tab_key;
@@ -231,6 +237,110 @@ $tabs = [
</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>&times;</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>
<!-- After-sale tickets panel -->
<?php
$as_section = sanitize_key((string) ($_GET['section'] ?? ''));
if ($as_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 = 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'] ?? '')); ?>
<?php if (!empty($t['progress_label'])) : ?>
· <?php echo esc_html((string) $t['progress_label']); ?>
<?php endif; ?>
</div>
<div class="aksrt-as-card__reason"><?php echo esc_html((string) ($t['reason'] ?? '')); ?></div>
<?php if (!empty($t['return_shipping']['tracking_no'])) : ?>
<div class="aksrt-as-card__ship muted-2-color">
<?php
printf(
/* translators: 1 carrier 2 tracking */
esc_html__('退货物流:%1$s %2$s', 'aksrt'),
esc_html((string) ($t['return_shipping']['carrier'] ?? '')),
esc_html((string) $t['return_shipping']['tracking_no'])
);
?>
</div>
<?php endif; ?>
<?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['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['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; ?>
<!-- Coupon wallet -->
<?php if ($as_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; ?>
<!-- Favorites section -->
<?php
$fav_tab = sanitize_key((string) ($_GET['section'] ?? ''));