售后服务(退换货)
This commit is contained in:
parent
44f72291e2
commit
39794da2ea
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Beike\Admin\Http\Controllers;
|
||||
|
||||
use Beike\Admin\Http\Resources\RmaDetail;
|
||||
use Beike\Models\Rma;
|
||||
use Beike\Repositories\RmaReasonRepo;
|
||||
use Beike\Repositories\RmaRepo;
|
||||
|
|
@ -24,6 +25,7 @@ class RmaController extends Controller
|
|||
$rmas = RmaRepo::list($request->only('name', 'email', 'telephone', 'product_name', 'sku', 'type', 'status'));
|
||||
$data = [
|
||||
'rmas' => $rmas,
|
||||
'rmas_format' => RmaDetail::collection($rmas)->jsonSerialize(),
|
||||
];
|
||||
|
||||
return view('admin::pages.rmas.index', $data);
|
||||
|
|
@ -48,7 +50,7 @@ class RmaController extends Controller
|
|||
RmaRepo::addHistory($id, $request->only('status', 'notify', 'comment'));
|
||||
|
||||
$data = [
|
||||
'rma' => RmaRepo::find($id),
|
||||
'rma' => (new RmaDetail(RmaRepo::find($id)))->jsonSerialize(),
|
||||
'statuses' => RmaRepo::getStatuses(),
|
||||
];
|
||||
return json_success(trans('common.updated_success'), $data);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* RmaDetail.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author TL <mengwb@opencart.cn>
|
||||
* @created 2022-08-31 11:56:28
|
||||
* @modified 2022-08-31 11:56:28
|
||||
*/
|
||||
|
||||
namespace Beike\Admin\Http\Resources;
|
||||
|
||||
use Beike\Repositories\RmaRepo;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class RmaDetail extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
$types = RmaRepo::getTypes();
|
||||
$statuses = RmaRepo::getStatuses();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'order_product_id' => $this->order_product_id,
|
||||
'quantity' => $this->quantity,
|
||||
'opened' => $this->opened,
|
||||
'type' => $types[$this->type],
|
||||
'comment' => $this->comment,
|
||||
'status' => $statuses[$this->status],
|
||||
'created_at' => time_format($this->created_at),
|
||||
'email' => $this->email,
|
||||
'telephone' => $this->telephone,
|
||||
'product_name' => $this->product_name,
|
||||
'name' => $this->name,
|
||||
'sku' => $this->sku,
|
||||
'model' => $this->model,
|
||||
'reason' => $this->reason->name ?? '',
|
||||
'type_text' => $this->type_text,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ class RmaDetail extends JsonResource
|
|||
public function toArray($request): array
|
||||
{
|
||||
$types = RmaRepo::getTypes();
|
||||
$statuses = RmaRepo::getStatuses();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
|
|
@ -27,7 +28,7 @@ class RmaDetail extends JsonResource
|
|||
'opened' => $this->opened,
|
||||
'type' => $types[$this->type],
|
||||
'comment' => $this->comment,
|
||||
'status' => $this->status,
|
||||
'status' => $statuses[$this->status],
|
||||
'created_at' => time_format($this->created_at),
|
||||
'email' => $this->email,
|
||||
'telephone' => $this->telephone,
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($rmas as $rma)
|
||||
@foreach ($rmas_format as $rma)
|
||||
<tr>
|
||||
<td>{{ $rma->name }}</td>
|
||||
<td>{{ $rma->email }}</td>
|
||||
<td>{{ $rma->telephone }}</td>
|
||||
<td>{{ $rma->product_name }}</td>
|
||||
<td>{{ $rma->model }}</td>
|
||||
<td>{{ $rma->quantity }}</td>
|
||||
<td>{{ $rma->type }}</td>
|
||||
<td>{{ $rma->status }}</td>
|
||||
<td>{{ $rma['name'] }}</td>
|
||||
<td>{{ $rma['email'] }}</td>
|
||||
<td>{{ $rma['telephone'] }}</td>
|
||||
<td>{{ $rma['product_name'] }}</td>
|
||||
<td>{{ $rma['model'] }}</td>
|
||||
<td>{{ $rma['quantity'] }}</td>
|
||||
<td>{{ $rma['type'] }}</td>
|
||||
<td>{{ $rma['status'] }}</td>
|
||||
<td><a href="{{ admin_route('rmas.show', [$rma->id]) }}" class="btn btn-outline-secondary btn-sm">{{ __('common.view') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue