fix:pay
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 52s

This commit is contained in:
luo
2026-06-26 18:01:01 +08:00
parent 59e4e1203e
commit 85cdeac804
2 changed files with 76 additions and 35 deletions

View File

@@ -58,11 +58,34 @@ export function getPendingAlipayPaymentData() {
return uni.getStorageSync(ALIPAY_PAYMENT_DATA_KEY) || null;
}
function getAlipayPaymentPageUrl(refreshTarget) {
function encodePaymentUrl(value) {
try {
return btoa(unescape(encodeURIComponent(value)))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');
} catch (e) {
return '';
}
}
function getAlipayPaymentPageUrl(refreshTarget, payUrl, qrUrl) {
const params = [`t=${Date.now()}`];
if (refreshTarget) {
params.push(`from=${encodeURIComponent(refreshTarget)}`);
}
if (payUrl) {
const encodedPayUrl = encodePaymentUrl(payUrl);
if (encodedPayUrl) {
params.push(`pay64=${encodedPayUrl}`);
}
}
if (qrUrl) {
const encodedQrUrl = encodePaymentUrl(qrUrl);
if (encodedQrUrl) {
params.push(`qr64=${encodedQrUrl}`);
}
}
return `/pages/alipay-payment/alipay-payment?${params.join('&')}`;
}
@@ -120,7 +143,7 @@ export function openAlipayPayment(paymentLink, refreshTarget) {
timestamp: Date.now()
});
navigateToAlipayPaymentPage(getAlipayPaymentPageUrl(refreshTarget), resolve, reject);
navigateToAlipayPaymentPage(getAlipayPaymentPageUrl(refreshTarget, copyUrl, qrUrl), resolve, reject);
});
}