From 79d9efad739c0cdb5ee099d2413cb25cf63912fa Mon Sep 17 00:00:00 2001 From: Timi Date: Sat, 19 Sep 2026 16:46:00 +0800 Subject: [PATCH] number wan split --- src/pages/point/PointAccountDetail.vue | 5 +++-- src/pages/point/PointAccountList.vue | 3 ++- src/pages/point/PointAdjust.vue | 3 ++- src/pages/point/PointLedgerDetail.vue | 9 +++++---- src/pages/point/PointLedgerList.vue | 9 +++++++-- src/pages/point/PointRedeemSkuList.vue | 3 ++- src/pages/point/PointRedemptionCreate.vue | 7 ++++--- src/pages/point/PointRedemptionDetail.vue | 3 ++- src/pages/point/PointRedemptionList.vue | 3 ++- src/pages/point/PointRuleDetail.vue | 3 ++- src/pages/point/PointRuleList.vue | 3 ++- src/pages/point/PointRuleSort.vue | 3 ++- 12 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/pages/point/PointAccountDetail.vue b/src/pages/point/PointAccountDetail.vue index 20835e8..2c22d3a 100644 --- a/src/pages/point/PointAccountDetail.vue +++ b/src/pages/point/PointAccountDetail.vue @@ -51,6 +51,7 @@ import CustomerProfileCard from "@/components/CustomerProfileCard.vue"; import { useCurrentStoreStore } from "@/store/currentStoreStore"; import type { Customer } from "@/types/Customer"; import type { PointAccount as PointAccountData } from "@/types/Point"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; defineOptions({ @@ -149,7 +150,7 @@ async function toAdjust(): Promise { // ---------- 展示 ---------- function formatPoints(value?: number): string { - return `${(value ?? 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } function formatTimestamp(timestamp?: number): string { @@ -165,7 +166,7 @@ function formatTimestamp(timestamp?: number): string { function formatSignedPoints(value?: number): string { const pointValue = value ?? 0; - return pointValue < 0 ? `扣除 ${Math.abs(pointValue).toLocaleString("zh-CN")} 分` : `增加 ${pointValue.toLocaleString("zh-CN")} 分`; + return pointValue < 0 ? `扣除 ${formatWanInteger(Math.abs(pointValue))} 分` : `增加 ${formatWanInteger(pointValue)} 分`; } onMounted(async () => { diff --git a/src/pages/point/PointAccountList.vue b/src/pages/point/PointAccountList.vue index 7d516fd..ef06909 100644 --- a/src/pages/point/PointAccountList.vue +++ b/src/pages/point/PointAccountList.vue @@ -64,6 +64,7 @@ import CustomerSelector from "@/components/CustomerSelector.vue"; import { useCurrentStoreStore } from "@/store/currentStoreStore"; import type { PointAccount, PointAccountPage } from "@/types/Point"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; defineOptions({ @@ -196,7 +197,7 @@ async function load(): Promise { // ---------- 展示 ---------- function formatPoints(value?: number): string { - return `${(value ?? 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } function getBalanceTheme(value?: number): string { diff --git a/src/pages/point/PointAdjust.vue b/src/pages/point/PointAdjust.vue index d98d51f..f474370 100644 --- a/src/pages/point/PointAdjust.vue +++ b/src/pages/point/PointAdjust.vue @@ -83,6 +83,7 @@ import { useCurrentStoreStore } from "@/store/currentStoreStore"; import type { Customer } from "@/types/Customer"; import type { PointAccount } from "@/types/Point"; import { getErrorMessage } from "@/utils/error"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; defineOptions({ @@ -113,7 +114,7 @@ const selectedCustomerId = ref(String(route.query.customerId || "")); const selectedCustomer = ref(); const account = ref(); const selectorVisible = ref(false); -const balanceText = computed(() => `当前余额:${(account.value?.balance ?? 0).toLocaleString("zh-CN")} 分`); +const balanceText = computed(() => `当前余额:${formatWanInteger(account.value?.balance ?? 0)} 分`); async function handleCustomerChange(value: string | string[]): Promise { selectedCustomerId.value = Array.isArray(value) ? String(value[0] || "") : value; diff --git a/src/pages/point/PointLedgerDetail.vue b/src/pages/point/PointLedgerDetail.vue index 3e744e1..d2f3fca 100644 --- a/src/pages/point/PointLedgerDetail.vue +++ b/src/pages/point/PointLedgerDetail.vue @@ -91,6 +91,7 @@ import type { EventItem } from "@/types/EventItem"; import type { EventRecord } from "@/types/EventRecord"; import type { PointLedger, PointRule, PointRuleStatus } from "@/types/Point"; import { formatEventNumberValue, getEventValueUnitText } from "@/utils/eventValue"; +import { formatWanInteger } from "@/utils/money"; import { permissionCodes } from "@/utils/permission"; defineOptions({ @@ -220,18 +221,18 @@ function getPointDeltaText(pointDelta?: number): string { if (pointDelta === undefined || pointDelta === null) { return "-"; } - return `${0 < pointDelta ? "获得" : "消耗"} ${Math.abs(pointDelta)} 分`; + return `${0 < pointDelta ? "获得" : "消耗"} ${formatWanInteger(Math.abs(pointDelta))} 分`; } function getPointText(value?: number | null): string { - return value === undefined || value === null ? "-" : `${value} 分`; + return value === undefined || value === null ? "-" : `${formatWanInteger(value)} 分`; } function getSignedPointText(value?: number | null): string { if (value === undefined || value === null) { return "-"; } - return `${0 < value ? "获得" : "消耗"} ${Math.abs(value)} 分`; + return `${0 < value ? "获得" : "消耗"} ${formatWanInteger(Math.abs(value))} 分`; } function getEventValueTypeText(event: EventItem): string { @@ -252,7 +253,7 @@ function getRulePointText(rule: PointRule): string { if (rule.pointValue === undefined || rule.pointValue === null) { return "-"; } - return `${0 < rule.pointValue ? "发放" : "消耗"} ${Math.abs(rule.pointValue)} 分`; + return `${0 < rule.pointValue ? "发放" : "消耗"} ${formatWanInteger(Math.abs(rule.pointValue))} 分`; } function getRuleScriptText(rule: PointRule): string { diff --git a/src/pages/point/PointLedgerList.vue b/src/pages/point/PointLedgerList.vue index 3b7d9ab..ba51abe 100644 --- a/src/pages/point/PointLedgerList.vue +++ b/src/pages/point/PointLedgerList.vue @@ -96,7 +96,7 @@ 时间: -
+
@@ -153,6 +153,7 @@ import type { PointLedger, PointLedgerChangeType, PointLedgerPage } from "@/type import { getCustomerPhotoURL } from "@/utils/customer"; import { buildPresetDateRange, parseDateTime } from "@/utils/date"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; type DateFilter = "all" | "today" | "last7" | "last30" | "custom"; @@ -386,7 +387,11 @@ function buildListOptions(): { storeId: string } { function getLedgerDelta(item: PointLedger): string { const value = item.pointDelta ?? 0; - return `${0 < value ? "+" : "-"}${Math.abs(value)} 分`; + return `${0 < value ? "+" : "-"}${formatWanInteger(Math.abs(value))} 分`; +} + +function formatPointValue(value?: number): string { + return value === undefined || value === null ? "-" : formatWanInteger(value); } function getLedgerShortType(item: PointLedger): string { diff --git a/src/pages/point/PointRedeemSkuList.vue b/src/pages/point/PointRedeemSkuList.vue index a88f63e..df1f083 100644 --- a/src/pages/point/PointRedeemSkuList.vue +++ b/src/pages/point/PointRedeemSkuList.vue @@ -66,6 +66,7 @@ import PointAPI from "@/api/PointAPI"; import { useNavBarStore } from "@/store/navBarStore"; import type { PointRedeemSku, PointRedeemSkuStatus } from "@/types/Point"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { getProductPhotoURL } from "@/utils/product"; import { permissionCodes } from "@/utils/permission"; @@ -129,7 +130,7 @@ const reloadByKeyword = Toolkit.debounce(async () => { }, false); function formatPoint(value?: number): string { - return `${(value || 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } function getProductPhoto(item: PointRedeemSku): string { diff --git a/src/pages/point/PointRedemptionCreate.vue b/src/pages/point/PointRedemptionCreate.vue index 55fa031..496cd25 100644 --- a/src/pages/point/PointRedemptionCreate.vue +++ b/src/pages/point/PointRedemptionCreate.vue @@ -41,7 +41,7 @@ v-entrance-transition /> - + @@ -122,6 +122,7 @@ import type { PhotoItem } from "@/types/Photo"; import type { PointAccount, PointRedeemSku } from "@/types/Point"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { normalizePackageQuantity } from "@/utils/package"; import { getProductQuantityStep } from "@/utils/product"; import { uploadPhotoList } from "@/utils/photo"; @@ -163,7 +164,7 @@ const pointBalanceText = computed(() => { if (!canReadPointAccount.value) { return "无余额读取权限"; } - return pointAccountLoading.value ? "正在加载" : `${(pointAccount.value?.balance ?? 0).toLocaleString("zh-CN")} 分`; + return pointAccountLoading.value ? "正在加载" : `${formatWanInteger(pointAccount.value?.balance ?? 0)} 分`; }); const scannerVisible = ref(false); const scanStatus = ref("点击扫码开始识别。"); @@ -302,7 +303,7 @@ async function save(): Promise { } function formatPoint(value?: number): string { - return `${(value || 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } onMounted(async () => { diff --git a/src/pages/point/PointRedemptionDetail.vue b/src/pages/point/PointRedemptionDetail.vue index cba824f..15d9962 100644 --- a/src/pages/point/PointRedemptionDetail.vue +++ b/src/pages/point/PointRedemptionDetail.vue @@ -88,6 +88,7 @@ import type { PhotoItem } from "@/types/Photo"; import type { PointRedemption, PointRedemptionReturn, PointRedemptionStatus } from "@/types/Point"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { comparePackageQuantity, getPackageQuantityText, normalizePackageQuantity } from "@/utils/package"; import { uploadPhotoList } from "@/utils/photo"; import { permissionCodes } from "@/utils/permission"; @@ -193,7 +194,7 @@ async function submitReturn(): Promise { } function formatPoint(value?: number): string { - return `${(value || 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } function quantityText(value?: number | string): string { diff --git a/src/pages/point/PointRedemptionList.vue b/src/pages/point/PointRedemptionList.vue index e6e6e91..17503b6 100644 --- a/src/pages/point/PointRedemptionList.vue +++ b/src/pages/point/PointRedemptionList.vue @@ -160,6 +160,7 @@ import type { Customer } from "@/types/Customer"; import type { PointRedemption, PointRedemptionStatus } from "@/types/Point"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { getPackageQuantityText } from "@/utils/package"; import { getCustomerPhotoURL } from "@/utils/customer"; import { permissionCodes } from "@/utils/permission"; @@ -258,7 +259,7 @@ async function load(): Promise { } function formatPoint(value?: number): string { - return `${(value || 0).toLocaleString("zh-CN")} 分`; + return `${formatWanInteger(value ?? 0)} 分`; } function quantityText(value?: number | string): string { diff --git a/src/pages/point/PointRuleDetail.vue b/src/pages/point/PointRuleDetail.vue index 3c5e2f2..072a91d 100644 --- a/src/pages/point/PointRuleDetail.vue +++ b/src/pages/point/PointRuleDetail.vue @@ -101,6 +101,7 @@ import type { EventItem } from "@/types/EventItem"; import type { PointRule, PointRuleStatus } from "@/types/Point"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; defineOptions({ @@ -217,7 +218,7 @@ function formatPointValue(value?: number | null): string { if (value === 0) { return "不产生积分流水"; } - return `${0 < value ? "发放" : "消耗"} ${Math.abs(value)} 分`; + return `${0 < value ? "发放" : "消耗"} ${formatWanInteger(Math.abs(value))} 分`; } function formatNumber(value?: number): string { diff --git a/src/pages/point/PointRuleList.vue b/src/pages/point/PointRuleList.vue index 5f3f97f..70c7104 100644 --- a/src/pages/point/PointRuleList.vue +++ b/src/pages/point/PointRuleList.vue @@ -70,6 +70,7 @@ import { useNavBarStore } from "@/store/navBarStore"; import type { EventItem } from "@/types/EventItem"; import type { NavBarAction } from "@/types/NavBarAction"; import type { PointRule, PointRuleStatus } from "@/types/Point"; +import { formatWanInteger } from "@/utils/money"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; import { type Page, type PageResult, useUserStore } from "timi-web-api"; import { Message } from "@/utils/message.ts"; @@ -242,7 +243,7 @@ function getPointText(rule: PointRule): string { if (rule.pointValue === undefined || rule.pointValue === null) { return "?"; } - return `${0 < rule.pointValue ? "+" : "-"}${Math.abs(rule.pointValue)}`; + return `${0 < rule.pointValue ? "+" : "-"}${formatWanInteger(Math.abs(rule.pointValue))}`; } function getStatusText(status?: PointRuleStatus): string { diff --git a/src/pages/point/PointRuleSort.vue b/src/pages/point/PointRuleSort.vue index 846db5d..2d62f21 100644 --- a/src/pages/point/PointRuleSort.vue +++ b/src/pages/point/PointRuleSort.vue @@ -52,6 +52,7 @@ import PointAPI from "@/api/PointAPI"; import { useNavBarStore } from "@/store/navBarStore"; import type { EventItem } from "@/types/EventItem"; import type { PointRule } from "@/types/Point"; +import { formatWanInteger } from "@/utils/money"; import { permissionCodes } from "@/utils/permission"; defineOptions({ name: "PointRuleSort" }); @@ -72,7 +73,7 @@ function getPointText(rule: PointRule): string { if (rule.pointValue === undefined || rule.pointValue === null) { return "未配置"; } - return (0 < rule.pointValue ? "+" : "") + rule.pointValue; + return (0 < rule.pointValue ? "+" : "") + formatWanInteger(rule.pointValue); } async function loadData(): Promise {