feat: 支付宝手机端支付测试
This commit is contained in:
@@ -9,6 +9,15 @@ export function aliPayPcPay(params: {orderId: number}) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** AliPay wapPay with orderId */
|
||||||
|
export function aliPayWapPay(params: {orderId: number}) {
|
||||||
|
return rawRequest({
|
||||||
|
url: '/payment/aliPay/wapPay',
|
||||||
|
method: 'post',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** WxPay scanCode with orderId */
|
/** WxPay scanCode with orderId */
|
||||||
export function wxPayScanCode(params: {orderId: number}) {
|
export function wxPayScanCode(params: {orderId: number}) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { submitOrder } from '@/service/api/auth';
|
import { submitOrder } from '@/service/api/auth';
|
||||||
import { aliPayPcPay } from '@/service/api/payment';
|
import { aliPayPcPay, aliPayWapPay } from '@/service/api/payment';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import { useRouterPush } from '@/hooks/common/router';
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -13,6 +14,7 @@ defineOptions({
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { routerPushByKey } = useRouterPush();
|
const { routerPushByKey } = useRouterPush();
|
||||||
|
const appStore = useAppStore();
|
||||||
|
|
||||||
interface RechargeOption {
|
interface RechargeOption {
|
||||||
amount: number;
|
amount: number;
|
||||||
@@ -106,7 +108,13 @@ const handleAliPay = async () => {
|
|||||||
type: 1,
|
type: 1,
|
||||||
orderAmount: paymentAmount.value
|
orderAmount: paymentAmount.value
|
||||||
});
|
});
|
||||||
const res = await aliPayPcPay({orderId: orderRes.data});
|
// 区分手机端和pc端支付
|
||||||
|
let res;
|
||||||
|
if(appStore.isMobile) {
|
||||||
|
res = await aliPayWapPay({orderId: orderRes.data});
|
||||||
|
} else {
|
||||||
|
res = await aliPayPcPay({orderId: orderRes.data});
|
||||||
|
}
|
||||||
console.log(res);
|
console.log(res);
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
div.innerHTML = res; // html code
|
div.innerHTML = res; // html code
|
||||||
|
|||||||
Reference in New Issue
Block a user