add ProductTab

This commit is contained in:
Timi
2026-09-02 12:56:22 +08:00
parent 551bb149fd
commit f3602f232d
7 changed files with 185 additions and 84 deletions
+106
View File
@@ -0,0 +1,106 @@
<template>
<div class="product-tab">
<t-notice-bar
theme="error"
visible
content="产品库设计方案及实现未完成,套餐功能仍在测试中,可以试用反馈可改进问题,但不要实际落到业务使用。产品库实现后套餐模块会联动更新,会清除测试的套餐数据"
/>
<t-cell-group
v-for="(group, index) in visibleMenuGroupList"
:key="group.title"
:title="group.title"
theme="card"
v-entrance-transition="index * 70"
>
<t-cell
v-for="item in group.items"
:key="item.path"
class="item"
:title="item.title"
arrow
hover
@click="go(item.path)"
>
<template #leftIcon>
<t-icon :name="item.icon" size="1.75rem" />
</template>
</t-cell>
</t-cell-group>
</div>
</template>
<script setup lang="ts">
import { useUserStore } from "timi-web-api";
import { permissionCodes } from "@/utils/permission";
type MenuItem = {
icon: string;
path: string;
title: string;
visible: boolean;
};
type MenuGroup = {
items: MenuItem[];
title: string;
};
defineOptions({
name: "ProductTab"
});
const router = useRouter();
const userStore = useUserStore();
const menuGroupList = computed<MenuGroup[]>(() => [
{
title: "套餐",
items: [
{
icon: "layers",
path: "/management/package-configs",
title: "套餐配置",
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
},
{
icon: "order-list",
path: "/management/customer-packages",
title: "客户套餐",
visible: userStore.hasPermissions(permissionCodes.customerPackage.read)
},
{
icon: "upload",
path: "/management/package-deliveries",
title: "发放记录",
visible: userStore.hasPermissions(permissionCodes.packageDelivery.read)
},
{
icon: "money",
path: "/management/fund-records",
title: "资金流水",
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
}
]
}
]);
const visibleMenuGroupList = computed<MenuGroup[]>(() => menuGroupList.value
.map(group => ({
...group,
items: group.items.filter(item => item.visible)
}))
.filter(group => group.items.length));
async function go(path: string): Promise<void> {
await router.push(path);
}
</script>
<style scoped lang="less">
.product-tab {
gap: .5rem;
display: flex;
padding: calc(var(--app-nav-height)) 0 6rem;
flex-direction: column;
}
</style>
-29
View File
@@ -196,35 +196,6 @@ const menuGroupList = computed<MenuGroup[]>(() => [
}
]
},
{
title: "套餐",
items: [
{
icon: "layers",
path: "/management/package-configs",
title: "套餐配置",
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
},
{
icon: "order-list",
path: "/management/customer-packages",
title: "客户套餐",
visible: userStore.hasPermissions(permissionCodes.customerPackage.read)
},
{
icon: "upload",
path: "/management/package-deliveries",
title: "发放记录",
visible: userStore.hasPermissions(permissionCodes.packageDelivery.read)
},
{
icon: "money",
path: "/management/fund-records",
title: "资金流水",
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
}
]
},
{
title: "系统",
items: [
+49 -50
View File
@@ -1,53 +1,53 @@
<template>
<div class="store-tab">
<section v-entrance-transition v-if="canViewStore || canManageStore" class="store-header">
<t-cell-group class="store-card" theme="card">
<t-cell
v-if="canViewStore"
class="info"
:title="currentStoreStore.currentStoreName"
:description="currentStore?.address"
/>
<t-cell
v-if="canSelectStore"
class="action"
title="切换门店"
note="选择使用门店"
arrow
hover
@click="openStorePicker"
>
<template #leftIcon>
<t-icon name="swap" />
</template>
</t-cell>
<t-cell
v-if="canManageStore"
class="action"
title="门店管理"
note="管理门店资料和营业日"
arrow
hover
@click="goStoreManagement"
>
<template #leftIcon>
<t-icon name="shop-3" />
</template>
</t-cell>
<t-cell
v-if="canManageStoreDiary"
class="action"
title="门店日记"
note="记录门店经营和护理过程"
arrow
hover
@click="goStoreDiaryManagement"
>
<template #leftIcon>
<t-icon name="file" />
</template>
</t-cell>
</t-cell-group>
<section v-entrance-transition v-if="canViewStore || canManageStore" class="store-header">
<t-cell-group class="store-card" theme="card">
<t-cell
v-if="canViewStore"
class="info"
:title="currentStoreStore.currentStoreName"
:description="currentStore?.address"
/>
<t-cell
v-if="canSelectStore"
class="action"
title="切换门店"
note="选择使用门店"
arrow
hover
@click="openStorePicker"
>
<template #leftIcon>
<t-icon name="swap" />
</template>
</t-cell>
<t-cell
v-if="canManageStore"
class="action"
title="门店管理"
note="管理门店资料和营业日"
arrow
hover
@click="goStoreManagement"
>
<template #leftIcon>
<t-icon name="shop-3" />
</template>
</t-cell>
<t-cell
v-if="canManageStoreDiary"
class="action"
title="门店日记"
note="记录门店经营和护理过程"
arrow
hover
@click="goStoreDiaryManagement"
>
<template #leftIcon>
<t-icon name="file" />
</template>
</t-cell>
</t-cell-group>
</section>
<store-data-charts :key="`${currentStoreStore.currentStoreId}-${chartRefreshKey}`" />
<t-popup v-model="storePickerVisible" placement="bottom">
@@ -93,8 +93,7 @@ const canManageStore = computed(() => userStore.hasRoles([
gaoRoleCodes.storeManager
], "or") && userStore.hasPermissions(permissionCodes.store.read));
const canManageStoreDiary = computed(() => userStore.hasRoles(gaoRoleCodes.storeManager)
&& !userStore.hasRoles(gaoRoleCodes.globalManager)
&& userStore.hasPermissions(permissionCodes.storeDiary.read));
&& userStore.hasPermissions(permissionCodes.storeDiary.create));
// ---------- 门店切换 ----------