增加转账时间
This commit is contained in:
parent
91d355b7f1
commit
cd9dfb4bfb
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||||
<title>Withdraw/Exchange</title>
|
<title>Withdraw/Exchange</title>
|
||||||
<link rel="stylesheet" href="./style.css?v=20260601-0110" />
|
<link rel="stylesheet" href="./style.css?v=20260604-0100" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wallet-page" aria-label="Withdraw and exchange" data-i18n-aria="page_label">
|
<div class="wallet-page" aria-label="Withdraw and exchange" data-i18n-aria="page_label">
|
||||||
@ -165,6 +165,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="home-indicator" aria-hidden="true"></div>
|
<div class="home-indicator" aria-hidden="true"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./script.js?v=20260601-0110" defer></script>
|
<script src="./script.js?v=20260604-0100" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -69,6 +69,8 @@
|
|||||||
income: "Income",
|
income: "Income",
|
||||||
expense: "Expense",
|
expense: "Expense",
|
||||||
balance: "Balance",
|
balance: "Balance",
|
||||||
|
receive_time: "Receive time",
|
||||||
|
transfer_time: "Transfer time",
|
||||||
period: "Period",
|
period: "Period",
|
||||||
days: "Days",
|
days: "Days",
|
||||||
target: "Target",
|
target: "Target",
|
||||||
@ -675,12 +677,40 @@
|
|||||||
document.body.classList.toggle("salary-history-open", open);
|
document.body.classList.toggle("salary-history-open", open);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatHistoryDateParts(date) {
|
||||||
|
const pad = (item) => String(item).padStart(2, "0");
|
||||||
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||||
|
}
|
||||||
|
|
||||||
function formatHistoryDate(value) {
|
function formatHistoryDate(value) {
|
||||||
if (!value) return "";
|
if (value === null || value === undefined || value === "") return "";
|
||||||
const text = String(value).replace("T", " ");
|
const raw = String(value).trim();
|
||||||
|
if (/^\d{10,13}$/.test(raw)) {
|
||||||
|
const number = Number(raw);
|
||||||
|
const date = new Date(raw.length === 10 ? number * 1000 : number);
|
||||||
|
if (!Number.isNaN(date.getTime())) return formatHistoryDateParts(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = raw.replace("T", " ");
|
||||||
return text.length > 16 ? text.slice(0, 16) : text;
|
return text.length > 16 ? text.slice(0, 16) : text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rawHistoryTime(item) {
|
||||||
|
const transferCandidates = [item?.transferTime, item?.transferredAt, item?.transferAt, item?.outTime];
|
||||||
|
const receiveCandidates = [item?.receiveTime, item?.receivedAt, item?.receiveAt, item?.incomeTime];
|
||||||
|
const commonCandidates = [item?.createTime, item?.createdAt, item?.time, item?.timestamp, item?.updateTime, item?.updatedAt];
|
||||||
|
const candidates = Number(item?.type) === 1
|
||||||
|
? transferCandidates.concat(commonCandidates)
|
||||||
|
: receiveCandidates.concat(commonCandidates);
|
||||||
|
return candidates.find((candidate) => candidate !== null && candidate !== undefined && candidate !== "") || "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function historyTimeLabel(item) {
|
||||||
|
return Number(item?.type) === 1
|
||||||
|
? message("transfer_time", "Transfer time")
|
||||||
|
: message("receive_time", "Receive time");
|
||||||
|
}
|
||||||
|
|
||||||
function formatBillPeriod(value) {
|
function formatBillPeriod(value) {
|
||||||
const text = String(value || "");
|
const text = String(value || "");
|
||||||
if (text.length < 6) return text;
|
if (text.length < 6) return text;
|
||||||
@ -903,7 +933,7 @@
|
|||||||
const meta = document.createElement("div");
|
const meta = document.createElement("div");
|
||||||
meta.className = "salary-history-item-meta";
|
meta.className = "salary-history-item-meta";
|
||||||
const metaItems = [];
|
const metaItems = [];
|
||||||
if (item.date) metaItems.push(item.date);
|
if (item.date) metaItems.push(`${historyTimeLabel(item)}: ${item.date}`);
|
||||||
if (item.period) metaItems.push(`${message("period", "Period")}: ${item.period}`);
|
if (item.period) metaItems.push(`${message("period", "Period")}: ${item.period}`);
|
||||||
if (item.target) metaItems.push(`${message("target", "Target")}: ${item.target}`);
|
if (item.target) metaItems.push(`${message("target", "Target")}: ${item.target}`);
|
||||||
if (item.days) metaItems.push(`${message("days", "Days")}: ${item.days}`);
|
if (item.days) metaItems.push(`${message("days", "Days")}: ${item.days}`);
|
||||||
@ -1067,7 +1097,7 @@
|
|||||||
type: item.type,
|
type: item.type,
|
||||||
status: item.salaryEvent || "",
|
status: item.salaryEvent || "",
|
||||||
period: item.billBelong ? formatBillPeriod(item.billBelong) : "",
|
period: item.billBelong ? formatBillPeriod(item.billBelong) : "",
|
||||||
date: formatHistoryDate(item.createdAt)
|
date: formatHistoryDate(rawHistoryTime(item))
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1089,7 +1119,7 @@
|
|||||||
balance: item.balance,
|
balance: item.balance,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
status: item.event || "",
|
status: item.event || "",
|
||||||
date: formatHistoryDate(item.createTime)
|
date: formatHistoryDate(rawHistoryTime(item))
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user