diff --git a/src/pages/salesOrder/components/SalesOrderListCell.vue b/src/pages/salesOrder/components/SalesOrderListCell.vue index 0d65504..b761ad7 100644 --- a/src/pages/salesOrder/components/SalesOrderListCell.vue +++ b/src/pages/salesOrder/components/SalesOrderListCell.vue @@ -28,6 +28,14 @@ :theme="getStatusTheme(props.order.status)" /> +
@@ -127,6 +155,7 @@ const props = defineProps<{ canReceive: boolean; canFulfill: boolean; canCancel: boolean; + canRefund: boolean; canStoreManager: boolean; }>(); const emit = defineEmits<{ @@ -134,6 +163,8 @@ const emit = defineEmits<{ cancel: []; receive: []; fulfill: []; + refund: []; + confirmNoRefund: []; }>(); const moreVisible = ref(false); const itemList = computed(() => props.order.itemList || []); @@ -142,8 +173,10 @@ const avatarText = computed(() => customerName.value.slice(0, 1) || "客"); const photoURL = computed(() => getCustomerPhotoURL(props.order.customer, 64)); const orderNoText = computed(() => `订单号:${props.order.orderNo || props.order.id || "未知"}`); const totalProductQuantity = computed(() => sumProductQuantity("quantity")); -const fulfilledProductQuantity = computed(() => sumProductQuantity("fulfilledBaseQuantity")); const productSummaryText = computed(() => `共 ${itemList.value.length} 项 · 订单数量 ${totalProductQuantity.value}`); +const isCancelledPendingRefund = computed(() => props.order.status === "CANCELLED" && props.order.refundStatus === "PENDING"); +const showRefundActions = computed(() => props.canRefund && isCancelledPendingRefund.value); +const showMoreActionMenu = computed(() => props.canCancel || showRefundActions.value); const showReceiveAction = computed(() => props.canReceive && props.order.status !== "CANCELLED" && props.order.paymentStatus !== "PAID"); const canCancelOrder = computed(() => props.order.status === "ACTIVE"); const canFulfillByPayment = computed(() => props.order.paymentStatus === "PAID" || props.canStoreManager); @@ -157,6 +190,22 @@ function handleCancel(): void { emit("cancel"); } +function handleRefund(): void { + if (!showRefundActions.value || !props.order.id) { + return; + } + moreVisible.value = false; + emit("refund"); +} + +function handleConfirmNoRefund(): void { + if (!showRefundActions.value || !props.order.id) { + return; + } + moreVisible.value = false; + emit("confirmNoRefund"); +} + function getPaymentStatusTheme(status?: GaoSalesPaymentStatus): "success" | "warning" | "danger" | "default" { if (status === "PAID") { return "success"; @@ -303,22 +352,12 @@ function getProductText(item: NonNullable[number]): stri justify-content: end; :deep(.t-popover__content) { - padding: .5rem 1rem; + padding: .25rem .5rem; border-radius: .875rem; } .more { font-weight: normal; - - .menu { - padding: 0 .5rem; - min-width: 7rem; - - .item { - width: 100%; - justify-content: flex-start; - } - } } .detail { @@ -328,6 +367,21 @@ function getProductText(item: NonNullable[number]): stri } } +.more-menu { + --td-divider-color: var(--td-gray-color-2); + + padding: 0; + display: flex; + flex-direction: column; + + .item { + width: 100%; + padding: 0 .5rem; + font-weight: normal; + justify-content: flex-start; + } +} + :deep(.sales-order-cell .avatar .t-image__img) { width: 100%; height: 100%;