fix filter and navbar style
This commit is contained in:
@@ -8,49 +8,14 @@
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<div
|
||||
class="nav-actions"
|
||||
v-if="pageNavBarActionList.length"
|
||||
<t-button
|
||||
v-can="permissionCodes.pointRedeemSku.manage"
|
||||
>
|
||||
<t-popover
|
||||
v-model:visible="pageNavBarActionVisible"
|
||||
placement="bottom-right"
|
||||
:show-arrow="false"
|
||||
theme="light"
|
||||
>
|
||||
<t-button
|
||||
class="trigger"
|
||||
variant="text"
|
||||
:aria-label="'更多操作'"
|
||||
type="button"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="ellipsis" />
|
||||
</template>
|
||||
</t-button>
|
||||
<template #content>
|
||||
<div class="menu">
|
||||
<t-button
|
||||
v-for="action in pageNavBarActionList"
|
||||
:key="action.key"
|
||||
class="menu-item"
|
||||
variant="text"
|
||||
type="button"
|
||||
:theme="action.theme"
|
||||
:loading="action.loading"
|
||||
:disabled="action.disabled || action.loading"
|
||||
@click="handlePageNavBarAction(action)"
|
||||
>
|
||||
<template v-if="action.icon" #icon>
|
||||
<t-icon :name="action.icon" />
|
||||
</template>
|
||||
<span v-text="action.text" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-popover>
|
||||
</div>
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="新增"
|
||||
@click="toCreate"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.pointRedeemSku.manage" class="page-content scroll list">
|
||||
@@ -125,7 +90,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NavBarAction } from "@/types/NavBarAction";
|
||||
import { Toolkit } from "timi-web";
|
||||
import PointAPI from "@/api/PointAPI";
|
||||
import ProductSkuTags from "@/components/ProductSkuTags.vue";
|
||||
@@ -134,14 +98,6 @@ import { formatWanInteger } from "@/utils/money";
|
||||
import { getProductPhotoURL } from "@/utils/product";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
const pageNavBarActionVisible = ref(false);
|
||||
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref([{ key: "create", icon: "add", text: "新增兑换配置", theme: "primary", action: toCreate }]) as NavBarAction[]).filter(action => action.visible !== false));
|
||||
|
||||
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
|
||||
pageNavBarActionVisible.value = false;
|
||||
await action.action();
|
||||
}
|
||||
|
||||
import type { PointRedeemSku, PointRedeemSkuStatus } from "@/types/Point";
|
||||
|
||||
defineOptions({ name: "PointRedeemSkuList" });
|
||||
@@ -291,45 +247,4 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.nav-actions {
|
||||
--td-popover-padding: 0 .5rem;
|
||||
|
||||
width: 6rem;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
:deep(.t-popover__content) { border-radius: .875rem; }
|
||||
|
||||
.trigger { padding: 0; }
|
||||
|
||||
.menu {
|
||||
gap: .25rem;
|
||||
display: grid;
|
||||
padding: .5rem 0;
|
||||
min-width: 9rem;
|
||||
|
||||
.menu-item {
|
||||
--td-button-medium-height: 32px;
|
||||
--td-button-medium-padding-horizontal: 10px;
|
||||
|
||||
gap: .25rem;
|
||||
width: 100%;
|
||||
font-weight: unset;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
.nav-actions {
|
||||
:deep(.t-popover__content) {
|
||||
color: #e2e8f0;
|
||||
background: rgba(30, 41, 59, .98);
|
||||
}
|
||||
|
||||
.menu-item { color: #e2e8f0; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,49 +8,14 @@
|
||||
@left-click="$router.back()"
|
||||
>
|
||||
<template #right>
|
||||
<div
|
||||
class="nav-actions"
|
||||
v-if="pageNavBarActionList.length"
|
||||
<t-button
|
||||
v-can="permissionCodes.pointRedemption.create"
|
||||
>
|
||||
<t-popover
|
||||
v-model:visible="pageNavBarActionVisible"
|
||||
placement="bottom-right"
|
||||
:show-arrow="false"
|
||||
theme="light"
|
||||
>
|
||||
<t-button
|
||||
class="trigger"
|
||||
variant="text"
|
||||
:aria-label="'更多操作'"
|
||||
type="button"
|
||||
>
|
||||
<template #icon>
|
||||
<t-icon name="ellipsis" />
|
||||
</template>
|
||||
</t-button>
|
||||
<template #content>
|
||||
<div class="menu">
|
||||
<t-button
|
||||
v-for="action in pageNavBarActionList"
|
||||
:key="action.key"
|
||||
class="menu-item"
|
||||
variant="text"
|
||||
type="button"
|
||||
:theme="action.theme"
|
||||
:loading="action.loading"
|
||||
:disabled="action.disabled || action.loading"
|
||||
@click="handlePageNavBarAction(action)"
|
||||
>
|
||||
<template v-if="action.icon" #icon>
|
||||
<t-icon :name="action.icon" />
|
||||
</template>
|
||||
<span v-text="action.text" />
|
||||
</t-button>
|
||||
</div>
|
||||
</template>
|
||||
</t-popover>
|
||||
</div>
|
||||
theme="primary"
|
||||
variant="text"
|
||||
size="small"
|
||||
content="兑换"
|
||||
@click="toCreate"
|
||||
/>
|
||||
</template>
|
||||
</t-navbar>
|
||||
<main v-can="permissionCodes.pointRedemption.create" class="page-content scroll list">
|
||||
@@ -203,7 +168,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NavBarAction } from "@/types/NavBarAction";
|
||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||
import { Text, Time, Toolkit } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
@@ -217,14 +181,6 @@ import { getPackageQuantityText } from "@/utils/package";
|
||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
const pageNavBarActionVisible = ref(false);
|
||||
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref([{ key: "create", icon: "add", text: "客户兑换", theme: "primary", action: toCreate }]) as NavBarAction[]).filter(action => action.visible !== false));
|
||||
|
||||
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
|
||||
pageNavBarActionVisible.value = false;
|
||||
await action.action();
|
||||
}
|
||||
|
||||
import type { Customer } from "@/types/Customer";
|
||||
|
||||
defineOptions({ name: "PointRedemptionList" });
|
||||
@@ -516,45 +472,4 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.nav-actions {
|
||||
--td-popover-padding: 0 .5rem;
|
||||
|
||||
width: 6rem;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
:deep(.t-popover__content) { border-radius: .875rem; }
|
||||
|
||||
.trigger { padding: 0; }
|
||||
|
||||
.menu {
|
||||
gap: .25rem;
|
||||
display: grid;
|
||||
padding: .5rem 0;
|
||||
min-width: 9rem;
|
||||
|
||||
.menu-item {
|
||||
--td-button-medium-height: 32px;
|
||||
--td-button-medium-padding-horizontal: 10px;
|
||||
|
||||
gap: .25rem;
|
||||
width: 100%;
|
||||
font-weight: unset;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
.nav-actions {
|
||||
:deep(.t-popover__content) {
|
||||
color: #e2e8f0;
|
||||
background: rgba(30, 41, 59, .98);
|
||||
}
|
||||
|
||||
.menu-item { color: #e2e8f0; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -60,8 +60,16 @@
|
||||
@refresh="reload"
|
||||
@scrolltolower="load"
|
||||
>
|
||||
<div class="filter-menu">
|
||||
<t-dropdown-menu>
|
||||
<div class="filters">
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="keyword"
|
||||
type="search"
|
||||
borderless
|
||||
clearable
|
||||
placeholder="搜索积分规则名称"
|
||||
/>
|
||||
<t-dropdown-menu class="menus">
|
||||
<t-dropdown-item
|
||||
v-model="statusFilter"
|
||||
label="规则状态"
|
||||
@@ -118,6 +126,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { NavBarAction } from "@/types/NavBarAction";
|
||||
import { type DropdownValue } from "tdesign-mobile-vue";
|
||||
import { Toolkit } from "timi-web";
|
||||
import EventAPI from "@/api/EventAPI";
|
||||
import PointAPI from "@/api/PointAPI";
|
||||
import { useCurrentStoreStore } from "@/store/currentStoreStore";
|
||||
@@ -175,6 +184,7 @@ const actionList = computed<NavBarAction[]>(() => {
|
||||
});
|
||||
|
||||
const statusFilter = ref("ALL");
|
||||
const keyword = ref("");
|
||||
const statusOptions = [
|
||||
{ label: "全部状态", value: "ALL" },
|
||||
{ label: "草稿", value: "DRAFT" },
|
||||
@@ -205,19 +215,27 @@ const isLoading = ref(false);
|
||||
const isRefreshing = ref(false);
|
||||
const isNoMore = ref(false);
|
||||
let loadToken = 0;
|
||||
let reloadRequested = false;
|
||||
|
||||
const loadStateText = computed(() => {
|
||||
if (isLoading.value) {
|
||||
return "正在加载更多";
|
||||
}
|
||||
if (isNoMore.value) {
|
||||
return pageResult.list.length ? `共 ${pageResult.total} 条规则` : "";
|
||||
if (pageResult.list.length) {
|
||||
return `共 ${pageResult.total} 条规则`;
|
||||
}
|
||||
return keyword.value.trim() ? "未找到匹配积分规则" : "暂无积分规则";
|
||||
}
|
||||
return "上拉加载更多";
|
||||
});
|
||||
|
||||
async function reload(): Promise<void> {
|
||||
isRefreshing.value = true;
|
||||
if (isLoading.value) {
|
||||
reloadRequested = true;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
page.index = 0;
|
||||
pageResult.total = 0;
|
||||
@@ -251,14 +269,20 @@ async function load(): Promise<void> {
|
||||
} finally {
|
||||
if (token === loadToken) {
|
||||
isLoading.value = false;
|
||||
if (reloadRequested) {
|
||||
reloadRequested = false;
|
||||
await reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildRequest(): Page<PointRule> {
|
||||
const currentKeyword = keyword.value.trim();
|
||||
return {
|
||||
index: page.index,
|
||||
size: page.size,
|
||||
likesExample: currentKeyword ? { name: currentKeyword } : undefined,
|
||||
equalsExample: statusFilter.value === "ALL" ? undefined : {
|
||||
status: statusFilter.value as PointRuleStatus
|
||||
}
|
||||
@@ -269,6 +293,14 @@ function buildListOptions(): { storeId: string } {
|
||||
return { storeId: currentStoreStore.currentStoreId };
|
||||
}
|
||||
|
||||
const reloadByKeyword = Toolkit.debounce(async () => {
|
||||
await reload();
|
||||
}, false);
|
||||
|
||||
watch(keyword, () => {
|
||||
reloadByKeyword();
|
||||
});
|
||||
|
||||
// ---------- 事件名称 ----------
|
||||
|
||||
const eventList = ref<EventItem[]>([]);
|
||||
@@ -363,6 +395,10 @@ onMounted(async () => {
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
reloadByKeyword.cancel();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user