add ProductTab
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user