修复四项新版开单和恢复差异,核验三项已确认行为
This commit is contained in:
1 parent
fdaa6afad5
commit
c29ea45ec4
25 files changed
+617
-171
No files matched your search
@@ -99,6 +99,7 @@ export function OrderActionDialog({
|
||||
const printStatus = printStatuses[original?.printStatus?.id || id];
|
||||
const order = original && printStatus ? { ...original, printStatus } : original;
|
||||
const [change, ownership, cancellation] = details.value?.entries || [];
|
||||
const pending = client.pending();
|
||||
const ctx = {
|
||||
state,
|
||||
session,
|
||||
@@ -112,7 +113,12 @@ export function OrderActionDialog({
|
||||
user: state.user.id,
|
||||
forceApproval: ui.forceApproval,
|
||||
},
|
||||
ui,
|
||||
ui: {
|
||||
...ui,
|
||||
actionBlocked: client.busy || !!pending,
|
||||
retryBusy: client.busy,
|
||||
retryKey: pending?.key === ui.pendingKey ? ui.pendingKey : null,
|
||||
},
|
||||
navigation: (
|
||||
<DetailNavigation ids={listIds} id={id} open={openOrder} blocked={!!form || client.busy || !!client.pending()} />
|
||||
),
|
||||
@@ -340,7 +346,21 @@ export function OrderActionDialog({
|
||||
data = readForm(node),
|
||||
kind = node.dataset.kind;
|
||||
let submittedDirect = false;
|
||||
let submittedKey;
|
||||
const retryKey = e.nativeEvent.submitter?.dataset.retryKey;
|
||||
try {
|
||||
if (client.busy) return;
|
||||
if (retryKey) {
|
||||
const job = client.pending();
|
||||
if (!job || job.key !== retryKey || job.key !== ui.pendingKey) return;
|
||||
submittedKey = job.key;
|
||||
submittedDirect = job.url === base + '/' + kind;
|
||||
await client.retryPending();
|
||||
refreshDetail();
|
||||
await refreshState();
|
||||
return;
|
||||
}
|
||||
if (client.pending()) return;
|
||||
let url, payload;
|
||||
if (form.type === 'after') {
|
||||
payload = views.orderAfterSaleInput(node);
|
||||
@@ -400,7 +420,9 @@ export function OrderActionDialog({
|
||||
}
|
||||
if (data.legacyCountVerified) payload.legacyCountVerified = true;
|
||||
}
|
||||
await client.mutate(url, payload);
|
||||
const saving = client.mutate(url, payload);
|
||||
submittedKey = client.pending()?.key;
|
||||
await saving;
|
||||
refreshDetail();
|
||||
await refreshState();
|
||||
} catch (err) {
|
||||
@@ -421,14 +443,16 @@ export function OrderActionDialog({
|
||||
} else if (
|
||||
form.type === 'action' &&
|
||||
views.orderActionUsesChangeForm(kind) &&
|
||||
[403, 404, 409].includes(err.status)
|
||||
([403, 404, 409].includes(err.status) || (submittedKey && submittedKey === client.pending()?.key))
|
||||
) {
|
||||
const forceApproval = err.status === 403 && submittedDirect && !client.pending();
|
||||
if (node.elements.verified) node.elements.verified.checked = false;
|
||||
const rejected = [403, 404, 409].includes(err.status);
|
||||
if (rejected && node.elements.verified) node.elements.verified.checked = false;
|
||||
setUi(old => ({
|
||||
...old,
|
||||
forceApproval,
|
||||
stale: !forceApproval,
|
||||
pendingKey: submittedKey,
|
||||
stale: !forceApproval && rejected,
|
||||
actionError: messageOf(err) + (forceApproval ? ' 输入已保留,请重新核实后提交店主审批。' : ''),
|
||||
}));
|
||||
} else setError(messageOf(err));
|
||||
|
||||
Reference in new issue
Block a user