This commit is contained in:
王一嘉
2025-07-15 11:11:24 +08:00
parent 2ea567a76d
commit c953ec5354
20 changed files with 194 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import {reactive, ref} from "vue";
import {reactive, ref, watch} from "vue";
import {Message} from "@arco-design/web-vue";
import Api from "../../api/index.ts";
import {QrcodeCanvas} from "qrcode.vue";
@@ -10,6 +10,8 @@ const {money} = defineProps({
default: null
}
});
const successShow = ref(false);
let timer = null;
const visible = ref(false);
const qrInfo = reactive({});
const open = () => {
@@ -20,13 +22,41 @@ const open = () => {
visible.value = true;
initQR();
}
let orderData = null;
const checkOrder = (flag) => {
Api.merchant.checkOrder({
sn: qrInfo.out_trade_no,
}).then(({code}) => {
if (code === 1) {
Message.success('支付成功');
successShow.value = true;
clearInterval(timer);
}
}).catch(() => {
if (flag) {
Message.warning('未检测到支付');
}
})
}
const initQR = async () => {
clearInterval(timer);
const {data: {data}} = await Api.merchant.rechargeOrderQR({
money: money,
});
Object.assign(qrInfo, data);
timer = setInterval(() => {
checkOrder();
}, 1000);
}
watch(
() => visible.value,
(val) => {
if (!val) clearInterval(timer);
},
{deep: true}
)
</script>
<template>
@@ -41,7 +71,7 @@ const initQR = async () => {
title-align="start"
title="支付宝支付"
v-model:visible="visible">
<template v-if="true">
<template v-if="!successShow">
<a-alert>平台提示支付后未出现成功提示点击我已支付刷新充值状态</a-alert>
<div class="py-[24px] px-[20px]">
@@ -57,7 +87,7 @@ const initQR = async () => {
<icon-sync class="mr-[5px]"/>
点击刷新
</a-link>
<a-button class="mx-auto mt-[20px]" type="primary">我已支付</a-button>
<a-button class="mx-auto mt-[20px]" type="primary" @click="checkOrder(true)">我已支付</a-button>
</div>
<div class="mt-[20px] info mb-[40px]">
@@ -72,11 +102,11 @@ const initQR = async () => {
<div class="py-[24px] px-[20px]">
<a-result status="success" title="充值成功">
<template #subtitle>
支付宝付款200.00
支付宝付款{{ money }}
</template>
<template #extra>
<a-space>
<a-button type='primary'>确定</a-button>
<a-button type='primary' @click="visible=false">确定</a-button>
</a-space>
</template>
</a-result>

View File

@@ -1,6 +1,6 @@
<script setup>
import {defineModel, defineProps, ref} from 'vue';
import {Message, Notification} from "@arco-design/web-vue";
import {Message} from "@arco-design/web-vue";
import Api from "../../api/index.js";
const verificationCode = defineModel('verificationCode', {type: String});
@@ -40,7 +40,7 @@ const verifyPhone = async () => {
}
return true;
} else {
Notification.error({
Message.warning({
title: '手机号错误',
content: '请检查后重新输入'
});