fix(订单物流): 到店自提与上门服务隐藏「查看物流」按钮

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
吴昊天 2026-10-26 14:09:26 +08:00
parent 7293a7eb4d
commit 7f29dc3872
3 changed files with 31 additions and 12 deletions

View File

@ -348,17 +348,20 @@ class NormalOrderAdapter extends BaseOrderTypeAdapter
public function getStatusButtons(string $statusCode, array $detail = []): array
{
if ($statusCode === self::STATUS_PROCESSING) {
return $this->getProcessingButtons($detail);
$buttons = $this->getProcessingButtons($detail);
} else {
// 其他状态:从 STATUS_TREE 静态读取
$node = $this->centerStatusMap[$statusCode][0] ?? null;
if ($node) {
$buttons = $node['user_buttons'] ?? [];
} else {
// 回退:纯扩展状态节点(after_sale / refunded)
$buttons = $this->extStatusMap[$statusCode]['user_buttons'] ?? [];
}
}
// 其他状态:从 STATUS_TREE 静态读取
$node = $this->centerStatusMap[$statusCode][0] ?? null;
if ($node) {
return $node['user_buttons'] ?? [];
}
// 回退:纯扩展状态节点(after_sale / refunded)
return $this->extStatusMap[$statusCode]['user_buttons'] ?? [];
// 到店自提 / 上门服务无快递物流,列表与详情都不展示「查看物流」
return $this->filterLogisticsButtons($buttons, $detail);
}
public function getOrderButtons(array $detail): array
@ -373,7 +376,23 @@ class NormalOrderAdapter extends BaseOrderTypeAdapter
'params' => ['order_no' => (string)($detail['order_no'] ?? '')],
]);
}
return $buttons;
// parent 已走 getStatusButtons 过滤;此处再滤一次,防止后续插入按钮后遗漏
return $this->filterLogisticsButtons($buttons, $detail);
}
/**
* 到店自提(shipping_type=2)/ 上门服务(shipping_type=3)去掉「查看物流」
*/
protected function filterLogisticsButtons(array $buttons, array $detail): array
{
$shippingType = (int)($detail['shipping_type'] ?? 0);
if (!in_array($shippingType, [2, 3], true)) {
return $buttons;
}
return array_values(array_filter(
$buttons,
static fn($btn) => ($btn['action'] ?? '') !== 'viewLogistics'
));
}
/**

View File

@ -67,7 +67,7 @@
@click.stop="openSubcribe(item)">
{{$t(`申请退款`)}}</view>
<view class="rig-btn" v-if="status_type === 2 && index === cartInfo.length - 1 || !split">
<view v-if="delivery_type === 'express'" class="logistics" @click.stop="logistics(orderId)">{{$t(`查看物流`)}}
<view v-if="delivery_type === 'express' && shipping_type !== 2 && shipping_type !== 3" class="logistics" @click.stop="logistics(orderId)">{{$t(`查看物流`)}}
</view>
<view class="logistics sure" v-if="status_type === 2" @click.stop="confirmOrder(orderId)">{{$t(`确认收货`)}}
</view>

View File

@ -487,7 +487,7 @@
</view>
<navigator :render-link="false"
class="bnt cancel"
v-if="orderInfo.delivery_type == 'express' && status.class_status == 3 && status.type == 2 && !split.length"
v-if="orderInfo.shipping_type == 1 && orderInfo.delivery_type == 'express' && status.class_status == 3 && status.type == 2 && !split.length"
hover-class="none"
:url="'/pages/goods/goods_logistics/index?orderId=' + orderInfo.order_id"
>