转账
This commit is contained in:
parent
7705a62a3a
commit
a7ac5fcd61
@ -165,6 +165,6 @@
|
||||
</div>
|
||||
<div class="home-indicator" aria-hidden="true"></div>
|
||||
</div>
|
||||
<script src="./script.js?v=20260529-1300" defer></script>
|
||||
<script src="./script.js?v=20260601-0100" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -280,7 +280,6 @@
|
||||
let selectedPaymentInfo = null;
|
||||
let selectedPayee = null;
|
||||
let currentProfile = null;
|
||||
let currentIdentityInfo = null;
|
||||
let isSubmitting = false;
|
||||
let isSavingAddress = false;
|
||||
let isSearchingPayee = false;
|
||||
@ -490,12 +489,6 @@
|
||||
return Number.isFinite(number) ? number : 0;
|
||||
}
|
||||
|
||||
function isTruthyIdentityValue(value) {
|
||||
if (value === true || value === 1) return true;
|
||||
const text = String(value || "").trim().toLowerCase();
|
||||
return text === "true" || text === "1" || text === "yes";
|
||||
}
|
||||
|
||||
function currentUserId() {
|
||||
return currentProfile?.id ||
|
||||
currentProfile?.userId ||
|
||||
@ -855,67 +848,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchIdentityInfo() {
|
||||
if (currentIdentityInfo) return currentIdentityInfo;
|
||||
try {
|
||||
const data = await requestJSON("/app/h5/identity");
|
||||
currentIdentityInfo = responseBody(data) || {};
|
||||
} catch (error) {
|
||||
console.warn("Failed to load identity info:", error);
|
||||
currentIdentityInfo = {};
|
||||
}
|
||||
return currentIdentityInfo;
|
||||
}
|
||||
|
||||
function normalizeStatusLabel(status) {
|
||||
const value = String(status || "").trim();
|
||||
if (value === "SETTLED" || value === "PAY_OUT" || value === "Completed") return "Completed";
|
||||
if (value === "UNPAID" || value === "In Progress") return "In progress";
|
||||
if (value === "HANG_UP" || value === "Out of account" || value === "Out Of Account") return "Out of account";
|
||||
if (value === "Pending") return "Pending";
|
||||
return value;
|
||||
}
|
||||
|
||||
function memberWorkSalary(target, identity) {
|
||||
const settlement = target?.settlementResult || {};
|
||||
const memberSalary = moneyNumber(settlement.memberSalary);
|
||||
const ownSalary = moneyNumber(settlement.ownSalary);
|
||||
const totalSalary = moneyNumber(settlement.totalSalary);
|
||||
if (isTruthyIdentityValue(identity?.agent)) return memberSalary + ownSalary;
|
||||
if (isTruthyIdentityValue(identity?.anchor)) return memberSalary;
|
||||
return totalSalary || memberSalary || ownSalary;
|
||||
}
|
||||
|
||||
async function fetchMemberWorkHistory() {
|
||||
if (!currentProfile) await fetchUserProfile();
|
||||
const userId = currentUserId();
|
||||
if (!userId) throw new Error(message("missing_token", "Missing token"));
|
||||
|
||||
const [identity, data] = await Promise.all([
|
||||
fetchIdentityInfo(),
|
||||
requestJSON(`/team/member-work?userId=${encodeURIComponent(userId)}`)
|
||||
]);
|
||||
const body = responseBody(data) || {};
|
||||
const targets = Array.isArray(body.targets) ? body.targets : [];
|
||||
return {
|
||||
total: body.historySalary ?? availableBalance,
|
||||
items: targets.map((item) => {
|
||||
const target = item.target || {};
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.billTitle || message("work_report", "Work report"),
|
||||
amount: memberWorkSalary(target, identity),
|
||||
type: 0,
|
||||
status: normalizeStatusLabel(item.status),
|
||||
target: target.acceptGiftValue,
|
||||
days: target.effectiveDay,
|
||||
period: item.billBelong ? formatBillPeriod(item.billBelong) : "",
|
||||
date: item.billTitle || ""
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchSalaryAccountHistory() {
|
||||
if (!currentProfile) await fetchUserProfile();
|
||||
const query = new URLSearchParams({
|
||||
@ -963,12 +895,7 @@
|
||||
|
||||
async function fetchSalaryHistory() {
|
||||
if (isSalaryAccountMode()) return fetchSalaryAccountHistory();
|
||||
try {
|
||||
return await fetchMemberWorkHistory();
|
||||
} catch (error) {
|
||||
console.warn("Failed to load member work history, falling back to bank water:", error);
|
||||
return fetchBankWaterHistory();
|
||||
}
|
||||
return fetchBankWaterHistory();
|
||||
}
|
||||
|
||||
async function openSalaryHistory() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user