feat: 优化收银台支付页金额展示与二维码
在二维码内嵌入代币及网络 Logo,钱包地址高亮首尾字符, 并将法币金额与网络信息合并为一行,提升支付页可读性。 Ps:参考来自群友
This commit is contained in:
@@ -9,3 +9,4 @@ dist/
|
||||
static/web
|
||||
static/secure
|
||||
*.log
|
||||
AGENTS.md
|
||||
@@ -96,6 +96,44 @@ body {
|
||||
}
|
||||
.amount-crypto-value:hover { color: #009a5c; }
|
||||
|
||||
#paymentStage .amount-crypto-row {
|
||||
margin-top: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
#paymentStage .amount-crypto-value {
|
||||
font-size: 32px;
|
||||
font-weight: 800;
|
||||
line-height: 1.1;
|
||||
}
|
||||
#paymentStage .amount-meta-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
margin-top: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#paymentStage .amount-fiat {
|
||||
flex-shrink: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 750;
|
||||
letter-spacing: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
#paymentStage .amount-network-line {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
margin-top: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
#paymentStage .network-tag {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.copy-trigger {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -395,6 +433,7 @@ body {
|
||||
|
||||
.qr-stage { padding: 20px 24px 0; }
|
||||
.qr-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -406,7 +445,35 @@ body {
|
||||
background: #fff;
|
||||
}
|
||||
.qr-wrapper canvas { display: block; }
|
||||
|
||||
.qr-payment-logo {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
transform: translate(-50%, -50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.qr-token-logo {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.qr-network-logo {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
padding: 1px;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
object-fit: contain;
|
||||
}
|
||||
.address-card { background: #f8f9fa; border-radius: 12px; padding: 8px 12px; margin-bottom: 16px; }
|
||||
.address-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
|
||||
.address-label {
|
||||
@@ -423,6 +490,10 @@ body {
|
||||
word-break: break-all;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.address-emphasis {
|
||||
color: var(--color-accent);
|
||||
font-weight: 800;
|
||||
}
|
||||
.reselect-btn {
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
@@ -631,6 +702,7 @@ body {
|
||||
body { padding: 12px 10px 32px; }
|
||||
.checkout-card { margin-top: 0; }
|
||||
.amount-fiat { font-size: 26px; }
|
||||
#paymentStage .amount-crypto-value { font-size: 28px; }
|
||||
.card-header,
|
||||
.amount-block,
|
||||
.form-section,
|
||||
@@ -642,4 +714,5 @@ body {
|
||||
|
||||
@media (max-width: 360px) {
|
||||
.amount-fiat { font-size: 22px; }
|
||||
#paymentStage .amount-crypto-value { font-size: 26px; }
|
||||
}
|
||||
|
||||
@@ -566,10 +566,77 @@
|
||||
|
||||
(function () {
|
||||
var orderData = null, gTradeId = '';
|
||||
var WEB3 = '/checkout/official/assets/web3icons';
|
||||
window._qrAmount = '';
|
||||
|
||||
function _t(k, d) { return (window.Payment && window.Payment.t) ? window.Payment.t(k, d) : d; }
|
||||
|
||||
function renderWalletAddress(value) {
|
||||
var el = document.getElementById('walletAddress');
|
||||
if (!el) return;
|
||||
|
||||
var address = value == null || value === '' ? '--' : String(value);
|
||||
el.textContent = '';
|
||||
if (address === '--') {
|
||||
el.textContent = address;
|
||||
return;
|
||||
}
|
||||
|
||||
function appendPart(text, emphasized) {
|
||||
var part = document.createElement('span');
|
||||
part.textContent = text;
|
||||
if (emphasized) part.className = 'address-emphasis';
|
||||
el.appendChild(part);
|
||||
}
|
||||
|
||||
if (address.length <= 10) {
|
||||
appendPart(address, true);
|
||||
return;
|
||||
}
|
||||
|
||||
appendPart(address.slice(0, 4), true);
|
||||
appendPart(address.slice(4, -6), false);
|
||||
appendPart(address.slice(-6), true);
|
||||
}
|
||||
|
||||
function updateQrPaymentLogo(currencyValue, networkValue) {
|
||||
var badge = document.getElementById('qrPaymentLogo');
|
||||
var tokenLogo = document.getElementById('qrTokenLogo');
|
||||
var networkLogo = document.getElementById('qrNetworkLogo');
|
||||
if (!badge || !tokenLogo || !networkLogo) return;
|
||||
|
||||
var currency = currencyValue == null ? '' : String(currencyValue).trim().toUpperCase();
|
||||
var network = networkValue == null ? '' : String(networkValue).trim().toLowerCase();
|
||||
badge.style.display = 'none';
|
||||
tokenLogo.removeAttribute('src');
|
||||
networkLogo.style.display = 'none';
|
||||
networkLogo.removeAttribute('src');
|
||||
tokenLogo.onload = null;
|
||||
tokenLogo.onerror = null;
|
||||
networkLogo.onload = null;
|
||||
networkLogo.onerror = null;
|
||||
if (!currency) return;
|
||||
|
||||
tokenLogo.onerror = function () {
|
||||
badge.style.display = 'none';
|
||||
tokenLogo.removeAttribute('src');
|
||||
};
|
||||
tokenLogo.onload = function () {
|
||||
badge.style.display = 'flex';
|
||||
};
|
||||
tokenLogo.src = WEB3 + '/token/' + currency + '.svg';
|
||||
|
||||
if (!network) return;
|
||||
networkLogo.onerror = function () {
|
||||
networkLogo.style.display = 'none';
|
||||
networkLogo.removeAttribute('src');
|
||||
};
|
||||
networkLogo.onload = function () {
|
||||
networkLogo.style.display = 'block';
|
||||
};
|
||||
networkLogo.src = WEB3 + '/network/' + network + '.svg';
|
||||
}
|
||||
|
||||
function showSelection() {
|
||||
document.getElementById('selectionStage').style.display = 'block';
|
||||
document.getElementById('paymentStage').style.display = 'none';
|
||||
@@ -605,6 +672,7 @@
|
||||
var d = orderData;
|
||||
var currency = (d.network && d.network.crypto) ? d.network.crypto : (d.selected_payment ? d.selected_payment.currency : 'USDT');
|
||||
var netName = (d.network && d.network.name) ? d.network.name : (d.selected_payment ? d.selected_payment.token_net_name : '');
|
||||
var network = (d.network && d.network.network) ? d.network.network : (d.selected_payment ? d.selected_payment.network : '');
|
||||
var amount = d.actual_amount || '--';
|
||||
window._qrAmount = amount;
|
||||
document.getElementById('orderMoneyQ').textContent = d.money || '--';
|
||||
@@ -612,10 +680,12 @@
|
||||
document.getElementById('payAmountQ').textContent = amount + ' ' + currency;
|
||||
document.getElementById('payNetworkQ').textContent = _t('networkPrefix', '区块网络 · ') + netName;
|
||||
document.getElementById('orderIdQ').textContent = d.order_id || '--';
|
||||
document.getElementById('walletAddress').textContent = d.token || d.address || '--';
|
||||
var paymentAddress = d.token || d.address || '';
|
||||
renderWalletAddress(paymentAddress);
|
||||
var addr = document.getElementById('addressLabelQ');
|
||||
if (addr) addr.textContent = _t('receivingAddress', '收款地址');
|
||||
$('#qrcode').empty().qrcode({ text: d.token || d.address || '', width: 200, height: 200 });
|
||||
$('#qrcode').empty().qrcode({ text: paymentAddress, width: 200, height: 200 });
|
||||
updateQrPaymentLogo(currency, network);
|
||||
updateReselectButton();
|
||||
bindHelp('helpBtnQ', d.support_url);
|
||||
Payment.initQrPage({
|
||||
|
||||
@@ -132,9 +132,6 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="amount-block">
|
||||
<div class="amount-fiat">
|
||||
<span id="orderMoneyQ">--</span> <span id="orderFiatQ">--</span>
|
||||
</div>
|
||||
<div class="amount-crypto-row">
|
||||
<span class="amount-crypto-value" id="payAmountQ"></span>
|
||||
<span class="copy-trigger" id="copyAmountQBtn" data-i18n="[title]copyAmountTitle" title="复制金额">
|
||||
@@ -146,8 +143,13 @@
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="amount-network-line">
|
||||
<span class="network-tag" id="payNetworkQ">--</span>
|
||||
<div class="amount-meta-row">
|
||||
<div class="amount-fiat">
|
||||
<span id="orderMoneyQ">--</span> <span id="orderFiatQ">--</span>
|
||||
</div>
|
||||
<div class="amount-network-line">
|
||||
<span class="network-tag" id="payNetworkQ">--</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding: 12px 24px 0; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;">
|
||||
@@ -179,6 +181,10 @@
|
||||
<div class="qr-stage">
|
||||
<div class="qr-wrapper">
|
||||
<div id="qrcode"></div>
|
||||
<div class="qr-payment-logo" id="qrPaymentLogo" aria-hidden="true" style="display:none;">
|
||||
<img class="qr-token-logo" id="qrTokenLogo" alt="">
|
||||
<img class="qr-network-logo" id="qrNetworkLogo" alt="" style="display:none;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="address-card">
|
||||
<div class="address-label-row">
|
||||
|
||||
Reference in New Issue
Block a user