Drop nested zib-widget chrome on dual cards; one surface with side-by-side cells (stack on mobile) instead of card-on-card.
374 lines
20 KiB
PHP
374 lines
20 KiB
PHP
<?php
|
|
/**
|
|
* User center: cash wallet (站内余额) — Zibll-like asset card.
|
|
*
|
|
* Expects extracted $context vars.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
if (empty($balance_enabled)) {
|
|
return;
|
|
}
|
|
|
|
$wallet = (float) ($wallet_balance ?? 0.0);
|
|
$wallet_fmt = class_exists('\AKSRT\Credits\Balance')
|
|
? \AKSRT\Credits\Balance::format($wallet)
|
|
: number_format_i18n($wallet, 2);
|
|
|
|
$recharge = class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_payment_recharge_settings')
|
|
? \AKSRT\Settings\Settings::get_payment_recharge_settings()
|
|
: [];
|
|
$uid = (int) ($user_id ?? get_current_user_id());
|
|
$transfer_on = !empty($recharge['transfer']['enabled']);
|
|
if ($transfer_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_transfer', $uid)) {
|
|
$transfer_on = false;
|
|
}
|
|
$exchange_on = !empty($recharge['exchange']['enabled']);
|
|
$all_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_all() : [];
|
|
$withdraw_on = !empty($all_settings['pay_balance_withdraw_s']);
|
|
if ($withdraw_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_withdraw', $uid)) {
|
|
$withdraw_on = false;
|
|
}
|
|
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? 50));
|
|
$withdraw_pending_hold = 0.0;
|
|
$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_processing = $withdraw_pending_hold > 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();
|
|
$card_pass_balance = is_array($opts['balance'] ?? null) ? $opts['balance'] : $card_pass_balance;
|
|
} elseif (!empty($recharge['pass_charge'])) {
|
|
$card_pass_balance = is_array($recharge['pass_charge']) ? $recharge['pass_charge'] : $card_pass_balance;
|
|
}
|
|
|
|
$charge_view = [];
|
|
if (class_exists('\AKSRT\Credits\BalanceService')) {
|
|
$charge_view = \AKSRT\Credits\BalanceService::get_instance()->get_charge_view((int) $user_id);
|
|
}
|
|
$packages = is_array($charge_view['packages'] ?? null) ? $charge_view['packages'] : [];
|
|
$methods = is_array($charge_view['payment_methods'] ?? null) ? $charge_view['payment_methods'] : [];
|
|
$custom_s = !empty($charge_view['custom_s']);
|
|
$custom_limit = (int) ($charge_view['custom_limit'] ?? 9999);
|
|
$mark = (string) ($charge_view['currency_mark'] ?? '元');
|
|
?>
|
|
<div class="uc-asset-card uc-asset-card--wallet">
|
|
<div class="uc-asset-card__head flex jsb ac">
|
|
<div class="uc-asset-card__title">
|
|
<i class="fas fa-wallet em12 mr6" aria-hidden="true"></i><?php esc_html_e('余额', 'aksrt'); ?>
|
|
</div>
|
|
<?php if ($withdraw_on) : ?>
|
|
<button type="button" class="uc-asset-card__head-action muted-color px12" data-aksrt-withdraw-history-open>
|
|
<?php echo $withdraw_processing ? esc_html__('提现处理中', 'aksrt') : esc_html__('提现记录', 'aksrt'); ?>
|
|
<i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="uc-asset-card__body flex jsb ac">
|
|
<div class="uc-asset-card__amount c-blue-2">
|
|
<span class="uc-asset-card__mark px12"><?php echo esc_html($mark === '元' ? '¥' : $mark); ?></span>
|
|
<span class="uc-asset-card__value font-bold"><?php echo esc_html($wallet_fmt); ?></span>
|
|
</div>
|
|
<div class="uc-asset-card__actions flex0">
|
|
<?php if ($transfer_on) : ?>
|
|
<button type="button" class="but c-blue-2 mr6 hollow" data-aksrt-transfer-open="balance"><?php esc_html_e('转账', 'aksrt'); ?></button>
|
|
<?php endif; ?>
|
|
<?php if ($withdraw_on) : ?>
|
|
<?php if ($withdraw_processing) : ?>
|
|
<button type="button" class="but c-blue-2 mr6 hollow" data-aksrt-withdraw-history-open><?php esc_html_e('提现处理中', 'aksrt'); ?></button>
|
|
<?php else : ?>
|
|
<button type="button" class="but c-blue-2 mr6 hollow" data-aksrt-withdraw-open><?php esc_html_e('提现', 'aksrt'); ?></button>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<button type="button" class="but b-blue-2" data-aksrt-charge-open><?php esc_html_e('充值', 'aksrt'); ?></button>
|
|
</div>
|
|
</div>
|
|
<?php if ($exchange_on) : ?>
|
|
<button type="button" class="uc-asset-card__link muted-2-color em09" data-aksrt-exchange-open>
|
|
<?php
|
|
$rate = (int) ($recharge['exchange']['rate'] ?? 100);
|
|
printf(esc_html__('积分兑换余额(%d 积分 = 1 元)', 'aksrt'), $rate);
|
|
?>
|
|
<i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
|
</button>
|
|
<?php endif; ?>
|
|
<?php if ($withdraw_on) : ?>
|
|
<div class="uc-asset-card__foot muted-2-color em09 flex jsb ac mt6">
|
|
<span><?php printf(esc_html__('处理中冻结 %s', 'aksrt'), esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format((float) $withdraw_pending_hold) : number_format_i18n((float) $withdraw_pending_hold, 2))); ?></span>
|
|
<button type="button" class="muted-color" data-aksrt-withdraw-history-open><?php esc_html_e('提现记录', 'aksrt'); ?></button>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if (!empty($card_pass_balance['enabled'])) : ?>
|
|
<div class="uc-card-pass" data-aksrt-card-pass="balance">
|
|
<div class="uc-card-pass__title">
|
|
<i class="fas fa-ticket-alt" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('卡密兑换余额', 'aksrt'); ?></span>
|
|
</div>
|
|
<?php if (!empty($card_pass_balance['desc'])) : ?>
|
|
<p class="uc-card-pass__desc"><?php echo esc_html((string) $card_pass_balance['desc']); ?></p>
|
|
<?php endif; ?>
|
|
<?php if (empty($card_pass_balance['only_password'])) : ?>
|
|
<input type="text" class="uc-card-pass__input" name="aksrt_card_no" data-aksrt-card-no autocomplete="off" placeholder="<?php esc_attr_e('请输入卡号', 'aksrt'); ?>">
|
|
<?php endif; ?>
|
|
<input type="text" class="uc-card-pass__input" name="aksrt_card_password" data-aksrt-card-password autocomplete="off" placeholder="<?php esc_attr_e('请输入卡密', 'aksrt'); ?>">
|
|
<button type="button" class="uc-card-pass__btn" data-aksrt-card-redeem data-type="balance">
|
|
<?php esc_html_e('兑换余额', 'aksrt'); ?>
|
|
</button>
|
|
<p class="uc-card-pass__tip" data-aksrt-card-tip></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Charge modal -->
|
|
<div class="uc-modal" id="aksrt-charge-modal" hidden data-aksrt-charge-modal>
|
|
<div class="uc-modal__overlay" data-aksrt-charge-close></div>
|
|
<div class="uc-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="aksrt-charge-title">
|
|
<button type="button" class="uc-modal__close" data-aksrt-charge-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
|
<h3 id="aksrt-charge-title" class="uc-modal__title"><i class="fas fa-wallet mr6" aria-hidden="true"></i><?php esc_html_e('余额充值', 'aksrt'); ?></h3>
|
|
<?php if (!empty($charge_view['desc'])) : ?>
|
|
<div class="uc-modal__desc muted-box em09"><?php echo esc_html((string) $charge_view['desc']); ?></div>
|
|
<?php endif; ?>
|
|
<form class="uc-charge-form" data-aksrt-charge-form>
|
|
<?php if ($packages) : ?>
|
|
<div class="muted-color mb6"><?php esc_html_e('请选择充值金额', 'aksrt'); ?></div>
|
|
<div class="uc-charge-packages">
|
|
<?php foreach ($packages as $idx => $pkg) : ?>
|
|
<label class="uc-charge-package<?php echo $idx === 0 ? ' is-active' : ''; ?>">
|
|
<input type="radio" name="balance_package" value="<?php echo esc_attr((string) $pkg['key']); ?>" <?php checked($idx === 0); ?>>
|
|
<div class="uc-charge-package__credit"><span class="px12">¥</span><?php echo esc_html((string) $pkg['price']); ?></div>
|
|
<div class="uc-charge-package__pay c-red"><span class="px12">¥</span><?php echo esc_html((string) $pkg['pay_price']); ?>
|
|
<?php if ((float) $pkg['pay_price'] < (float) $pkg['price']) : ?>
|
|
<span class="ml6 c-yellow smail"><?php printf(esc_html__('省%s', 'aksrt'), esc_html((string) ((float) $pkg['price'] - (float) $pkg['pay_price']))); ?></span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php if (!empty($pkg['tag'])) : ?>
|
|
<span class="uc-charge-package__tag"><?php echo esc_html((string) $pkg['tag']); ?></span>
|
|
<?php endif; ?>
|
|
</label>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($custom_s) : ?>
|
|
<div class="muted-color mt16 mb6"><?php echo $packages ? esc_html__('自定义充值金额', 'aksrt') : esc_html__('请输入充值金额', 'aksrt'); ?></div>
|
|
<div class="uc-charge-custom flex ac">
|
|
<span class="mr10 muted-color">¥</span>
|
|
<input type="number" class="uc-charge-custom__input" name="custom_price" min="1" max="<?php echo esc_attr((string) $custom_limit); ?>" step="0.01" placeholder="1 ~ <?php echo esc_attr((string) $custom_limit); ?>">
|
|
</div>
|
|
<?php if (!$packages) : ?>
|
|
<input type="hidden" name="balance_package" value="custom">
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<?php if ($methods) : ?>
|
|
<div class="muted-color mt16 mb6"><?php esc_html_e('支付方式', 'aksrt'); ?></div>
|
|
<div class="uc-charge-methods">
|
|
<?php foreach ($methods as $mi => $m) : ?>
|
|
<label class="uc-charge-method">
|
|
<input type="radio" name="payment_method" value="<?php echo esc_attr((string) ($m['id'] ?? '')); ?>" <?php checked($mi === 0); ?>>
|
|
<span><?php echo esc_html((string) ($m['name'] ?? $m['id'] ?? '')); ?></span>
|
|
</label>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<p class="uc-modal__tip" data-aksrt-charge-tip></p>
|
|
<button type="submit" class="but jb-blue btn-block mt10" data-aksrt-charge-submit><?php esc_html_e('立即充值', 'aksrt'); ?></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Transfer modal (balance) -->
|
|
<div class="uc-modal" id="aksrt-transfer-modal" hidden data-aksrt-transfer-modal>
|
|
<div class="uc-modal__overlay" data-aksrt-transfer-close></div>
|
|
<div class="uc-modal__dialog" role="dialog" aria-modal="true">
|
|
<button type="button" class="uc-modal__close" data-aksrt-transfer-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
|
<h3 class="uc-modal__title" data-aksrt-transfer-title><?php esc_html_e('余额转账', 'aksrt'); ?></h3>
|
|
<form data-aksrt-transfer-form>
|
|
<input type="hidden" name="type" value="balance" data-aksrt-transfer-type>
|
|
<div class="mb10">
|
|
<label class="muted-color em09"><?php esc_html_e('收款用户', 'aksrt'); ?></label>
|
|
<input type="search" class="uc-card-pass__input" data-aksrt-transfer-search placeholder="<?php esc_attr_e('搜索用户名/昵称/邮箱', 'aksrt'); ?>" autocomplete="off">
|
|
<div class="uc-transfer-results" data-aksrt-transfer-results></div>
|
|
<input type="hidden" name="recipient" value="" data-aksrt-transfer-recipient>
|
|
<div class="uc-transfer-selected muted-2-color em09 mt6" data-aksrt-transfer-selected></div>
|
|
</div>
|
|
<div class="mb10">
|
|
<label class="muted-color em09"><?php esc_html_e('金额', 'aksrt'); ?></label>
|
|
<input type="number" class="uc-card-pass__input" name="amount" min="0.01" step="0.01" data-aksrt-transfer-amount>
|
|
</div>
|
|
<?php if (!empty($recharge['transfer']['desc'])) : ?>
|
|
<div class="muted-box em09 mb10"><?php echo esc_html((string) $recharge['transfer']['desc']); ?></div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($recharge['transfer']['service_charge'])) : ?>
|
|
<div class="c-yellow em09 mb10"><?php printf(esc_html__('转账将扣除 %s%% 手续费', 'aksrt'), esc_html((string) (int) $recharge['transfer']['service_charge'])); ?></div>
|
|
<?php endif; ?>
|
|
<p class="uc-modal__tip" data-aksrt-transfer-tip></p>
|
|
<button type="submit" class="but jb-blue btn-block" data-aksrt-transfer-submit><?php esc_html_e('确认转账', 'aksrt'); ?></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Exchange modal -->
|
|
<?php if ($exchange_on) : ?>
|
|
<div class="uc-modal" id="aksrt-exchange-modal" hidden data-aksrt-exchange-modal>
|
|
<div class="uc-modal__overlay" data-aksrt-exchange-close></div>
|
|
<div class="uc-modal__dialog" role="dialog" aria-modal="true">
|
|
<button type="button" class="uc-modal__close" data-aksrt-exchange-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
|
<h3 class="uc-modal__title"><?php esc_html_e('积分兑换余额', 'aksrt'); ?></h3>
|
|
<?php if (!empty($recharge['exchange']['desc'])) : ?>
|
|
<div class="muted-box em09 mb10"><?php echo esc_html((string) $recharge['exchange']['desc']); ?></div>
|
|
<?php endif; ?>
|
|
<form data-aksrt-exchange-form>
|
|
<label class="muted-color em09"><?php esc_html_e('兑换积分数量', 'aksrt'); ?></label>
|
|
<input type="number" class="uc-card-pass__input" name="points" min="<?php echo esc_attr((string) (int) ($recharge['exchange']['rate'] ?? 100)); ?>" step="1" data-aksrt-exchange-points>
|
|
<p class="muted-2-color em09 mt6">
|
|
<?php printf(esc_html__('比例:%d 积分 = 1 元(向下取整)', 'aksrt'), (int) ($recharge['exchange']['rate'] ?? 100)); ?>
|
|
</p>
|
|
<p class="uc-modal__tip" data-aksrt-exchange-tip></p>
|
|
<button type="submit" class="but jb-blue btn-block" data-aksrt-exchange-submit><?php esc_html_e('确认兑换', 'aksrt'); ?></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($withdraw_on) : ?>
|
|
<div class="uc-modal" id="aksrt-withdraw-modal" hidden data-aksrt-withdraw-modal>
|
|
<div class="uc-modal__overlay" data-aksrt-withdraw-close></div>
|
|
<div class="uc-modal__dialog" role="dialog" aria-modal="true">
|
|
<button type="button" class="uc-modal__close" data-aksrt-withdraw-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
|
<h3 class="uc-modal__title"><?php esc_html_e('余额提现', 'aksrt'); ?></h3>
|
|
<form data-aksrt-withdraw-form>
|
|
<label class="muted-color em09"><?php esc_html_e('提现金额', 'aksrt'); ?></label>
|
|
<input type="number" class="uc-card-pass__input" name="amount" min="<?php echo esc_attr((string) $withdraw_min); ?>" step="0.01" data-aksrt-withdraw-amount>
|
|
<p class="muted-2-color em09 mt6"><?php printf(esc_html__('最低提现 %s 元,当前余额 %s', 'aksrt'), esc_html((string) $withdraw_min), esc_html($wallet_fmt)); ?></p>
|
|
<label class="muted-color em09 mt10"><?php esc_html_e('收款方式', 'aksrt'); ?></label>
|
|
<select class="uc-card-pass__input" name="method" data-aksrt-withdraw-method>
|
|
<option value="alipay"><?php esc_html_e('支付宝', 'aksrt'); ?></option>
|
|
<option value="wechat"><?php esc_html_e('微信', 'aksrt'); ?></option>
|
|
<option value="bank"><?php esc_html_e('银行卡', 'aksrt'); ?></option>
|
|
</select>
|
|
<label class="muted-color em09 mt10"><?php esc_html_e('收款账号信息', 'aksrt'); ?></label>
|
|
<textarea class="uc-card-pass__input" name="account" rows="3" data-aksrt-withdraw-account placeholder="<?php esc_attr_e('姓名 + 账号 / 卡号', 'aksrt'); ?>"></textarea>
|
|
<p class="uc-modal__tip" data-aksrt-withdraw-tip></p>
|
|
<button type="submit" class="but jb-blue btn-block" data-aksrt-withdraw-submit><?php esc_html_e('提交申请', 'aksrt'); ?></button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if ($withdraw_on) :
|
|
$status_labels = [
|
|
'pending' => __('待处理', 'aksrt'),
|
|
'approved' => __('已通过', '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="fas fa-times" aria-hidden="true"></i></button>
|
|
<h3 class="uc-modal__title"><i class="fas fa-file-invoice-dollar 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 = (float) ($wd['gross_amount'] ?? $wd['amount'] ?? 0);
|
|
$net = (float) ($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(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format($gross) : number_format_i18n($gross, 2)); ?></b>
|
|
</div>
|
|
<div class="muted-2-color em09 mt6">
|
|
<?php echo esc_html((string) ($wd['created_at'] ?? '')); ?>
|
|
<?php if (abs($gross - $net) > 0.001) : ?>
|
|
· <?php printf(esc_html__('到账 %s', 'aksrt'), esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format($net) : number_format_i18n($net, 2))); ?>
|
|
<?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; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($skip_wallet_ledger)) : ?>
|
|
<div class="uc-transactions uc-transactions--wallet">
|
|
<div class="uc-transactions__header">
|
|
<h3 class="uc-transactions__title">
|
|
<i class="fas fa-list-ul" aria-hidden="true"></i>
|
|
<?php esc_html_e('余额记录', 'aksrt'); ?>
|
|
</h3>
|
|
</div>
|
|
<?php
|
|
$wallet_page = max(1, isset($_GET['wallet_page']) ? (int) $_GET['wallet_page'] : 1);
|
|
$wlog = class_exists('\AKSRT\Credits\Balance')
|
|
? \AKSRT\Credits\Balance::get_log(['user_id' => (int) $user_id, 'page' => $wallet_page, 'per_page' => 10])
|
|
: ['items' => [], 'total' => 0];
|
|
if (!empty($wlog['items'])) :
|
|
?>
|
|
<div class="uc-transactions__list">
|
|
<?php foreach ($wlog['items'] as $row) :
|
|
$delta = (float) $row['delta'];
|
|
$delta_class = $delta >= 0 ? 'is-positive' : 'is-negative';
|
|
$delta_txt = ($delta > 0 ? '+' : '') . (class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format($delta) : number_format_i18n($delta, 2));
|
|
?>
|
|
<div class="uc-transactions__item">
|
|
<div class="uc-transactions__icon <?php echo esc_attr($delta_class); ?>">
|
|
<i class="fas fa-<?php echo $delta >= 0 ? 'arrow-up' : 'arrow-down'; ?>" aria-hidden="true"></i>
|
|
</div>
|
|
<div class="uc-transactions__info">
|
|
<div class="uc-transactions__reason">
|
|
<?php echo esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::reason_label((string) $row['reason']) : (string) $row['reason']); ?>
|
|
<?php if (!empty($row['remark'])) : ?>
|
|
<span class="uc-transactions__remark">(<?php echo esc_html((string) $row['remark']); ?>)</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="uc-transactions__time"><?php echo esc_html(get_date_from_gmt((string) $row['created_at'], 'Y-m-d H:i')); ?></div>
|
|
</div>
|
|
<div class="uc-transactions__amount">
|
|
<span class="uc-transactions__delta <?php echo esc_attr($delta_class); ?>"><?php echo esc_html($delta_txt); ?></span>
|
|
<span class="uc-transactions__balance">
|
|
<?php
|
|
printf(
|
|
esc_html__('余额 %s', 'aksrt'),
|
|
esc_html(class_exists('\AKSRT\Credits\Balance') ? \AKSRT\Credits\Balance::format((float) $row['balance_after']) : number_format_i18n((float) $row['balance_after'], 2))
|
|
);
|
|
?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php
|
|
$total_pages = (int) ceil((int) ($wlog['total'] ?? 0) / 10);
|
|
if ($total_pages > 1 && function_exists('aksrt_render_profile_pagination')) {
|
|
aksrt_render_profile_pagination($total_pages, $wallet_page, 'wallet_page');
|
|
}
|
|
?>
|
|
<?php else : ?>
|
|
<div class="uc-transactions__empty">
|
|
<div class="uc-transactions__empty-icon"><i class="fas fa-wallet" aria-hidden="true"></i></div>
|
|
<p><?php esc_html_e('还没有任何余额流水', 'aksrt'); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; // skip_wallet_ledger ?>
|