add PointLedgerDetail.vue

This commit is contained in:
Timi
2026-08-16 00:13:34 +08:00
parent 466c2e7ab7
commit 371fee4c4f
6 changed files with 452 additions and 17 deletions
+31 -16
View File
@@ -83,9 +83,9 @@
v-for="item in pageResult.list"
:key="item.id"
class="item"
:arrow="!!item.eventRecordId"
:hover="!!item.eventRecordId"
@click="toRecord(item)"
:arrow="!!item.id"
:hover="!!item.id"
@click="toDetail(item)"
>
<template #leftIcon>
<t-image
@@ -410,16 +410,6 @@ function buildListOptions(): { allStores?: boolean; storeId?: string } | undefin
// ---------- 展示与导航 ----------
// function getLedgerTitle(item: PointLedger): string {
// if (item.changeType === "EARN") {
// return "登记事件获得积分";
// }
// if (item.changeType === "REVOKE") {
// return "删除登记记录撤销积分";
// }
// return "人工调整积分";
// }
function getLedgerDescription(item: PointLedger): string {
const parts = [`余额 ${item.balanceBefore ?? 0} → ${item.balanceAfter ?? 0}`];
if (item.remark) {
@@ -441,10 +431,35 @@ function getLedgerTheme(item: PointLedger): string {
return item.pointDelta && 0 < item.pointDelta ? "increase" : "decrease";
}
async function toRecord(item: PointLedger): Promise<void> {
if (item.eventRecordId) {
await router.push(`/management/registration-event-records/${item.eventRecordId}`);
async function toDetail(item: PointLedger): Promise<void> {
if (!item.id) {
return;
}
const snapshot: PointLedger = {
id: item.id,
accountId: item.accountId,
storeId: item.storeId,
customerId: item.customerId,
changeType: item.changeType,
direction: item.direction,
pointDelta: item.pointDelta,
balanceBefore: item.balanceBefore,
balanceAfter: item.balanceAfter,
ruleId: item.ruleId,
eventId: item.eventId,
eventRecordId: item.eventRecordId,
sourcePayload: item.sourcePayload,
idempotencyKey: item.idempotencyKey,
remark: item.remark,
operatorUserId: item.operatorUserId,
occurredAt: item.occurredAt
};
await router.push({
name: "PointLedgerDetail",
params: { id: item.id },
query: { snapshot: JSON.stringify(snapshot) }
});
}
async function toAdjust(): Promise<void> {