diff --git a/beike/Helpers.php b/beike/Helpers.php index 96547f52..10691605 100644 --- a/beike/Helpers.php +++ b/beike/Helpers.php @@ -122,7 +122,7 @@ function plugin_route($route, $params = []): string */ function type_route($type, $value): string { - $types = ['category', 'product', 'brand', 'page', 'order', 'static', 'custom']; + $types = ['category', 'product', 'brand', 'page', 'order', 'rma', 'static', 'custom']; if (empty($type) || empty($value) || !in_array($type, $types)) { return ''; } @@ -140,6 +140,8 @@ function type_route($type, $value): string return shop_route('pages.show', ['page' => $value]); } elseif ($type == 'order') { return shop_route('account.order.show', ['number' => $value]); + } elseif ($type == 'rma') { + return shop_route('account.rma.show', ['id' => $value]); } elseif ($type == 'static') { return shop_route($value); } elseif ($type == 'custom') { diff --git a/beike/Services/DesignService.php b/beike/Services/DesignService.php index 7a72f7fb..f986f586 100644 --- a/beike/Services/DesignService.php +++ b/beike/Services/DesignService.php @@ -170,6 +170,7 @@ class DesignService * @param $type * @param $value * @return string + * @throws \Exception */ private static function handleLink($type, $value): string { diff --git a/beike/Shop/Http/Resources/RmaDetail.php b/beike/Shop/Http/Resources/RmaDetail.php index ada5c4ae..63451e0c 100644 --- a/beike/Shop/Http/Resources/RmaDetail.php +++ b/beike/Shop/Http/Resources/RmaDetail.php @@ -34,7 +34,7 @@ class RmaDetail extends JsonResource 'product_name' => $this->product_name, 'name' => $this->name, 'sku' => $this->sku, - 'reason' => $this->reason->name, + 'reason' => $this->reason->name ?? '', 'type_text' => $this->type_text, ]; } diff --git a/beike/Shop/View/Components/Breadcrumb.php b/beike/Shop/View/Components/Breadcrumb.php index e254cb70..bfcd4ef2 100644 --- a/beike/Shop/View/Components/Breadcrumb.php +++ b/beike/Shop/View/Components/Breadcrumb.php @@ -40,6 +40,8 @@ class Breadcrumb extends Component $breadcrumbs = array_merge($breadcrumbs, $this->handleProductLinks($value)); } elseif ($type == 'order') { $breadcrumbs = array_merge($breadcrumbs, $this->handleOrderLinks($value)); + } elseif ($type == 'rma') { + $breadcrumbs = array_merge($breadcrumbs, $this->handleRmaLinks($value)); } elseif (Str::startsWith($value, 'account')) { $breadcrumbs = array_merge($breadcrumbs, $this->handleAccountLinks($value)); } else { @@ -141,6 +143,39 @@ class Breadcrumb extends Component } + /** + * 获取订单详情页面包屑 + * + * @param $value + * @return array + * @throws \Exception + */ + private function handleRmaLinks($value): array + { + $links = []; + + $link = handle_link(['type' => 'static', 'value' => 'account.index']); + $links[] = [ + 'title' => $link['text'], + 'url' => $link['link'], + ]; + + $link = handle_link(['type' => 'static', 'value' => 'account.rma.index']); + $links[] = [ + 'title' => $link['text'], + 'url' => $link['link'], + ]; + + $link = handle_link(['type' => 'rma', 'value' => $value]); + $links[] = [ + 'title' => $value, + 'url' => $link['link'], + ]; + + return $links; + } + + /** * 处理个人中心面包屑 * diff --git a/themes/default/account/rmas/info.blade.php b/themes/default/account/rmas/info.blade.php index a605dcef..71a011a1 100644 --- a/themes/default/account/rmas/info.blade.php +++ b/themes/default/account/rmas/info.blade.php @@ -9,13 +9,7 @@ @section('content')
- - +