更新
This commit is contained in:
@@ -2206,8 +2206,8 @@ class PrescriptionOrderLogic
|
||||
$remark = mb_substr(trim((string) ($params['pay_remark'] ?? '')), 0, 200);
|
||||
$completionRequest = (int) ($params['completion_request'] ?? 0);
|
||||
|
||||
if ($amount <= 0) {
|
||||
self::$error = '支付单金额须大于 0';
|
||||
if ($amount < 0) {
|
||||
self::$error = '支付单金额不能为负数';
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2380,6 +2380,54 @@ class PrescriptionOrderLogic
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发货/已签收订单:不新增/关联支付单,仅提交完单申请并将支付审核置为待审核。
|
||||
*
|
||||
* @param array<string,mixed> $params id
|
||||
* @return array<string,mixed>|false
|
||||
*/
|
||||
public static function requestCompletion(array $params, int $adminId, array $adminInfo)
|
||||
{
|
||||
self::$error = '';
|
||||
$id = (int) $params['id'];
|
||||
$order = PrescriptionOrder::where('id', $id)->whereNull('delete_time')->find();
|
||||
if (!$order) {
|
||||
self::$error = '订单不存在';
|
||||
return false;
|
||||
}
|
||||
if (!self::canAccessOrder($order, $adminId, $adminInfo)) {
|
||||
self::$error = '无权限操作';
|
||||
return false;
|
||||
}
|
||||
if (!in_array((int) $order->fulfillment_status, [5, 6], true)) {
|
||||
self::$error = '仅「已发货」或「已签收」状态的订单可申请完单';
|
||||
return false;
|
||||
}
|
||||
|
||||
$order->completion_request = 1;
|
||||
$order->completion_request_time = time();
|
||||
$order->completion_request_by = $adminId;
|
||||
$order->completion_request_by_name = (string) ($adminInfo['name'] ?? '');
|
||||
$order->payment_slip_audit_status = 0;
|
||||
$order->payment_slip_audit_remark = '';
|
||||
|
||||
try {
|
||||
$order->save();
|
||||
} catch (\Throwable $e) {
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
self::writeLog($id, $adminId, $adminInfo, 'completion_request', '提交完单申请(未新增/关联支付单),等待支付审核');
|
||||
|
||||
$out = $order->toArray();
|
||||
self::maskInternalCostIfNeeded($out, $adminInfo);
|
||||
self::maskRemarkExtraIfNeeded($out, $adminInfo);
|
||||
self::attachLinkedPayOrders($out);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/** 完成订单时可选的履约终态:3=已完成,7-12=业务结案类状态 */
|
||||
private const COMPLETE_FULFILLMENT_TARGETS = [3, 7, 8, 9, 10, 11, 12];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user