@@ -157,8 +157,7 @@ export default function ProductSpecsEditor({ productId, initialAttrs, initialSku
|
||||
const payloadSkus = skus.map((s, i) => ({
|
||||
id: s.id,
|
||||
specValueIds: resolveIds(s.specValueIds ?? []),
|
||||
skuCode: s.skuCode,
|
||||
barcode69: s.barcode69,
|
||||
barcode69: s.barcode69.trim(),
|
||||
price: s.price,
|
||||
benefitAmount: s.benefitAmount,
|
||||
status: s.status,
|
||||
@@ -171,8 +170,10 @@ export default function ProductSpecsEditor({ productId, initialAttrs, initialSku
|
||||
sortOrder: i,
|
||||
}));
|
||||
|
||||
for (const row of payloadSkus) {
|
||||
if (!row.barcode69?.trim()) throw new Error('请填写全部 SKU 的 69 码');
|
||||
const barcodes = payloadSkus.map((row) => row.barcode69);
|
||||
if (barcodes.some((b) => !b)) throw new Error('每个规格须填写独立 69 码');
|
||||
if (new Set(barcodes).size !== barcodes.length) {
|
||||
throw new Error('同一商品内 69 码不可重复,每个规格请填写不同 69 码');
|
||||
}
|
||||
|
||||
await request(`/admin/products/${productId}/skus`, {
|
||||
@@ -191,7 +192,8 @@ export default function ProductSpecsEditor({ productId, initialAttrs, initialSku
|
||||
return (
|
||||
<div>
|
||||
<Typography.Paragraph type="secondary">
|
||||
先配置销售规格轴(如「包装」),再生成 SKU 矩阵。未配置规格时仅保留默认一行 SKU,与基础信息价/码同步。
|
||||
SKU 码由系统自动生成(DK 开头),无需填写。每个规格必须填写<strong>互不相同</strong>的 69 码。
|
||||
先配置销售规格轴(如「包装」),再生成 SKU 矩阵;未配置规格时仅保留默认一行。
|
||||
</Typography.Paragraph>
|
||||
|
||||
<Typography.Title level={5}>规格轴</Typography.Title>
|
||||
@@ -272,7 +274,7 @@ export default function ProductSpecsEditor({ productId, initialAttrs, initialSku
|
||||
size="small"
|
||||
rowKey={(_, i) => String(i)}
|
||||
pagination={false}
|
||||
scroll={{ x: 1100 }}
|
||||
scroll={{ x: 1240 }}
|
||||
dataSource={skus}
|
||||
columns={[
|
||||
{
|
||||
@@ -281,10 +283,20 @@ export default function ProductSpecsEditor({ productId, initialAttrs, initialSku
|
||||
render: (_, row) => row.specText || (row.specValueIds?.length ? row.specValueIds.join(',') : '默认'),
|
||||
},
|
||||
{
|
||||
title: '69码',
|
||||
width: 140,
|
||||
title: 'SKU',
|
||||
width: 110,
|
||||
render: (_, row) => (
|
||||
<Typography.Text type="secondary">
|
||||
{row.skuCode || '保存后自动生成'}
|
||||
</Typography.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: <span>69码 <Typography.Text type="danger">*</Typography.Text></span>,
|
||||
width: 180,
|
||||
render: (_, row, index) => (
|
||||
<Input
|
||||
placeholder="本规格独立 69 码"
|
||||
value={row.barcode69}
|
||||
onChange={(e) => {
|
||||
const next = [...skus];
|
||||
|
||||
@@ -17,9 +17,11 @@ import {
|
||||
} from 'antd';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import {
|
||||
INVOICE_CATEGORY_LABELS,
|
||||
INVOICE_KIND_LABELS,
|
||||
INVOICE_STATUS_LABELS,
|
||||
INVOICE_TITLE_TYPE_LABELS,
|
||||
type InvoiceCategory,
|
||||
type InvoiceKind,
|
||||
type InvoiceStatus,
|
||||
type InvoiceTitleType,
|
||||
@@ -35,6 +37,7 @@ type Row = {
|
||||
orderNo?: string;
|
||||
titleType: InvoiceTitleType;
|
||||
invoiceKind: InvoiceKind;
|
||||
invoiceCategory?: InvoiceCategory;
|
||||
titleName: string;
|
||||
status: InvoiceStatus;
|
||||
overdue?: boolean;
|
||||
@@ -54,6 +57,7 @@ type CreateFormValues = {
|
||||
orderNo: string;
|
||||
titleType: InvoiceTitleType;
|
||||
invoiceKind: InvoiceKind;
|
||||
invoiceCategory?: InvoiceCategory;
|
||||
titleName: string;
|
||||
taxNo?: string;
|
||||
addressPhone?: string;
|
||||
@@ -156,6 +160,7 @@ export default function InvoicesPage() {
|
||||
orderNo: values.orderNo.trim(),
|
||||
titleType: values.titleType,
|
||||
invoiceKind: values.invoiceKind,
|
||||
invoiceCategory: values.invoiceCategory,
|
||||
titleName: values.titleName.trim(),
|
||||
taxNo: values.taxNo?.trim() || undefined,
|
||||
addressPhone: values.addressPhone?.trim() || undefined,
|
||||
@@ -186,9 +191,17 @@ export default function InvoicesPage() {
|
||||
},
|
||||
{
|
||||
title: '票种',
|
||||
width: 120,
|
||||
width: 140,
|
||||
render: (_, r) => INVOICE_KIND_LABELS[r.invoiceKind] ?? r.invoiceKind,
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
width: 88,
|
||||
render: (_, r) =>
|
||||
r.invoiceCategory
|
||||
? INVOICE_CATEGORY_LABELS[r.invoiceCategory] ?? r.invoiceCategory
|
||||
: '—',
|
||||
},
|
||||
{ title: '名称', dataIndex: 'titleName', ellipsis: true },
|
||||
{
|
||||
title: '状态',
|
||||
@@ -233,6 +246,7 @@ export default function InvoicesPage() {
|
||||
createForm.setFieldsValue({
|
||||
titleType: 'PERSONAL',
|
||||
invoiceKind: 'NORMAL',
|
||||
invoiceCategory: 'LIQUOR',
|
||||
});
|
||||
setCreateOpen(true);
|
||||
}}
|
||||
@@ -324,6 +338,11 @@ export default function InvoicesPage() {
|
||||
<Descriptions.Item label="发票类型">
|
||||
{INVOICE_KIND_LABELS[detail.invoiceKind]}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="类型">
|
||||
{detail.invoiceCategory
|
||||
? INVOICE_CATEGORY_LABELS[detail.invoiceCategory]
|
||||
: '—'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="抬头名称">{detail.titleName}</Descriptions.Item>
|
||||
<Descriptions.Item label="税号">{detail.taxNo ?? '—'}</Descriptions.Item>
|
||||
<Descriptions.Item label="地址电话">{detail.addressPhone ?? '—'}</Descriptions.Item>
|
||||
@@ -382,6 +401,18 @@ export default function InvoicesPage() {
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="invoiceCategory"
|
||||
label="类型"
|
||||
rules={[{ required: true, message: '请选择类型' }]}
|
||||
>
|
||||
<Select
|
||||
options={(Object.keys(INVOICE_CATEGORY_LABELS) as InvoiceCategory[]).map((k) => ({
|
||||
value: k,
|
||||
label: INVOICE_CATEGORY_LABELS[k],
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="titleType"
|
||||
label="抬头类型"
|
||||
|
||||
@@ -222,8 +222,13 @@ function BaseInfoFields({ mode, form }: { mode: 'create' | 'edit'; form: FormIns
|
||||
<Form.Item label="SKU">
|
||||
<Input disabled placeholder="保存后自动生成" />
|
||||
</Form.Item>
|
||||
<Form.Item name="barcode69" label="69码" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
<Form.Item
|
||||
name="barcode69"
|
||||
label="69码"
|
||||
rules={[{ required: true, message: '请填写默认规格 69 码' }]}
|
||||
extra="默认规格的 69 码;若有多种规格,保存后请到「规格与 SKU」为每个规格分别填写不同 69 码"
|
||||
>
|
||||
<Input placeholder="默认规格 69 码" />
|
||||
</Form.Item>
|
||||
<Form.Item name="aromaType" label="香型" rules={[{ required: true }]}>
|
||||
<Select options={Object.entries(AROMA_TYPE_LABELS).map(([value, label]) => ({ value, label }))} />
|
||||
@@ -421,8 +426,8 @@ export default function ProductsPage() {
|
||||
{detail && (
|
||||
<>
|
||||
<Descriptions column={1} bordered size="small" style={{ marginBottom: 16 }}>
|
||||
<Descriptions.Item label="SKU">{String(detail.skuCode)}</Descriptions.Item>
|
||||
<Descriptions.Item label="69码">{String(detail.barcode69)}</Descriptions.Item>
|
||||
<Descriptions.Item label="SKU">{String(detail.skuCode)}(系统生成)</Descriptions.Item>
|
||||
<Descriptions.Item label="默认 69 码">{String(detail.barcode69)}</Descriptions.Item>
|
||||
<Descriptions.Item label="香型">{AROMA_TYPE_LABELS[String(detail.aromaType)] || String(detail.aromaType)}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<Form form={editForm} layout="vertical">
|
||||
|
||||
Reference in New Issue
Block a user