修改功能
This commit is contained in:
+54
-2
@@ -336,6 +336,10 @@
|
||||
return fieldValue(item, ["withdrawNo", "orderNo", "flowNo", "serialNo", "tradeNo", "id"]) || "--";
|
||||
}
|
||||
|
||||
function getRecordId(item) {
|
||||
return fieldValue(item, ["id", "flowId", "recordId", "walletFlowId", "walletFlowRecordId"]);
|
||||
}
|
||||
|
||||
function getAmount(item) {
|
||||
return Number(fieldValue(item, ["amount", "withdrawAmount", "money", "applyAmount", "flowAmount"]) || 0);
|
||||
}
|
||||
@@ -408,12 +412,16 @@
|
||||
};
|
||||
}
|
||||
|
||||
function canDeleteWalletFlowRecord(item) {
|
||||
return currentFlowType === "purchase" && Boolean(getRecordId(item));
|
||||
}
|
||||
|
||||
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"];
|
||||
: ["\u6d41\u6c34\u53f7", "\u7c7b\u578b", "\u91d1\u989d", "\u65b9\u5f0f/\u6765\u6e90", "\u72b6\u6001", "\u65f6\u95f4", "\u64cd\u4f5c"];
|
||||
$.each(columns, function (_, title) {
|
||||
$header.append("<th>" + escapeHtml(title) + "</th>");
|
||||
});
|
||||
@@ -488,13 +496,20 @@
|
||||
);
|
||||
} else {
|
||||
const amountInfo = getDisplayAmount(item);
|
||||
const recordId = getRecordId(item);
|
||||
const canDelete = canDeleteWalletFlowRecord(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>",
|
||||
"<td>" + escapeHtml(getCreateTime(item)) + "</td>" +
|
||||
"<td>" +
|
||||
(canDelete
|
||||
? '<button class="tl-delete-btn" type="button" data-record-id="' + escapeHtml(recordId) + '">\u5220\u9664</button>'
|
||||
: '<span class="tl-action-empty">--</span>') +
|
||||
"</td>",
|
||||
);
|
||||
}
|
||||
$tbody.append($row);
|
||||
@@ -505,6 +520,40 @@
|
||||
updateFilterSummary();
|
||||
}
|
||||
|
||||
function deleteWalletFlowRecord(recordId) {
|
||||
if (!recordId) {
|
||||
layui.layer.msg("\u7f3a\u5c11\u6d41\u6c34\u8bb0\u5f55\u4fe1\u606f\uff0c\u65e0\u6cd5\u5220\u9664", { icon: 2 });
|
||||
return;
|
||||
}
|
||||
|
||||
layui.layer.confirm(
|
||||
"\u786e\u5b9a\u5220\u9664\u8fd9\u6761\u6587\u7ae0\u8d2d\u4e70\u8bb0\u5f55\u5417\uff1f",
|
||||
{
|
||||
title: "\u5220\u9664\u6587\u7ae0\u8d2d\u4e70\u8bb0\u5f55",
|
||||
btn: ["\u5220\u9664", "\u53d6\u6d88"],
|
||||
},
|
||||
function (index) {
|
||||
layui.layer.close(index);
|
||||
ApiClient.delete(ApiClient.API.walletFlowDelete(recordId))
|
||||
.then(function (res) {
|
||||
if (!isSuccess(res)) {
|
||||
throw new Error(res.msg || res.message || "\u5220\u9664\u6587\u7ae0\u8d2d\u4e70\u8bb0\u5f55\u5931\u8d25");
|
||||
}
|
||||
|
||||
layui.layer.msg("\u5220\u9664\u6210\u529f", { icon: 1 });
|
||||
currentPage =
|
||||
totalRow > 1 && currentPage > 1 && totalRow - 1 <= (currentPage - 1) * pageSize
|
||||
? currentPage - 1
|
||||
: currentPage;
|
||||
loadWalletFlowList();
|
||||
})
|
||||
.catch(function (error) {
|
||||
layui.layer.msg(error.message || "\u5220\u9664\u6587\u7ae0\u8d2d\u4e70\u8bb0\u5f55\u5931\u8d25", { icon: 2 });
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function renderPagination() {
|
||||
if (totalRow <= 0) {
|
||||
$("#withdrawPagination").empty().addClass("is-hidden");
|
||||
@@ -546,6 +595,9 @@
|
||||
renderNav();
|
||||
initFromUrl();
|
||||
renderFilters();
|
||||
$("#withdrawTable tbody").on("click", ".tl-delete-btn", function () {
|
||||
deleteWalletFlowRecord($(this).data("recordId"));
|
||||
});
|
||||
CommonUtil.loadPageConfig({ ads: false, links: false });
|
||||
CommonUtil.requireAuth(function () {
|
||||
loadWalletFlowList();
|
||||
|
||||
@@ -279,6 +279,31 @@
|
||||
color: #5a6987;
|
||||
}
|
||||
|
||||
.tl-delete-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid #e04828;
|
||||
border-radius: var(--radius-sm);
|
||||
background: #fff;
|
||||
color: #e04828;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.tl-delete-btn:hover {
|
||||
background: #e04828;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tl-action-empty {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.tl-empty {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -68,6 +68,7 @@ const ApiClient = {
|
||||
}).toString()}`,
|
||||
walletOverview: '/api/web/wallet/overview',
|
||||
walletFlowList: '/api/web/wallet/flow/list',
|
||||
walletFlowDelete: (id) => `/api/web/wallet/flow/${encodeURIComponent(id)}`,
|
||||
walletRechargeConfigList: '/api/web/wallet/recharge/config/list',
|
||||
walletRechargeOrder: '/api/web/wallet/recharge/order',
|
||||
walletRechargeOrderStatus: (outTradeNo) => `/api/web/wallet/recharge/order/status/${encodeURIComponent(outTradeNo || '')}`,
|
||||
|
||||
Reference in New Issue
Block a user