From 8e1db58902e12d9ba3ea3a4d56aad01028632b6f Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 26 Jun 2026 15:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/tixianlist.html | 56 +++++++++++++++++++++++++++++++++++++-- public/css/tixianlist.css | 25 +++++++++++++++++ utils/ApiClient.js | 1 + 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/html/tixianlist.html b/html/tixianlist.html index b61327b..2f20105 100644 --- a/html/tixianlist.html +++ b/html/tixianlist.html @@ -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("" + escapeHtml(title) + ""); }); @@ -488,13 +496,20 @@ ); } else { const amountInfo = getDisplayAmount(item); + const recordId = getRecordId(item); + const canDelete = canDeleteWalletFlowRecord(item); $row.html( "" + escapeHtml(getRecordNo(item)) + "" + "" + escapeHtml(getFlowTypeText(item)) + "" + '' + escapeHtml(amountInfo.text) + "" + "" + escapeHtml(getRecordSourceText(item)) + "" + '' + escapeHtml(getStatusText(item)) + "" + - "" + escapeHtml(getCreateTime(item)) + "", + "" + escapeHtml(getCreateTime(item)) + "" + + "" + + (canDelete + ? '' + : '--') + + "", ); } $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(); diff --git a/public/css/tixianlist.css b/public/css/tixianlist.css index 5e347d7..ecd05c4 100644 --- a/public/css/tixianlist.css +++ b/public/css/tixianlist.css @@ -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; diff --git a/utils/ApiClient.js b/utils/ApiClient.js index 0598396..f165faf 100644 --- a/utils/ApiClient.js +++ b/utils/ApiClient.js @@ -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 || '')}`,