Compare commits

..

No commits in common. "309760863ab7aeaf096a0affd154df39e5c4dccd" and "17a32a89de08e4389d23a7737e87dfdbf359e796" have entirely different histories.

3 changed files with 3 additions and 45 deletions

View File

@ -9,54 +9,11 @@
import QRCode from 'qrcode'; import QRCode from 'qrcode';
import { ref } from 'vue'; import { ref } from 'vue';
import {authStore} from "~/stores/auth/index.js"; import {authStore} from "~/stores/auth/index.js";
import {orderQuery} from "~/api/goods/index.js";
const {payment}= authStore() const {payment}= authStore()
definePageMeta({ definePageMeta({
i18n: 'payment.title' i18n: 'payment.title'
}) })
const router=useRouter()
const resData=ref({})
let timer = null
const queryOrder = async () => {
try {
const res = await orderQuery({
orderNo: payment.value.payUid
})
if (res.status === 0) {
resData.value = res.data
//
if (resData.value.status === 1) {
clearInterval(timer)
router.push({
path: '/payment/result',
query:{
orderNo:payment.value.payUid
}
})
}
}
} catch (error) {
clearInterval(timer)
}
}
//
await queryOrder()
const qrCodeUrl=ref('') const qrCodeUrl=ref('')
//
timer = setInterval(async () => {
await queryOrder()
}, 1000)
//
onUnmounted(() => {
if (timer) {
clearInterval(timer)
closeToast()
}
})
async function generateQRCodeURL(text) { async function generateQRCodeURL(text) {
try { try {
const url = await QRCode.toDataURL(text, { const url = await QRCode.toDataURL(text, {

View File

@ -54,7 +54,8 @@
"sass-loader": "^16.0.4", "sass-loader": "^16.0.4",
"sharp": "^0.33.5", "sharp": "^0.33.5",
"typescript": "~5.7.2", "typescript": "~5.7.2",
"vant": "^4.9.15" "vant": "^4.9.15",
"vite-plugin-imagemin": "^0.6.1"
}, },
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {

View File

@ -24,7 +24,7 @@ export default defineConfig({
], ],
shortcuts: [ shortcuts: [
// shortcuts to multiple utilities // shortcuts to multiple utilities
['btn', 'px-6 py-3 rounded-3 inline-block bg-primary text-white cursor-pointer disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'], ['btn', 'px-6 py-3 rounded-3 inline-block bg-primary text-white cursor-pointer hover:bg-primary-hover disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
], ],
presets: [ presets: [