feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
+130
@@ -0,0 +1,130 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewCloseFulfillmentDialog.vue
|
||||
用途:关闭行级或剩余开放行的履约决定确认弹窗(原因必填)。
|
||||
依赖:vue-i18n、closeWorkspaceShippingOrderReviewLineFulfillment、showReviewResumeOutcome。
|
||||
逻辑:父级传入 lineKeys;空数组表示关闭全部剩余开放行;成功后 emit confirmed。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError, resolveLocalizedErrorMessage } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { closeWorkspaceShippingOrderReviewLineFulfillment } from '@/features/chat/api/shipping.api';
|
||||
import { showReviewResumeOutcome } from '@/features/chat/shipping-review/showReviewResumeOutcome';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
caseNo: string;
|
||||
draftVersion: number | null | undefined;
|
||||
lineKeys: string[];
|
||||
closeAllRemaining?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:open': [value: boolean];
|
||||
confirmed: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const reason = ref('');
|
||||
const busy = ref(false);
|
||||
|
||||
const title = computed(() => (
|
||||
props.closeAllRemaining || !props.lineKeys.length
|
||||
? t('chat.shippingOrderReview.closeFulfillment.titleAll')
|
||||
: t('chat.shippingOrderReview.closeFulfillment.titleSelected', { count: props.lineKeys.length })
|
||||
));
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(isOpen) => {
|
||||
if (!isOpen) {
|
||||
reason.value = '';
|
||||
busy.value = false;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* 提交关闭履约行决定。
|
||||
*/
|
||||
async function onConfirm() {
|
||||
const trimmed = reason.value.trim();
|
||||
if (!trimmed || !props.caseNo || busy.value) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
const result = await closeWorkspaceShippingOrderReviewLineFulfillment(props.caseNo, {
|
||||
reason: trimmed,
|
||||
line_keys: props.lineKeys.length ? props.lineKeys : undefined,
|
||||
expected_draft_version: props.draftVersion ?? undefined,
|
||||
});
|
||||
showReviewResumeOutcome(
|
||||
result.resume_outcome,
|
||||
msg,
|
||||
t,
|
||||
t('chat.shippingOrderReview.closeFulfillment.success'),
|
||||
);
|
||||
emit('update:open', false);
|
||||
emit('confirmed');
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof BusinessError
|
||||
? resolveLocalizedErrorMessage(error.code, error.message)
|
||||
: (error instanceof Error ? error.message : t('chat.shippingOrderReview.closeFulfillment.failed'));
|
||||
msg.warning(message);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消并关闭弹窗。
|
||||
*/
|
||||
function onCancel() {
|
||||
emit('update:open', false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
|
||||
data-testid="review-close-fulfillment-dialog"
|
||||
@click.self="onCancel"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-xl border border-slate-200 bg-white p-4 shadow-xl dark:border-slate-800 dark:bg-slate-900">
|
||||
<h2 class="text-sm font-semibold">{{ title }}</h2>
|
||||
<p class="mt-1 text-xs text-muted">{{ t('chat.shippingOrderReview.closeFulfillment.subtitle') }}</p>
|
||||
<label class="mt-3 block text-xs font-medium text-secondary">
|
||||
{{ t('chat.shippingOrderReview.closeFulfillment.reasonLabel') }}
|
||||
<textarea
|
||||
v-model="reason"
|
||||
rows="3"
|
||||
class="mt-1 w-full rounded-md border border-default bg-surface px-2.5 py-2 text-sm"
|
||||
data-testid="review-close-fulfillment-reason"
|
||||
:placeholder="t('chat.shippingOrderReview.closeFulfillment.reasonPlaceholder')"
|
||||
:disabled="busy"
|
||||
/>
|
||||
</label>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-default px-3 py-1.5 text-sm hover:bg-surface-soft disabled:opacity-50"
|
||||
:disabled="busy"
|
||||
@click="onCancel"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.workbench.close') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded bg-rose-600 px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50"
|
||||
data-testid="review-close-fulfillment-submit"
|
||||
:disabled="busy || !reason.trim()"
|
||||
@click="onConfirm"
|
||||
>
|
||||
{{ busy ? t('chat.shippingOrderReview.closeFulfillment.closing') : t('chat.shippingOrderReview.closeFulfillment.confirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user