diff --git a/h5/KYC/kyc.js b/h5/KYC/kyc.js index bbbb3ae..f5c79f5 100644 --- a/h5/KYC/kyc.js +++ b/h5/KYC/kyc.js @@ -1,4 +1,4 @@ -import { applyLang, bindHeader, connectToApp, get, post, safeJsonArray, t, toast } from "../bd-static/shared.js"; +import { applyLang, bindHeader, connectToApp, createMask, get, navigateTo, post, safeJsonArray, t, toast } from "../bd-static/shared.js"; let existing = false; let data = { id: "", contactNumber: "", category: "CARD", otherDescription: "", passportFrontUrl: "", passportBackUrl: "meaningless" }; @@ -11,7 +11,13 @@ document.getElementById("contactNumber").placeholder = t("enter_contact_number") document.getElementById("otherDescription").placeholder = t("enter_other_description"); document.getElementById("contactNumber").addEventListener("input", sync); document.getElementById("otherDescription").addEventListener("input", sync); -document.getElementById("submitButton").addEventListener("click", submit); +document.getElementById("submitButton").addEventListener("click", () => { + if (existing) { + confirmSubmit(); + } else { + submit(); + } +}); connectToApp().then(load); async function load() { @@ -102,8 +108,45 @@ async function submit() { try { await post(existing ? "/wallet/withdraw-info/update" : "/wallet/withdraw-info/add", data); toast(t("application_submitted")); - window.setTimeout(() => window.history.back(), 300); + window.setTimeout(returnBack, 300); } catch (error) { toast(error.response?.errorMsg || error.message); } } + +function confirmSubmit() { + const sheet = document.createElement("section"); + sheet.className = "sheet"; + sheet.style.bottom = "auto"; + sheet.style.left = "5%"; + sheet.style.right = "5%"; + sheet.style.top = "30%"; + sheet.style.borderRadius = "12px"; + sheet.innerHTML = ` +
${t("tips")}
+
${t("confirm_modify_kyc")}
+
+ + +
+ `; + const mask = createMask(sheet); + sheet.querySelector("[data-cancel]").addEventListener("click", () => mask.remove()); + sheet.querySelector("[data-confirm]").addEventListener("click", () => { + mask.remove(); + submit(); + }); +} + +function returnBack() { + const query = new URLSearchParams(window.location.search); + const from = query.get("from"); + if (from) { + const activeAction = query.get("activeAction"); + const target = new URL(from, window.location.origin); + if (activeAction) target.searchParams.set("activeAction", activeAction); + navigateTo(`${target.pathname}${target.search}`); + return; + } + window.history.back(); +} diff --git a/h5/agency-list/team-list.js b/h5/agency-list/team-list.js index e252f4f..1602655 100644 --- a/h5/agency-list/team-list.js +++ b/h5/agency-list/team-list.js @@ -93,7 +93,7 @@ function historyItem(item, settings) { `
${t("num_teams") || t(settings.countLabel)} ${item.agencyNumber || item.bdNumber || 0}
` ]; card.innerHTML = `
${statusText(item.statusText)}
${details.join("")}`; - if (item.billBelong) { + if (item.statusText === "Completed") { const more = document.createElement("button"); more.className = "more-btn"; more.type = "button"; diff --git a/h5/available-income/available-income.js b/h5/available-income/available-income.js index a0aaab5..f19a559 100644 --- a/h5/available-income/available-income.js +++ b/h5/available-income/available-income.js @@ -56,7 +56,7 @@ function readIdentity() { function readPayee() { for (const storage of [sessionStorage, localStorage]) { try { - const value = storage.getItem("payee"); + const value = storage.getItem("transfer.payee") || storage.getItem("payee"); if (value) return JSON.parse(value); } catch {} } @@ -180,7 +180,9 @@ function renderTransfer() { renderTransfer(); })); document.getElementById("payeeButton").addEventListener("click", () => navigateTo("/search-payee?from=/available-income&activeAction=Transfer")); - document.getElementById("transferButton").addEventListener("click", submitTransfer); + const transferButton = document.getElementById("transferButton"); + transferButton.disabled = !(state.transferId && state.payee?.id); + transferButton.addEventListener("click", submitTransfer); } function payeeHtml(payee) { @@ -189,7 +191,7 @@ function payeeHtml(payee) { ${payee.name || "-"} - ${t("user_id_prefix")}${payee.account || "-"} + ${t("user_id_prefix")}${payee.goodID || payee.account || "-"} `; @@ -201,7 +203,7 @@ function renderExchange() {
${exchanges.map((item) => ``).join("")}
-
+
`; panel.querySelectorAll("[data-exchange]").forEach((button) => button.addEventListener("click", () => { const id = Number(button.dataset.exchange); @@ -222,11 +224,13 @@ function renderCashOut() { ${state.kyc ? kycHtml(state.kyc) : ``}
- +
`; const completeKyc = document.getElementById("completeKyc"); if (completeKyc) completeKyc.addEventListener("click", () => navigateTo("/bank-cards?from=/available-income&activeAction=Cash out")); + const editKyc = document.getElementById("editKyc"); + if (editKyc) editKyc.addEventListener("click", () => navigateTo("/bank-cards?from=/available-income&activeAction=Cash out")); document.getElementById("cashButton").addEventListener("click", () => { if (state.kyc && state.kyc.status === "PASS") openCashSheet(); else if (!state.kyc) openImproveDialog(); @@ -243,7 +247,7 @@ function statusLabel(status) { function kycHtml(item) { return `
-
${t("passport_id_card_title")}:
+
${t("passport_id_card_title")}:
${(item.previewUrls || []).map((src) => ``).join("")}
${t("contact_number")}:
${item.contactNumber || ""}
${t("other_description")}:
${item.otherDescription || ""}
diff --git a/h5/bank-cards/bank-cards.js b/h5/bank-cards/bank-cards.js index 404fd12..484a3eb 100644 --- a/h5/bank-cards/bank-cards.js +++ b/h5/bank-cards/bank-cards.js @@ -17,7 +17,10 @@ kycMore.addEventListener("click", () => navigateTo("/KYC")); async function init() { try { await connectToApp(); - await Promise.all([loadCards(), loadKyc()]); + const [cardsResult, kycResult] = await Promise.allSettled([loadCards(), loadKyc()]); + [cardsResult, kycResult].forEach((result) => { + if (result.status === "rejected") toast(result.reason?.response?.errorMsg || result.reason?.message); + }); } catch (error) { toast(error.response?.errorMsg || error.message); } finally { diff --git a/h5/bd-item-distribution/item-distribution.js b/h5/bd-item-distribution/item-distribution.js index aac6cfc..6574175 100644 --- a/h5/bd-item-distribution/item-distribution.js +++ b/h5/bd-item-distribution/item-distribution.js @@ -117,7 +117,11 @@ async function sendGift(account, mask) { mask.remove(); toast(t("gift_delivery_successful")); state.selected = null; + } else { + state.locked = true; } + } else { + state.locked = true; } } catch (error) { toast(error.response?.errorMsg || error.message); diff --git a/h5/bd-static/shared.js b/h5/bd-static/shared.js index fd3eadc..5ca31d4 100644 --- a/h5/bd-static/shared.js +++ b/h5/bd-static/shared.js @@ -272,6 +272,17 @@ export function navigateTo(target) { } export function closePage() { + const params = new URLSearchParams(window.location.search); + const from = params.get("from"); + if (from) { + const target = new URL(from, window.location.origin); + const activeAction = params.get("activeAction"); + if (activeAction) target.searchParams.set("activeAction", activeAction); + const currentLang = params.get("lang"); + if (currentLang && !target.searchParams.has("lang")) target.searchParams.set("lang", currentLang); + window.location.href = `${target.pathname}${target.search}${target.hash}`; + return; + } if (window.history.length > 1) { window.history.back(); return; diff --git a/h5/invite-agency/invite.js b/h5/invite-agency/invite.js index e86544c..de34080 100644 --- a/h5/invite-agency/invite.js +++ b/h5/invite-agency/invite.js @@ -45,12 +45,6 @@ clearButton.addEventListener("click", () => { inviteButton.addEventListener("click", inviteSelected); -let searchTimer = 0; -input.addEventListener("input", () => { - window.clearTimeout(searchTimer); - if (state.query.trim()) searchTimer = window.setTimeout(search, 500); -}); - async function init() { try { await connectToApp(); diff --git a/h5/invite-bd/index.html b/h5/invite-bd/index.html index c402ba8..89427f3 100644 --- a/h5/invite-bd/index.html +++ b/h5/invite-bd/index.html @@ -11,7 +11,11 @@
- +
+ + + +
diff --git a/h5/invite-bd/invite.js b/h5/invite-bd/invite.js index d0ca13d..3e0b50c 100644 --- a/h5/invite-bd/invite.js +++ b/h5/invite-bd/invite.js @@ -14,15 +14,24 @@ let selected = null; bindHeader(config.title); applyLang(); const input = document.getElementById("searchInput"); +const clearButton = document.getElementById("clearButton"); input.placeholder = t("enter_user_id"); input.addEventListener("input", () => { selected = null; + clearButton.hidden = !input.value; render(); }); input.addEventListener("keyup", (event) => { if (event.key === "Enter") search(); }); document.getElementById("inviteButton").addEventListener("click", invite); +clearButton.addEventListener("click", () => { + input.value = ""; + searchResult = []; + selected = null; + clearButton.hidden = true; + render(); +}); connectToApp().then(loadInvited); async function loadInvited() { diff --git a/h5/policy/index.html b/h5/policy/index.html index d0922ad..164e28e 100644 --- a/h5/policy/index.html +++ b/h5/policy/index.html @@ -7,13 +7,7 @@ -
-
-
-
-
-
-
+
diff --git a/h5/policy/policy.js b/h5/policy/policy.js index ea84e56..fd4316b 100644 --- a/h5/policy/policy.js +++ b/h5/policy/policy.js @@ -1,7 +1,6 @@ -import { applyLang, bindHeader, connectToApp, t } from "../bd-static/shared.js"; +import { applyLang, bindHeader, connectToApp } from "../bd-static/shared.js"; const from = new URLSearchParams(window.location.search).get("from") || "BDLead"; bindHeader(from === "BD" ? "bd_policy" : "bd_leader_policy"); applyLang(); -document.getElementById("policyHint").textContent = from === "BD" ? t("bd_policy") : t("bd_leader_policy"); connectToApp();