parent
ad0376c077
commit
3942ffe36b
|
|
@ -12,6 +12,7 @@
|
||||||
namespace Beike\Admin\Http\Controllers;
|
namespace Beike\Admin\Http\Controllers;
|
||||||
|
|
||||||
use Beike\Admin\Http\Resources\RmaDetail;
|
use Beike\Admin\Http\Resources\RmaDetail;
|
||||||
|
use Beike\Admin\Http\Resources\RmaHistoryDetail;
|
||||||
use Beike\Models\Rma;
|
use Beike\Models\Rma;
|
||||||
use Beike\Repositories\RmaReasonRepo;
|
use Beike\Repositories\RmaReasonRepo;
|
||||||
use Beike\Repositories\RmaRepo;
|
use Beike\Repositories\RmaRepo;
|
||||||
|
|
@ -40,7 +41,7 @@ class RmaController extends Controller
|
||||||
$rma = RmaRepo::find($id);
|
$rma = RmaRepo::find($id);
|
||||||
$data = [
|
$data = [
|
||||||
'rma' => (new RmaDetail($rma))->jsonSerialize(),
|
'rma' => (new RmaDetail($rma))->jsonSerialize(),
|
||||||
'histories' => $rma->histories,
|
'histories' => RmaHistoryDetail::collection($rma->histories)->jsonSerialize(),
|
||||||
'statuses' => RmaRepo::getStatuses(),
|
'statuses' => RmaRepo::getStatuses(),
|
||||||
'types' => RmaRepo::getTypes(),
|
'types' => RmaRepo::getTypes(),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -96,9 +96,9 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($histories as $history)
|
@foreach ($histories as $history)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $history->status }}</td>
|
<td>{{ $history['status'] }}</td>
|
||||||
<td>{{ $history->comment }}</td>
|
<td>{{ $history['comment'] }}</td>
|
||||||
<td>{{ $history->created_at }}</td>
|
<td>{{ $history['created_at'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue