diff --git a/src/pages/customer/CustomerList.vue b/src/pages/customer/CustomerList.vue index 2dd64f3..dd293d6 100644 --- a/src/pages/customer/CustomerList.vue +++ b/src/pages/customer/CustomerList.vue @@ -180,6 +180,7 @@ import { useCurrentStoreStore } from "@/store/currentStoreStore"; import type { Customer } from "@/types/Customer"; import type { Tag } from "@/types/Tag"; import { buildPresetDateRange, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission"; import { useSettingStore } from "@/store/settingStore"; @@ -188,8 +189,6 @@ defineOptions({ name: "CustomerList" }); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; - const router = useRouter(); const userStore = useUserStore(); const currentStoreStore = useCurrentStoreStore(); @@ -209,15 +208,6 @@ const canShowActionMenu = computed(() => canCreateCustomer.value || canExportCus const scannerVisible = ref(false); const scanStatus = ref("点击扫码开始识别"); let latestDecodedText = ""; -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "全部", value: "all" }, - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "自定义范围", value: "custom" } -]; const dateFilterType = ref("all"); const dateRange = ref<[string, string]>(buildPresetDateRange("all")); const startDraft = ref(""); diff --git a/src/pages/event/EventRecordList.vue b/src/pages/event/EventRecordList.vue index 3935a3b..4033c16 100644 --- a/src/pages/event/EventRecordList.vue +++ b/src/pages/event/EventRecordList.vue @@ -170,12 +170,12 @@ import type { EventOptionStat, EventRecordPage, EventRecordPageResult, Verificat import { isRetiredEvent } from "@/utils/event"; import { formatEventNumberValue } from "@/utils/eventValue"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { permissionCodes } from "@/utils/permission"; import { Message } from "@/utils/message.ts"; import type { EventItem, EventStatus } from "@/types/EventItem"; -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; type VerificationFilter = "ALL" | VerificationStatus; defineOptions({ @@ -186,16 +186,6 @@ const pageSize = 20; const route = useRoute(); const router = useRouter(); const userStore = useUserStore(); -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "全部", value: "all" }, - { label: "自定义范围", value: "custom" } -]; - // ---------- 筛选 ---------- const keyword = ref(getInitialKeyword()); diff --git a/src/pages/event/EventRecordRank.vue b/src/pages/event/EventRecordRank.vue index 751dc5e..7c5dbdc 100644 --- a/src/pages/event/EventRecordRank.vue +++ b/src/pages/event/EventRecordRank.vue @@ -142,13 +142,12 @@ import EventRecordAPI from "@/api/EventRecordAPI"; import type { CustomerEventRankView, EventRecordRankPage, EventRecordRankType } from "@/types/EventRecord"; import type { EventItem } from "@/types/EventItem"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { getErrorMessage } from "@/utils/error"; import { formatEventNumberValue } from "@/utils/eventValue"; import { permissionCodes } from "@/utils/permission"; import { Message } from "@/utils/message.ts"; -type DateFilterType = "all" | "today" | "yesterday" | "thisWeek" | "thisMonth" | "custom"; - defineOptions({ name: "EventRecordRank" }); @@ -162,15 +161,6 @@ const rankTypeOptions: Array<{ label: string; value: EventRecordRankType }> = [ { label: "按连续天数", value: "CONTINUOUS_DAYS" }, { label: "按登记数值", value: "TOTAL_NUMBER_VALUE" } ]; -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "全部时间", value: "all" }, - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "自定义范围", value: "custom" } -]; - // ---------- 筛选 ---------- const rankType = ref(parseRankType(route.query.rankType)); diff --git a/src/pages/fulfillment/OrderFulfillmentList.vue b/src/pages/fulfillment/OrderFulfillmentList.vue index 2b8dd35..37e08b1 100644 --- a/src/pages/fulfillment/OrderFulfillmentList.vue +++ b/src/pages/fulfillment/OrderFulfillmentList.vue @@ -182,6 +182,7 @@ import SkuFilterPopup from "@/pages/fulfillment/components/SkuFilterPopup.vue"; import type { Customer } from "@/types/Customer"; import type { SalesOrder } from "@/types/SalesOrder"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; import { permissionCodes } from "@/utils/permission"; @@ -220,17 +221,7 @@ const actions = computed(() => [ action: toPackageOrderList } ]); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; type SkuFilterOption = { skuId: string; productName: string; skuName: string }; -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "全部", value: "all" }, - { label: "自定义范围", value: "custom" } -]; const customerId = ref(getQueryText(route.query.customerId)); const selectedSkuIdList = ref(getSkuIdList(route.query.skuIds)); diff --git a/src/pages/point/PointLedgerList.vue b/src/pages/point/PointLedgerList.vue index bd5ee3e..ea0c3cf 100644 --- a/src/pages/point/PointLedgerList.vue +++ b/src/pages/point/PointLedgerList.vue @@ -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(); const customerKeyword = ref(""); const selectorVisible = ref(false); const changeTypeFilter = ref("ALL"); -const dateFilter = ref("last30"); -const dateRange = ref<[string, string]>(buildPresetDateRange("last30")); +const dateFilter = ref("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 { @@ -263,7 +255,7 @@ async function selectDateFilter(value: DropdownValue): Promise { 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(); diff --git a/src/pages/point/PointRedemptionList.vue b/src/pages/point/PointRedemptionList.vue index 70183c8..2b0f39e 100644 --- a/src/pages/point/PointRedemptionList.vue +++ b/src/pages/point/PointRedemptionList.vue @@ -175,6 +175,7 @@ import PointAPI from "@/api/PointAPI"; import CustomerSelector from "@/components/CustomerSelector.vue"; import type { PointRedemption, PointRedemptionStatus } from "@/types/Point"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { Message } from "@/utils/message"; import { formatWanInteger } from "@/utils/money"; import { getPackageQuantityText } from "@/utils/package"; @@ -188,16 +189,6 @@ defineOptions({ name: "PointRedemptionList" }); const route = useRoute(); const router = useRouter(); const result = reactive({ total: 0, list: [] as PointRedemption[] }); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "全部", value: "all" }, - { label: "自定义范围", value: "custom" } -]; const keyword = ref(getQueryText(route.query.keyword)); const customerId = ref(getQueryText(route.query.customerId)); const selectedCustomer = ref(); diff --git a/src/pages/product/ProductStockRecordList.vue b/src/pages/product/ProductStockRecordList.vue index 8b3428d..11ba31e 100644 --- a/src/pages/product/ProductStockRecordList.vue +++ b/src/pages/product/ProductStockRecordList.vue @@ -198,6 +198,7 @@ import ProductAPI from "@/api/ProductAPI"; import ProductSelectPopup from "@/components/productSelector/ProductSelectPopup.vue"; import type { ProductSkuSelectionValue } from "@/types/ProductSkuSelection"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { getErrorMessage } from "@/utils/error"; import { getProductBaseUnitName, getProductPhotoURL, getProductQuantityText, getProductTypeText, getStockOperationText } from "@/utils/product"; import { Message } from "@/utils/message"; @@ -209,7 +210,6 @@ import type { Product, ProductSelection, ProductSku, StockOperationType, StockRe defineOptions({ name: "ProductStockRecordList" }); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; type OperationFilter = "ALL" | StockOperationType; type DirectionFilter = "ALL" | StockRecordDirection; @@ -239,15 +239,6 @@ const activeReservationRequested = getQueryText("activeReservationOnly") === "tr const operationType = ref(getQueryText("operationType") as OperationFilter || (activeReservationRequested ? "ORDER_RESERVE" : "ALL")); const direction = ref(getQueryText("direction") as DirectionFilter || "ALL"); const keyword = ref(getQueryText("keyword")); -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "全部", value: "all" }, - { label: "自定义范围", value: "custom" } -]; const dateFilterType = ref(parseDateFilterType(getQueryText("dateType"), dateOptions, "all")); const dateRange = ref<[string, string]>(parseDateRange(dateFilterType.value)); const startDraft = ref(""); diff --git a/src/pages/salesOrder/ConsumptionRecordList.vue b/src/pages/salesOrder/ConsumptionRecordList.vue index d575105..16426d4 100644 --- a/src/pages/salesOrder/ConsumptionRecordList.vue +++ b/src/pages/salesOrder/ConsumptionRecordList.vue @@ -196,6 +196,7 @@ import type { ConsumptionRecordStatus } from "@/types/ConsumptionRecord"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { getErrorMessage } from "@/utils/error"; import { getCustomerPhotoURL } from "@/utils/customer"; import { Message } from "@/utils/message"; @@ -206,21 +207,10 @@ import type { Customer } from "@/types/Customer"; defineOptions({ name: "ConsumptionRecordList" }); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; - const pageSize = 20; const route = useRoute(); const router = useRouter(); const userStore = useUserStore(); -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "全部时间", value: "all" }, - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "自定义范围", value: "custom" } -]; const sourceType = ref("ALL"); const status = ref("ALL"); const customerId = ref(""); diff --git a/src/pages/salesOrder/FundRecordList.vue b/src/pages/salesOrder/FundRecordList.vue index ce22c3a..f47d23a 100644 --- a/src/pages/salesOrder/FundRecordList.vue +++ b/src/pages/salesOrder/FundRecordList.vue @@ -192,6 +192,7 @@ import SalesOrderAPI from "@/api/SalesOrderAPI"; import CustomerSelector from "@/components/CustomerSelector.vue"; import type { FundOperationType, FundRecord, FundRecordStatus } from "@/types/SalesOrder"; import { buildPresetDateRange, parseDateFilterType, parseDateTime } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions, type DateFilterType } from "@/utils/dateFilter"; import { getErrorMessage } from "@/utils/error"; import { formatPackageAmount } from "@/utils/package"; import { getFundOperationText, getFundStatusText } from "@/utils/salesOrder"; @@ -203,8 +204,6 @@ import type { Customer } from "@/types/Customer"; defineOptions({ name: "FundRecordList" }); -type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom"; - const route = useRoute(); const router = useRouter(); const userStore = useUserStore(); @@ -220,15 +219,6 @@ const customerId = ref(getQueryText(route.query.customerId)); const selectedCustomer = ref(); const customerSelectorVisible = ref(false); const customerSearchKeyword = ref(""); -const dateOptions: Array<{ label: string; value: DateFilterType }> = [ - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "上个月", value: "lastMonth" }, - { label: "全部", value: "all" }, - { label: "自定义范围", value: "custom" } -]; const dateFilterType = ref(parseDateFilterType(getQueryText(route.query.dateType), dateOptions, "all")); const dateRange = ref<[string, string]>(parseDateRange(dateFilterType.value)); const startDraft = ref(""); diff --git a/src/pages/salesOrder/components/SalesOrderFilterPopup.vue b/src/pages/salesOrder/components/SalesOrderFilterPopup.vue index ebeec04..a2c90dc 100644 --- a/src/pages/salesOrder/components/SalesOrderFilterPopup.vue +++ b/src/pages/salesOrder/components/SalesOrderFilterPopup.vue @@ -62,6 +62,7 @@ import { Time } from "timi-web"; import FilterPopup from "@/components/filter-popup/FilterPopup.vue"; import type { FilterGroup, FilterModel, FilterValueList } from "@/components/filter-popup/FilterPopup"; import { buildPresetDateRange } from "@/utils/date"; +import { DATE_FILTER_OPTIONS as dateOptions } from "@/utils/dateFilter"; import type { GaoSalesOrderStatus, GaoSalesOrderType, GaoSalesRefundStatus } from "@/types/SalesOrder"; import { cloneSalesOrderFilter, @@ -96,15 +97,6 @@ const endVisible = ref(false); const startDraft = ref(""); const endDraft = ref(""); let resetRequested = false; -const dateOptions: Array<{ label: string; value: SalesOrderDateFilterType }> = [ - { label: "全部时间", value: "all" }, - { label: "今天", value: "today" }, - { label: "昨天", value: "yesterday" }, - { label: "本周", value: "thisWeek" }, - { label: "本月", value: "thisMonth" }, - { label: "最近 30 天", value: "last30" }, - { label: "自定义范围", value: "custom" } -]; const orderTypeOptions: Array<{ label: string; value: GaoSalesOrderType }> = [ { label: "套餐订单", value: "PACKAGE" }, { label: "产品订单", value: "DIRECT_PRODUCT" } diff --git a/src/pages/salesOrder/components/SalesOrderFilterSummary.vue b/src/pages/salesOrder/components/SalesOrderFilterSummary.vue index 090eea5..615bdb8 100644 --- a/src/pages/salesOrder/components/SalesOrderFilterSummary.vue +++ b/src/pages/salesOrder/components/SalesOrderFilterSummary.vue @@ -73,8 +73,8 @@