diff --git a/src/pages/customers/QuoteVersionManagement.tsx b/src/pages/customers/QuoteVersionManagement.tsx index ab2f70b..2a7581b 100644 --- a/src/pages/customers/QuoteVersionManagement.tsx +++ b/src/pages/customers/QuoteVersionManagement.tsx @@ -11,6 +11,8 @@ import { useListLoadState, type ListLoadOptions } from '../../hooks/useListLoadS import { CustomerSelector, type CustomerOption } from '../../components/order/CustomerSelector'; import { type SkuNameOption } from '../../components/order/SkuNameSelector'; import { SearchableSelect, type SearchableSelectOption } from '../../components/ui/SearchableSelect'; +import { QuickCreateProductModal, type QuickCreateProductConfirm } from '../../components/order/QuickCreateProductModal'; +import { createCatalogProductForOrderLine } from '../../utils/productCatalog'; import { DecimalTextInput, parseDecimalText } from '../../components/ui/DecimalInput'; import { createQuoteSheetApi, @@ -557,6 +559,11 @@ export const QuoteVersionManagement: React.FC = () => { const [inlineAddOpen, setInlineAddOpen] = useState(false); const [inlineSaving, setInlineSaving] = useState(false); const [inlineDraft, setInlineDraft] = useState({ sku_code: '', spec: '', unit: '', cost_price: '', sale_price: '', markup_ratio: '' }); + /** 录单同款「新建商品」弹窗(2026-10-20 开发者:选不到商品时当场建档,复用录单组件) */ + const [showCreateProductModal, setShowCreateProductModal] = useState(false); + const [createProductInitialName, setCreateProductInitialName] = useState(''); + const [createProductError, setCreateProductError] = useState(''); + const [creatingProduct, setCreatingProduct] = useState(false); /** * 重复商品集合(2026-10-20 开发者需求:重复商品标红提示)。 * 判定按 `sku_code`;出现 ≥2 次即标红 —— 提交时后端会按 SKU 去重只保留最后一行, @@ -591,6 +598,10 @@ export const QuoteVersionManagement: React.FC = () => { const [showExcelImportModal, setShowExcelImportModal] = useState(false); const { categoryRows } = useCategoryRows({ enabledOnly: false }); const categoryLabelMap = useMemo(() => buildCategoryLabelMap(categoryRows), [categoryRows]); + const createCategoryOptions = useMemo( + () => categoryRows.map((c) => ({ category_code: c.category_code, label: c.category_name })), + [categoryRows] + ); const skuMap = useMemo(() => new Map(skus.map((sku) => [sku.sku_code, sku])), [skus]); const quoteSheetColumns = useMemo( @@ -1801,29 +1812,18 @@ export const QuoteVersionManagement: React.FC = () => { }} options={quoteSkuOptions} compact + alwaysShowCreate + onCreateFromQuery={(q) => { + setCreateProductInitialName(q); + setCreateProductError(''); + setShowCreateProductModal(true); + }} /> {inlineDraft.sku_code ? ( ) : null} - - + {t('quotes.form.newSku')} - -