修改功能,现已测试注册登录忘记密码
This commit is contained in:
+128
-22
@@ -59,6 +59,7 @@
|
||||
</div>
|
||||
|
||||
<div class="tl-filter-bar">
|
||||
<div class="tl-flow-tabs" id="walletFlowTabs"></div>
|
||||
<div class="tl-filter-group">
|
||||
<span>状态</span>
|
||||
<div class="tl-segment" id="statusFilters"></div>
|
||||
@@ -137,6 +138,17 @@
|
||||
{ value: "sales", label: "销售余额" },
|
||||
{ value: "expert", label: "专家余额" },
|
||||
];
|
||||
const flowTypeOptions = [
|
||||
{ value: "withdraw", label: "\u63d0\u73b0\u7533\u8bf7", desc: "\u63d0\u73b0\u5230\u6536\u6b3e\u8d26\u6237" },
|
||||
{ value: "recharge", label: "\u8d26\u6237\u5145\u503c", desc: "\u8d26\u6237\u4f59\u989d\u5145\u503c" },
|
||||
{ value: "purchase", label: "\u6587\u7ae0\u8d2d\u4e70", desc: "\u8d2d\u4e70\u6587\u7ae0\u652f\u51fa" },
|
||||
{ value: "sales", label: "\u9080\u8bf7\u8fd4\u5229", desc: "\u5206\u9500\u8fd4\u5229\u6536\u5165" },
|
||||
{ value: "expert", label: "\u4e13\u5bb6\u4f63\u91d1", desc: "\u4e13\u5bb6\u6536\u76ca\u6536\u5165" },
|
||||
];
|
||||
const flowTypeMap = flowTypeOptions.reduce(function (map, item) {
|
||||
map[item.value] = item;
|
||||
return map;
|
||||
}, {});
|
||||
const statusTextMap = {
|
||||
0: "审核中",
|
||||
1: "成功",
|
||||
@@ -160,6 +172,8 @@
|
||||
const sourceTextMap = {
|
||||
sales: "销售余额",
|
||||
expert: "专家余额",
|
||||
account: "\u8d26\u6237\u4f59\u989d",
|
||||
balance: "\u8d26\u6237\u4f59\u989d",
|
||||
};
|
||||
const methodTextMap = {
|
||||
alipay: "支付宝",
|
||||
@@ -168,12 +182,15 @@
|
||||
bank: "银行卡",
|
||||
bank_card: "银行卡",
|
||||
};
|
||||
const incomeFlowTypes = new Set(["recharge", "sales", "expert"]);
|
||||
const outcomeFlowTypes = new Set(["withdraw", "purchase"]);
|
||||
|
||||
let currentPage = 1;
|
||||
let pageSize = 10;
|
||||
let totalRow = 0;
|
||||
let currentStatus = "";
|
||||
let currentSource = "";
|
||||
let currentFlowType = "withdraw";
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem("token");
|
||||
@@ -249,19 +266,40 @@
|
||||
}
|
||||
|
||||
function renderFilters() {
|
||||
renderFlowTabs();
|
||||
$(".tl-filter-group").toggle(currentFlowType === "withdraw");
|
||||
renderSegment("#statusFilters", statusOptions, currentStatus, function (value) {
|
||||
currentStatus = value;
|
||||
currentPage = 1;
|
||||
loadWithdrawList();
|
||||
loadWalletFlowList();
|
||||
});
|
||||
renderSegment("#sourceFilters", sourceOptions, currentSource, function (value) {
|
||||
currentSource = value;
|
||||
currentPage = 1;
|
||||
loadWithdrawList();
|
||||
loadWalletFlowList();
|
||||
});
|
||||
updateFilterSummary();
|
||||
}
|
||||
|
||||
function renderFlowTabs() {
|
||||
const $wrap = $("#walletFlowTabs").empty();
|
||||
$.each(flowTypeOptions, function (_, item) {
|
||||
const $button = $('<button class="tl-flow-tab" type="button"></button>');
|
||||
$button.attr("data-type", item.value);
|
||||
$button.html("<span>" + escapeHtml(item.label) + "</span><em>" + escapeHtml(item.desc) + "</em>");
|
||||
$button.toggleClass("active", item.value === currentFlowType);
|
||||
$button.on("click", function () {
|
||||
currentFlowType = item.value;
|
||||
currentPage = 1;
|
||||
currentStatus = "";
|
||||
currentSource = "";
|
||||
renderFilters();
|
||||
loadWalletFlowList();
|
||||
});
|
||||
$wrap.append($button);
|
||||
});
|
||||
}
|
||||
|
||||
function renderSegment(selector, options, selectedValue, onChange) {
|
||||
const $wrap = $(selector).empty();
|
||||
$.each(options, function (_, item) {
|
||||
@@ -277,6 +315,10 @@
|
||||
}
|
||||
|
||||
function updateFilterSummary() {
|
||||
if (currentFlowType !== "withdraw") {
|
||||
$("#filterSummary").text((flowTypeMap[currentFlowType] && flowTypeMap[currentFlowType].label) || "\u8d44\u91d1\u6d41\u6c34");
|
||||
return;
|
||||
}
|
||||
const statusLabel = statusOptions.find((item) => item.value === currentStatus)?.label || "全部";
|
||||
const sourceLabel = sourceOptions.find((item) => item.value === currentSource)?.label || "全部";
|
||||
$("#filterSummary").text(statusLabel + "状态 / " + sourceLabel + "来源");
|
||||
@@ -299,7 +341,7 @@
|
||||
}
|
||||
|
||||
function getStatus(item) {
|
||||
return fieldValue(item, ["status", "withdrawStatus", "auditStatus"]);
|
||||
return item.status ?? item.withdrawStatus ?? item.auditStatus ?? item.flowStatus ?? item.payStatus ?? "";
|
||||
}
|
||||
|
||||
function getStatusText(item) {
|
||||
@@ -314,7 +356,7 @@
|
||||
|
||||
function getSourceText(item) {
|
||||
const source = fieldValue(item, ["sourceWallet", "walletType"]);
|
||||
return fieldValue(item, ["sourceWalletText", "walletTypeText"]) || sourceTextMap[source] || source || "--";
|
||||
return fieldValue(item, ["sourceWalletText", "walletTypeText", "flowTypeText", "typeText"]) || sourceTextMap[source] || source || getFlowTypeText(item);
|
||||
}
|
||||
|
||||
function getMethodText(item) {
|
||||
@@ -334,22 +376,69 @@
|
||||
}
|
||||
|
||||
function getCreateTime(item) {
|
||||
const time = fieldValue(item, ["createTime", "createdTime", "applyTime", "submitTime", "updateTime"]);
|
||||
const time = fieldValue(item, ["createTime", "createdTime", "applyTime", "submitTime", "payTime", "updateTime"]);
|
||||
return DateUtil.formatDateTimeToYMDHM(time) || time || "--";
|
||||
}
|
||||
|
||||
function loadWithdrawList() {
|
||||
function getFlowTypeText(item) {
|
||||
const flowType = fieldValue(item, ["flowType", "type"]) || currentFlowType;
|
||||
return fieldValue(item, ["flowTypeText", "typeText"]) || (flowTypeMap[flowType] && flowTypeMap[flowType].label) || flowType || "\u8d44\u91d1\u6d41\u6c34";
|
||||
}
|
||||
|
||||
function getRecordSourceText(item) {
|
||||
const source = fieldValue(item, ["withdrawType", "receiveType", "walletType", "paymentType", "sourceWallet"]);
|
||||
return (
|
||||
fieldValue(item, ["withdrawTypeText", "receiveTypeText", "walletTypeText", "paymentTypeText", "sourceWalletText", "remark", "description"]) ||
|
||||
methodTextMap[source] ||
|
||||
sourceTextMap[source] ||
|
||||
source ||
|
||||
"--"
|
||||
);
|
||||
}
|
||||
|
||||
function getDisplayAmount(item) {
|
||||
const amount = getAmount(item);
|
||||
const flowType = fieldValue(item, ["flowType", "type"]) || currentFlowType;
|
||||
const isIncome = amount > 0 || (amount === Math.abs(amount) && incomeFlowTypes.has(flowType));
|
||||
const isOutcome = amount < 0 || outcomeFlowTypes.has(flowType);
|
||||
const sign = isIncome && !isOutcome ? "+" : isOutcome ? "-" : "";
|
||||
return {
|
||||
text: sign + money(Math.abs(amount)) + " \u5143",
|
||||
className: isIncome && !isOutcome ? "income" : isOutcome ? "outcome" : "neutral",
|
||||
};
|
||||
}
|
||||
|
||||
function renderTableHeader() {
|
||||
const $header = $("#withdrawTable thead tr").empty();
|
||||
const columns =
|
||||
currentFlowType === "withdraw"
|
||||
? ["\u7533\u8bf7\u5355\u53f7", "\u63d0\u73b0\u6765\u6e90", "\u63d0\u73b0\u65b9\u5f0f", "\u91d1\u989d", "\u6536\u6b3e\u8d26\u6237", "\u72b6\u6001", "\u7533\u8bf7\u65f6\u95f4"]
|
||||
: ["\u6d41\u6c34\u53f7", "\u7c7b\u578b", "\u91d1\u989d", "\u65b9\u5f0f/\u6765\u6e90", "\u72b6\u6001", "\u65f6\u95f4"];
|
||||
$.each(columns, function (_, title) {
|
||||
$header.append("<th>" + escapeHtml(title) + "</th>");
|
||||
});
|
||||
}
|
||||
|
||||
function isWithdrawRecordType() {
|
||||
return currentFlowType === "withdraw";
|
||||
}
|
||||
|
||||
function loadWalletFlowList() {
|
||||
const params = {
|
||||
pageNum: currentPage,
|
||||
pageSize: pageSize,
|
||||
};
|
||||
if (currentStatus) params.status = currentStatus;
|
||||
if (currentSource) params.sourceWallet = currentSource;
|
||||
if (isWithdrawRecordType()) {
|
||||
if (currentStatus) params.status = currentStatus;
|
||||
if (currentSource) params.sourceWallet = currentSource;
|
||||
} else {
|
||||
params.flowType = currentFlowType;
|
||||
}
|
||||
|
||||
$("#withdrawTable").addClass("loading");
|
||||
ApiClient.get(ApiClient.API.walletWithdrawList, params)
|
||||
ApiClient.get(isWithdrawRecordType() ? ApiClient.API.walletWithdrawList : ApiClient.API.walletFlowList, params)
|
||||
.then(function (res) {
|
||||
if (!isSuccess(res)) throw new Error(res.msg || "获取提现记录失败");
|
||||
if (!isSuccess(res)) throw new Error(res.msg || "获取记录失败");
|
||||
const data = pickData(res) || res || {};
|
||||
const records = getRecords(data, res);
|
||||
totalRow = getTotal(data, records, res);
|
||||
@@ -357,7 +446,7 @@
|
||||
renderPagination();
|
||||
})
|
||||
.catch(function (err) {
|
||||
layui.layer.msg(err.message || "获取提现记录失败", { icon: 2 });
|
||||
layui.layer.msg(err.message || "获取记录失败", { icon: 2 });
|
||||
totalRow = 0;
|
||||
renderTable([]);
|
||||
renderPagination();
|
||||
@@ -370,9 +459,12 @@
|
||||
function renderTable(records) {
|
||||
const $tbody = $("#withdrawTable tbody").empty();
|
||||
let pageAmount = 0;
|
||||
renderTableHeader();
|
||||
if (!records.length) {
|
||||
$("#withdrawTable").addClass("tl-table-hidden");
|
||||
$("#emptyState").addClass("show");
|
||||
$("#emptyState .tl-empty-title").text("\u6682\u65e0\u8bb0\u5f55");
|
||||
$("#emptyState .tl-empty-desc").text(((flowTypeMap[currentFlowType] && flowTypeMap[currentFlowType].label) || "\u5f53\u524d\u7c7b\u578b") + "\u6682\u65e0\u8d44\u91d1\u6d41\u6c34");
|
||||
$(".tl-summary").addClass("is-hidden");
|
||||
} else {
|
||||
$("#withdrawTable").removeClass("tl-table-hidden");
|
||||
@@ -384,15 +476,27 @@
|
||||
const amount = getAmount(item);
|
||||
pageAmount += Math.abs(amount);
|
||||
const $row = $("<tr></tr>");
|
||||
$row.html(
|
||||
"<td>" + escapeHtml(getRecordNo(item)) + "</td>" +
|
||||
"<td>" + escapeHtml(getSourceText(item)) + "</td>" +
|
||||
"<td>" + escapeHtml(getMethodText(item)) + "</td>" +
|
||||
'<td class="tl-amount">-' + escapeHtml(money(Math.abs(amount))) + " 元</td>" +
|
||||
"<td>" + escapeHtml(getReceiveAccountText(item)) + "</td>" +
|
||||
'<td><span class="tl-status ' + getStatusClass(item) + '">' + escapeHtml(getStatusText(item)) + "</span></td>" +
|
||||
"<td>" + escapeHtml(getCreateTime(item)) + "</td>",
|
||||
);
|
||||
if (isWithdrawRecordType()) {
|
||||
$row.html(
|
||||
"<td>" + escapeHtml(getRecordNo(item)) + "</td>" +
|
||||
"<td>" + escapeHtml(getSourceText(item)) + "</td>" +
|
||||
"<td>" + escapeHtml(getMethodText(item)) + "</td>" +
|
||||
'<td class="tl-amount outcome">-' + escapeHtml(money(Math.abs(amount))) + " \u5143</td>" +
|
||||
"<td>" + escapeHtml(getReceiveAccountText(item)) + "</td>" +
|
||||
'<td><span class="tl-status ' + getStatusClass(item) + '">' + escapeHtml(getStatusText(item)) + "</span></td>" +
|
||||
"<td>" + escapeHtml(getCreateTime(item)) + "</td>",
|
||||
);
|
||||
} else {
|
||||
const amountInfo = getDisplayAmount(item);
|
||||
$row.html(
|
||||
"<td>" + escapeHtml(getRecordNo(item)) + "</td>" +
|
||||
"<td>" + escapeHtml(getFlowTypeText(item)) + "</td>" +
|
||||
'<td class="tl-amount ' + amountInfo.className + '">' + escapeHtml(amountInfo.text) + "</td>" +
|
||||
"<td>" + escapeHtml(getRecordSourceText(item)) + "</td>" +
|
||||
'<td><span class="tl-status ' + getStatusClass(item) + '">' + escapeHtml(getStatusText(item)) + "</span></td>" +
|
||||
"<td>" + escapeHtml(getCreateTime(item)) + "</td>",
|
||||
);
|
||||
}
|
||||
$tbody.append($row);
|
||||
});
|
||||
|
||||
@@ -417,7 +521,7 @@
|
||||
jump: function (obj, first) {
|
||||
if (first) return;
|
||||
currentPage = obj.curr;
|
||||
loadWithdrawList();
|
||||
loadWalletFlowList();
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -427,6 +531,8 @@
|
||||
const query = new URLSearchParams(window.location.search);
|
||||
const status = query.get("status") || "";
|
||||
const sourceWallet = query.get("sourceWallet") || "";
|
||||
const flowType = query.get("flowType") || "";
|
||||
if (flowTypeMap[flowType]) currentFlowType = flowType;
|
||||
if (statusOptions.some((item) => item.value === status)) currentStatus = status;
|
||||
if (sourceOptions.some((item) => item.value === sourceWallet)) currentSource = sourceWallet;
|
||||
}
|
||||
@@ -442,7 +548,7 @@
|
||||
renderFilters();
|
||||
CommonUtil.loadPageConfig({ ads: false, links: false });
|
||||
CommonUtil.requireAuth(function () {
|
||||
loadWithdrawList();
|
||||
loadWalletFlowList();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user