update customer package

This commit is contained in:
Timi
2026-09-07 16:42:12 +08:00
parent d56719df1c
commit ab47086ed7
3 changed files with 67 additions and 10 deletions
+23 -9
View File
@@ -59,7 +59,7 @@
<div class="center-tips" v-text="loading ? '正在加载' : noMore ? '已经到底了' : '上拉加载更多'" />
</t-pull-down-refresh>
</div>
<nav-bar-action-menu v-if="canCreate" :actions="actions" />
<nav-bar-action-menu v-if="actions.length" :actions="actions" />
</template>
<script setup lang="ts">
@@ -81,16 +81,26 @@ const router = useRouter();
const navBarStore = useNavBarStore();
const userStore = useUserStore();
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.salesOrder.create));
const canCreatePackageOrder = computed(() => userStore.hasPermissions(permissionCodes.customerPackage.create));
const canReceive = computed(() => userStore.hasPermissions(permissionCodes.fundReceive.create));
const canCreateFulfillment = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.create));
const canOperateStock = computed(() => userStore.hasPermissions(permissionCodes.productStock.create));
const actions = computed(() => canCreate.value ? [{
key: "create",
text: "直接产品下单",
icon: "add",
theme: "primary" as const,
action: toCreate
}] : []);
const actions = computed(() => [
...(canCreate.value ? [{
key: "create",
text: "直接产品下单",
icon: "add",
theme: "primary" as const,
action: toCreate
}] : []),
...(canCreatePackageOrder.value ? [{
key: "create-package-order",
text: "创建客户套餐",
icon: "add-circle",
theme: "primary" as const,
action: toCreatePackageOrder
}] : [])
]);
const keyword = ref("");
const customerId = ref("");
const orderType = ref("ALL");
@@ -225,6 +235,10 @@ async function toCreate(): Promise<void> {
await router.push("/management/sales-orders/create");
}
async function toCreatePackageOrder(): Promise<void> {
await router.push("/management/customer-packages/create");
}
const search = Toolkit.debounce(async () => {
try {
await fetchList(true);
@@ -239,7 +253,7 @@ watch(routeFilterKey, async () => {
});
onMounted(async () => {
navBarStore.clearRight();
navBarStore.setCustomRightVisible(canCreate.value);
navBarStore.setCustomRightVisible(!!actions.value.length);
applyRouteFilters();
try { await fetchList(true); } catch (error) { Message.error(getErrorMessage(error, "销售订单加载失败")); }
});