support consume point
This commit is contained in:
@@ -102,18 +102,20 @@
|
||||
class="type-icon"
|
||||
:theme="item.pointDelta && 0 < item.pointDelta ? 'success' : 'danger'"
|
||||
:content="getLedgerShortType(item)"
|
||||
variant="outline"
|
||||
/>
|
||||
<div class="name" v-text="item.customer?.name" />
|
||||
</div>
|
||||
</template>
|
||||
<template #description>
|
||||
<div class="description">
|
||||
<div v-text="`交易时间:${Time.toPassedDateTime(item.occurredAt)}`" />
|
||||
<div class="remark" v-text="getLedgerDescription(item)" />
|
||||
<div v-text="`时间:${Time.toPassedDateTime(item.occurredAt)}`" />
|
||||
<div v-text="`余额:${item.balanceBefore ?? 0} → ${item.balanceAfter ?? 0}`" />
|
||||
<div v-text="item.remark" />
|
||||
</div>
|
||||
</template>
|
||||
<template #note>
|
||||
<div class="delta" :class="getLedgerTheme(item)" v-text="getLedgerDelta(item)" />
|
||||
<div class="delta keep-text" :class="getLedgerTheme(item)" v-text="getLedgerDelta(item)" />
|
||||
</template>
|
||||
</t-cell>
|
||||
</t-cell-group>
|
||||
@@ -410,21 +412,16 @@ function buildListOptions(): { allStores?: boolean; storeId?: string } | undefin
|
||||
|
||||
// ---------- 展示与导航 ----------
|
||||
|
||||
function getLedgerDescription(item: PointLedger): string {
|
||||
const parts = [`余额 ${item.balanceBefore ?? 0} → ${item.balanceAfter ?? 0}`];
|
||||
if (item.remark) {
|
||||
parts.push(item.remark);
|
||||
}
|
||||
return parts.join("|");
|
||||
}
|
||||
|
||||
function getLedgerDelta(item: PointLedger): string {
|
||||
const value = item.pointDelta ?? 0;
|
||||
return `${0 < value ? "+" : ""}${value}`;
|
||||
return `${0 < value ? "+" : "-"}${Math.abs(value)} 分`;
|
||||
}
|
||||
|
||||
function getLedgerShortType(item: PointLedger): string {
|
||||
return item.changeType === "EARN" ? "得" : item.changeType === "REVOKE" ? "撤" : "调";
|
||||
if (item.changeType === "EARN") {
|
||||
return 0 < (item.pointDelta || 0) ? "获得" : "消耗";
|
||||
}
|
||||
return item.changeType === "REVOKE" ? "撤销" : "调整";
|
||||
}
|
||||
|
||||
function getLedgerTheme(item: PointLedger): string {
|
||||
@@ -604,9 +601,6 @@ onMounted(async () => {
|
||||
|
||||
.type-icon {
|
||||
display: flex;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
border-radius: .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user