This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user