feat(user-center): Zibll-like assets charge, transfer, and dual cards
Complete wallet/points assets surface: sidebar mini dual cards, dual asset row, balance charge packages REST + modal, transfer search/pay, points-to-balance exchange, and payment success credit for recharge orders.
This commit is contained in:
1 parent
8e0f9d989d
commit
0529ab5fb9
9 files changed
+1409
-127
No files matched your search
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* User center credits: points card + sign-in controls + credits card-pass redeem.
|
||||
*
|
||||
* Cash wallet UI lives in credits-wallet.php.
|
||||
* User center credits: points asset card + sign-in + credits card-pass.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -20,26 +18,32 @@ if (class_exists('AKSRT_Charge_Card')) {
|
||||
$opts = AKSRT_Charge_Card::get_instance()->get_public_options();
|
||||
$card_pass_credits = is_array($opts['credits'] ?? null) ? $opts['credits'] : $card_pass_credits;
|
||||
}
|
||||
$points_transfer_on = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::get_all()['points_transfer_s']);
|
||||
$currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
||||
?>
|
||||
<div class="uc-balance-card">
|
||||
<div class="uc-balance-card__bg"></div>
|
||||
<div class="uc-balance-card__content">
|
||||
<div class="uc-balance-card__header">
|
||||
<span class="uc-balance-card__label"><?php echo esc_html(sprintf(__('%s余额', 'aksrt'), $currency_name)); ?></span>
|
||||
<span class="uc-balance-card__currency"><?php echo esc_html($currency_name); ?></span>
|
||||
<div class="uc-asset-card uc-asset-card--points zib-widget">
|
||||
<div class="uc-asset-card__head flex jsb ac">
|
||||
<div class="uc-asset-card__title">
|
||||
<i class="fas fa-coins em12 mr6" aria-hidden="true"></i><?php echo esc_html($currency); ?>
|
||||
</div>
|
||||
<div class="uc-balance-card__amount">
|
||||
<span class="uc-balance-card__value"><?php echo esc_html(aksrt_format_credits((int) $balance)); ?></span>
|
||||
</div>
|
||||
<div class="uc-balance-card__actions" data-aksrt-signin>
|
||||
<span class="uc-balance-card__sign-status" data-signin-status></span>
|
||||
<button type="button" class="uc-balance-card__sign-btn" data-signin-btn disabled>
|
||||
<i class="fas fa-calendar-check" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('签到', 'aksrt'); ?></span>
|
||||
<span class="uc-asset-card__head-action muted-color px12" data-aksrt-signin>
|
||||
<button type="button" class="uc-asset-card__signin muted-color px12" data-signin-btn disabled>
|
||||
<?php esc_html_e('签到领积分', 'aksrt'); ?><i class="fa fa-angle-right em12 ml3" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
<p class="uc-balance-card__tip" data-signin-tip></p>
|
||||
<span class="uc-asset-card__signin-status" data-signin-status></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="uc-asset-card__body flex jsb ac">
|
||||
<div class="uc-asset-card__amount c-green">
|
||||
<span class="uc-asset-card__value font-bold"><?php echo esc_html(function_exists('aksrt_format_credits') ? aksrt_format_credits((int) $balance) : (string) (int) $balance); ?></span>
|
||||
</div>
|
||||
<div class="uc-asset-card__actions flex0">
|
||||
<?php if ($points_transfer_on) : ?>
|
||||
<button type="button" class="but c-green mr6 hollow" data-aksrt-transfer-open="points"><?php esc_html_e('转账', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<p class="uc-balance-card__tip muted-2-color em09" data-signin-tip></p>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($card_pass_credits['enabled'])) : ?>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* User center: cash wallet (站内余额) card + ledger.
|
||||
* User center: cash wallet (站内余额) — Zibll-like asset card.
|
||||
*
|
||||
* Expects extracted $context vars: $user_id, $wallet_balance, $balance_enabled, $card pass opts.
|
||||
* Expects extracted $context vars.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -14,43 +14,60 @@ if (empty($balance_enabled)) {
|
||||
}
|
||||
|
||||
$wallet = (float) ($wallet_balance ?? 0.0);
|
||||
$wallet_fmt = class_exists('AKSRT_Balance')
|
||||
? AKSRT_Balance::format($wallet)
|
||||
: number_format_i18n($wallet, 2);
|
||||
|
||||
$recharge = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_payment_recharge_settings')
|
||||
? AKSRT_Settings::get_payment_recharge_settings()
|
||||
: [];
|
||||
$transfer_on = !empty($recharge['transfer']['enabled']);
|
||||
$exchange_on = !empty($recharge['exchange']['enabled']);
|
||||
$card_pass_balance = ['enabled' => false, 'desc' => '', 'only_password' => true];
|
||||
if (class_exists('AKSRT_Charge_Card')) {
|
||||
$opts = AKSRT_Charge_Card::get_instance()->get_public_options();
|
||||
$card_pass_balance = is_array($opts['balance'] ?? null) ? $opts['balance'] : $card_pass_balance;
|
||||
} elseif (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_payment_recharge_settings')) {
|
||||
$recharge = AKSRT_Settings::get_payment_recharge_settings();
|
||||
$pc = is_array($recharge['pass_charge'] ?? null) ? $recharge['pass_charge'] : [];
|
||||
$card_pass_balance = [
|
||||
'enabled' => !empty($pc['enabled']),
|
||||
'desc' => (string) ($pc['desc'] ?? ''),
|
||||
'only_password' => !isset($pc['only_password']) || !empty($pc['only_password']),
|
||||
];
|
||||
} 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_Balance_Service')) {
|
||||
$charge_view = AKSRT_Balance_Service::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-wallet-grid">
|
||||
<div class="uc-balance-card uc-balance-card--wallet">
|
||||
<div class="uc-balance-card__bg uc-balance-card__bg--wallet"></div>
|
||||
<div class="uc-balance-card__content">
|
||||
<div class="uc-balance-card__header">
|
||||
<span class="uc-balance-card__label"><?php esc_html_e('钱包余额', 'aksrt'); ?></span>
|
||||
<span class="uc-balance-card__currency"><?php esc_html_e('元', 'aksrt'); ?></span>
|
||||
</div>
|
||||
<div class="uc-balance-card__amount">
|
||||
<span class="uc-balance-card__value">
|
||||
<?php
|
||||
echo esc_html(
|
||||
class_exists('AKSRT_Balance')
|
||||
? AKSRT_Balance::format($wallet)
|
||||
: number_format_i18n($wallet, 2)
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<p class="uc-balance-card__tip"><?php esc_html_e('可用于站内余额支付、卡密充值入账', 'aksrt'); ?></p>
|
||||
<div class="uc-asset-card uc-asset-card--wallet zib-widget">
|
||||
<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>
|
||||
</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; ?>
|
||||
<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; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($card_pass_balance['enabled'])) : ?>
|
||||
@@ -73,20 +90,128 @@ if (class_exists('AKSRT_Charge_Card')) {
|
||||
</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; ?>
|
||||
|
||||
<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'); ?>
|
||||
<?php esc_html_e('余额记录', 'aksrt'); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<?php
|
||||
$wallet_page = max(1, isset($_GET['wallet_page']) ? (int) $_GET['wallet_page'] : 1);
|
||||
if (class_exists('AKSRT_Balance')) {
|
||||
$wlog = AKSRT_Balance::get_log(['user_id' => (int) $user_id, 'page' => $wallet_page, 'per_page' => 10]);
|
||||
} else {
|
||||
$wlog = ['items' => [], 'total' => 0];
|
||||
}
|
||||
$wlog = class_exists('AKSRT_Balance')
|
||||
? AKSRT_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">
|
||||
@@ -101,35 +226,20 @@ if (class_exists('AKSRT_Charge_Card')) {
|
||||
</div>
|
||||
<div class="uc-transactions__info">
|
||||
<div class="uc-transactions__reason">
|
||||
<?php
|
||||
echo esc_html(
|
||||
class_exists('AKSRT_Balance')
|
||||
? AKSRT_Balance::reason_label((string) $row['reason'])
|
||||
: (string) $row['reason']
|
||||
);
|
||||
?>
|
||||
<?php echo esc_html(class_exists('AKSRT_Balance') ? AKSRT_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 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__delta <?php echo esc_attr($delta_class); ?>"><?php echo esc_html($delta_txt); ?></span>
|
||||
<span class="uc-transactions__balance">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: wallet balance */
|
||||
esc_html__('余额 %s', 'aksrt'),
|
||||
esc_html(
|
||||
class_exists('AKSRT_Balance')
|
||||
? AKSRT_Balance::format((float) $row['balance_after'])
|
||||
: number_format_i18n((float) $row['balance_after'], 2)
|
||||
)
|
||||
esc_html(class_exists('AKSRT_Balance') ? AKSRT_Balance::format((float) $row['balance_after']) : number_format_i18n((float) $row['balance_after'], 2))
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
@@ -145,9 +255,7 @@ if (class_exists('AKSRT_Charge_Card')) {
|
||||
?>
|
||||
<?php else : ?>
|
||||
<div class="uc-transactions__empty">
|
||||
<div class="uc-transactions__empty-icon">
|
||||
<i class="fas fa-wallet" aria-hidden="true"></i>
|
||||
</div>
|
||||
<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; ?>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* User center credits panel orchestrator.
|
||||
* User center assets panel orchestrator (wallet + points).
|
||||
*
|
||||
* Zibll-like dual assets: cash wallet + points, when each is enabled.
|
||||
* Zibll user-tab-balance parity layout.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -13,24 +13,35 @@ $context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
|
||||
$dir = __DIR__;
|
||||
|
||||
$show_wallet = !empty($balance_enabled);
|
||||
$show_credits = !empty($credits_enabled);
|
||||
|
||||
if ($show_wallet) {
|
||||
require $dir . '/credits-wallet.php';
|
||||
}
|
||||
// Dual cards row (Zibll row gutters-10).
|
||||
if ($show_wallet || $show_credits) :
|
||||
?>
|
||||
<div class="uc-assets-row<?php echo ($show_wallet && $show_credits) ? ' uc-assets-row--dual' : ''; ?>">
|
||||
<?php if ($show_wallet) : ?>
|
||||
<div class="uc-assets-col">
|
||||
<?php require $dir . '/credits-wallet.php'; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_credits) : ?>
|
||||
<div class="uc-assets-col">
|
||||
<?php
|
||||
// Points card only (ledger rendered once below).
|
||||
require $dir . '/credits-balance.php';
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
// Points block (existing UI) — only when credits system on.
|
||||
if ($show_credits) {
|
||||
// Rename label in balance card is handled inside credits-balance (账户余额 → 积分).
|
||||
require $dir . '/credits-balance.php';
|
||||
if (!empty($show_vip)) {
|
||||
require $dir . '/credits-vip.php';
|
||||
}
|
||||
if ($show_credits) {
|
||||
require $dir . '/credits-signin.php';
|
||||
require $dir . '/credits-transactions.php';
|
||||
} elseif ($show_wallet) {
|
||||
// Wallet-only: still show VIP block if enabled.
|
||||
if (!empty($show_vip)) {
|
||||
require $dir . '/credits-vip.php';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,44 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* User center sidebar: rights / commerce shortcuts.
|
||||
*
|
||||
* Expects extracted $context vars.
|
||||
* User center sidebar: Zibll dual asset mini cards + commerce shortcuts.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (empty($orders_url) && empty($show_vip) && empty($show_credit_tabs) && empty($balance_enabled)) {
|
||||
$show_wallet = !empty($balance_enabled);
|
||||
$show_credits = !empty($show_credit_tabs) || !empty($credits_enabled);
|
||||
$wallet = (float) ($wallet_balance ?? 0.0);
|
||||
$points = (float) ($credit_balance ?? 0.0);
|
||||
$currency = (string) ($currency_name ?? __('积分', 'aksrt'));
|
||||
|
||||
if ($show_wallet || $show_credits) :
|
||||
$assets_url = function_exists('aksrt_get_user_center_tab_url')
|
||||
? aksrt_get_user_center_tab_url('credits')
|
||||
: '#';
|
||||
?>
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('我的资产', 'aksrt'); ?></div>
|
||||
<div class="uc-asset-mini flex ab jsb col-ml6">
|
||||
<?php if ($show_wallet) : ?>
|
||||
<a class="uc-asset-mini__card flex1" href="<?php echo esc_url($assets_url); ?>">
|
||||
<div class="uc-asset-mini__label muted-2-color em09"><?php esc_html_e('余额', 'aksrt'); ?><i class="ml6 fa fa-angle-right em12" aria-hidden="true"></i></div>
|
||||
<div class="flex jsb ac">
|
||||
<span class="font-bold c-blue-2"><?php echo esc_html(class_exists('AKSRT_Balance') ? AKSRT_Balance::format($wallet) : number_format_i18n($wallet, 2)); ?></span>
|
||||
<i class="fas fa-wallet em14 c-blue-2" aria-hidden="true"></i>
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_credits) : ?>
|
||||
<a class="uc-asset-mini__card flex1" href="<?php echo esc_url($assets_url); ?>">
|
||||
<div class="uc-asset-mini__label muted-2-color em09"><?php echo esc_html($currency); ?><i class="ml6 fa fa-angle-right em12" aria-hidden="true"></i></div>
|
||||
<div class="flex jsb ac">
|
||||
<span class="font-bold c-yellow"><?php echo esc_html(function_exists('aksrt_format_credits') ? aksrt_format_credits((int) $points) : (string) (int) $points); ?></span>
|
||||
<i class="fas fa-coins em14 c-yellow" aria-hidden="true"></i>
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if (empty($orders_url) && empty($show_vip) && empty($show_credit_tabs) && empty($balance_enabled) && empty($affiliate_enabled)) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="uc-sidebar__section">
|
||||
<div class="uc-sidebar__title"><?php esc_html_e('权益与消费', 'aksrt'); ?></div>
|
||||
<div class="uc-sidebar__buttons">
|
||||
<?php
|
||||
$revenue_url = function_exists('aksrt_get_revenue_page_url') ? aksrt_get_revenue_page_url() : '';
|
||||
?>
|
||||
<?php if ($orders_url) : ?>
|
||||
<?php $revenue_url = function_exists('aksrt_get_revenue_page_url') ? aksrt_get_revenue_page_url() : ''; ?>
|
||||
<?php if (!empty($orders_url)) : ?>
|
||||
<a href="<?php echo esc_url($orders_url); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-receipt" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_vip) : ?>
|
||||
<a class="uc-sidebar__btn<?php echo $active_tab === 'credits' ? ' is-active' : ''; ?>" href="<?php echo esc_url(aksrt_get_user_center_tab_url('credits')); ?>" data-tab="credits">
|
||||
<?php if (!empty($show_vip)) : ?>
|
||||
<a class="uc-sidebar__btn<?php echo (!empty($active_tab) && $active_tab === 'credits') ? ' is-active' : ''; ?>" href="<?php echo esc_url(aksrt_get_user_center_tab_url('credits')); ?>" data-tab="credits">
|
||||
<i class="fas fa-crown" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('VIP 会员', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_credit_tabs) : ?>
|
||||
<a class="uc-sidebar__btn<?php echo $active_tab === 'credits' ? ' is-active' : ''; ?>" href="<?php echo esc_url(aksrt_get_user_center_tab_url('credits')); ?>" data-tab="credits">
|
||||
<i class="fas fa-coins" aria-hidden="true"></i>
|
||||
<span><?php echo esc_html($currency_name); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($affiliate_enabled) && $revenue_url) : ?>
|
||||
<a href="<?php echo esc_url($revenue_url); ?>" class="uc-sidebar__btn">
|
||||
<?php if (!empty($affiliate_enabled) && $revenue_url) : ?>
|
||||
<a href="<?php echo esc_url($revenue_url); ?>" class="uc-sidebar__btn">
|
||||
<i class="fas fa-share-alt" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('推广返佣', 'aksrt'); ?></span>
|
||||
</a>
|
||||
|
||||
Reference in new issue
Block a user