feat(shipping-notice): 新增发货批次和任务管理功能,支持批次创建与任务处理
This commit is contained in:
1 parent
457f0f4e5e
commit
634dee4b81
81 files changed
+9088
-3625
No files matched your search
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* features/chat/components/ChatViewContent.vue
|
||||
* 对话页主区域:侧栏、消息列表、输入栏与内置浏览器。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Loader2 } from 'lucide-vue-next';
|
||||
import ChatShell from '@/shared/layouts/ChatShell.vue';
|
||||
import ChatSidebar from '@/features/chat/components/ChatSidebar.vue';
|
||||
@@ -10,9 +12,68 @@ import ChatInputBar from '@/features/chat/components/ChatInputBar.vue';
|
||||
import ChatMessageList from '@/features/chat/components/ChatMessageList.vue';
|
||||
import ChatMobileHeader from '@/features/chat/components/ChatMobileHeader.vue';
|
||||
import ChatBrowserPanel from '@/features/chat/components/ChatBrowserPanel.vue';
|
||||
import ShippingWorkflowStepper from '@/features/chat/components/ShippingWorkflowStepper.vue';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
import { buildShippingWorkflowSteps } from '@/features/chat/shipping';
|
||||
import type { ShippingTaskSummary } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const page = useChatPageContext();
|
||||
const { t } = useI18n();
|
||||
|
||||
const statusMeta = (status?: string | null) => {
|
||||
const map: Record<string, { label: string; chip: string }> = {
|
||||
created: { label: t('chat.shippingNoticeUi.status.created'), chip: 'bg-slate-100 text-slate-700' },
|
||||
waiting_inventory: { label: t('chat.shippingNoticeUi.status.waitingInventory'), chip: 'bg-amber-100 text-amber-700' },
|
||||
inventory_ready: { label: t('chat.shippingNoticeUi.status.inventoryReady'), chip: 'bg-sky-100 text-sky-700' },
|
||||
matched: { label: t('chat.shippingNoticeUi.status.matched'), chip: 'bg-emerald-100 text-emerald-700' },
|
||||
waiting_upload: { label: t('chat.shippingNoticeUi.status.waitingUpload'), chip: 'bg-orange-100 text-orange-700' },
|
||||
uploaded: { label: t('chat.shippingNoticeUi.status.uploaded'), chip: 'bg-emerald-100 text-emerald-700' },
|
||||
upload_failed: { label: t('chat.shippingNoticeUi.status.uploadFailed'), chip: 'bg-rose-100 text-rose-700' },
|
||||
rejected: { label: t('chat.shippingNoticeUi.status.rejected'), chip: 'bg-rose-100 text-rose-700' },
|
||||
closed: { label: t('chat.shippingNoticeUi.status.closed'), chip: 'bg-slate-100 text-slate-700' },
|
||||
};
|
||||
return map[String(status || '').trim()] || { label: String(status || t('chat.shippingNoticeUi.processing')), chip: 'bg-slate-100 text-slate-700' };
|
||||
};
|
||||
|
||||
const stepLabel = (step?: string | null) => {
|
||||
const map: Record<string, string> = {
|
||||
step1_notice_submit: t('chat.shippingNoticeUi.currentStep.noticeParse'),
|
||||
step2_inventory_prepare: t('chat.shippingNoticeUi.currentStep.inventoryPrepare'),
|
||||
step3_inventory_match: t('chat.shippingNoticeUi.currentStep.inventoryMatch'),
|
||||
step4_shortage_review: t('chat.shippingNoticeUi.currentStep.shortageHandle'),
|
||||
step5_export_excel: t('chat.shippingNoticeUi.currentStep.generateExcel'),
|
||||
step6_upload_freight: t('chat.shippingNoticeUi.currentStep.uploadFreight'),
|
||||
step7_finish: t('chat.shippingNoticeUi.currentStep.finishArchive'),
|
||||
};
|
||||
return map[String(step || '').trim()] || t('chat.shippingNoticeUi.processing');
|
||||
};
|
||||
|
||||
const currentShippingTask = computed<ShippingTaskSummary | null>(() => {
|
||||
const focusTaskNo = String(page.shippingBatchSummary?.current_focus_task_no || '').trim();
|
||||
if (!focusTaskNo || !Array.isArray(page.shippingBatchTasks)) return null;
|
||||
return page.shippingBatchTasks.find((task: ShippingTaskSummary) => task.task_no === focusTaskNo) || null;
|
||||
});
|
||||
|
||||
const currentShippingTaskSource = computed(() => currentShippingTask.value || page.activeShippingTaskDetail || null);
|
||||
const currentShippingSteps = computed(() => buildShippingWorkflowSteps(currentShippingTaskSource.value));
|
||||
const currentShippingBatchProgress = computed(() => {
|
||||
const task = currentShippingTask.value;
|
||||
if (!task?.batch_index || !task?.batch_total) return '';
|
||||
return t('chat.shippingNoticeUi.batchProgress', { index: task.batch_index, total: task.batch_total });
|
||||
});
|
||||
const batchCompletedCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.process_summary?.completed || 0),
|
||||
);
|
||||
const batchRunningCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.process_summary?.running || 0),
|
||||
);
|
||||
const batchFileCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.file_count || 0),
|
||||
);
|
||||
const batchCompletionPercent = computed(() => {
|
||||
if (!batchFileCount.value) return 0;
|
||||
return Math.min(100, Math.max(0, Math.round((batchCompletedCount.value / batchFileCount.value) * 100)));
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -80,6 +141,148 @@ const page = useChatPageContext();
|
||||
<template v-else>
|
||||
<div class="flex min-h-0 flex-1">
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<div
|
||||
v-if="page.isShippingNoticeAgent && (page.shippingBatchSummary || currentShippingTaskSource)"
|
||||
class="mx-4 mt-4 rounded-3xl border border-default/80 bg-[linear-gradient(135deg,rgba(255,255,255,0.96),rgba(246,248,251,0.92))] px-4 py-3 shadow-sm"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="space-y-1">
|
||||
<div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">
|
||||
{{ page.shippingBatchSummary ? t('chat.shippingNoticeUi.batchTitle') : t('chat.shippingNoticeUi.taskTitle') }}
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span
|
||||
v-if="page.shippingBatchSummary"
|
||||
class="font-mono text-sm font-semibold text-primary"
|
||||
>
|
||||
{{ page.shippingBatchSummary.batch_no }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="currentShippingTaskSource"
|
||||
class="font-mono text-sm font-semibold text-primary"
|
||||
>
|
||||
{{ currentShippingTaskSource.task_no }}
|
||||
</span>
|
||||
<span
|
||||
v-if="page.shippingBatchSummary?.current_focus_task_no"
|
||||
class="rounded-full bg-brand-50 px-2.5 py-1 text-xs font-medium text-brand-700"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.currentTask', { taskId: page.shippingBatchSummary.current_focus_task_no }) }}
|
||||
</span>
|
||||
<span
|
||||
v-if="currentShippingBatchProgress"
|
||||
class="rounded-full bg-sky-50 px-2.5 py-1 text-xs font-medium text-sky-700"
|
||||
>
|
||||
{{ currentShippingBatchProgress }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="currentShippingTaskSource" class="flex flex-wrap items-center gap-2 text-xs text-secondary">
|
||||
<span class="truncate font-medium text-primary">
|
||||
{{ currentShippingTaskSource.customer_name || currentShippingTaskSource.source_file_name || t('chat.shippingNoticeUi.currentNotice') }}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 font-medium"
|
||||
:class="statusMeta(currentShippingTaskSource.process_status).chip"
|
||||
>
|
||||
{{ statusMeta(currentShippingTaskSource.process_status).label }}
|
||||
</span>
|
||||
<span class="text-muted">{{ t('chat.shippingNoticeUi.stepperTitle') }}:{{ stepLabel(currentShippingTaskSource.current_step) }}</span>
|
||||
</div>
|
||||
<ShippingWorkflowStepper
|
||||
v-if="currentShippingTaskSource"
|
||||
:steps="currentShippingSteps"
|
||||
compact
|
||||
class="pt-2"
|
||||
/>
|
||||
<div class="flex flex-wrap gap-2 pt-1 text-xs">
|
||||
<button
|
||||
v-if="page.shippingBatchSummary"
|
||||
type="button"
|
||||
class="rounded-full border border-default px-2.5 py-1 text-secondary transition hover:bg-surface-soft"
|
||||
@click="page.input = '上一票'"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.prevTask') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="page.shippingBatchSummary"
|
||||
type="button"
|
||||
class="rounded-full border border-default px-2.5 py-1 text-secondary transition hover:bg-surface-soft"
|
||||
@click="page.input = '下一票'"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.nextTask') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="page.shippingBatchTasks?.length > 1"
|
||||
type="button"
|
||||
class="rounded-full border border-default px-2.5 py-1 text-secondary transition hover:bg-surface-soft"
|
||||
@click="page.shippingBatchTasksExpanded = !page.shippingBatchTasksExpanded"
|
||||
>
|
||||
{{ page.shippingBatchTasksExpanded ? t('chat.shippingNoticeUi.collapseTasks') : t('chat.shippingNoticeUi.viewTasks') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page.shippingBatchSummary" class="grid grid-cols-3 gap-2 text-right text-xs">
|
||||
<div class="rounded-2xl bg-surface px-3 py-2">
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.fileCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchFileCount }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl bg-surface px-3 py-2">
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.runningCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchRunningCount }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl bg-surface px-3 py-2">
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.completedCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchCompletedCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="page.shippingBatchSummary"
|
||||
class="mt-3 space-y-1 border-t border-default/70 pt-3"
|
||||
>
|
||||
<div class="flex items-center justify-between text-[11px] text-muted">
|
||||
<span>{{ t('chat.shippingNoticeUi.batchProgressTitle') }}</span>
|
||||
<span>{{ batchCompletedCount }}/{{ batchFileCount }} · {{ batchCompletionPercent }}%</span>
|
||||
</div>
|
||||
<div class="h-2 overflow-hidden rounded-full bg-slate-200">
|
||||
<div
|
||||
class="h-full rounded-full bg-brand-500 transition-all"
|
||||
:style="{ width: `${batchCompletionPercent}%` }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="page.shippingBatchTasksExpanded && page.shippingBatchTasks?.length"
|
||||
class="mt-3 grid gap-2 border-t border-default/70 pt-3 sm:grid-cols-2 xl:grid-cols-3"
|
||||
>
|
||||
<button
|
||||
v-for="task in page.shippingBatchTasks"
|
||||
:key="task.task_no"
|
||||
type="button"
|
||||
class="rounded-2xl border px-3 py-3 text-left transition"
|
||||
:class="task.task_no === page.shippingBatchSummary?.current_focus_task_no ? 'border-brand-300 bg-brand-50/80 shadow-sm' : 'border-default bg-surface hover:bg-surface-soft'"
|
||||
@click="page.switchShippingFocusTask(task.task_no)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="font-mono text-xs font-semibold text-primary">{{ task.task_no }}</div>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-[11px] font-medium"
|
||||
:class="statusMeta(task.process_status).chip"
|
||||
>
|
||||
{{ statusMeta(task.process_status).label }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-2 truncate text-sm font-medium text-secondary">{{ task.customer_name || task.source_file_name || '未命名通知' }}</div>
|
||||
<div class="mt-1 text-[11px] text-muted">
|
||||
{{ stepLabel(task.current_step) }}
|
||||
<span v-if="task.batch_index && task.batch_total">
|
||||
· {{ t('chat.shippingNoticeUi.batchProgress', { index: task.batch_index, total: task.batch_total }) }}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChatMessageList
|
||||
:messages="page.messages"
|
||||
:agent-name="page.currentAgent?.name || 'AI'"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* features/chat/components/ShippingWorkflowStepper.vue
|
||||
* 货代发货七步流程 Stepper。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingWorkflowStepItem } from '../shipping';
|
||||
|
||||
defineProps<{
|
||||
steps: ShippingWorkflowStepItem[];
|
||||
compact?: boolean;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const stepClass = (status: ShippingWorkflowStepItem['status']) => {
|
||||
if (status === 'completed') return 'border-emerald-200 bg-emerald-50 text-emerald-700';
|
||||
if (status === 'current') return 'border-brand-300 bg-brand-50 text-brand-700';
|
||||
if (status === 'blocked') return 'border-rose-200 bg-rose-50 text-rose-700';
|
||||
return 'border-default bg-surface text-muted';
|
||||
};
|
||||
|
||||
const dotClass = (status: ShippingWorkflowStepItem['status']) => {
|
||||
if (status === 'completed') return 'bg-emerald-500';
|
||||
if (status === 'current') return 'bg-brand-500';
|
||||
if (status === 'blocked') return 'bg-rose-500';
|
||||
return 'bg-slate-300';
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-2">
|
||||
<div class="text-[11px] font-semibold uppercase tracking-[0.18em] text-muted">{{ t('chat.shippingNoticeUi.stepperTitle') }}</div>
|
||||
<div class="grid gap-2" :class="compact ? 'sm:grid-cols-4 xl:grid-cols-7' : 'md:grid-cols-4 xl:grid-cols-7'">
|
||||
<div
|
||||
v-for="(step, index) in steps"
|
||||
:key="step.id"
|
||||
class="rounded-2xl border px-3 py-2.5 transition"
|
||||
:class="stepClass(step.status)"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex h-5 min-w-5 items-center justify-center rounded-full text-[11px] font-semibold text-white" :class="dotClass(step.status)">
|
||||
{{ index + 1 }}
|
||||
</span>
|
||||
<span class="text-xs font-semibold">{{ t(step.label) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -7,13 +7,16 @@ import { computed } from 'vue';
|
||||
import { Check, Copy, Edit2, LayoutGrid, MessageSquareText, RotateCw } from 'lucide-vue-next';
|
||||
import LeaveMessageBlock, { type LeaveMessageHandlers } from './LeaveMessageBlock.vue';
|
||||
import ShippingInventoryMappingMessage, { type ShippingMappingHandlers } from './ShippingInventoryMappingMessage.vue';
|
||||
import ShippingMatchResultCard from './ShippingMatchResultCard.vue';
|
||||
import ShippingParseReviewMessage, { type ShippingParseReviewHandlers } from './ShippingParseReviewMessage.vue';
|
||||
import type { ChatMessage, SourceFileLink } from '../../types/chat.types';
|
||||
import type { ShippingInventoryMappingFormPayload } from '../../types/shipping.types';
|
||||
import type { ShippingInventoryMappingFormPayload, ShippingMatchResultPayload } from '../../types/shipping.types';
|
||||
|
||||
export interface ChatMessageBubbleHandlers {
|
||||
renderMarkdown: (text: string) => string;
|
||||
onMarkdownClick: (event: MouseEvent) => void;
|
||||
getShippingInventoryMappingPayload: (msg: ChatMessage) => ShippingInventoryMappingFormPayload | null;
|
||||
getShippingMatchResultPayload: (msg: ChatMessage) => ShippingMatchResultPayload | null;
|
||||
canOpenQueryPreview: (msg: ChatMessage) => boolean;
|
||||
getQueryPreviewSummary: (msg: ChatMessage) => string;
|
||||
openQueryPreviewDialog: (msg: ChatMessage) => void;
|
||||
@@ -77,8 +80,20 @@ const showSourceSection = computed(() => {
|
||||
});
|
||||
|
||||
const showActions = computed(() => message.type !== 'leave-form');
|
||||
const showShippingActionsPanel = computed(() =>
|
||||
isShippingNoticeAgent
|
||||
&& !!message.shipping_actions?.length
|
||||
&& message.type !== 'shipping-match-result',
|
||||
);
|
||||
const isLastMessage = computed(() => index === messageCount - 1);
|
||||
const isCopied = computed(() => copiedIndex === index);
|
||||
const shippingParseReviewHandlers = computed<ShippingParseReviewHandlers>(() => ({
|
||||
getPayload: shippingHandlers.getParseReviewPayload,
|
||||
updateHeader: shippingHandlers.updateHeader,
|
||||
updateLine: shippingHandlers.updateLine,
|
||||
addLine: shippingHandlers.addLine,
|
||||
removeLine: shippingHandlers.removeLine,
|
||||
}));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -110,6 +125,22 @@ const isCopied = computed(() => copiedIndex === index);
|
||||
:message="message"
|
||||
:handlers="shippingHandlers"
|
||||
/>
|
||||
<ShippingParseReviewMessage
|
||||
v-else-if="message.type === 'shipping-parse-review' && shippingHandlers.getParseReviewPayload(message)"
|
||||
:message="message"
|
||||
:handlers="shippingParseReviewHandlers"
|
||||
/>
|
||||
<ShippingMatchResultCard
|
||||
v-else-if="message.type === 'shipping-match-result' && handlers.getShippingMatchResultPayload(message)"
|
||||
:task-id="handlers.getShippingMatchResultPayload(message)!.taskId"
|
||||
:match-status="handlers.getShippingMatchResultPayload(message)!.match_status"
|
||||
:line-results="handlers.getShippingMatchResultPayload(message)!.line_results"
|
||||
:shortage-lines="handlers.getShippingMatchResultPayload(message)!.shortage_lines"
|
||||
:action-buttons="handlers.getShippingMatchResultPayload(message)!.action_buttons"
|
||||
:action-busy="isThinking || message.shipping_actions_used"
|
||||
:action-button-class="handlers.shippingActionButtonClass"
|
||||
:on-action-click="(action) => handlers.onShippingActionClick(message, action)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
|
||||
@@ -132,7 +163,7 @@ const isCopied = computed(() => copiedIndex === index);
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="isShippingNoticeAgent && message.shipping_actions?.length"
|
||||
v-if="showShippingActionsPanel"
|
||||
class="mt-4 space-y-2 border-t border-default pt-4"
|
||||
>
|
||||
<div class="text-xs font-medium text-muted">{{ $t('chat.shippingNoticeActionsHint') }}</div>
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import type { ChatMessage } from '../../types/chat.types';
|
||||
import type { ShippingInventoryMappingFormPayload } from '../../types/shipping.types';
|
||||
import type { ShippingNoticeHeader, ShippingNoticeLine } from '../../types/shipping.api.types';
|
||||
import type { ShippingInventoryMappingFormPayload, ShippingMatchResultPayload, ShippingParseReviewPayload } from '../../types/shipping.types';
|
||||
|
||||
export interface ShippingMappingHandlers {
|
||||
getPayload: (msg: ChatMessage) => ShippingInventoryMappingFormPayload | null;
|
||||
@@ -13,6 +14,14 @@ export interface ShippingMappingHandlers {
|
||||
getSampleRowText: (msg: ChatMessage) => string;
|
||||
reupload: (msg: ChatMessage) => void;
|
||||
apply: (msg: ChatMessage) => void;
|
||||
getParseReviewPayload: (msg: ChatMessage) => ShippingParseReviewPayload | null;
|
||||
getMatchResultPayload: (msg: ChatMessage) => ShippingMatchResultPayload | null;
|
||||
updateParseReviewHeader: (msg: ChatMessage, fields: Partial<ShippingNoticeHeader>) => Promise<boolean>;
|
||||
updateParseReviewLine: (msg: ChatMessage, lineIndex: number, patch: Partial<ShippingNoticeLine>) => Promise<boolean>;
|
||||
updateHeader: (msg: ChatMessage, fields: Partial<ShippingNoticeHeader>) => Promise<boolean>;
|
||||
updateLine: (msg: ChatMessage, lineIndex: number, patch: Partial<ShippingNoticeLine>) => Promise<boolean>;
|
||||
addLine: (msg: ChatMessage, line: Partial<ShippingNoticeLine>) => Promise<boolean>;
|
||||
removeLine: (msg: ChatMessage, lineIndex: number) => Promise<boolean>;
|
||||
}
|
||||
|
||||
const { message, handlers } = defineProps<{
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/**
|
||||
* features/chat/components/messages/ShippingMatchResultCard.vue
|
||||
* 用途:出货 Agent 对话区与工作台共用的库存匹配/缺口结果卡片。
|
||||
* 依赖:shipping.api.types、vue-i18n。
|
||||
* 逻辑:由 Chat 消息区和 ShippingNoticeView 传入匹配结果;本组件只负责结构化展示状态、缺口与操作按钮。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type {
|
||||
ShippingChatAction,
|
||||
ShippingMatchLineResult,
|
||||
} from '../../types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
taskId: string;
|
||||
matchStatus?: string | null;
|
||||
lineResults?: ShippingMatchLineResult[] | null;
|
||||
shortageLines?: ShippingMatchLineResult[] | null;
|
||||
actionButtons?: ShippingChatAction[] | null;
|
||||
actionBusy?: boolean;
|
||||
onActionClick?: (action: ShippingChatAction) => void;
|
||||
actionButtonClass?: (variant?: string) => string;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const formatQty = (value: unknown) => {
|
||||
const num = Number(value ?? 0);
|
||||
if (!Number.isFinite(num)) return '-';
|
||||
return Number.isInteger(num) ? String(num) : String(num);
|
||||
};
|
||||
|
||||
const rowStatusLabel = (status?: string | null) => {
|
||||
if (status === 'ok') return t('chat.shippingNoticeUi.rowStatus.ok');
|
||||
if (status === 'partial') return t('chat.shippingNoticeUi.rowStatus.partial');
|
||||
if (status === 'shortage') return t('chat.shippingNoticeUi.rowStatus.shortage');
|
||||
return status || '-';
|
||||
};
|
||||
|
||||
const matchStatusLabel = (status?: string | null) => {
|
||||
if (status === 'fulfillable') return t('chat.shippingNoticeUi.matchStatus.fulfillable');
|
||||
if (status === 'partial') return t('chat.shippingNoticeUi.matchStatus.partial');
|
||||
if (status === 'unfulfillable') return t('chat.shippingNoticeUi.matchStatus.unfulfillable');
|
||||
return status || t('chat.shippingNoticeUi.matchStatus.pending');
|
||||
};
|
||||
|
||||
const hasShortage = () => Array.isArray(props.shortageLines) && props.shortageLines.length > 0;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-4 rounded-2xl border border-default bg-surface-soft/90 p-4">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ t('chat.shippingNoticeUi.matchResult') }}</div>
|
||||
<div class="mt-1 text-xs text-muted">{{ t('chat.shippingNoticeUi.taskId', { taskId }) }}</div>
|
||||
</div>
|
||||
<span
|
||||
class="rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="hasShortage()
|
||||
? 'bg-rose-100 text-rose-700'
|
||||
: 'bg-emerald-100 text-emerald-700'"
|
||||
>
|
||||
{{ matchStatusLabel(matchStatus) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="hasShortage()"
|
||||
class="rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-700"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.shortageBanner') }}
|
||||
</div>
|
||||
|
||||
<div v-if="lineResults?.length" class="overflow-x-auto rounded-xl border border-default">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-surface text-left text-xs text-muted">
|
||||
<tr>
|
||||
<th class="px-3 py-2">#</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.reservationId') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.sku') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.orderDemand') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.inventoryAvailable') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.shortageQty') }}</th>
|
||||
<th class="px-3 py-2">{{ t('chat.shippingNoticeUi.statusLabel') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(line, index) in lineResults"
|
||||
:key="`${taskId}-match-${index}`"
|
||||
class="border-t border-default/70"
|
||||
>
|
||||
<td class="px-3 py-2 text-secondary">{{ index + 1 }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-secondary">{{ line.sku || '-' }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ formatQty(line.required_qty) }}</td>
|
||||
<td class="px-3 py-2 text-secondary">{{ formatQty(line.available_qty) }}</td>
|
||||
<td class="px-3 py-2" :class="Number(line.shortage_qty || 0) > 0 ? 'font-semibold text-rose-700' : 'text-secondary'">
|
||||
{{ Number(line.shortage_qty || 0) > 0 ? formatQty(line.shortage_qty) : '-' }}
|
||||
</td>
|
||||
<td class="px-3 py-2">
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-xs font-medium"
|
||||
:class="line.line_status === 'ok'
|
||||
? 'bg-emerald-100 text-emerald-700'
|
||||
: line.line_status === 'partial'
|
||||
? 'bg-amber-100 text-amber-700'
|
||||
: 'bg-rose-100 text-rose-700'"
|
||||
>
|
||||
{{ rowStatusLabel(line.line_status) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div v-if="shortageLines?.length" class="space-y-2">
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ t('chat.shippingNoticeUi.shortageDetails') }}</div>
|
||||
<ul class="space-y-2 rounded-xl border border-rose-200 bg-rose-50/70 p-3 text-sm text-rose-700">
|
||||
<li
|
||||
v-for="(line, index) in shortageLines"
|
||||
:key="`${taskId}-shortage-${index}`"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.shortageRowDetail', { index: index + 1, reservationId: line.reservation_id || '-', sku: line.sku || '-', shortage: formatQty(line.shortage_qty) }) }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-if="actionButtons?.length" class="space-y-2 border-t border-default pt-4">
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ t('chat.shippingNoticeUi.availableActions') }}</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
v-for="(action, index) in actionButtons"
|
||||
:key="`${taskId}-action-${action.id}-${index}`"
|
||||
type="button"
|
||||
:class="actionButtonClass
|
||||
? actionButtonClass(action.variant)
|
||||
: 'rounded-xl border border-default px-3 py-2 text-sm font-medium text-secondary hover:bg-surface'"
|
||||
:disabled="actionBusy"
|
||||
@click="onActionClick?.(action)"
|
||||
>
|
||||
{{ action.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -0,0 +1,325 @@
|
||||
/**
|
||||
* features/chat/components/messages/ShippingParseReviewMessage.vue
|
||||
* 出货 Agent:parse_review 阶段订单表编辑消息 UI。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ChatMessage } from '../../types/chat.types';
|
||||
import type { ShippingParseReviewPayload } from '../../types/shipping.types';
|
||||
import type { ShippingNoticeHeader, ShippingNoticeLine } from '../../types/shipping.api.types';
|
||||
|
||||
export interface ShippingParseReviewHandlers {
|
||||
getPayload: (msg: ChatMessage) => ShippingParseReviewPayload | null;
|
||||
updateHeader: (msg: ChatMessage, fields: Partial<ShippingNoticeHeader>) => Promise<boolean>;
|
||||
updateLine: (msg: ChatMessage, lineIndex: number, patch: Partial<ShippingNoticeLine>) => Promise<boolean>;
|
||||
addLine: (msg: ChatMessage, line: Partial<ShippingNoticeLine>) => Promise<boolean>;
|
||||
removeLine: (msg: ChatMessage, lineIndex: number) => Promise<boolean>;
|
||||
}
|
||||
|
||||
const { message, handlers } = defineProps<{
|
||||
message: ChatMessage;
|
||||
handlers: ShippingParseReviewHandlers;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const editingHeader = ref(false);
|
||||
const editingLineIndex = ref<number | null>(null);
|
||||
const headerForm = reactive<ShippingNoticeHeader>({
|
||||
customer_name: '',
|
||||
customer_code: '',
|
||||
ship_to: '',
|
||||
po_number: '',
|
||||
required_date: '',
|
||||
});
|
||||
const lineForm = reactive<Partial<ShippingNoticeLine>>({
|
||||
reservation_id: '',
|
||||
sku: '',
|
||||
qty: 0,
|
||||
required_date: '',
|
||||
uom: '',
|
||||
});
|
||||
const addingLine = ref(false);
|
||||
|
||||
const payload = computed(() => handlers.getPayload(message));
|
||||
|
||||
watch(payload, (value) => {
|
||||
if (!value) return;
|
||||
headerForm.customer_name = value.header.customer_name ?? '';
|
||||
headerForm.customer_code = value.header.customer_code ?? '';
|
||||
headerForm.ship_to = value.header.ship_to ?? '';
|
||||
headerForm.po_number = value.header.po_number ?? '';
|
||||
headerForm.required_date = value.header.required_date ?? '';
|
||||
}, { immediate: true, deep: true });
|
||||
|
||||
watch(
|
||||
() => editingLineIndex.value,
|
||||
(value) => {
|
||||
if (value == null || !payload.value) return;
|
||||
const line = payload.value.lines[value];
|
||||
if (!line) return;
|
||||
lineForm.reservation_id = line.reservation_id ?? '';
|
||||
lineForm.sku = line.sku;
|
||||
lineForm.qty = line.qty;
|
||||
lineForm.required_date = line.required_date ?? '';
|
||||
lineForm.uom = line.uom ?? '';
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const saveHeader = async () => {
|
||||
const ok = await handlers.updateHeader(message, {
|
||||
customer_name: headerForm.customer_name,
|
||||
customer_code: headerForm.customer_code,
|
||||
ship_to: headerForm.ship_to,
|
||||
po_number: headerForm.po_number,
|
||||
required_date: headerForm.required_date,
|
||||
});
|
||||
if (ok) editingHeader.value = false;
|
||||
};
|
||||
|
||||
const saveLine = async () => {
|
||||
if (editingLineIndex.value == null) return;
|
||||
const ok = await handlers.updateLine(message, editingLineIndex.value, {
|
||||
reservation_id: lineForm.reservation_id,
|
||||
sku: lineForm.sku,
|
||||
qty: Number(lineForm.qty || 0),
|
||||
required_date: lineForm.required_date,
|
||||
uom: lineForm.uom,
|
||||
});
|
||||
if (ok) editingLineIndex.value = null;
|
||||
};
|
||||
|
||||
const startAddLine = () => {
|
||||
addingLine.value = true;
|
||||
editingLineIndex.value = null;
|
||||
lineForm.reservation_id = '';
|
||||
lineForm.sku = '';
|
||||
lineForm.qty = 0;
|
||||
lineForm.required_date = '';
|
||||
lineForm.uom = '';
|
||||
};
|
||||
|
||||
const saveAddedLine = async () => {
|
||||
const ok = await handlers.addLine(message, {
|
||||
reservation_id: lineForm.reservation_id,
|
||||
sku: lineForm.sku,
|
||||
qty: Number(lineForm.qty || 0),
|
||||
required_date: lineForm.required_date,
|
||||
uom: lineForm.uom,
|
||||
});
|
||||
if (ok) addingLine.value = false;
|
||||
};
|
||||
|
||||
const removeLine = async (lineIndex: number) => {
|
||||
const ok = await handlers.removeLine(message, lineIndex);
|
||||
if (ok && editingLineIndex.value === lineIndex) {
|
||||
editingLineIndex.value = null;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="payload" class="space-y-4">
|
||||
<div class="whitespace-pre-wrap text-sm font-medium text-secondary">{{ message.content }}</div>
|
||||
<div class="space-y-4 rounded-2xl border border-default bg-surface-soft/90 p-4">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<div>
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ t('chat.shippingNoticeUi.parseReviewHeader') }}</div>
|
||||
<div class="mt-1 text-xs text-muted">{{ t('chat.shippingNoticeUi.taskId', { taskId: payload.taskId }) }}</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-xs font-medium text-secondary transition hover:bg-surface disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="editingHeader = !editingHeader"
|
||||
>
|
||||
{{ editingHeader ? t('chat.shippingNoticeUi.cancelEdit') : t('chat.shippingNoticeUi.editHeader') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="editingHeader" class="grid gap-3 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customer') }}</span>
|
||||
<input v-model="headerForm.customer_name" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customerCode') }}</span>
|
||||
<input v-model="headerForm.customer_code" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5 md:col-span-2">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.shipTo') }}</span>
|
||||
<input v-model="headerForm.ship_to" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.poNumber') }}</span>
|
||||
<input v-model="headerForm.po_number" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</span>
|
||||
<input v-model="headerForm.required_date" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<div class="md:col-span-2 flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="saveHeader"
|
||||
>
|
||||
{{ payload.saving ? t('chat.shippingNoticeUi.saving') : t('chat.shippingNoticeUi.saveHeader') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table v-else class="w-full border-collapse text-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.customer') }}</th>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ payload.header.customer_name || '-' }}</td>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.poNumber') }}</th>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ payload.header.po_number || '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.shipTo') }}</th>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ payload.header.ship_to || '-' }}</td>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</th>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ payload.header.required_date || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="space-y-2">
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-muted">{{ t('chat.shippingNoticeUi.orderLines') }}</div>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-xs font-medium text-secondary transition hover:bg-surface disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving || addingLine"
|
||||
@click="startAddLine"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.addLine') }}
|
||||
</button>
|
||||
</div>
|
||||
<table class="w-full border-collapse text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">#</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.reservationId') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</th>
|
||||
<th class="border border-default bg-surface px-3 py-2 text-left text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(line, lineIndex) in payload.lines" :key="`${payload.taskId}-${line.line_no || lineIndex}`">
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ lineIndex + 1 }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.sku }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.qty }}</td>
|
||||
<td class="border border-default px-3 py-2 text-secondary">{{ line.required_date || '-' }}</td>
|
||||
<td class="border border-default px-3 py-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-xs font-medium text-secondary transition hover:bg-surface disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="editingLineIndex = lineIndex"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.editLine') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="ml-2 rounded-xl border border-rose-200 px-3 py-1.5 text-xs font-medium text-rose-700 transition hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving || payload.lines.length <= 1"
|
||||
@click="removeLine(lineIndex)"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.deleteLine') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div v-if="addingLine" class="space-y-3 rounded-xl border border-emerald-200 bg-emerald-50/70 p-4">
|
||||
<div class="text-sm font-semibold text-emerald-700">{{ t('chat.shippingNoticeUi.addOrderLine') }}</div>
|
||||
<div class="grid gap-3 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.reservationId') }}</span>
|
||||
<input v-model="lineForm.reservation_id" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</span>
|
||||
<input v-model="lineForm.sku" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</span>
|
||||
<input v-model.number="lineForm.qty" type="number" min="1" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</span>
|
||||
<input v-model="lineForm.required_date" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition hover:bg-surface disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="addingLine = false"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.cancelEdit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="saveAddedLine"
|
||||
>
|
||||
{{ payload.saving ? t('chat.shippingNoticeUi.saving') : t('chat.shippingNoticeUi.saveAddedLine') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="editingLineIndex !== null" class="space-y-3 rounded-xl border border-brand-200 bg-brand-50/70 p-4">
|
||||
<div class="text-sm font-semibold text-brand-700">{{ t('chat.shippingNoticeUi.editLineTitle', { index: editingLineIndex + 1 }) }}</div>
|
||||
<div class="grid gap-3 md:grid-cols-2">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.reservationId') }}</span>
|
||||
<input v-model="lineForm.reservation_id" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.sku') }}</span>
|
||||
<input v-model="lineForm.sku" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.qty') }}</span>
|
||||
<input v-model.number="lineForm.qty" type="number" min="1" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-muted">{{ t('chat.shippingNoticeUi.requiredDate') }}</span>
|
||||
<input v-model="lineForm.required_date" class="w-full rounded-xl border border-default px-3 py-2 text-sm text-secondary outline-none transition focus:border-blue-400" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-4 py-2 text-sm font-medium text-secondary transition hover:bg-surface disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="editingLineIndex = null"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.cancelEdit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-emerald-600 px-4 py-2 text-sm font-medium text-white transition hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="payload.saving"
|
||||
@click="saveLine"
|
||||
>
|
||||
{{ payload.saving ? t('chat.shippingNoticeUi.saving') : t('chat.shippingNoticeUi.saveLineItem') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user