183 lines
4.2 KiB
Vue
183 lines
4.2 KiB
Vue
<template>
|
|
<t-navbar fixed :z-index="20" title="产品" />
|
|
<main class="page-content scroll column product-tab">
|
|
<t-cell-group
|
|
v-for="(group, index) in visibleMenuGroupList"
|
|
:key="group.title"
|
|
class="menu-group"
|
|
:title="group.title"
|
|
theme="card"
|
|
v-entrance-transition
|
|
>
|
|
<t-cell
|
|
v-for="item in group.items"
|
|
:key="item.path"
|
|
class="menu-item"
|
|
:title="item.title"
|
|
arrow
|
|
hover
|
|
@click="go(item.path)"
|
|
>
|
|
<template #leftIcon>
|
|
<span class="icon-wrap" :class="`tone-${index}`"><t-icon :name="item.icon" size="1.35rem" /></span>
|
|
</template>
|
|
</t-cell>
|
|
</t-cell-group>
|
|
<center-tips v-if="!visibleMenuGroupList.length" :content="'当前账号暂无产品管理权限'" />
|
|
</main>
|
|
</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: "catalog",
|
|
path: "/management/product-categories",
|
|
title: "产品分类",
|
|
visible: userStore.hasPermissions(permissionCodes.productCategory.read)
|
|
},
|
|
{
|
|
icon: "control-platform",
|
|
path: "/management/products",
|
|
title: "产品库",
|
|
visible: userStore.hasPermissions(permissionCodes.product.read)
|
|
},
|
|
{
|
|
icon: "wallet",
|
|
path: "/management/product-stocks",
|
|
title: "库存",
|
|
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
|
},
|
|
{
|
|
icon: "history",
|
|
path: "/management/product-stock-records",
|
|
title: "库存流水",
|
|
visible: userStore.hasPermissions(permissionCodes.productStock.read)
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: "交易管理",
|
|
items: [
|
|
{
|
|
icon: "task",
|
|
path: "/management/sales-orders",
|
|
title: "销售订单",
|
|
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
|
},
|
|
{
|
|
icon: "wallet",
|
|
path: "/management/fund-records",
|
|
title: "资金流水",
|
|
visible: userStore.hasPermissions(permissionCodes.fundRecord.read)
|
|
},
|
|
{
|
|
icon: "undertake-delivery",
|
|
path: "/management/order-fulfillments",
|
|
title: "履约记录",
|
|
visible: userStore.hasPermissions(permissionCodes.orderFulfillment.read)
|
|
},
|
|
{
|
|
icon: "money",
|
|
path: "/management/consumption-records",
|
|
title: "消费记录",
|
|
visible: userStore.hasPermissions(permissionCodes.salesOrder.read)
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: "套餐管理",
|
|
items: [
|
|
{
|
|
icon: "layers",
|
|
path: "/management/package-configs",
|
|
title: "套餐配置",
|
|
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
|
},
|
|
{
|
|
icon: "task",
|
|
path: "/management/package-orders",
|
|
title: "套餐订单",
|
|
visible: userStore.hasPermissions(permissionCodes.packageConfig.read)
|
|
&& userStore.hasPermissions(permissionCodes.salesOrder.read)
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: "积分兑换",
|
|
items: [
|
|
{
|
|
icon: "cart",
|
|
path: "/management/points/redeem-skus",
|
|
title: "兑换商品",
|
|
visible: userStore.hasPermissions(permissionCodes.pointRedeemSku.manage)
|
|
},
|
|
{
|
|
icon: "gift",
|
|
path: "/management/points/redemptions",
|
|
title: "积分兑换",
|
|
visible: userStore.hasPermissions(permissionCodes.pointRedemption.create)
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: "经营分析",
|
|
items: [
|
|
{
|
|
icon: "chart-analytics",
|
|
path: "/management/product-data-charts",
|
|
title: "产品经营图表",
|
|
visible: userStore.hasPermissions(permissionCodes.stat.read)
|
|
},
|
|
{
|
|
icon: "chart-combo",
|
|
path: "/management/order-data-charts",
|
|
title: "客户经营图表",
|
|
visible: userStore.hasPermissions(permissionCodes.stat.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;
|
|
}
|
|
</style>
|