修复词条显示问题

https://guangdagit.com/beike/beikeshop/issues/253
This commit is contained in:
TL 2022-09-30 10:35:54 +08:00 committed by Edward Yang
parent ad0376c077
commit 3942ffe36b
3 changed files with 37 additions and 4 deletions

View File

@ -12,6 +12,7 @@
namespace Beike\Admin\Http\Controllers;
use Beike\Admin\Http\Resources\RmaDetail;
use Beike\Admin\Http\Resources\RmaHistoryDetail;
use Beike\Models\Rma;
use Beike\Repositories\RmaReasonRepo;
use Beike\Repositories\RmaRepo;
@ -40,7 +41,7 @@ class RmaController extends Controller
$rma = RmaRepo::find($id);
$data = [
'rma' => (new RmaDetail($rma))->jsonSerialize(),
'histories' => $rma->histories,
'histories' => RmaHistoryDetail::collection($rma->histories)->jsonSerialize(),
'statuses' => RmaRepo::getStatuses(),
'types' => RmaRepo::getTypes(),
];

View File

@ -0,0 +1,32 @@
<?php
/**
* RmaHistoryDetail.php
*
* @copyright 2022 beikeshop.com - All Rights Reserved
* @link https://beikeshop.com
* @author TL <mengwb@guangda.work>
* @created 2022-09-30 11:56:28
* @modified 2022-09-30 11:56:28
*/
namespace Beike\Admin\Http\Resources;
use Beike\Repositories\RmaRepo;
use Illuminate\Http\Resources\Json\JsonResource;
class RmaHistoryDetail extends JsonResource
{
public function toArray($request): array
{
$statuses = RmaRepo::getStatuses();
return [
'id' => $this->id,
'rma_id' => $this->rma_id,
'status' => $statuses[$this->status],
'created_at' => time_format($this->created_at),
'notify' => $this->notify,
'comment' => $this->comment,
];
}
}

View File

@ -96,9 +96,9 @@
<tbody>
@foreach ($histories as $history)
<tr>
<td>{{ $history->status }}</td>
<td>{{ $history->comment }}</td>
<td>{{ $history->created_at }}</td>
<td>{{ $history['status'] }}</td>
<td>{{ $history['comment'] }}</td>
<td>{{ $history['created_at'] }}</td>
</tr>
@endforeach
</tbody>