feat: paypal中英文适配
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
import { loadScript } from "@paypal/paypal-js";
|
import { loadScript } from "@paypal/paypal-js";
|
||||||
import { payPalOrders, payPalCapture } from '@/service/api/payment';
|
import { payPalOrders, payPalCapture } from '@/service/api/payment';
|
||||||
|
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) =>{
|
export const constructPaypalBtn = async(orderId: number, currency: string) =>{
|
||||||
loadScript({ clientId: import.meta.env.VITE_PAYPAL_CLIENT_ID, disableFunding: ["paylater"], currency })
|
loadScript({ clientId: import.meta.env.VITE_PAYPAL_CLIENT_ID, currency, locale: locale })
|
||||||
.then((paypal: any) => {
|
.then((paypal: any) => {
|
||||||
paypal
|
paypal
|
||||||
.Buttons({
|
.Buttons({
|
||||||
@@ -16,7 +20,7 @@ export const constructPaypalBtn = async(orderId: number, currency: string) =>{
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async createOrder() {
|
async createOrder() {
|
||||||
try {
|
try {
|
||||||
const response = await payPalOrders({orderId: orderId});
|
const response = await payPalOrders({orderId: orderId});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user