add wait revoke

This commit is contained in:
Timi
2026-09-09 15:50:01 +08:00
parent 87feba0343
commit a76f423763
@@ -28,6 +28,14 @@
:theme="getStatusTheme(props.order.status)"
/>
<t-tag
v-if="isCancelledPendingRefund"
content="待退款"
:theme="getStatusTheme(props.order.refundStatus)"
size="small"
variant="light-outline"
/>
<t-tag
v-else
:content="getSalesPaymentStatusText(props.order.paymentStatus)"
:theme="getPaymentStatusTheme(props.order.paymentStatus)"
size="small"
@@ -64,7 +72,7 @@
</div>
<div class="actions" @click.stop>
<t-popover
v-if="props.canCancel"
v-if="showMoreActionMenu"
v-model:visible="moreVisible"
placement="bottom-left"
theme="light"
@@ -76,8 +84,9 @@
content="更多"
/>
<template #content>
<div class="menu">
<div class="more-menu">
<t-button
v-if="props.canCancel"
class="item"
size="extra-small"
variant="text"
@@ -86,6 +95,25 @@
:disabled="!canCancelOrder"
@click="handleCancel"
>取消订单</t-button>
<t-divider />
<t-button
v-if="showRefundActions"
class="item"
size="extra-small"
variant="text"
theme="danger"
type="button"
@click="handleRefund"
>登记退款</t-button>
<t-divider />
<t-button
v-if="showRefundActions"
class="item"
size="extra-small"
variant="text"
type="button"
@click="handleConfirmNoRefund"
>确认无需退款</t-button>
</div>
</template>
</t-popover>
@@ -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<SalesOrder["itemList"]>[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<SalesOrder["itemList"]>[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%;