杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -31,6 +31,23 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="admin-filter-bar">
|
||||
<a-select v-model:value="shopFilter" allow-clear placeholder="所属店铺" style="width: 180px" @change="handleSearch">
|
||||
<a-select-option v-for="shop in shops" :key="shop.id" :value="shop.id">
|
||||
{{ shop.shopName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-select v-model:value="tagFilter" allow-clear placeholder="标签" style="width: 160px" @change="handleSearch">
|
||||
<a-select-option v-for="tag in tags" :key="tag.id" :value="tag.id">
|
||||
{{ tag.tagName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input-number v-model:value="minPriceFilter" :min="0" placeholder="最低价" style="width: 120px" @pressEnter="handleSearch" />
|
||||
<a-input-number v-model:value="maxPriceFilter" :min="0" placeholder="最高价" style="width: 120px" @pressEnter="handleSearch" />
|
||||
<a-range-picker v-model:value="createdRange" value-format="YYYY-MM-DD HH:mm:ss" show-time @change="handleSearch" />
|
||||
<a-button @click="resetFilters">重置筛选</a-button>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
v-if="!isMobile"
|
||||
:columns="columns"
|
||||
@@ -514,6 +531,11 @@ const { isMobile } = useAdminViewport()
|
||||
const loading = ref(false)
|
||||
/** searchText is a reactive state variable used by the template and event handlers. */
|
||||
const searchText = ref('')
|
||||
const shopFilter = ref<IdType | undefined>()
|
||||
const tagFilter = ref<IdType | undefined>()
|
||||
const minPriceFilter = ref<number | undefined>()
|
||||
const maxPriceFilter = ref<number | undefined>()
|
||||
const createdRange = ref<[string, string] | undefined>()
|
||||
const productList = ref<Product[]>([])
|
||||
/** modalVisible is a reactive state variable used by the template and event handlers. */
|
||||
const modalVisible = ref(false)
|
||||
@@ -836,7 +858,13 @@ const fetchProductList = async () => {
|
||||
const params: any = {
|
||||
page: pagination.current,
|
||||
size: pagination.pageSize,
|
||||
keyword: searchText.value
|
||||
keyword: searchText.value,
|
||||
shopId: shopFilter.value,
|
||||
tagId: tagFilter.value,
|
||||
minPrice: minPriceFilter.value,
|
||||
maxPrice: maxPriceFilter.value,
|
||||
createdFrom: createdRange.value?.[0],
|
||||
createdTo: createdRange.value?.[1]
|
||||
}
|
||||
|
||||
if (currentUser && currentUser.type !== 4 && currentUser.shopId) {
|
||||
@@ -864,6 +892,16 @@ const fetchProductList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const resetFilters = () => {
|
||||
searchText.value = ''
|
||||
shopFilter.value = undefined
|
||||
tagFilter.value = undefined
|
||||
minPriceFilter.value = undefined
|
||||
maxPriceFilter.value = undefined
|
||||
createdRange.value = undefined
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
/** loadImageUrls is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadImageUrls = async (products: Product[], requestToken?: number) => {
|
||||
const nextImageUrls: Record<string, string[]> = {}
|
||||
@@ -1495,4 +1533,11 @@ watch(() => formState.shopId, (newShopId) => {
|
||||
.coupon-actions {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.admin-filter-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user