This commit is contained in:
zhx 2026-06-15 20:02:41 +08:00
parent c69c680a39
commit 802bc1c686
7 changed files with 227 additions and 86 deletions

View File

@ -489,14 +489,19 @@
"recharge.orderTitle": "الطلب",
"recharge.paymentOperation": "عملية الدفع",
"recharge.close": "إغلاق",
"recharge.amount": "المبلغ",
"recharge.orderId": "رقم الطلب",
"recharge.orderStatus": "الحالة",
"recharge.payRedirecting": "جار فتح صفحة الدفع...",
"recharge.payOpenHint": "افتح صفحة الدفع وأكمل الدفع.",
"recharge.openPayment": "فتح الدفع",
"recharge.usdtPayment": "دفع USDT",
"recharge.usdtAddress": "عنوان USDT-TRC20",
"recharge.usdtHint": "حوّل USDT ثم أرسل TXID.",
"recharge.usdtPaymentHint": "انسخ العنوان، حوّل USDT، ثم أرسل TXID.",
"recharge.copy": "نسخ",
"recharge.copyAddress": "نسخ العنوان",
"recharge.copyOrderId": "نسخ رقم الطلب",
"recharge.txHashPlaceholder": "أدخل TXID بعد الدفع",
"recharge.submitTx": "إرسال TXID",
"recharge.submitted": "جار الإرسال...",

View File

@ -495,14 +495,19 @@
"recharge.orderTitle": "Order",
"recharge.paymentOperation": "Payment operation",
"recharge.close": "Close",
"recharge.amount": "Amount",
"recharge.orderId": "Order ID",
"recharge.orderStatus": "Status",
"recharge.payRedirecting": "Opening payment page...",
"recharge.payOpenHint": "Open the payment page and finish the payment.",
"recharge.openPayment": "Open payment",
"recharge.usdtPayment": "USDT payment",
"recharge.usdtAddress": "USDT-TRC20 address",
"recharge.usdtHint": "Transfer USDT and submit the TXID.",
"recharge.usdtPaymentHint": "Copy the address, transfer USDT, then submit TXID.",
"recharge.copy": "Copy",
"recharge.copyAddress": "Copy address",
"recharge.copyOrderId": "Copy order ID",
"recharge.txHashPlaceholder": "Enter TXID after payment",
"recharge.submitTx": "Submit TXID",
"recharge.submitted": "Submitting...",

View File

@ -489,14 +489,19 @@
"recharge.orderTitle": "Pedido",
"recharge.paymentOperation": "Operación de pago",
"recharge.close": "Cerrar",
"recharge.amount": "Importe",
"recharge.orderId": "ID de pedido",
"recharge.orderStatus": "Estado",
"recharge.payRedirecting": "Abriendo página de pago...",
"recharge.payOpenHint": "Abre la página de pago y completa el pago.",
"recharge.openPayment": "Abrir pago",
"recharge.usdtPayment": "Pago USDT",
"recharge.usdtAddress": "Dirección USDT-TRC20",
"recharge.usdtHint": "Transfiere USDT y envía el TXID.",
"recharge.usdtPaymentHint": "Copia la dirección, transfiere USDT y luego envía el TXID.",
"recharge.copy": "Copiar",
"recharge.copyAddress": "Copiar dirección",
"recharge.copyOrderId": "Copiar ID de pedido",
"recharge.txHashPlaceholder": "Ingresa el TXID después del pago",
"recharge.submitTx": "Enviar TXID",
"recharge.submitted": "Enviando...",

View File

@ -456,14 +456,19 @@
"recharge.orderTitle": "Pesanan",
"recharge.paymentOperation": "Operasi pembayaran",
"recharge.close": "Tutup",
"recharge.amount": "Jumlah",
"recharge.orderId": "ID pesanan",
"recharge.orderStatus": "Status",
"recharge.payRedirecting": "Membuka halaman pembayaran...",
"recharge.payOpenHint": "Buka halaman pembayaran dan selesaikan pembayaran.",
"recharge.openPayment": "Buka pembayaran",
"recharge.usdtPayment": "Pembayaran USDT",
"recharge.usdtAddress": "Alamat USDT-TRC20",
"recharge.usdtHint": "Transfer USDT lalu kirim TXID.",
"recharge.usdtPaymentHint": "Salin alamat, transfer USDT, lalu kirim TXID.",
"recharge.copy": "Salin",
"recharge.copyAddress": "Salin alamat",
"recharge.copyOrderId": "Salin ID pesanan",
"recharge.txHashPlaceholder": "Masukkan TXID setelah bayar",
"recharge.submitTx": "Kirim TXID",
"recharge.submitted": "Mengirim...",

View File

@ -456,14 +456,19 @@
"recharge.orderTitle": "Sipariş",
"recharge.paymentOperation": "Ödeme işlemi",
"recharge.close": "Kapat",
"recharge.amount": "Tutar",
"recharge.orderId": "Sipariş ID",
"recharge.orderStatus": "Durum",
"recharge.payRedirecting": "Ödeme sayfasıılıyor...",
"recharge.payOpenHint": "Ödeme sayfasınıın ve ödemeyi tamamlayın.",
"recharge.openPayment": "Ödemeyi aç",
"recharge.usdtPayment": "USDT ödeme",
"recharge.usdtAddress": "USDT-TRC20 adresi",
"recharge.usdtHint": "USDT gönderin ve TXID girin.",
"recharge.usdtPaymentHint": "Adresi kopyalayın, USDT gönderin, sonra TXID girin.",
"recharge.copy": "Kopyala",
"recharge.copyAddress": "Adresi kopyala",
"recharge.copyOrderId": "Sipariş ID kopyala",
"recharge.txHashPlaceholder": "Ödemeden sonra TXID girin",
"recharge.submitTx": "TXID gönder",
"recharge.submitted": "Gönderiliyor...",

View File

@ -462,14 +462,19 @@
"recharge.orderTitle": "订单",
"recharge.paymentOperation": "支付操作",
"recharge.close": "关闭",
"recharge.amount": "金额",
"recharge.orderId": "订单号",
"recharge.orderStatus": "状态",
"recharge.payRedirecting": "正在打开支付页面...",
"recharge.payOpenHint": "打开支付页面并完成付款。",
"recharge.openPayment": "打开支付",
"recharge.usdtPayment": "USDT 支付",
"recharge.usdtAddress": "USDT-TRC20 收款地址",
"recharge.usdtHint": "转账 USDT 后提交 TXID。",
"recharge.usdtPaymentHint": "复制地址,转账 USDT然后提交 TXID。",
"recharge.copy": "复制",
"recharge.copyAddress": "复制地址",
"recharge.copyOrderId": "复制订单号",
"recharge.txHashPlaceholder": "付款后输入 TXID",
"recharge.submitTx": "提交 TXID",
"recharge.submitted": "提交中...",

View File

@ -436,23 +436,42 @@
white-space: nowrap;
}
.modal-subtitle {
margin: 3px 0 0;
color: var(--hy-theme-muted);
font-size: 12px;
line-height: 1.35;
.modal-close {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 38px;
min-width: 38px;
min-height: 38px;
padding: 0;
border-radius: 50%;
font-size: 0;
line-height: 1;
}
.modal-close {
min-height: 38px;
padding: 0 14px;
border-radius: 14px;
.modal-close::before,
.modal-close::after {
content: '';
position: absolute;
width: 16px;
height: 2px;
border-radius: 999px;
background: currentColor;
}
.modal-close::before {
transform: rotate(45deg);
}
.modal-close::after {
transform: rotate(-45deg);
}
.payment-summary {
display: grid;
gap: 8px;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
align-items: stretch;
}
@ -484,21 +503,71 @@
white-space: nowrap;
}
.summary-pill.order-id-pill {
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
column-gap: 8px;
}
.summary-pill.order-id-pill span {
grid-column: 1 / -1;
}
.copy-icon-button {
position: relative;
width: 30px;
min-width: 30px;
min-height: 30px;
padding: 0;
border: 1px solid var(--hy-theme-line);
border-radius: 10px;
background: var(--hy-theme-surface);
color: var(--hy-theme-primary-deep);
}
.copy-icon-button::before,
.copy-icon-button::after {
content: '';
position: absolute;
width: 12px;
height: 14px;
border: 2px solid currentColor;
border-radius: 3px;
}
.copy-icon-button::before {
right: 8px;
top: 7px;
background: var(--hy-theme-surface);
}
.copy-icon-button::after {
right: 12px;
top: 10px;
opacity: 0.65;
}
.status-pill {
display: inline-flex;
min-height: 34px;
align-items: center;
justify-content: center;
align-self: center;
padding: 0 12px;
border-radius: 999px;
background: var(--hy-theme-primary-soft);
gap: 6px;
color: var(--hy-theme-primary-deep);
font-size: 12px;
font-size: 13px;
font-weight: 900;
white-space: nowrap;
}
.status-pill::before {
content: '';
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--hy-theme-primary-deep);
box-shadow: 0 0 0 4px var(--hy-theme-primary-soft);
}
.address-box {
display: grid;
gap: 8px;
@ -507,6 +576,11 @@
background: var(--hy-theme-primary-soft);
}
#usdt-panel {
display: grid;
gap: 12px;
}
.address-head {
display: flex;
align-items: center;
@ -572,7 +646,7 @@
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 16px;
padding: 18px 16px 14px;
border-bottom: 1px solid var(--hy-theme-line);
background: var(--hy-theme-surface);
}
@ -583,8 +657,13 @@
letter-spacing: 0;
}
.modal-header > div {
min-width: 0;
flex: 1;
}
.modal-body {
padding: 16px;
padding: 12px 16px 16px;
}
.modal-actions {
@ -688,14 +767,6 @@
padding: 8px;
}
.payment-summary {
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.status-pill {
grid-column: 1 / -1;
}
.checkout-inner .primary-button {
min-width: 104px;
padding: 0 12px;
@ -853,55 +924,67 @@
>
<div class="modal">
<div class="modal-header">
<h2 data-i18n="recharge.paymentOperation">
Payment operation
</h2>
<div>
<h2
id="order-modal-title"
data-i18n="recharge.paymentOperation"
>
Payment operation
</h2>
</div>
<strong id="order-status" class="status-pill">-</strong>
<button
id="close-order-modal"
class="secondary-button"
class="secondary-button modal-close"
type="button"
data-i18n="recharge.close"
>
Close
</button>
aria-label="Close"
data-i18n-aria="recharge.close"
></button>
</div>
<div class="modal-body">
<section id="order-panel" class="order-panel">
<div class="section-title">
<h2 data-i18n="recharge.orderTitle">Order</h2>
<span id="order-status"></span>
</div>
<div class="order-row">
<span data-i18n="recharge.orderId"
>Order ID</span
>
<strong id="order-id">-</strong>
</div>
<div class="order-row">
<span data-i18n="recharge.orderStatus"
>Status</span
>
<strong id="order-status-text">-</strong>
<div class="payment-summary">
<div class="summary-pill">
<span data-i18n="recharge.amount"
>Amount</span
>
<strong id="order-amount">-</strong>
</div>
<div class="summary-pill order-id-pill">
<span data-i18n="recharge.orderId"
>Order ID</span
>
<strong id="order-id">-</strong>
<button
id="copy-order-id"
class="copy-icon-button"
type="button"
aria-label="Copy order ID"
data-i18n-aria="recharge.copyOrderId"
></button>
</div>
</div>
<div id="usdt-panel" class="hidden">
<div class="address-box">
<span data-i18n="recharge.usdtAddress">
USDT-TRC20 address
</span>
<div class="address-head">
<span data-i18n="recharge.usdtAddress">
USDT-TRC20 address
</span>
<button
id="copy-address"
class="secondary-button copy-address-button"
type="button"
data-i18n="recharge.copyAddress"
>
Copy address
</button>
</div>
<div
class="address-value"
id="receive-address"
>
-
</div>
<button
id="copy-address"
class="secondary-button"
type="button"
data-i18n="recharge.copy"
>
Copy
</button>
</div>
<form id="tx-form" class="tx-form">
<input
@ -1006,10 +1089,12 @@
closeOrderModal:
document.getElementById('close-order-modal'),
orderPanel: document.getElementById('order-panel'),
orderModalTitle:
document.getElementById('order-modal-title'),
orderAmount: document.getElementById('order-amount'),
orderID: document.getElementById('order-id'),
copyOrderID: document.getElementById('copy-order-id'),
orderStatus: document.getElementById('order-status'),
orderStatusText:
document.getElementById('order-status-text'),
orderMessage: document.getElementById('order-message'),
usdtPanel: document.getElementById('usdt-panel'),
mifapayPanel: document.getElementById('mifapay-panel'),
@ -1060,20 +1145,13 @@
'click',
closeOrderModal
);
nodes.orderModal.addEventListener(
'click',
function (event) {
if (event.target === nodes.orderModal) {
closeOrderModal();
}
}
);
nodes.openPaymentURL.addEventListener('click', function () {
if (state.order && state.order.pay_url) {
window.location.href = state.order.pay_url;
}
});
nodes.copyAddress.addEventListener('click', copyAddress);
nodes.copyOrderID.addEventListener('click', copyOrderID);
nodes.txForm.addEventListener('submit', submitTx);
window.addEventListener('hyapp:i18n-ready', function () {
document.title = t(
@ -1337,15 +1415,15 @@
);
nodes.orderPanel.classList.toggle('is-visible', !!order);
if (!order) return;
nodes.orderID.textContent = order.order_id || '-';
var isUSDT = order.provider_code === 'usdt_trc20';
nodes.orderModalTitle.textContent = isUSDT
? t('recharge.usdtPayment', 'USDT payment')
: t('recharge.paymentOperation', 'Payment operation');
nodes.orderAmount.textContent = orderAmountText(order);
nodes.orderID.textContent = shortOrderID(order.order_id);
nodes.orderID.title = order.order_id || '';
nodes.orderStatus.textContent = statusLabel(order.status);
nodes.orderStatusText.textContent = statusLabel(
order.status
);
nodes.usdtPanel.classList.toggle(
'hidden',
order.provider_code !== 'usdt_trc20'
);
nodes.usdtPanel.classList.toggle('hidden', !isUSDT);
nodes.mifapayPanel.classList.toggle(
'hidden',
order.provider_code !== 'mifapay' || !order.pay_url
@ -1377,13 +1455,7 @@
)
);
} else {
setStatus(
nodes.orderMessage,
t(
'recharge.usdtHint',
'Transfer USDT and submit the TXID.'
)
);
setStatus(nodes.orderMessage, '');
}
}
@ -1722,9 +1794,22 @@
function copyAddress() {
var address = nodes.receiveAddress.textContent || '';
if (!address || address === '-') return;
copyText(address);
}
function copyOrderID() {
var orderID =
state.order && state.order.order_id
? state.order.order_id
: '';
if (!orderID) return;
copyText(orderID);
}
function copyText(text) {
var copied = window.navigator.clipboard
? window.navigator.clipboard.writeText(address)
: fallbackCopy(address);
? window.navigator.clipboard.writeText(text)
: fallbackCopy(text);
Promise.resolve(copied)
.then(function () {
toast(t('recharge.copied', 'Copied'));
@ -1846,6 +1931,32 @@
return t(key, status || 'pending');
}
// 弹窗摘要优先使用后端订单快照,恢复三方支付订单时也能脱离当前选中商品显示正确金额。
function orderAmountText(order) {
if (!order) return '-';
if (order.provider_code === 'usdt_trc20') {
return amountMinorText(order.usd_minor_amount, 'USD');
}
return amountMinorText(
order.provider_amount_minor,
order.currency_code || 'USD'
);
}
function amountMinorText(value, currency) {
var minor = Number(value || 0);
if (!Number.isFinite(minor) || minor <= 0) return '-';
return (minor / 100).toFixed(2) + ' ' + currency;
}
function shortOrderID(value) {
value = String(value || '');
if (!value) return '-';
return value.length > 18
? value.slice(0, 8) + '...' + value.slice(-4)
: value;
}
// loading 同时锁住确认账号和创建订单,避免用户在请求中切账号或重复下单。
function setBusy(loading) {
state.loading = loading;