number wan split
This commit is contained in:
@@ -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<void> {
|
||||
// ---------- 展示 ----------
|
||||
|
||||
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 () => {
|
||||
|
||||
@@ -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<void> {
|
||||
// ---------- 展示 ----------
|
||||
|
||||
function formatPoints(value?: number): string {
|
||||
return `${(value ?? 0).toLocaleString("zh-CN")} 分`;
|
||||
return `${formatWanInteger(value ?? 0)} 分`;
|
||||
}
|
||||
|
||||
function getBalanceTheme(value?: number): string {
|
||||
|
||||
@@ -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<Customer>();
|
||||
const account = ref<PointAccount>();
|
||||
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<void> {
|
||||
selectedCustomerId.value = Array.isArray(value) ? String(value[0] || "") : value;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<span>时间:</span>
|
||||
<pass-time-label :timestamp="item.occurredAt" underline />
|
||||
</div>
|
||||
<div v-text="`余额:${item.balanceBefore ?? 0} → ${item.balanceAfter ?? 0}`" />
|
||||
<div v-text="`余额:${formatPointValue(item.balanceBefore)} → ${formatPointValue(item.balanceAfter)}`" />
|
||||
<div v-text="item.remark" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
v-entrance-transition
|
||||
/>
|
||||
<t-form-item v-if="customer" label="积分余额" content-align="right">
|
||||
<span v-text="pointBalanceText" />
|
||||
<span class="orange" v-text="pointBalanceText" />
|
||||
</t-form-item>
|
||||
<t-form-item label="兑换商品" required-mark content-align="right" arrow @click="skuVisible = true">
|
||||
<span v-text="skuName || '请选择兑换商品'" />
|
||||
@@ -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<void> {
|
||||
}
|
||||
|
||||
function formatPoint(value?: number): string {
|
||||
return `${(value || 0).toLocaleString("zh-CN")} 分`;
|
||||
return `${formatWanInteger(value ?? 0)} 分`;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -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<void> {
|
||||
}
|
||||
|
||||
function formatPoint(value?: number): string {
|
||||
return `${(value || 0).toLocaleString("zh-CN")} 分`;
|
||||
return `${formatWanInteger(value ?? 0)} 分`;
|
||||
}
|
||||
|
||||
function quantityText(value?: number | string): string {
|
||||
|
||||
@@ -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<void> {
|
||||
}
|
||||
|
||||
function formatPoint(value?: number): string {
|
||||
return `${(value || 0).toLocaleString("zh-CN")} 分`;
|
||||
return `${formatWanInteger(value ?? 0)} 分`;
|
||||
}
|
||||
|
||||
function quantityText(value?: number | string): string {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<void> {
|
||||
|
||||
Reference in New Issue
Block a user