|
|
@@ -6,11 +6,11 @@
|
|
|
* 编辑:`POST /customer/update@v1`(资料)+ `POST /customer/attribution_update@v1`(运营商/合伙人)
|
|
|
* + 区域变更时 `POST /customer/move_region@v1`(必填变更依据)。
|
|
|
* 边界:登记材料(营业执照影像)由浏览器直传平台 `unified-oss`(凭证自取、⛔ 经后端),
|
|
|
- * 建档载荷只回报 `{object_key, file_name}`;合同文档区本期仍无路由(保持禁用并说明)。
|
|
|
+ * 建档载荷只回报 `{object_key, file_name}`;合同文档在合同登记时上传。
|
|
|
* 错误一律显示后端/平台 `message` 原文。
|
|
|
*/
|
|
|
import { useEffect, useMemo, useRef, useState, type FormEvent, type ReactNode } from "react";
|
|
|
-import { ArrowLeft, Upload } from "lucide-react";
|
|
|
+import { ArrowLeft, FileText, Upload } from "lucide-react";
|
|
|
import { Link, useLocation, useNavigate, useParams } from "react-router";
|
|
|
import { FetchError } from "../components/fetchError";
|
|
|
import { Button } from "../components/ui/button";
|
|
|
@@ -99,6 +99,7 @@ export function CustomerEditorPage() {
|
|
|
/** 登记材料:`licenseObj`=已直传成功的对象(建案载荷据此回报);⛔ 存签名 URL/⛔ 存文件本体。 */
|
|
|
const [licenseObj, setLicenseObj] = useState<UploadedObject | null>(null);
|
|
|
const [licenseBusy, setLicenseBusy] = useState(false);
|
|
|
+ const [licenseDragging, setLicenseDragging] = useState(false);
|
|
|
const [licenseError, setLicenseError] = useState("");
|
|
|
function set<K extends keyof Draft>(key: K, value: Draft[K]) { setDraft((current) => ({ ...current, [key]: value })); setErrors((current) => { const next = { ...current }; delete next[key]; return next; }); }
|
|
|
function field(key: keyof Draft, label: string, control: ReactNode, required = false, wide = false, hint?: ReactNode) {
|
|
|
@@ -333,38 +334,61 @@ export function CustomerEditorPage() {
|
|
|
</div>
|
|
|
<div className="customer-document-grid">
|
|
|
{draft.subject === "enterprise" ? (
|
|
|
- <div className="customer-document-picker">
|
|
|
- <div>
|
|
|
- <strong>登记材料 · 营业执照影像</strong>
|
|
|
- <label className="customer-upload-button" title="选择后立即直传平台对象存储(字节流不经过本系统)">
|
|
|
- <Upload size={15} />{licenseBusy ? "正在上传…" : licenseObj ? "重新选择" : "选择文件"}
|
|
|
- <input aria-label="上传登记材料" type="file" disabled={licenseBusy || busy}
|
|
|
- onChange={(event) => {
|
|
|
- const file = event.target.files?.[0] ?? null;
|
|
|
- event.target.value = "";
|
|
|
- void pickLicense(file);
|
|
|
- }} />
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <p>{licenseObj ? `已上传:${licenseObj.file_name}` : licenseBusy ? "正在上传影像…" : "尚未选择文件"}</p>
|
|
|
- {licenseError && <small className="customer-field-error">{licenseError}</small>}
|
|
|
+ <div
|
|
|
+ className={`contract-license-drop${licenseDragging ? " is-dragging" : ""}`}
|
|
|
+ onDragOver={(event) => {
|
|
|
+ if (!Array.from(event.dataTransfer.types).includes("Files")) return;
|
|
|
+ event.preventDefault();
|
|
|
+ const locked = licenseBusy || busy;
|
|
|
+ event.dataTransfer.dropEffect = locked ? "none" : "copy";
|
|
|
+ setLicenseDragging(!locked);
|
|
|
+ }}
|
|
|
+ onDragLeave={(event) => {
|
|
|
+ if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setLicenseDragging(false);
|
|
|
+ }}
|
|
|
+ onDrop={(event) => {
|
|
|
+ event.preventDefault();
|
|
|
+ setLicenseDragging(false);
|
|
|
+ if (!licenseBusy && !busy) void pickLicense(event.dataTransfer.files[0] ?? null);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <span className="contract-license-drop-body">
|
|
|
+ <Upload size={22} aria-hidden="true" />
|
|
|
+ <strong>营业执照影像</strong>
|
|
|
+ <span aria-live="polite" title={licenseObj?.file_name}>
|
|
|
+ {licenseBusy ? "正在上传影像…" : licenseObj ? `已上传:${licenseObj.file_name}` : "拖入文件,或点击选择"}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ <input
|
|
|
+ className="contract-license-drop-input"
|
|
|
+ aria-label={licenseObj ? "替换营业执照影像" : "上传登记材料"}
|
|
|
+ type="file"
|
|
|
+ disabled={licenseBusy || busy}
|
|
|
+ onChange={(event) => {
|
|
|
+ const file = event.target.files?.[0] ?? null;
|
|
|
+ event.target.value = "";
|
|
|
+ void pickLicense(file);
|
|
|
+ }}
|
|
|
+ />
|
|
|
</div>
|
|
|
) : (
|
|
|
- <div className="customer-document-picker">
|
|
|
- <div><strong>登记材料</strong></div>
|
|
|
- <p>不适用(个人与个体工商户不采集证件影像)</p>
|
|
|
+ <div className="contract-license-drop customer-document-readonly">
|
|
|
+ <span className="contract-license-drop-body">
|
|
|
+ <FileText size={22} aria-hidden="true" />
|
|
|
+ <strong>营业执照影像</strong>
|
|
|
+ <span>仅企业客户适用</span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
)}
|
|
|
- <div className="customer-document-picker">
|
|
|
- <div>
|
|
|
+ <div className="contract-license-drop customer-document-readonly">
|
|
|
+ <span className="contract-license-drop-body">
|
|
|
+ <FileText size={22} aria-hidden="true" />
|
|
|
<strong>合同文档</strong>
|
|
|
- <label className="customer-upload-button" title="合同文档随合同登记上传(合同详情 → 附件),建档页不采集">
|
|
|
- <Upload size={15} />选择文件<input aria-label="上传合同文档" type="file" multiple disabled />
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <p>合同文档由合同模块登记,本页不采集</p>
|
|
|
+ <span>在登记合同时上传</span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ {licenseError && <small className="customer-field-error" role="alert">{licenseError}</small>}
|
|
|
</section>
|
|
|
)}
|
|
|
</>
|