remove store filter
This commit is contained in:
@@ -18,9 +18,6 @@
|
||||
</template>
|
||||
</t-input>
|
||||
</t-form-item>
|
||||
<t-form-item v-if="isGlobalManager" label="门店" required-mark arrow @click="openStorePicker">
|
||||
<div class="picker-text" v-text="selectedStoreName" />
|
||||
</t-form-item>
|
||||
<div v-if="scannerVisible && scannerTarget === 'code'" class="code-scanner-wrapper">
|
||||
<code-scanner
|
||||
visible
|
||||
@@ -162,15 +159,6 @@
|
||||
@change="handleTagSelected"
|
||||
/>
|
||||
</div>
|
||||
<t-popup v-model="storePickerVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="storePickerDraft"
|
||||
:columns="storePickerColumns"
|
||||
title="选择门店"
|
||||
@cancel="storePickerVisible = false"
|
||||
@confirm="confirmStorePicker"
|
||||
/>
|
||||
</t-popup>
|
||||
<bottom-popup
|
||||
v-model="bodyAreaPickerVisible"
|
||||
title="选择调理部位"
|
||||
@@ -203,8 +191,6 @@ import { normalizeBodyAreaValue } from "@/utils/customer";
|
||||
import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
import { compressUploadImage } from "@/utils/imageCompression";
|
||||
|
||||
type PickerValue = string | number;
|
||||
|
||||
defineOptions({
|
||||
name: "CustomerEdit"
|
||||
});
|
||||
@@ -371,56 +357,17 @@ function openPhotoPicker(target: CustomerAttachmentType): void {
|
||||
photoInputRef.value?.click();
|
||||
}
|
||||
|
||||
const canSubmit = computed(() => formData.name?.trim() && formData.storeId);
|
||||
|
||||
// ---------- 门店选择 ----------
|
||||
|
||||
const storePickerVisible = ref(false);
|
||||
const storePickerDraft = ref<PickerValue[]>([]);
|
||||
const storePickerColumns = computed(() => [
|
||||
currentStoreStore.storeList.map(item => ({
|
||||
label: item.name || item.code || "未命名门店",
|
||||
value: item.id || ""
|
||||
})).filter(item => item.value)
|
||||
]);
|
||||
const selectedStoreName = computed(() => {
|
||||
const store = currentStoreStore.storeList.find(item => item.id === formData.storeId);
|
||||
return store?.name || store?.code || "请选择门店";
|
||||
});
|
||||
|
||||
function openStorePicker(): void {
|
||||
if (!currentStoreStore.storeList.length) {
|
||||
Toast.warning("暂无可选门店");
|
||||
return;
|
||||
}
|
||||
|
||||
storePickerDraft.value = [formData.storeId || ""];
|
||||
storePickerVisible.value = true;
|
||||
}
|
||||
|
||||
function confirmStorePicker(): void {
|
||||
const storeId = String(storePickerDraft.value[0] || "");
|
||||
if (!storeId) {
|
||||
return;
|
||||
}
|
||||
|
||||
formData.storeId = storeId;
|
||||
currentStoreStore.selectStore(storeId);
|
||||
storePickerVisible.value = false;
|
||||
}
|
||||
const canSubmit = computed(() => formData.name?.trim() && currentStoreStore.currentStoreId);
|
||||
|
||||
async function prepareStoreScope(): Promise<void> {
|
||||
if (isGlobalManager.value) {
|
||||
await currentStoreStore.loadStoreList();
|
||||
const queryStoreId = String(route.query.storeId || "");
|
||||
formData.storeId = currentStoreStore.storeList.some(item => item.id === queryStoreId)
|
||||
? queryStoreId
|
||||
: currentStoreStore.currentStoreId;
|
||||
formData.storeId = currentStoreStore.currentStoreId;
|
||||
return;
|
||||
}
|
||||
|
||||
const store = await currentStoreStore.loadLoginStore();
|
||||
formData.storeId = store?.id || "";
|
||||
await currentStoreStore.loadLoginStore();
|
||||
formData.storeId = currentStoreStore.currentStoreId;
|
||||
}
|
||||
|
||||
async function loadDetail() {
|
||||
@@ -434,8 +381,8 @@ async function loadDetail() {
|
||||
try {
|
||||
const customer = await CustomerAPI.detail(id);
|
||||
Object.assign(formData, customer);
|
||||
formData.storeId = currentStoreStore.currentStoreId;
|
||||
await loadCustomerTags(id);
|
||||
formData.storeId = customer.storeId || formData.storeId;
|
||||
photoItemList.value = (customer.attachmentList || [])
|
||||
.filter(item => !!item.id)
|
||||
.map(item => ({
|
||||
@@ -579,7 +526,7 @@ async function doSubmit(): Promise<void> {
|
||||
Toast.warning("请填写姓名");
|
||||
return;
|
||||
}
|
||||
Toast.warning("请选择门店");
|
||||
Toast.warning("当前门店未设置");
|
||||
return;
|
||||
}
|
||||
if (!validateCustomerPhotoList()) {
|
||||
@@ -589,6 +536,7 @@ async function doSubmit(): Promise<void> {
|
||||
isSubmitting.value = true;
|
||||
try {
|
||||
const payload: Customer = { ...formData };
|
||||
payload.storeId = currentStoreStore.currentStoreId;
|
||||
payload.conditioningPart = selectedAreas.value;
|
||||
payload.introducerCustomerId = introducerCustomerId.value || "";
|
||||
payload.attachmentList = buildAttachmentList();
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
<template>
|
||||
<div v-can="permissionCodes.customer.read" class="customer-list">
|
||||
<div class="filter bg-white">
|
||||
<t-dropdown-menu v-if="isGlobalManager" class="store">
|
||||
<t-dropdown-item
|
||||
v-model="selectedStoreId"
|
||||
:label="storeFilterLabel"
|
||||
:options="storeOptions"
|
||||
@change="selectStoreFilter"
|
||||
/>
|
||||
</t-dropdown-menu>
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="search"
|
||||
@@ -107,7 +99,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||
import { type Page, type PageResult, Time, Toolkit, useUserStore } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import GenderIcon from "@/components/GenderIcon.vue";
|
||||
@@ -132,28 +123,6 @@ const isExporting = ref(false);
|
||||
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
|
||||
const canReadTag = computed(() => userStore.hasPermissions(corePermissionCodes.tag.read));
|
||||
|
||||
// ---------- 门店筛选 ----------
|
||||
|
||||
const selectedStoreId = ref(currentStoreStore.currentStoreId);
|
||||
const storeOptions = computed(() => currentStoreStore.storeList
|
||||
.map(item => ({
|
||||
label: item.name || item.code || "未命名门店",
|
||||
value: item.id || ""
|
||||
}))
|
||||
.filter(item => item.value));
|
||||
const storeFilterLabel = computed(() => storeOptions.value.find(item => item.value === selectedStoreId.value)?.label || "选择门店");
|
||||
|
||||
async function selectStoreFilter(value: DropdownValue): Promise<void> {
|
||||
if (Array.isArray(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const storeId = String(value);
|
||||
selectedStoreId.value = storeId;
|
||||
currentStoreStore.selectStore(storeId);
|
||||
await refresh();
|
||||
}
|
||||
|
||||
// ---------- 标签筛选 ----------
|
||||
|
||||
const selectedTagList = ref<Tag[]>([]);
|
||||
@@ -196,7 +165,7 @@ const fetch = Toolkit.debounce(async () => {
|
||||
const result = await CustomerAPI.list({
|
||||
...page,
|
||||
keyword: keyword.value,
|
||||
storeId: selectedStoreId.value,
|
||||
storeId: currentStoreStore.currentStoreId,
|
||||
tagIdList: selectedTagIdList.value
|
||||
});
|
||||
pageResult.total = result.total;
|
||||
@@ -221,7 +190,6 @@ async function refresh(): Promise<void> {
|
||||
async function loadData(): Promise<void> {
|
||||
if (isGlobalManager.value) {
|
||||
await currentStoreStore.loadStoreList();
|
||||
selectedStoreId.value = currentStoreStore.currentStoreId;
|
||||
} else {
|
||||
await currentStoreStore.loadLoginStore();
|
||||
}
|
||||
@@ -254,7 +222,7 @@ onUnmounted(() => {
|
||||
async function toCreate(): Promise<void> {
|
||||
await router.push({
|
||||
path: "/management/customers/create",
|
||||
query: isGlobalManager.value && selectedStoreId.value ? { storeId: selectedStoreId.value } : undefined
|
||||
query: isGlobalManager.value && currentStoreStore.currentStoreId ? { storeId: currentStoreStore.currentStoreId } : undefined
|
||||
});
|
||||
}
|
||||
|
||||
@@ -291,13 +259,6 @@ async function doExport(): Promise<void> {
|
||||
box-shadow: var(--td-shadow-1);
|
||||
align-items: center;
|
||||
|
||||
.store {
|
||||
|
||||
&:after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(148, 163, 184, .28);
|
||||
|
||||
Reference in New Issue
Block a user