更新
This commit is contained in:
@@ -2465,7 +2465,8 @@ function canPayAudit(row: {
|
|||||||
fulfillment_status?: number
|
fulfillment_status?: number
|
||||||
}) {
|
}) {
|
||||||
const fs = Number(row.fulfillment_status)
|
const fs = Number(row.fulfillment_status)
|
||||||
if (fs === 3 || fs === 4 || fs === 6) return false
|
// 已完成/已取消不可再支付审核;已发货(5)/已签收(6) 与发货前状态一样,支付待审核时可审核
|
||||||
|
if (fs === 3 || fs === 4) return false
|
||||||
return Number(row.prescription_audit_status) === 1 && Number(row.payment_slip_audit_status) === 0
|
return Number(row.prescription_audit_status) === 1 && Number(row.payment_slip_audit_status) === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1183,6 +1183,8 @@ class PrescriptionOrderLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$didAutoComplete = false;
|
||||||
|
|
||||||
if ($action === 'approve') {
|
if ($action === 'approve') {
|
||||||
$order->payment_slip_audit_status = 1;
|
$order->payment_slip_audit_status = 1;
|
||||||
$order->payment_slip_audit_remark = mb_substr(trim($remark), 0, 500);
|
$order->payment_slip_audit_remark = mb_substr(trim($remark), 0, 500);
|
||||||
@@ -1198,12 +1200,23 @@ class PrescriptionOrderLogic
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有完单申请,自动完成订单
|
// 已发货/已签收且已申请完单:同意支付审核后直接结案(与手动「完成订单」一致:实付=关联支付单合计)
|
||||||
if ((int) $order->completion_request === 1 && (int) $order->fulfillment_status === 5) {
|
if ((int) $order->completion_request === 1 && in_array((int) $order->fulfillment_status, [5, 6], true)) {
|
||||||
$order->fulfillment_status = 3; // 已完成
|
$linkedPayOrderIds = self::linkedPayOrderIdList($id);
|
||||||
$order->completion_request = 0; // 清除完单申请标记
|
$linkedPayOrders = self::linkedPayOrdersPayload($linkedPayOrderIds);
|
||||||
self::writeLog((int) $order->id, $adminId, $adminInfo, 'auto_complete',
|
$linkedPayPaidTotal = 0.0;
|
||||||
'支付审核通过,根据完单申请自动完成订单');
|
foreach ($linkedPayOrders as $o) {
|
||||||
|
$linkedPayPaidTotal += (float) ($o['amount'] ?? 0);
|
||||||
|
}
|
||||||
|
$linkedPayPaidTotal = round($linkedPayPaidTotal, 2);
|
||||||
|
|
||||||
|
$order->fulfillment_status = 3;
|
||||||
|
$order->paid = $linkedPayPaidTotal;
|
||||||
|
$order->completion_request = 0;
|
||||||
|
$order->completion_request_time = 0;
|
||||||
|
$order->completion_request_by = 0;
|
||||||
|
$order->completion_request_by_name = '';
|
||||||
|
$didAutoComplete = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$order->payment_slip_audit_status = 2;
|
$order->payment_slip_audit_status = 2;
|
||||||
@@ -1229,13 +1242,11 @@ class PrescriptionOrderLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 状态同步和关联清除逻辑:
|
// 状态同步和关联清除逻辑:
|
||||||
// - 如果是"已发货"状态(5),无论同意还是拒绝,都保持状态不变
|
// - 已发货(5)/已签收(6):不同步为「待发货」,拒绝时也不整单解绑(与原先仅已发货一致)
|
||||||
// - 如果不是"已发货"状态,同步状态;拒绝时清除所有支付单关联关系
|
// - 其它状态:同步;拒绝时清除所有支付单关联关系
|
||||||
$currentStatus = (int) $order->fulfillment_status;
|
$currentStatus = (int) $order->fulfillment_status;
|
||||||
if ($currentStatus === 5) {
|
if (in_array($currentStatus, [5, 6], true)) {
|
||||||
// 已发货状态:保持已发货状态不变
|
// 保持履约节点不变
|
||||||
// 不调用 syncFulfillmentStatus
|
|
||||||
// 拒绝时也不清除关联(只删除了待审核支付单)
|
|
||||||
} else {
|
} else {
|
||||||
self::syncFulfillmentStatus($order);
|
self::syncFulfillmentStatus($order);
|
||||||
if ($action === 'reject') {
|
if ($action === 'reject') {
|
||||||
@@ -1251,6 +1262,13 @@ class PrescriptionOrderLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($didAutoComplete) {
|
||||||
|
$unassignSummary = self::clearDiagnosisAssistantOnComplete((int) $order->diagnosis_id);
|
||||||
|
$paidStr = number_format((float) $order->paid, 2, '.', '');
|
||||||
|
self::writeLog((int) $order->id, $adminId, $adminInfo, 'auto_complete',
|
||||||
|
'支付审核通过,根据完单申请自动完成订单,实付金额更新为 ¥' . $paidStr . $unassignSummary);
|
||||||
|
}
|
||||||
|
|
||||||
$actionName = $action === 'approve' ? 'audit_pay_approve' : 'audit_pay_reject';
|
$actionName = $action === 'approve' ? 'audit_pay_approve' : 'audit_pay_reject';
|
||||||
$summary = $action === 'approve' ? '支付单审核通过' . ($remark ? ',意见:' . $remark : '') : '支付单审核驳回,意见:' . $remark;
|
$summary = $action === 'approve' ? '支付单审核通过' . ($remark ? ',意见:' . $remark : '') : '支付单审核驳回,意见:' . $remark;
|
||||||
self::writeLog((int) $order->id, $adminId, $adminInfo, $actionName, $summary);
|
self::writeLog((int) $order->id, $adminId, $adminInfo, $actionName, $summary);
|
||||||
|
|||||||
Reference in New Issue
Block a user