add dateFilter.ts
This commit is contained in:
@@ -162,12 +162,11 @@ import type { Customer } from "@/types/Customer";
|
||||
import type { PointLedger, PointLedgerChangeType, PointLedgerPage } from "@/types/Point";
|
||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
||||
import { buildPresetDateRange, parseDateTime } from "@/utils/date";
|
||||
import { DATE_FILTER_OPTIONS as dateFilterOptions, type DateFilterType } from "@/utils/dateFilter";
|
||||
import { Message } from "@/utils/message";
|
||||
import { formatWanInteger } from "@/utils/money";
|
||||
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
|
||||
type DateFilter = "all" | "today" | "last7" | "last30" | "custom";
|
||||
|
||||
defineOptions({
|
||||
name: "PointLedgerList"
|
||||
});
|
||||
@@ -186,8 +185,8 @@ const customer = ref<Customer>();
|
||||
const customerKeyword = ref("");
|
||||
const selectorVisible = ref(false);
|
||||
const changeTypeFilter = ref("ALL");
|
||||
const dateFilter = ref<DateFilter>("last30");
|
||||
const dateRange = ref<[string, string]>(buildPresetDateRange("last30"));
|
||||
const dateFilter = ref<DateFilterType>("thisMonth");
|
||||
const dateRange = ref<[string, string]>(buildPresetDateRange("thisMonth"));
|
||||
const startDraft = ref("");
|
||||
const endDraft = ref("");
|
||||
const startDateVisible = ref(false);
|
||||
@@ -199,13 +198,6 @@ const changeTypeOptions = [
|
||||
{ label: "撤销", value: "REVOKE" },
|
||||
{ label: "调整", value: "ADJUST" }
|
||||
];
|
||||
const dateFilterOptions = [
|
||||
{ label: "全部时间", value: "all" },
|
||||
{ label: "今天", value: "today" },
|
||||
{ label: "近 7 天", value: "last7" },
|
||||
{ label: "近 30 天", value: "last30" },
|
||||
{ label: "自定义", value: "custom" }
|
||||
];
|
||||
const dateFilterLabel = computed(() => dateFilterOptions.find(item => item.value === dateFilter.value)?.label || "时间范围");
|
||||
|
||||
async function handleCustomerChange(value: string | string[]): Promise<void> {
|
||||
@@ -263,7 +255,7 @@ async function selectDateFilter(value: DropdownValue): Promise<void> {
|
||||
if (Array.isArray(value)) {
|
||||
return;
|
||||
}
|
||||
dateFilter.value = String(value) as DateFilter;
|
||||
dateFilter.value = String(value) as DateFilterType;
|
||||
if (dateFilter.value !== "custom") {
|
||||
dateRange.value = buildPresetDateRange(dateFilter.value);
|
||||
await reload();
|
||||
|
||||
Reference in New Issue
Block a user