修复RMA详情页面包屑
This commit is contained in:
parent
6ffb987275
commit
28c188d5ce
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ class DesignService
|
|||
* @param $type
|
||||
* @param $value
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
private static function handleLink($type, $value): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理个人中心面包屑
|
||||
*
|
||||
|
|
|
|||
|
|
@ -9,13 +9,7 @@
|
|||
@section('content')
|
||||
<div class="container" id="address-app">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">Library</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<x-shop-breadcrumb type="rma" value="{{ $rma->id }}" />
|
||||
|
||||
<div class="row">
|
||||
<x-shop-sidebar/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue