This commit is contained in:
Flatlogic Bot 2026-02-22 12:46:20 +00:00
parent 99732244e3
commit 3e2db33621
2 changed files with 17 additions and 13 deletions

View File

@ -256,19 +256,19 @@ $requests = $stmt->fetchAll();
<span class="badge bg-light text-muted border"><?= $r['status'] == '4' ? '已拒绝' : '已通过' ?></span> <span class="badge bg-light text-muted border"><?= $r['status'] == '4' ? '已拒绝' : '已通过' ?></span>
<?php else: ?> <?php else: ?>
<div class="btn-group btn-group-sm"> <div class="btn-group btn-group-sm">
<?php if ($r['status'] == '0' || $r['status'] == 'pending'): ?> <?php if ($r['status'] === '0' || $r['status'] === 'pending'): ?>
<button type="button" class="btn btn-primary" onclick="submitMatchOnly(<?= $r['id'] ?>)"> <button type="button" class="btn btn-primary" onclick="submitMatchOnly(<?= $r['id'] ?>)">
匹配成功 匹配成功
</button> </button>
<?php elseif ($r['status'] == '1' || $r['status'] == 'matched'): ?> <?php elseif ($r['status'] === '1' || $r['status'] === 'matched'): ?>
<button type="button" class="btn btn-info text-white" onclick="showSendModal(<?= $r['id'] ?>, '<?= htmlspecialchars($r['account_bank'] ?? '') ?>', '<?= htmlspecialchars($r['account_name'] ?? '') ?>', '<?= htmlspecialchars($r['account_number'] ?? '') ?>')"> <button type="button" class="btn btn-info text-white" onclick="showSendModal(<?= $r['id'] ?>, '<?= htmlspecialchars($r['account_bank'] ?? '') ?>', '<?= htmlspecialchars($r['account_name'] ?? '') ?>', '<?= htmlspecialchars($r['account_number'] ?? '') ?>')">
发送账户 发送账户
</button> </button>
<?php elseif ($r['status'] == '2' || $r['status'] == 'account_sent'): ?> <?php elseif ($r['status'] === '2' || $r['status'] === 'account_sent'): ?>
<span class="badge bg-light text-muted border d-flex align-items-center px-2">等待用户转账...</span> <span class="badge bg-light text-muted border d-flex align-items-center px-2">等待用户转账...</span>
<?php elseif ($r['status'] == 'finished'): ?> <?php elseif ($r['status'] === 'finished'): ?>
<?php if ($r['type'] === 'recharge'): ?> <?php if ($r['type'] === 'recharge'): ?>
<button type="button" class="btn btn-outline-success" <button type="button" class="btn btn-outline-success fw-bold"
onclick="showApproveModal(<?= $r['id'] ?>, <?= $r['fiat_amount'] ?: 0 ?>, '<?= $r['fiat_currency'] ?: 'USDT' ?>', <?= $display_amount ?>)"> onclick="showApproveModal(<?= $r['id'] ?>, <?= $r['fiat_amount'] ?: 0 ?>, '<?= $r['fiat_currency'] ?: 'USDT' ?>', <?= $display_amount ?>)">
通过 通过
</button> </button>
@ -276,12 +276,12 @@ $requests = $stmt->fetchAll();
<form method="POST" class="d-inline"> <form method="POST" class="d-inline">
<input type="hidden" name="request_id" value="<?= $r['id'] ?>"> <input type="hidden" name="request_id" value="<?= $r['id'] ?>">
<input type="hidden" name="action" value="approve"> <input type="hidden" name="action" value="approve">
<button type="submit" class="btn btn-outline-success" onclick="return confirm('确定要通过该提现申请吗?')"> <button type="submit" class="btn btn-outline-success fw-bold" onclick="return confirm('确定要通过该提现申请吗?')">
通过 通过
</button> </button>
</form> </form>
<?php endif; ?> <?php endif; ?>
<button class="btn btn-outline-danger" onclick="showRejectModal(<?= $r['id'] ?>)">拒绝</button> <button class="btn btn-outline-danger fw-bold ms-1" onclick="showRejectModal(<?= $r['id'] ?>)">拒绝</button>
<?php else: ?> <?php else: ?>
<span class="badge bg-light text-muted border"><?= htmlspecialchars($r['status']) ?></span> <span class="badge bg-light text-muted border"><?= htmlspecialchars($r['status']) ?></span>
<?php endif; ?> <?php endif; ?>

View File

@ -410,6 +410,7 @@ let rechargeCountdownInterval;
let modalChatLastIds = new Set(); let modalChatLastIds = new Set();
let remainingSeconds = 1800; let remainingSeconds = 1800;
let modalChatPolling = false; let modalChatPolling = false;
window.lastRechargeStatus = null; // Track status to prevent flickering
function notify(icon, title, text = '') { function notify(icon, title, text = '') {
return Swal.fire({ return Swal.fire({
@ -553,20 +554,21 @@ function startStatusPolling(order_id) {
const modalEl = document.getElementById('rechargeModal'); const modalEl = document.getElementById('rechargeModal');
if (!modalEl || !modalEl.classList.contains('show')) return; if (!modalEl || !modalEl.classList.contains('show')) return;
try { try {
const r = await fetch(apiPath + `recharge_status.php?id=${order_id}&v=${Date.now()}`); // Add cache busting
const r = await fetch(apiPath + `recharge_status.php?id=${order_id}&t=${Date.now()}`);
const data = await r.json(); const data = await r.json();
if (data.success) { if (data.success) {
// console.log('Order status update:', data.status, data); // Force status to string
// Ensure data status is treated as string for comparison
const currentStatus = String(data.status); const currentStatus = String(data.status);
// Only re-render if status has changed to avoid UI flickering // Only re-render if status has changed or UI is empty
if (window.lastRechargeStatus !== currentStatus) { const side = document.querySelector('.info-side');
if (window.lastRechargeStatus !== currentStatus || (side && side.innerHTML.trim() === "")) {
window.lastRechargeStatus = currentStatus; window.lastRechargeStatus = currentStatus;
renderRechargeUI(data); renderRechargeUI(data);
} }
if (currentStatus === 'completed' || currentStatus === '3' || currentStatus === 'rejected' || currentStatus === '4') { if (currentStatus === '3' || currentStatus === '4' || currentStatus === 'completed' || currentStatus === 'rejected') {
clearInterval(window.statusPollingInterval); clearInterval(window.statusPollingInterval);
} }
} }
@ -583,6 +585,7 @@ function renderRechargeUI(data) {
// Normalize status to string // Normalize status to string
const status = String(data.status || '0'); const status = String(data.status || '0');
// Check if approved or rejected
if (status === 'completed' || status === '3') { if (status === 'completed' || status === '3') {
finishTransferUI(); finishTransferUI();
return; return;
@ -610,6 +613,7 @@ function renderRechargeUI(data) {
return; return;
} }
// Workflow phases
if (status === 'pending' || status === '0') { if (status === 'pending' || status === '0') {
side.innerHTML = ` side.innerHTML = `
<div class="text-center text-lg-start position-relative" style="z-index: 2;"> <div class="text-center text-lg-start position-relative" style="z-index: 2;">