support consume point
This commit is contained in:
@@ -45,8 +45,8 @@
|
||||
</template>
|
||||
</t-cell>
|
||||
<t-cell v-if="hasEventNumberValue" title="事件数值" :note="getEventNumberValueText()" />
|
||||
<t-cell v-if="hasSubmittedPointValue" title="提交积分值" :note="getPointText(eventRecord.pointValue)" />
|
||||
<t-cell v-if="hasEarnedPointValue" title="记录获得积分" :note="getPointText(eventRecord.earnedPointValue)" />
|
||||
<t-cell v-if="hasSubmittedPointValue" title="提交积分值" :note="getSignedPointText(eventRecord.pointValue)" />
|
||||
<t-cell v-if="hasEarnedPointValue" title="本次积分变化" :note="getSignedPointText(eventRecord.earnedPointValue)" />
|
||||
<t-cell title="登记人" :note="Text.display(eventRecord.operator?.nick || eventRecord.operator?.name)" />
|
||||
<t-cell title="记录备注" :note="Text.display(eventRecord.remark)" />
|
||||
</template>
|
||||
@@ -198,7 +198,7 @@ async function loadPageData(): Promise<void> {
|
||||
|
||||
function getChangeTypeText(changeType?: PointLedger["changeType"]): string {
|
||||
return ({
|
||||
EARN: "获得积分",
|
||||
EARN: "积分变化",
|
||||
REVOKE: "撤销积分",
|
||||
ADJUST: "人工调整"
|
||||
} as Record<string, string>)[changeType || ""] || "未知流水";
|
||||
@@ -212,13 +212,20 @@ function getPointDeltaText(pointDelta?: number): string {
|
||||
if (pointDelta === undefined || pointDelta === null) {
|
||||
return "-";
|
||||
}
|
||||
return `${0 < pointDelta ? "+" : ""}${pointDelta} 分`;
|
||||
return `${0 < pointDelta ? "获得" : "消耗"} ${Math.abs(pointDelta)} 分`;
|
||||
}
|
||||
|
||||
function getPointText(value?: number | null): string {
|
||||
return value === undefined || value === null ? "-" : `${value} 分`;
|
||||
}
|
||||
|
||||
function getSignedPointText(value?: number | null): string {
|
||||
if (value === undefined || value === null) {
|
||||
return "-";
|
||||
}
|
||||
return `${0 < value ? "获得" : "消耗"} ${Math.abs(value)} 分`;
|
||||
}
|
||||
|
||||
function getEventValueTypeText(event: EventItem): string {
|
||||
if (event.valueType === "NUMBER") {
|
||||
return `数值事件(${getEventValueUnitText(event.valueUnit)})`;
|
||||
@@ -252,7 +259,10 @@ function getRulePointText(rule: PointRule): string {
|
||||
if (rule.pointMode === "TIER") {
|
||||
return rule.conditionJson?.tiers?.length ? `${rule.conditionJson.tiers.length} 档` : "分档积分";
|
||||
}
|
||||
return getPointText(rule.pointValue);
|
||||
if (rule.pointValue === undefined || rule.pointValue === null) {
|
||||
return "-";
|
||||
}
|
||||
return `${0 < rule.pointValue ? "发放" : "消耗"} ${Math.abs(rule.pointValue)} 分`;
|
||||
}
|
||||
|
||||
function getRuleConditionText(rule: PointRule): string {
|
||||
@@ -278,7 +288,7 @@ function getRuleConditionText(rule: PointRule): string {
|
||||
textList.push(`来源事件:${sourceEvent.value?.name || sourceEvent.value?.id || condition.sourceEventId}`);
|
||||
}
|
||||
if (condition.tiers?.length) {
|
||||
textList.push(condition.tiers.map(tier => `${tier.min}~${tier.max ?? "以上"}:${tier.pointValue} 分`).join(","));
|
||||
textList.push(condition.tiers.map(tier => `${tier.min}~${tier.max ?? "以上"}:${0 < tier.pointValue ? "发放" : "消耗"} ${Math.abs(tier.pointValue)} 分`).join(","));
|
||||
}
|
||||
return textList.join(";") || "无额外条件";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user