diff --git a/src/components/payment/paypal-button.vue b/src/components/payment/paypal-button.vue index 5b2900c..3124b5f 100644 --- a/src/components/payment/paypal-button.vue +++ b/src/components/payment/paypal-button.vue @@ -1,6 +1,31 @@ diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 868d0b4..cba3098 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -728,6 +728,7 @@ const local: any = { selectPayment:'Payment', alipay:'Alipay', wxpay:'WeChat Pay', + wxpayScan:'Scan QR code on WeChat', stripe:'Stripe', balancePay:'Balance Pay', availableBalance:'Balance', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 37f2b66..79da9e7 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -728,6 +728,7 @@ const local:any = { selectPayment:'支付方式', alipay:'支付宝支付', wxpay:'微信支付', + wxpayScan:'使用微信扫码支付', stripe:'Stripe', balancePay:'余额支付', availableBalance:'可用余额', diff --git a/src/service/api/payment.ts b/src/service/api/payment.ts index 1d87915..7ca47cd 100644 --- a/src/service/api/payment.ts +++ b/src/service/api/payment.ts @@ -55,6 +55,14 @@ export function payPalCapture(paypalOrderId: string, orderId: number) { }); } +/** Get paypal configuration */ +export function getPayPalConfig() { + return request({ + url: '/payment/paypal/result/one', + method: 'get' + }); +} + /** Stripe pay with orderId */ export function stripePay(orderId: number) { return request({ diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index fc74cdc..5bce79e 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -128,6 +128,7 @@ declare global { const getFixedTabIds: typeof import('../store/modules/tab/shared')['getFixedTabIds'] const getFixedTabs: typeof import('../store/modules/tab/shared')['getFixedTabs'] const getGlobalMenusByAuthRoutes: typeof import('../store/modules/route/shared')['getGlobalMenusByAuthRoutes'] + const getPayPalConfig: typeof import('../service/api/payment')['getPayPalConfig'] const getPaymentConfig: typeof import('../service/api/payment')['getPaymentConfig'] const getQueryParams: typeof import('../utils/common')['getQueryParams'] const getRouteIcons: typeof import('../store/modules/tab/shared')['getRouteIcons'] diff --git a/src/utils/paypal.ts b/src/utils/paypal.ts index 9cef440..85eec6a 100644 --- a/src/utils/paypal.ts +++ b/src/utils/paypal.ts @@ -5,8 +5,8 @@ import { useAppStore } from '@/store/modules/app'; const appStore = useAppStore(); const locale = appStore.locale.includes("zh") ? "zh_CN" : "en_US" -export const constructPaypalBtn = async(orderId: number, currency: string) =>{ - loadScript({ clientId: import.meta.env.VITE_PAYPAL_CLIENT_ID, currency, locale: locale }) +export const constructPaypalBtn = async(clientId: string, orderId: number, currency: string) =>{ + loadScript({ clientId, currency, locale: locale }) .then((paypal: any) => { paypal .Buttons({ diff --git a/src/views/billing/wxpay/index.vue b/src/views/billing/wxpay/index.vue index d02f9fb..500590c 100644 --- a/src/views/billing/wxpay/index.vue +++ b/src/views/billing/wxpay/index.vue @@ -3,9 +3,11 @@ import { useRoute } from 'vue-router'; import { useRouterPush } from '@/hooks/common/router'; import { doGetOrderInfo } from '@/service/api/order'; + import { useI18n } from 'vue-i18n'; const route = useRoute(); const { routerPushByKey } = useRouterPush(); + const { t } = useI18n(); const qrCodeImg = ref(window.location.origin + route.query.url); @@ -34,15 +36,15 @@
+
+ {{ t('page.order.wxpayScan') }} +

-
- 使用微信扫码支付 -