fix(user-center): 优化提现记录弹窗分页
This commit is contained in:
1 parent
27f54c8e35
commit
6bbb79213b
5 files changed
+290
-62
No files matched your search
@@ -40,14 +40,11 @@ $withdraw_settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settin
|
||||
$withdraw_min = $normalize_balance($withdraw_settings['min_amount'] ?? '50')->decimal();
|
||||
$withdraw_usage = ['remaining_count' => 0, 'remaining_amount' => '0.00'];
|
||||
$withdraw_pending_hold = '0.00';
|
||||
$withdraw_history = [];
|
||||
if ($withdraw_on && class_exists('\AKSRT\Payment\Withdrawal')) {
|
||||
$wd_svc = \AKSRT\Payment\Withdrawal::get_instance();
|
||||
$withdraw_pending_hold = $wd_svc->sum_pending_hold((int) ($user_id ?? 0));
|
||||
$withdraw_history = $wd_svc->get_user_withdrawals((int) ($user_id ?? 0), ['limit' => 30]);
|
||||
$withdraw_usage = $wd_svc->daily_usage((int) ($user_id ?? 0), $withdraw_settings);
|
||||
}
|
||||
$withdraw_processing = $normalize_balance($withdraw_pending_hold)->minor() > 0;
|
||||
$card_pass_balance = ['enabled' => false, 'desc' => '', 'only_password' => true];
|
||||
if (class_exists('\AKSRT\Payment\ChargeCard')) {
|
||||
$opts = \AKSRT\Payment\ChargeCard::get_instance()->get_public_options();
|
||||
@@ -187,50 +184,16 @@ $mark = (string) ($charge_view['currency_mark'] ?? '元');
|
||||
endif; ?>
|
||||
|
||||
|
||||
<?php if ($withdraw_on) :
|
||||
$status_labels = [
|
||||
'pending' => __('待处理', 'aksrt'),
|
||||
'processing' => __('处理中', 'aksrt'),
|
||||
'completed' => __('已完成', 'aksrt'),
|
||||
'rejected' => __('已拒绝', 'aksrt'),
|
||||
];
|
||||
?>
|
||||
<div class="uc-modal" id="aksrt-withdraw-history-modal" hidden data-aksrt-withdraw-history-modal>
|
||||
<div class="uc-modal__overlay" data-aksrt-withdraw-history-close></div>
|
||||
<div class="uc-modal__dialog" role="dialog" aria-modal="true">
|
||||
<button type="button" class="uc-modal__close" data-aksrt-withdraw-history-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fa fas fa-times" aria-hidden="true"></i></button>
|
||||
<h3 class="uc-modal__title"><i class="fa fas fa-file-alt mr6" aria-hidden="true"></i><?php esc_html_e('提现记录', 'aksrt'); ?></h3>
|
||||
<div class="uc-withdraw-history">
|
||||
<?php if (!empty($withdraw_history)) : ?>
|
||||
<?php foreach ($withdraw_history as $wd) :
|
||||
$st = sanitize_key((string) ($wd['status'] ?? ''));
|
||||
$gross = $normalize_balance($wd['gross_amount'] ?? $wd['amount'] ?? '0');
|
||||
$net = $normalize_balance($wd['amount'] ?? '0');
|
||||
$st_class = $st === 'rejected' ? 'c-red' : ($st === 'completed' ? 'c-green' : 'c-blue');
|
||||
?>
|
||||
<div class="uc-withdraw-history__item border-bottom padding-h10">
|
||||
<div class="flex jsb ac">
|
||||
<span class="badg badg-sm <?php echo esc_attr($st_class); ?>"><?php echo esc_html($status_labels[$st] ?? $st); ?></span>
|
||||
<b class="em12"><?php echo esc_html($gross->formatted()); ?></b>
|
||||
</div>
|
||||
<div class="muted-2-color em09 mt6"><?php esc_html_e('提现单号:', 'aksrt'); ?><code><?php echo esc_html((string) ($wd['withdrawal_number'] ?? '')); ?></code></div>
|
||||
<div class="muted-2-color em09 mt6">
|
||||
<?php echo esc_html((string) ($wd['created_at'] ?? '')); ?>
|
||||
<?php if ($gross->minor() !== $net->minor()) : ?>
|
||||
· <?php printf(esc_html__('到账 %s', 'aksrt'), esc_html($net->formatted())); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!empty($wd['note'])) : ?>
|
||||
<div class="muted-2-color em09 mt3"><?php echo esc_html((string) $wd['note']); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<div class="uc-transactions__empty"><p><?php esc_html_e('暂无提现记录', 'aksrt'); ?></p></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($withdraw_on) : ?>
|
||||
<div class="uc-modal" id="aksrt-withdraw-history-modal" hidden data-aksrt-withdraw-history-modal>
|
||||
<div class="uc-modal__overlay" data-aksrt-withdraw-history-close></div>
|
||||
<div class="uc-modal__dialog uc-withdraw-history-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="aksrt-withdraw-history-title">
|
||||
<button type="button" class="uc-modal__close" data-aksrt-withdraw-history-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fa fas fa-times" aria-hidden="true"></i></button>
|
||||
<h3 id="aksrt-withdraw-history-title" class="uc-modal__title"><i class="fa fas fa-file-alt mr6" aria-hidden="true"></i><?php esc_html_e('提现记录', 'aksrt'); ?></h3>
|
||||
<div class="uc-withdraw-history" data-aksrt-withdraw-history-list aria-live="polite"></div>
|
||||
<nav class="uc-withdraw-history__pagination" data-aksrt-withdraw-history-pagination aria-label="<?php esc_attr_e('提现记录分页', 'aksrt'); ?>"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($skip_wallet_ledger)) : ?>
|
||||
|
||||
Reference in new issue
Block a user