fix(实物订单): 发货同步顶层配送方式并修正详情取值优先级

- 发货时同步更新 extra_info.delivery_type,与嵌套 delivery.delivery_type 保持一致
- 详情扩展监听器取值改为发货信息优先,避免下单时写入的顶层旧值(express)覆盖实际发货方式
- 修复无需配送发货后订单详情仍显示快递配送的问题
This commit is contained in:
From-wh 2026-10-27 10:16:50 +08:00 committed by 吴昊天
parent 520a323196
commit 730fdad6f4
2 changed files with 6 additions and 1 deletions

View File

@ -90,7 +90,10 @@ class OrderCenterDetailExtendListener implements ListenerInterface
}
}
$deliveryType = (string)($extraInfo['delivery_type'] ?? ($extraInfo['delivery']['delivery_type'] ?? ''));
// 发货配送方式以 extra_info.delivery.delivery_type(发货时写入)为准;
// 顶层 extra_info.delivery_type 是下单收货方式(express/pickup/door),
// 存量订单发货后两者可能不一致,不能让顶层旧值覆盖实际发货方式
$deliveryType = (string)(($extraInfo['delivery']['delivery_type'] ?? '') ?: ($extraInfo['delivery_type'] ?? ''));
if ($deliveryType === '') {
$shippingType = (int)($detail['shipping_type'] ?? 0);
$deliveryType = $shippingType === 2 ? 'pickup' : ($shippingType === 3 ? 'door' : 'express');

View File

@ -174,6 +174,8 @@ class OrderServices extends BaseService
'delivery_id' => $deliveryId,
'delivery_uid' => $deliveryUid,
];
// 顶层 delivery_type 为下单收货方式,发货后以实际发货配送方式为准,两处必须同步
$extraInfo['delivery_type'] = $deliveryType;
$this->centerServices->updateRecord($orderNo, [
'extra_info' => json_encode($extraInfo, JSON_UNESCAPED_UNICODE),
'delivery_time' => time(),