remove store filter
This commit is contained in:
@@ -32,13 +32,6 @@
|
||||
</div>
|
||||
<div class="filters">
|
||||
<t-dropdown-menu>
|
||||
<t-dropdown-item
|
||||
v-if="isGlobalManager"
|
||||
v-model="selectedStoreId"
|
||||
:label="selectedStoreName"
|
||||
:options="storeOptions"
|
||||
@change="selectStore"
|
||||
/>
|
||||
<t-dropdown-item
|
||||
v-model="changeTypeFilter"
|
||||
label="流水类型"
|
||||
@@ -175,7 +168,6 @@ import { getCustomerPhotoURL } from "@/utils/customer";
|
||||
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
|
||||
type DateFilter = "all" | "today" | "last7" | "last30" | "custom";
|
||||
const allStoresValue = "__ALL_STORES__";
|
||||
|
||||
defineOptions({
|
||||
name: "PointLedgerList"
|
||||
@@ -190,7 +182,6 @@ const settingStore = useSettingStore();
|
||||
// ---------- 筛选 ----------
|
||||
|
||||
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
|
||||
const selectedStoreId = ref(String(route.query.storeId || allStoresValue));
|
||||
const selectedCustomerId = ref(String(route.query.customerId || ""));
|
||||
const selectedAccountId = ref(String(route.query.accountId || ""));
|
||||
const customer = ref<Customer>();
|
||||
@@ -213,16 +204,6 @@ const dateFilterOptions = [
|
||||
{ label: "近 30 天", value: "last30" },
|
||||
{ label: "自定义", value: "custom" }
|
||||
];
|
||||
const storeOptions = computed(() => [
|
||||
{ label: "全部门店", value: allStoresValue },
|
||||
...currentStoreStore.storeList
|
||||
.map(item => ({
|
||||
label: item.name || item.code || "未命名门店",
|
||||
value: item.id || ""
|
||||
}))
|
||||
.filter(item => item.value)
|
||||
]);
|
||||
const selectedStoreName = computed(() => storeOptions.value.find(item => item.value === selectedStoreId.value)?.label || "全部门店");
|
||||
const customerFilterText = computed(() => customer.value?.name || customer.value?.code || "全部客户");
|
||||
const dateFilterLabel = computed(() => dateFilterOptions.find(item => item.value === dateFilter.value)?.label || "时间范围");
|
||||
const isCustomDate = computed(() => dateFilter.value === "custom");
|
||||
@@ -257,17 +238,6 @@ async function loadCustomerByCode(code: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function selectStore(value: DropdownValue): Promise<void> {
|
||||
if (Array.isArray(value)) {
|
||||
return;
|
||||
}
|
||||
selectedStoreId.value = String(value);
|
||||
if (selectedStoreId.value !== allStoresValue) {
|
||||
currentStoreStore.selectStore(selectedStoreId.value);
|
||||
}
|
||||
await reload();
|
||||
}
|
||||
|
||||
async function selectChangeType(value: DropdownValue): Promise<void> {
|
||||
if (Array.isArray(value)) {
|
||||
return;
|
||||
@@ -403,11 +373,8 @@ function buildRequest(): PointLedgerPage {
|
||||
};
|
||||
}
|
||||
|
||||
function buildListOptions(): { allStores?: boolean; storeId?: string } | undefined {
|
||||
if (!isGlobalManager.value) {
|
||||
return undefined;
|
||||
}
|
||||
return selectedStoreId.value === allStoresValue ? { allStores: true } : { storeId: selectedStoreId.value };
|
||||
function buildListOptions(): { storeId: string } {
|
||||
return { storeId: currentStoreStore.currentStoreId };
|
||||
}
|
||||
|
||||
// ---------- 展示与导航 ----------
|
||||
@@ -463,8 +430,7 @@ async function toAdjust(): Promise<void> {
|
||||
await router.push({
|
||||
name: "PointAdjust",
|
||||
query: {
|
||||
customerId: selectedCustomerId.value,
|
||||
storeId: selectedStoreId.value === allStoresValue ? "" : selectedStoreId.value
|
||||
customerId: selectedCustomerId.value
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -509,14 +475,8 @@ function toTimestamp(value: string, isEnd: boolean): number {
|
||||
async function preparePage(): Promise<void> {
|
||||
if (isGlobalManager.value) {
|
||||
await currentStoreStore.loadStoreList();
|
||||
const routeStoreId = String(route.query.storeId || "");
|
||||
if (routeStoreId && routeStoreId !== allStoresValue && currentStoreStore.storeList.some(item => item.id === routeStoreId)) {
|
||||
selectedStoreId.value = routeStoreId;
|
||||
currentStoreStore.selectStore(routeStoreId);
|
||||
}
|
||||
} else {
|
||||
const store = await currentStoreStore.loadLoginStore();
|
||||
selectedStoreId.value = store?.id || "";
|
||||
await currentStoreStore.loadLoginStore();
|
||||
}
|
||||
if (selectedCustomerId.value) {
|
||||
customer.value = await CustomerAPI.detail(selectedCustomerId.value);
|
||||
|
||||
Reference in New Issue
Block a user