From 3698f7151f51f37e35212584b3ab9a86516fcf1d Mon Sep 17 00:00:00 2001 From: Timi Date: Sat, 5 Sep 2026 23:36:53 +0800 Subject: [PATCH] fix OrderFulfillmentList.vue style --- .../fulfillment/OrderFulfillmentCreate.vue | 84 +--------- .../fulfillment/OrderFulfillmentDetail.vue | 157 ++++++++++++++++-- .../fulfillment/OrderFulfillmentList.vue | 32 +++- src/types/Fulfillment.ts | 1 + 4 files changed, 172 insertions(+), 102 deletions(-) diff --git a/src/pages/fulfillment/OrderFulfillmentCreate.vue b/src/pages/fulfillment/OrderFulfillmentCreate.vue index d3d7cc7..0d2930d 100644 --- a/src/pages/fulfillment/OrderFulfillmentCreate.vue +++ b/src/pages/fulfillment/OrderFulfillmentCreate.vue @@ -1,7 +1,7 @@ @@ -111,7 +94,7 @@ import type { OrderFulfillmentItemRequest } from "@/types/Fulfillment"; import type { SalesOrder, SalesOrderItem } from "@/types/SalesOrder"; import type { PhotoItem } from "@/types/Photo"; import type { Attachment } from "timi-web-api"; -import { createPackageRequestNo, formatPackageAmount, getPackageQuantityText, normalizePackageQuantity } from "@/utils/package"; +import { createPackageRequestNo, getPackageQuantityText, normalizePackageQuantity } from "@/utils/package"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; import { permissionCodes } from "@/utils/permission"; @@ -134,16 +117,17 @@ const requestNo = ref(""); const isSaving = ref(false); const photoItems = ref([]); const photoUrlList = computed(() => photoItems.value.map(item => item.url)); -const orderPickerVisible = ref(false); -const orderLoading = ref(false); -const orderOptions = ref([]); const isPackage = computed(() => !!customerPackage.value); const sourceItems = computed(() => customerPackage.value?.itemList || order.value?.itemList || []); async function loadData(): Promise { const salesOrderId = String(route.query.salesOrderId || ""); const customerPackageId = String(route.query.customerPackageId || ""); - if (!salesOrderId) return; + if (!salesOrderId) { + Message.warning("请从订单详情或客户套餐详情进入履约创建"); + await router.replace("/management/order-fulfillments"); + return; + } try { order.value = await SalesOrderAPI.detail(salesOrderId); if (customerPackageId) customerPackage.value = await PackageAPI.customerPackageDetail(customerPackageId); @@ -191,7 +175,7 @@ function buildAttachments(): Partial[] { function validate(): boolean { if (!order.value?.id) { - Message.warning("请先从订单详情进入履约创建"); + Message.warning("请从订单详情或客户套餐详情进入履约创建"); return false; } if (!buildAttachments().length) { @@ -240,46 +224,6 @@ async function save(): Promise { } } -async function openOrderPicker(): Promise { - if (order.value?.id) { - await router.push({ - path: `/management/sales-orders/${order.value.id}`, - query: { transitionDepth: String(getCurrentRouteDepth() + 1) } - }); - return; - } - orderPickerVisible.value = true; - if (orderOptions.value.length) return; - orderLoading.value = true; - try { - const result = await SalesOrderAPI.list({ index: 0, size: 100, orderType: "DIRECT_PRODUCT", status: "ACTIVE" }); - orderOptions.value = result.list || []; - } catch (error) { - Message.error(getErrorMessage(error, "可履约订单加载失败")); - } finally { - orderLoading.value = false; - } -} - -async function selectOrder(item: SalesOrder): Promise { - if (!item.id) return; - order.value = item; - orderPickerVisible.value = false; - for (const key of Object.keys(quantityMap)) delete quantityMap[key]; - await router.replace({ query: { salesOrderId: item.id } }); -} - -function getCurrentRouteDepth(): number { - const transitionDepth = Array.isArray(route.query.transitionDepth) - ? route.query.transitionDepth[0] - : route.query.transitionDepth; - const depth = Number(transitionDepth); - if (transitionDepth && Number.isInteger(depth) && 0 <= depth && depth <= 20) { - return depth; - } - return Number(route.meta.depth ?? 0); -} - onMounted(async () => { navBarStore.setRightText("提交", "var(--td-brand-color)", save); await loadData(); @@ -347,15 +291,5 @@ onUnmounted(() => navBarStore.clearRight()); text-align: center; } - .order-picker { - height: 100%; - overflow: auto; - padding: 1rem 0; - } - - .picker-title { - padding: 0 1rem 1rem; - font-weight: 700; - } } diff --git a/src/pages/fulfillment/OrderFulfillmentDetail.vue b/src/pages/fulfillment/OrderFulfillmentDetail.vue index 49fa56e..11f37ea 100644 --- a/src/pages/fulfillment/OrderFulfillmentDetail.vue +++ b/src/pages/fulfillment/OrderFulfillmentDetail.vue @@ -2,32 +2,82 @@
@@ -66,7 +116,7 @@ diff --git a/src/pages/fulfillment/OrderFulfillmentList.vue b/src/pages/fulfillment/OrderFulfillmentList.vue index 056954f..977f52d 100644 --- a/src/pages/fulfillment/OrderFulfillmentList.vue +++ b/src/pages/fulfillment/OrderFulfillmentList.vue @@ -48,6 +48,7 @@ import NavBarActionMenu from "@/components/NavBarActionMenu.vue"; import OrderFulfillmentListCell from "@/pages/fulfillment/components/OrderFulfillmentListCell.vue"; import { useNavBarStore } from "@/store/navBarStore"; import type { FulfillmentStatus, FulfillmentType, OrderFulfillment } from "@/types/Fulfillment"; +import type { NavBarAction } from "@/types/NavBarAction"; import { getErrorMessage } from "@/utils/error"; import { Message } from "@/utils/message"; import { permissionCodes } from "@/utils/permission"; @@ -59,13 +60,22 @@ const router = useRouter(); const navBarStore = useNavBarStore(); const userStore = useUserStore(); const canCreate = computed(() => userStore.hasPermissions(permissionCodes.orderFulfillment.create)); -const actions = computed(() => canCreate.value ? [{ - key: "create", - text: "创建履约单", - icon: "add", - theme: "primary" as const, - action: toCreate -}] : []); +const actions = computed(() => [ + { + key: "by-order", + text: "通过订单创建", + icon: "task", + theme: "primary", + action: toSalesOrderList + }, + { + key: "by-package", + text: "通过套餐创建", + icon: "gift", + theme: "primary", + action: toCustomerPackageList + } +]); const type = ref<"ALL" | FulfillmentType>("ALL"); const status = ref<"ALL" | FulfillmentStatus>(getInitialStatus(route.query.status)); const list = ref([]); @@ -172,8 +182,12 @@ async function toDetail(item: OrderFulfillment): Promise { } } -async function toCreate(): Promise { - await router.push("/management/order-fulfillments/create"); +async function toSalesOrderList(): Promise { + await router.push({ name: "SalesOrderList" }); +} + +async function toCustomerPackageList(): Promise { + await router.push({ name: "CustomerPackageList" }); } function getCurrentRouteDepth(): number { diff --git a/src/types/Fulfillment.ts b/src/types/Fulfillment.ts index 651f4fc..27b59d9 100644 --- a/src/types/Fulfillment.ts +++ b/src/types/Fulfillment.ts @@ -8,6 +8,7 @@ export type OrderFulfillmentItem = { fulfillmentId?: string; productId?: string; productUnitId?: string; + attachmentList?: Attachment[]; sourceOrderItemId?: string; sourceCustomerPackageItemId?: string; quantity?: number | string;