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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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