cancel sale order with fulfillment and fund record
This commit is contained in:
@@ -229,7 +229,6 @@
|
||||
<script setup lang="ts">
|
||||
import { TimeLabel, Text, Time } from "timi-web";
|
||||
import { type Attachment, useUserStore } from "timi-web-api";
|
||||
import FulfillmentAPI from "@/api/FulfillmentAPI";
|
||||
import SalesOrderAPI from "@/api/SalesOrderAPI";
|
||||
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
|
||||
import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
|
||||
@@ -258,7 +257,6 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
const order = ref<SalesOrder>();
|
||||
const hasPendingFulfillment = ref(false);
|
||||
const loading = ref(false);
|
||||
const isEditing = ref(false);
|
||||
const isSaving = ref(false);
|
||||
@@ -271,7 +269,9 @@ const canCreateFulfillment = computed(() => userStore.hasPermissions(permissionC
|
||||
const canReceive = computed(() => !!order.value && order.value.status !== "CANCELLED" && order.value.paymentStatus !== "PAID" && userStore.hasPermissions(permissionCodes.fundReceive.create));
|
||||
const canRefund = computed(() => !!order.value && order.value.status === "CANCELLED" && order.value.refundStatus === "PENDING" && userStore.hasPermissions(permissionCodes.fund.refund));
|
||||
const canConfirmNoRefund = computed(() => !!order.value && order.value.status === "CANCELLED" && order.value.refundStatus === "PENDING" && userStore.hasPermissions(permissionCodes.fund.refund));
|
||||
const canCancel = computed(() => !!order.value && order.value.status === "ACTIVE" && !hasPendingFulfillment.value && userStore.hasPermissions(permissionCodes.salesOrder.cancel));
|
||||
const canCancel = computed(() => !!order.value
|
||||
&& (order.value.status === "ACTIVE" || order.value.status === "FULFILLED")
|
||||
&& userStore.hasPermissions(permissionCodes.salesOrder.cancel));
|
||||
const canFulfillByPayment = computed(() => order.value?.paymentStatus === "PAID" || userStore.hasRoles(gaoRoleCodes.storeManager));
|
||||
|
||||
function toPhotoItems(attachmentList?: readonly Partial<Attachment>[]): PhotoItem[] {
|
||||
@@ -372,25 +372,12 @@ async function loadData(): Promise<void> {
|
||||
isEditing.value = false;
|
||||
if (!id) {
|
||||
order.value = undefined;
|
||||
hasPendingFulfillment.value = false;
|
||||
photoItems.value = [];
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
order.value = await SalesOrderAPI.detail(id);
|
||||
hasPendingFulfillment.value = false;
|
||||
if (userStore.hasPermissions(permissionCodes.orderFulfillment.read)) {
|
||||
try {
|
||||
const [pendingResult, waitingStockResult] = await Promise.all([
|
||||
FulfillmentAPI.list({ salesOrderId: id, status: "PENDING", index: 0, size: 1 }),
|
||||
FulfillmentAPI.list({ salesOrderId: id, status: "WAITING_STOCK", index: 0, size: 1 })
|
||||
]);
|
||||
hasPendingFulfillment.value = !!pendingResult.list?.length || !!waitingStockResult.list?.length;
|
||||
} catch {
|
||||
// 取消接口仍会在后端校验待处理履约,查询失败时不阻断订单详情展示。
|
||||
}
|
||||
}
|
||||
editRemark.value = order.value.remark || "";
|
||||
photoItems.value = toPhotoItems(order.value.attachmentList);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user