|
@@ -59,8 +59,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { redirectToCheckout, loadAirwallex } from 'airwallex-payment-elements';
|
|
|
-import { useRoute } from "vue-router";
|
|
|
+// import { redirectToCheckout, loadAirwallex } from 'airwallex-payment-elements';
|
|
|
+// import { useRoute } from "vue-router";
|
|
|
// import { useI18n } from "vue-i18n";
|
|
|
// import { ref } from 'vue';
|
|
|
import sHeader from "@/components/SimpleHeader";
|
|
@@ -72,104 +72,104 @@ export default {
|
|
|
setup() {
|
|
|
// const { t } = useI18n();
|
|
|
// 将语言始终设置为英文
|
|
|
- const curLang = localStorage.getItem('curLang');
|
|
|
- if (curLang !== 'en') {
|
|
|
- // 将 urllang 设置为 "en"
|
|
|
- localStorage.setItem('curLang', 'en');
|
|
|
- }
|
|
|
+ // const curLang = localStorage.getItem('curLang');
|
|
|
+ // if (curLang !== 'en') {
|
|
|
+ // // 将 urllang 设置为 "en"
|
|
|
+ // localStorage.setItem('curLang', 'en');
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
- const urlParams = new URLSearchParams(window.location.href.split('?')[1]);
|
|
|
- // console.log("urlParams是>>>" + urlParams.toString());
|
|
|
- const productsName = urlParams.get('productName');
|
|
|
- // console.log("productsName的value是:::" + productsName);
|
|
|
- const productsNum = urlParams.get('productsNum');
|
|
|
- const totalPrice = urlParams.get('totalPrice');
|
|
|
+ // const urlParams = new URLSearchParams(window.location.href.split('?')[1]);
|
|
|
+ // // console.log("urlParams是>>>" + urlParams.toString());
|
|
|
+ // const productsName = urlParams.get('productName');
|
|
|
+ // // console.log("productsName的value是:::" + productsName);
|
|
|
+ // const productsNum = urlParams.get('productsNum');
|
|
|
+ // const totalPrice = urlParams.get('totalPrice');
|
|
|
|
|
|
|
|
|
- const mode = 'payment';
|
|
|
- const route = useRoute();
|
|
|
+ // const mode = 'payment';
|
|
|
+ // const route = useRoute();
|
|
|
// console.log("route.query.intent_id>>>>>>>" + route.query.intent_id);
|
|
|
- const redirectHppForCheckout = () => {
|
|
|
- redirectToCheckout({
|
|
|
- env: 'demo',
|
|
|
- mode,
|
|
|
- currency: route.query.currency,
|
|
|
- intent_id: route.query.intent_id,
|
|
|
- client_secret: route.query.client_secret,
|
|
|
- //主题
|
|
|
- theme: {
|
|
|
- fonts: [
|
|
|
- {
|
|
|
- src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
|
|
|
- family: 'AxLLCircular',
|
|
|
- weight: 400,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- // successUrl: 'https://www.baidu.com', // 支付成功跳转页面
|
|
|
- // failUrl: 'https://www.baidu.com', // 支付失败跳转页面
|
|
|
- logoUrl: '', //支付页面展示商户LOGO
|
|
|
- });
|
|
|
- };
|
|
|
- const redirectHppForRecurring = () => {
|
|
|
- redirectToCheckout({
|
|
|
- env: 'demo',
|
|
|
- // mode,
|
|
|
- // currency,
|
|
|
- // client_secret,
|
|
|
- recurringOptions: {
|
|
|
- card: {
|
|
|
- next_triggered_by: 'customer',
|
|
|
- merchant_trigger_reason: 'scheduled',
|
|
|
- // currency,
|
|
|
- },
|
|
|
- },
|
|
|
- theme: {
|
|
|
- fonts: [
|
|
|
- {
|
|
|
- src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
|
|
|
- family: 'AxLLCircular',
|
|
|
- weight: 400,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- // successUrl: 'https://www.google.com',
|
|
|
- // failUrl: 'https://www.google.com',
|
|
|
- });
|
|
|
- };
|
|
|
- loadAirwallex({
|
|
|
- env: 'demo', // Can choose other production environments, 'staging | 'demo' | 'prod'
|
|
|
- });
|
|
|
- const redirectHpp = async () => {
|
|
|
- try {
|
|
|
- await loadAirwallex({
|
|
|
- env: 'demo',
|
|
|
- });
|
|
|
- if (mode === 'payment') {
|
|
|
- redirectHppForCheckout();
|
|
|
- } else if (mode === 'recurring') {
|
|
|
- redirectHppForRecurring();
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- window.alert('There was an error with HPP redirection', error);
|
|
|
- }
|
|
|
- };
|
|
|
+ // const redirectHppForCheckout = () => {
|
|
|
+ // redirectToCheckout({
|
|
|
+ // env: 'demo',
|
|
|
+ // mode,
|
|
|
+ // currency: route.query.currency,
|
|
|
+ // intent_id: route.query.intent_id,
|
|
|
+ // client_secret: route.query.client_secret,
|
|
|
+ // //主题
|
|
|
+ // theme: {
|
|
|
+ // fonts: [
|
|
|
+ // {
|
|
|
+ // src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
|
|
|
+ // family: 'AxLLCircular',
|
|
|
+ // weight: 400,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // },
|
|
|
+ // // successUrl: 'https://www.baidu.com', // 支付成功跳转页面
|
|
|
+ // // failUrl: 'https://www.baidu.com', // 支付失败跳转页面
|
|
|
+ // logoUrl: '', //支付页面展示商户LOGO
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ // const redirectHppForRecurring = () => {
|
|
|
+ // redirectToCheckout({
|
|
|
+ // env: 'demo',
|
|
|
+ // // mode,
|
|
|
+ // // currency,
|
|
|
+ // // client_secret,
|
|
|
+ // recurringOptions: {
|
|
|
+ // card: {
|
|
|
+ // next_triggered_by: 'customer',
|
|
|
+ // merchant_trigger_reason: 'scheduled',
|
|
|
+ // // currency,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // theme: {
|
|
|
+ // fonts: [
|
|
|
+ // {
|
|
|
+ // src: 'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
|
|
|
+ // family: 'AxLLCircular',
|
|
|
+ // weight: 400,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // },
|
|
|
+ // // successUrl: 'https://www.google.com',
|
|
|
+ // // failUrl: 'https://www.google.com',
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ // loadAirwallex({
|
|
|
+ // env: 'demo', // Can choose other production environments, 'staging | 'demo' | 'prod'
|
|
|
+ // });
|
|
|
+ // const redirectHpp = async () => {
|
|
|
+ // try {
|
|
|
+ // await loadAirwallex({
|
|
|
+ // env: 'demo',
|
|
|
+ // });
|
|
|
+ // if (mode === 'payment') {
|
|
|
+ // redirectHppForCheckout();
|
|
|
+ // } else if (mode === 'recurring') {
|
|
|
+ // redirectHppForRecurring();
|
|
|
+ // }
|
|
|
+ // } catch (error) {
|
|
|
+ // window.alert('There was an error with HPP redirection', error);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
|
|
|
- const cancelOrder = async () => {
|
|
|
- // 返回浏览器历史记录上一页
|
|
|
- window.history.back();
|
|
|
- }
|
|
|
+ // const cancelOrder = async () => {
|
|
|
+ // // 返回浏览器历史记录上一页
|
|
|
+ // window.history.back();
|
|
|
+ // }
|
|
|
|
|
|
- return {
|
|
|
- redirectHpp,
|
|
|
- redirectHppForCheckout,
|
|
|
- redirectHppForRecurring,
|
|
|
- productsName,
|
|
|
- productsNum,
|
|
|
- totalPrice,
|
|
|
- cancelOrder,
|
|
|
- };
|
|
|
+ // return {
|
|
|
+ // redirectHpp,
|
|
|
+ // redirectHppForCheckout,
|
|
|
+ // redirectHppForRecurring,
|
|
|
+ // productsName,
|
|
|
+ // productsNum,
|
|
|
+ // totalPrice,
|
|
|
+ // cancelOrder,
|
|
|
+ // };
|
|
|
}
|
|
|
};
|
|
|
|