-
- 输入 #词语 添加标签,例如 #补货、#客户自提。保存订单后可复用,点击下方标签即可填入。
-
+
+
+
+ 内部备注 必填,至少3个字符(含#号),最多500字
+ >
+ }
+ help="输入 #词语 添加标签,例如 #补货、#客户自提。保存订单后可复用,点击下方标签即可填入。内部备注不会出现在客户销售单或打印件中。"
+ field="internal_note"
+ id="order-internal-note"
+ >
+ update(f => ({ ...f, internal_note: event.target.value }))}
+ />
+
{tagsStatus ? (
{tagsStatus}
@@ -79,6 +79,7 @@ export function SummarySection({
-
-
-
成交合计
-
- {summary.totalText}
-
-
- {summary.roundingHint}
-
-
-
-
+
+ );
+}
+
+// 底部常驻操作栏:成交合计(大号等宽数字)、取整说明、整单优惠与“生成销售单据”。桌面与手机都贴在视口底部。
+export function SubmitBar({
+ form,
+ summary,
+ busy,
+ error,
+}: {
+ form: OrderForm;
+ summary: FormSummary;
+ busy: boolean;
+ error: string;
+}) {
+ const discount = String(form.discount).trim();
+ const discountCents = /^\d+(?:\.\d{1,2})?$/.test(discount) ? Math.round(Number(discount) * 100) : 0;
+ return (
+
{error && (
)}
-
+
+
+
成交合计
+
+ {summary.totalText}
+
+
+
+
+ {form.lines.length} 件商品
+ {discountCents > 0 ? <> · 整单优惠 −¥{Model.yuan(discountCents)}> : null}
+
+
+ {summary.roundingHint}
+
+
+
}
+ loading={busy}
+ data-action="issue"
+ className="issue-button"
+ >
+ 生成销售单据
+
+
+
);
}
diff --git a/新账系统/web/src/pages/CreateOrder/fields.tsx b/新账系统/web/src/pages/CreateOrder/fields.tsx
index a622fdc..7beba0d 100644
--- a/新账系统/web/src/pages/CreateOrder/fields.tsx
+++ b/新账系统/web/src/pages/CreateOrder/fields.tsx
@@ -1,24 +1,67 @@
// 表单小部件:带标签的文本、数字、选择与单选。每个字段外层带 data-field,便于核对与自动化操作。
-import type { ReactNode } from 'react';
-import { Input, Radio, Select } from 'antd';
+// 传入 span 时字段包在 antd Col 里,由外层 Row 排成响应式网格;标签通过 htmlFor / aria-labelledby 与控件关联。
+import { useId, type ReactNode } from 'react';
+import { Col, Input, Radio, Select, Tooltip } from 'antd';
+import type { Span } from './layout';
+import { LockOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+// “?”说明:悬停、聚焦或点按显示。长说明放这里,页面上只留必要文字。
+export function Help({ children, label = '查看说明' }: { children: ReactNode; label?: string }) {
+ return (
+
+
+
+
+
+ );
+}
+// 内部区域标记:客户单据和打印件中不出现。
+export function InternalTag() {
+ return (
+
+ 内部 · 客户不可见
+
+ );
+}
interface Base {
label: ReactNode;
field: string;
hint?: ReactNode;
+ help?: ReactNode;
hidden?: boolean;
className?: string;
+ span?: Span;
}
-export function Field({ label, field, hint, hidden, className, children }: Base & { children: ReactNode }) {
+export function Field({
+ label,
+ field,
+ hint,
+ help,
+ hidden,
+ className,
+ span,
+ id,
+ labelId,
+ children,
+}: Base & { children: ReactNode; id?: string; labelId?: string }) {
if (hidden) return null;
- return (
+ const body = (
-
+
+
+ {help ? {help} : null}
+
{children}
{hint ?
{hint}
: null}
);
+ return span ?
{body} : body;
}
+const ariaLabel = (base: Base) => (typeof base.label === 'string' ? base.label : base.field);
+
export function TextField({
value,
onChange,
@@ -39,11 +82,13 @@ export function TextField({
maxLength?: number;
type?: string;
}) {
+ const id = useId();
return (
-
+
onChange?.(event.target.value)}
/>
@@ -72,10 +117,12 @@ export function ChoiceField({
disabled?: boolean;
placeholder?: string;
}) {
+ const id = useId();
return (
-
+