This commit is contained in:
@@ -44,7 +44,7 @@ export function openAlipayPayment(paymentLink, refreshTarget) {
|
||||
const paymentUrl = getAlipayPaymentUrl(paymentLink);
|
||||
|
||||
if (!paymentUrl) {
|
||||
reject(new Error('Invalid payment link'));
|
||||
reject(new Error('\u652f\u4ed8\u94fe\u63a5\u65e0\u6548'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export function openAlipayPayment(paymentLink, refreshTarget) {
|
||||
uni.setClipboardData({
|
||||
data: paymentUrl,
|
||||
success: () => resolve({ copied: true }),
|
||||
fail: () => reject(new Error('Unable to open payment link in this environment'))
|
||||
fail: () => reject(new Error('\u5f53\u524d\u73af\u5883\u6682\u4e0d\u652f\u6301\u6253\u5f00\u652f\u4ed8\u94fe\u63a5'))
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -67,12 +67,12 @@ export function openAlipayPayment(paymentLink, refreshTarget) {
|
||||
export function wechatH5Pay(payConfig) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!isValidWechatPayConfig(payConfig)) {
|
||||
reject(new Error('Invalid payment params'));
|
||||
reject(new Error('\u652f\u4ed8\u53c2\u6570\u65e0\u6548'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof WeixinJSBridge === 'undefined') {
|
||||
reject(new Error('Please open in WeChat'));
|
||||
reject(new Error('\u8bf7\u5728\u5fae\u4fe1\u4e2d\u6253\u5f00'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,17 +87,17 @@ export function wechatH5Pay(payConfig) {
|
||||
if (res.err_msg === 'get_brand_wcpay_request:ok') {
|
||||
resolve({
|
||||
success: true,
|
||||
message: 'Payment successful'
|
||||
message: '\u652f\u4ed8\u6210\u529f'
|
||||
});
|
||||
} else if (res.err_msg === 'get_brand_wcpay_request:cancel') {
|
||||
reject({
|
||||
cancelled: true,
|
||||
message: 'Payment cancelled'
|
||||
message: '\u5df2\u53d6\u6d88\u652f\u4ed8'
|
||||
});
|
||||
} else {
|
||||
reject({
|
||||
success: false,
|
||||
message: 'Payment failed',
|
||||
message: '\u652f\u4ed8\u5931\u8d25',
|
||||
error: res
|
||||
});
|
||||
}
|
||||
@@ -107,7 +107,7 @@ export function wechatH5Pay(payConfig) {
|
||||
|
||||
export function showPaymentToast(success, message) {
|
||||
uni.showToast({
|
||||
title: message || (success ? 'Payment successful' : 'Payment failed'),
|
||||
title: message || (success ? '\u652f\u4ed8\u6210\u529f' : '\u652f\u4ed8\u5931\u8d25'),
|
||||
icon: success ? 'success' : 'none',
|
||||
duration: 2000
|
||||
});
|
||||
@@ -115,9 +115,9 @@ export function showPaymentToast(success, message) {
|
||||
|
||||
export function handlePaymentError(error) {
|
||||
if (error.cancelled) {
|
||||
showPaymentToast(false, 'Payment cancelled');
|
||||
showPaymentToast(false, '\u5df2\u53d6\u6d88\u652f\u4ed8');
|
||||
return;
|
||||
}
|
||||
|
||||
showPaymentToast(false, error.message || 'Payment failed');
|
||||
showPaymentToast(false, error.message || '\u652f\u4ed8\u5931\u8d25');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user