Files
tydata-webview-v2/src/views/Inquire.vue

142 lines
4.2 KiB
Vue
Raw Normal View History

2025-09-27 17:41:14 +08:00
<script setup>
2025-10-28 12:12:48 +08:00
import { ref, onMounted } from "vue";
2025-09-27 17:41:14 +08:00
import { useRoute } from "vue-router";
2025-10-28 12:12:48 +08:00
import InquireForm from "@/components/InquireForm.vue";
2025-09-27 17:41:14 +08:00
const route = useRoute();
const feature = ref(route.params.feature);
2025-10-28 12:12:48 +08:00
// 获取产品信息
2025-09-27 17:41:14 +08:00
const featureData = ref({});
2025-10-28 12:12:48 +08:00
onMounted(async () => {
2025-09-27 17:41:14 +08:00
isFinishPayment();
2025-10-28 12:12:48 +08:00
await getProduct();
2026-02-13 18:32:41 +08:00
// 检查是否为婚姻查询页面,如果是则显示升级通知
2025-09-27 17:41:14 +08:00
});
function isFinishPayment() {
const query = new URLSearchParams(window.location.search);
let orderNo = query.get("out_trade_no");
if (orderNo) {
router.push({ path: "/report", query: { orderNo } });
}
}
2025-10-28 12:12:48 +08:00
2026-02-13 18:32:41 +08:00
// 婚姻查询升级通知弹窗
function showMarriageUpgradeNotice() {
// 创建自定义弹窗
const modal = document.createElement('div');
modal.style.position = 'fixed';
modal.style.top = '0';
modal.style.left = '0';
modal.style.width = '100%';
modal.style.height = '100%';
modal.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
modal.style.display = 'flex';
modal.style.justifyContent = 'center';
modal.style.alignItems = 'center';
modal.style.zIndex = '9999';
modal.innerHTML = `
<div style="
background: white;
border-radius: 12px;
padding: 24px;
margin: 20px;
max-width: 400px;
width: 90%;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
position: relative;
overflow-y: auto;
max-height: 90vh;
">
<h3 style="
color: #333;
text-align: center;
margin-top: 0;
margin-bottom: 16px;
font-size: 18px;
">亲爱的用户您好</h3>
<p style="
color: #666;
line-height: 1.6;
margin: 8px 0;
text-align: center;
font-size: 14px;
">婚恋报告正在优化升级中需要查询请前往天远查</p>
<div style="display: flex; gap: 12px; margin-bottom: 16px;">
<button id="jumpNowBtn" style="
flex: 1;
background: linear-gradient(135deg, #ff6b6b, #ee5a24);
color: white;
border: none;
padding: 12px 0;
border-radius: 25px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
"></button>
<button id="remindLaterBtn" style="
flex: 1;
background: #f8f9fa;
color: #666;
border: 1px solid #ddd;
padding: 12px 0;
border-radius: 25px;
cursor: pointer;
font-size: 14px;
"></button>
</div>
</div>
`;
document.body.appendChild(modal);
// 绑定按钮事件
const jumpNowBtn = modal.querySelector('#jumpNowBtn');
const remindLaterBtn = modal.querySelector('#remindLaterBtn');
jumpNowBtn.addEventListener('click', () => {
// 跳转到新版首页
window.open('https://www.tianyuancha.cn/', '_blank');
document.body.removeChild(modal);
});
remindLaterBtn.addEventListener('click', () => {
// 跳转到指定网站
window.location.href = 'https://www.tianyuandb.com/';
});
}
2025-09-27 17:41:14 +08:00
async function getProduct() {
const { data, error } = await useApiFetch(`/product/en/${feature.value}`)
.get()
.json();
if (data.value) {
featureData.value = data.value.data;
// 确保 FLXG0V4B 排在首位
if (
featureData.value.features &&
featureData.value.features.length > 0
) {
featureData.value.features.sort((a, b) => {
if (a.api_id === "FLXG0V4B") return -1;
if (b.api_id === "FLXG0V4B") return 1;
return 0;
});
}
}
}
</script>
<template>
2025-10-28 12:12:48 +08:00
<InquireForm :type="'normal'" :feature="feature" :feature-data="featureData" />
</template>