From 743df3665cf1d69b63d34bcfd60c533ca877ca19 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Mon, 2 Feb 2026 15:02:01 +0800 Subject: [PATCH] f --- .env | 2 +- env.example | 2 +- src/components/Payment.vue | 98 ++++++++++++++++++++++---------------- src/views/Report.vue | 27 +++++++++-- 4 files changed, 82 insertions(+), 47 deletions(-) diff --git a/.env b/.env index a800f82..7e2ad0f 100644 --- a/.env +++ b/.env @@ -9,7 +9,7 @@ VITE_INQUIRE_AES_KEY=ff83609b2b24fc73196aac3d3dfb874f VITE_WECHAT_APP_ID=wx442ee1ac1ee75917 VITE_ICP_RECORD=琼ICP备2024048057号-2 -VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000584号 +VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000443号 VITE_SHOW_PUBLIC_SECURITY_RECORD=true VITE_CHAT_AES_KEY=qw5w6SFE2D1jmxyd diff --git a/env.example b/env.example index 2ffd0e5..51afa66 100644 --- a/env.example +++ b/env.example @@ -5,7 +5,7 @@ VITE_COMPANY_NAME=海南海宇大数据有限公司 VITE_APP_NAME=全能查 VITE_ICP_RECORD=琼ICP备2024038584号-10 -VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000584号 +VITE_PUBLIC_SECURITY_RECORD=琼公网安备46010002000443号 VITE_SHOW_PUBLIC_SECURITY_RECORD=false VITE_SERVICE_URL=https://work.weixin.qq.com/kfid/kfc82d4424e4b19e5f3 diff --git a/src/components/Payment.vue b/src/components/Payment.vue index 0bb1f15..47e72dc 100644 --- a/src/components/Payment.vue +++ b/src/components/Payment.vue @@ -70,6 +70,7 @@ import { ref, computed, onMounted } from "vue"; import { useRouter } from "vue-router"; const { isWeChat } = useEnv(); +import { showConfirmDialog, showToast } from "vant"; const props = defineProps({ data: { @@ -113,50 +114,63 @@ const router = useRouter(); const discountPrice = ref(false); // 是否应用折扣 async function getPayment() { - const { data, error } = await useApiFetch("/pay/payment") - .post({ - id: props.id, - pay_method: selectedPaymentMethod.value, - pay_type: props.type, - }) - .json(); + showConfirmDialog({ + title: '重要安全声明', + message: + '为保障您的个人信息与资金安全,请您务必知悉以下事项:\n\n关于平台业务:本平台官方服务仅限于大数据报告查询,不涉及也从未开展“央行征信修复”、“贷款办理”或“征信洗白”等相关业务。请注意,本平台出具的报告仅供决策参考,不可作为任何官方征信凭证或贷款依据。\n\n关于诈骗警示:任何自称与本平台合作,或以“内部渠道”、“百分百包下款”、“修复征信”等为由,诱导您进行支付的行为,均属欺诈。请您切勿相信,谨慎对待任何支付要求。\n\n关于安全提示:请您时刻保持警惕,妥善保管个人敏感信息。如遇任何索款要求或可疑承诺,请务必首先通过我平台官方公布的联系方式进行核实,切勿轻信他人。', + }) + .then(async () => { + const { data, error } = await useApiFetch("/pay/payment") + .post({ + id: props.id, + pay_method: selectedPaymentMethod.value, + pay_type: props.type, + }) + .json(); - if (data.value && !error.value) { - // 测试支付模式:直接跳转到结果页面 - if (selectedPaymentMethod.value === "test" || selectedPaymentMethod.value === "test_empty") { - orderNo.value = data.value.data.order_no; - router.push({ - path: "/payment/result", - query: { orderNo: data.value.data.order_no }, - }); - } else if (selectedPaymentMethod.value === "alipay") { - orderNo.value = data.value.data.order_no; - // 存储订单ID以便支付宝返回时获取 - const prepayUrl = data.value.data.prepay_id; - const paymentForm = document.createElement("form"); - paymentForm.method = "POST"; - paymentForm.action = prepayUrl; - paymentForm.style.display = "none"; - document.body.appendChild(paymentForm); - paymentForm.submit(); - } else { - const payload = data.value.data.prepay_data; - WeixinJSBridge.invoke( - "getBrandWCPayRequest", - payload, - function (res) { - if (res.err_msg == "get_brand_wcpay_request:ok") { - // 支付成功,直接跳转到结果页面 - router.push({ - path: "/payment/result", - query: { orderNo: data.value.data.order_no }, - }); - } + if (data.value && !error.value) { + // 测试支付模式:直接跳转到结果页面 + if (selectedPaymentMethod.value === "test" || selectedPaymentMethod.value === "test_empty") { + orderNo.value = data.value.data.order_no; + router.push({ + path: "/payment/result", + query: { orderNo: data.value.data.order_no }, + }); + } else if (selectedPaymentMethod.value === "alipay") { + orderNo.value = data.value.data.order_no; + // 存储订单ID以便支付宝返回时获取 + const prepayUrl = data.value.data.prepay_id; + const paymentForm = document.createElement("form"); + paymentForm.method = "POST"; + paymentForm.action = prepayUrl; + paymentForm.style.display = "none"; + document.body.appendChild(paymentForm); + paymentForm.submit(); + } else { + const payload = data.value.data.prepay_data; + WeixinJSBridge.invoke( + "getBrandWCPayRequest", + payload, + function (res) { + if (res.err_msg == "get_brand_wcpay_request:ok") { + // 支付成功:短延迟再跳转,给后端回调与异步任务留出时间,避免结果页查报告报错 + showToast({ message: "支付成功,正在跳转...", type: "success" }); + setTimeout(() => { + router.push({ + path: "/payment/result", + query: { orderNo: data.value.data.order_no }, + }); + }, 1500); + } + } + ); } - ); - } - } - show.value = false; + } + show.value = false; + }) + .catch(() => { + return; + }); } diff --git a/src/views/Report.vue b/src/views/Report.vue index 3f85288..806ee22 100644 --- a/src/views/Report.vue +++ b/src/views/Report.vue @@ -135,9 +135,30 @@ const getReport = async () => { } else if (data.value.code === 200003) { isEmpty.value = true; isDone.value = true; - } else if (data.value.code === 200002) { - isPending.value = true; - isDone.value = true; + } else if (data.value.code === 200002 || data.value.code === 100005) { + // 200002:报告生成中;100005:兼容旧后端“报告未就绪”时的 DB_ERROR,按生成中轮询 + queryState.value = "pending"; + if (!pollingInterval.value) { + pollingInterval.value = setInterval(() => { + getReport(); + }, 2000); + } + } + } else if (data.value?.code === 200002) { + // 接口返回 200002 时可能走不到上面分支,单独处理 + queryState.value = "pending"; + if (!pollingInterval.value) { + pollingInterval.value = setInterval(() => { + getReport(); + }, 2000); + } + } else if (data.value?.code === 100005) { + // 兼容:报告未就绪时后端返回 100005,按“生成中”轮询 + queryState.value = "pending"; + if (!pollingInterval.value) { + pollingInterval.value = setInterval(() => { + getReport(); + }, 2000); } } };