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 */
|
||||
export function wxPayScanCode(params: {orderId: number}) {
|
||||
return request({
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
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 { useRouterPush } from '@/hooks/common/router';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
defineOptions({
|
||||
@@ -13,6 +14,7 @@ defineOptions({
|
||||
|
||||
const { t } = useI18n();
|
||||
const { routerPushByKey } = useRouterPush();
|
||||
const appStore = useAppStore();
|
||||
|
||||
interface RechargeOption {
|
||||
amount: number;
|
||||
@@ -106,7 +108,13 @@ const handleAliPay = async () => {
|
||||
type: 1,
|
||||
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);
|
||||
const div = document.createElement("div");
|
||||
div.innerHTML = res; // html code
|
||||
|
||||
Reference in New Issue
Block a user