fix(user-center): reuse balance withdrawal modal
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50236b07fa
commit
d86125b130
6 files changed
+65
-141
No files matched your search
@@ -237,37 +237,18 @@ $mark = (string) ($charge_view['currency_mark'] ?? '元');
|
||||
</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) :
|
||||
$withdraw_modal_rendered = !empty($GLOBALS['aksrt_withdraw_modal_rendered']);
|
||||
if (!$withdraw_modal_rendered) {
|
||||
require __DIR__ . '/withdraw-modal.php';
|
||||
}
|
||||
endif; ?>
|
||||
|
||||
|
||||
<?php if ($withdraw_on) :
|
||||
$status_labels = [
|
||||
'pending' => __('待处理', 'aksrt'),
|
||||
'approved' => __('已通过', 'aksrt'),
|
||||
'processing' => __('处理中', 'aksrt'),
|
||||
'processing' => __('处理中', 'aksrt'),
|
||||
'completed' => __('已完成', 'aksrt'),
|
||||
'rejected' => __('已拒绝', 'aksrt'),
|
||||
];
|
||||
|
||||
@@ -30,6 +30,9 @@ if ($withdraw_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Sett
|
||||
$withdraw_on = false;
|
||||
}
|
||||
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? $withdrawal['min_amount'] ?? 50));
|
||||
$wallet_fmt = class_exists('\AKSRT\Credits\Balance')
|
||||
? \AKSRT\Credits\Balance::format((float) \AKSRT\Credits\Balance::balance($user_id))
|
||||
: '0.00';
|
||||
|
||||
$commission_stats = class_exists('\AKSRT\Payment\Rebate')
|
||||
? \AKSRT\Payment\Rebate::get_instance()->get_stats($user_id)
|
||||
@@ -110,7 +113,7 @@ $status_labels = [
|
||||
<span><?php printf(esc_html__('累计佣金 %s,待结算 %s', 'aksrt'), esc_html($format_amount($commission_stats['total_amount'] ?? 0)), esc_html($format_amount($commission_stats['pending_amount'] ?? 0))); ?></span>
|
||||
</div>
|
||||
<?php if ($withdraw_on) : ?>
|
||||
<button type="button" class="uc-commission-card__action" data-aksrt-commission-withdraw-open><i class="fas fa-arrow-right" aria-hidden="true"></i><?php esc_html_e('立即提现', 'aksrt'); ?></button>
|
||||
<button type="button" class="uc-commission-card__action" data-aksrt-withdraw-open><i class="fas fa-arrow-right" aria-hidden="true"></i><?php esc_html_e('立即提现', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</section>
|
||||
@@ -175,21 +178,6 @@ $status_labels = [
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if ($withdraw_on) : ?>
|
||||
<div class="uc-modal" id="aksrt-commission-withdraw-modal" hidden data-aksrt-commission-withdraw-modal>
|
||||
<div class="uc-modal__overlay" data-aksrt-commission-withdraw-close></div>
|
||||
<div class="uc-modal__dialog" role="dialog" tabindex="-1" aria-modal="true" aria-labelledby="aksrt-commission-withdraw-title">
|
||||
<button type="button" class="uc-modal__close" data-aksrt-commission-withdraw-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
||||
<h3 class="uc-modal__title" id="aksrt-commission-withdraw-title"><?php esc_html_e('立即提现', 'aksrt'); ?></h3>
|
||||
<form data-aksrt-commission-withdraw-form>
|
||||
<label><?php esc_html_e('提现金额', 'aksrt'); ?><input type="number" name="amount" min="<?php echo esc_attr((string) $withdraw_min); ?>" step="0.01" data-aksrt-commission-withdraw-amount required></label>
|
||||
<p class="muted-2-color em09"><?php printf(esc_html__('最低提现 %s,当前可提现 %s', 'aksrt'), esc_html($format_amount($withdraw_min)), esc_html($format_amount($available_commission))); ?></p>
|
||||
<label><?php esc_html_e('提现方式', 'aksrt'); ?><select name="method" data-aksrt-commission-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>
|
||||
<label><?php esc_html_e('收款账户信息', 'aksrt'); ?><textarea name="account_info" rows="3" data-aksrt-commission-withdraw-account required placeholder="<?php esc_attr_e('姓名 + 账号 / 卡号', 'aksrt'); ?>"></textarea></label>
|
||||
<p class="uc-modal__tip" data-aksrt-commission-withdraw-tip role="status" aria-live="polite"></p>
|
||||
<button type="submit" class="btn-primary btn-block" data-aksrt-commission-withdraw-submit><?php esc_html_e('提交申请', 'aksrt'); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($withdraw_on) {
|
||||
require __DIR__ . '/withdraw-modal.php';
|
||||
} ?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Shared balance withdrawal modal.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!empty($GLOBALS['aksrt_withdraw_modal_rendered'])) {
|
||||
return;
|
||||
}
|
||||
$GLOBALS['aksrt_withdraw_modal_rendered'] = true;
|
||||
|
||||
$withdraw_min = max(1, (float) ($withdraw_min ?? 50));
|
||||
$wallet_fmt = (string) ($wallet_fmt ?? '0.00');
|
||||
?>
|
||||
<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>
|
||||
Reference in new issue
Block a user