This commit is contained in:
pushuo 2022-08-16 17:20:07 +08:00
parent 3eb3b3a37b
commit d011cf2803
9 changed files with 131 additions and 13 deletions

View File

@ -9,16 +9,16 @@ class Input extends Component
public string $name;
public string $title;
public string $value;
public string $class;
public string $error;
public string $width;
public bool $required;
public function __construct(string $name, string $title, ?string $value, bool $required = false, ?string $class = '', ?string $width = '400')
public function __construct(string $name, string $title, ?string $value, bool $required = false, ?string $error = '', ?string $width = '400')
{
$this->name = $name;
$this->title = $title;
$this->value = $value;
$this->class = $class;
$this->error = $error;
$this->width = $width;
$this->required = $required;
}

View File

@ -9,14 +9,16 @@
* @modified 2022-08-03 21:17:04
*/
namespace Beike\Shop\Http\Controllers;
namespace Beike\Shop\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Beike\Repositories\RmaRepo;
use Beike\Shop\Http\Requests\RmaRequest;
use Beike\Shop\Services\RmaService;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Beike\Repositories\OrderProductRepo;
class RmaController extends Controller
{
@ -47,11 +49,12 @@ class RmaController extends Controller
public function create(int $orderProductId)
{
$data = [
'orderProductId' => $orderProductId,
'orderProduct' => OrderProductRepo::find($orderProductId),
'statuses' => RmaRepo::getStatuses(),
'types' => RmaRepo::getTypes(),
];
return view('rms/form', $data);
return view('account/rmas/form', $data);
}
public function store(RmaRequest $request): array

View File

@ -83,7 +83,12 @@ Route::prefix('/')
Route::get('/', [AccountController::class, 'index'])->name('account.index');
Route::resource('addresses', AddressController::class);
Route::get('edit', [EditController::class, 'index'])->name('account.edit.index');
Route::get('rmas', [RmaController::class, 'index'])->name('account.rma.index');
Route::get('rmas/{id}', [RmaController::class, 'show'])->name('account.rma.show');
Route::get('rmas/create/{order_product_id}', [RmaController::class, 'create'])->name('account.rma.create');
Route::post('rmas/store', [RmaController::class, 'store'])->name('account.rma.store');
Route::put('edit', [EditController::class, 'update'])->name('account.edit.update');
Route::get('orders', [OrderController::class, 'index'])->name('account.order.index');
Route::get('orders/{number}', [OrderController::class, 'show'])->name('account.order.show');

View File

@ -1,7 +1,7 @@
<x-admin::form.row :title="$title" :required="$required">
<input type="text" name="{{ $name }}" class="form-control wp-{{ $width }} {{ $errors->has($name) ? 'is-invalid' : '' }}" value="{{ $value }}" placeholder="{{ $title }}">
@if ($errors->has($name))
<span class="invalid-feedback" role="alert">{{ $errors->first($name) }}</span>
<input type="text" name="{{ $name }}" class="form-control wp-{{ $width }} {{ $error ? 'is-invalid' : '' }}" value="{{ $value }}" placeholder="{{ $title }}">
@if ($error)
<span class="invalid-feedback" role="alert">{{ $error }}</span>
@endif
{{ $slot }}
</x-admin::form.row>

View File

@ -24,7 +24,16 @@
<div class="tab-content">
@foreach ($admin_languages as $language)
<div class="tab-pane fade {{ $loop->first ? 'show active' : '' }}" id="tab-{{ $language['code'] }}">
<x-admin-form-input name="descriptions[{{ $language['code'] }}][title]" title="信息标题" value="{{ old('title', $descriptions[$language['code']]['title'] ?? '') }}" />
{{ $errors->first("descriptions.{$language['code']}.title") }}
<x-admin-form-input
{{-- :error="$errors->has("descriptions.{$language['code']}.title") ? $errors->first("descriptions.{$language['code']}.title") : ''" --}}
error="bbhjhhjg"
{{-- error="{{ $errors->first("descriptions.{$language['code']}.title") }}" --}}
name="descriptions[{{ $language['code'] }}][title]"
title="信息标题"
value="{{ old('title', $descriptions[$language['code']]['title'] ?? '') }}"
/>
<x-admin::form.row title="内容">
<div class="w-max-1000">
<textarea name="descriptions[{{ $language['code'] }}][content]" data-tinymce-height="600" class="form-control tinymce">

View File

@ -6,7 +6,7 @@ $(function() {
$('#offcanvas-search-top input').keydown(function (e) {
if (e.keyCode == 13) {
if ($(this).val() != '') {
location.href = 'products/keyword?name=' + $(this).val();
location.href = 'products/search?keyword=' + $(this).val();
}
// $('#offcanvas-search-top .btn-search').click();
}

View File

@ -59,7 +59,7 @@
</div>
</div>
@if ($order->status == 'completed')
<a href="{{ shop_route('orders.pay', $order->number) }}" class="btn btn-outline-primary btn-sm">申请售后</a>
<a href="{{ shop_route('account.rma.create', [$product->id]) }}" class="btn btn-outline-primary btn-sm">申请售后</a>
@endif
</div>
@endforeach

View File

@ -0,0 +1,102 @@
@extends('layout.master')
@section('body-class', 'page-account-rmas')
@push('header')
{{-- <script src="{{ asset('vendor/vue/2.6.14/vue.js') }}"></script> --}}
@endpush
@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>
<div class="row">
<x-shop-sidebar/>
<div class="col-12 col-md-9">
<div class="card h-min-600">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="card-title">提交售后信息</h5>
</div>
<div class="card-body h-600">
<div class="bg-light rounded-3 p-3 mb-4" style="background: #f6f9fc;">
{{-- <h6 class="mb-2">商品信息</h6> --}}
<div class="d-flex align-items-center">
<div class="left wh-70">
<img src="{{ $orderProduct->image }}" class="img-fluid">
</div>
<div class="right ms-3">
<div class="name mb-2 fw-bold fs-5">{{ $orderProduct->name }}</div>
<div class="price">{{ $orderProduct->price }} x {{ $orderProduct->quantity }}</div>
</div>
</div>
</div>
{{-- <h6 class="border-bottom pb-3 mb-4">商品信息 & 退换原因</h6> --}}
<form action="{{ shop_route('account.rma.store') }}" method="POST">
@csrf
{{-- {{ method_field('put') }} --}}
@if (session('success'))
<x-shop-alert type="success" msg="{{ session('success') }}" class="mt-4"/>
@endif
<input type="hidden" name="order_product_id" value="{{ $orderProduct->id }}">
<div class="row">
<div class="col-sm-6 mb-4">
<label class="form-label">退换数量</label>
<input class="form-control" type="text" value="{{ old('quantity', $orderProduct->quantity ?? '1') }}">
@if ($errors->has('quantity'))
<span class="invalid-feedback" role="alert">{{ $errors->first('quantity') }}</span>
@endif
</div>
<div class="col-sm-6 mb-4">
<label class="form-label">已打开包装</label>
<select class="form-select" name="opened">
<option selected value="0"></option>
<option value="1"></option>
</select>
</div>
<div class="col-sm-6 mb-4">
<label class="form-label">退换原因</label>
<select class="form-select" name="opened">
<option selected value="0"></option>
<option value="1"></option>
</select>
</div>
<div class="col-sm-6 mb-4">
<label class="form-label">服务类型</label>
<select class="form-select" name="type">
@foreach ($statuses as $key => $item)
<option value="{{ $key }}" {{ $key == old('type', '') ? 'selected': '' }}>{{ $item }}</option>
@endforeach
</select>
</div>
<div class="col-12 "></div>
<div class="col-sm-6 mb-4">
<label class="form-label">备注</label>
<textarea rows="4" type="text" name="comment" class="form-control">{{ old('comment', '') }}</textarea>
</div>
<div class="col-12 mt-4">
<button class="btn btn-primary mt-sm-0" type="submit">提交</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('add-scripts')
@endpush

View File

@ -1 +0,0 @@
info