后台售后用户角色等
This commit is contained in:
parent
79846ed46f
commit
217bdbadc3
|
|
@ -46,6 +46,12 @@ class RmaController extends Controller
|
|||
public function addHistory(Request $request, int $id)
|
||||
{
|
||||
RmaRepo::addHistory($id, $request->only('status', 'notify', 'comment'));
|
||||
|
||||
$data = [
|
||||
'rma' => RmaRepo::find($id),
|
||||
'statuses' => RmaRepo::getStatuses(),
|
||||
];
|
||||
return json_success('更新成功', $data);
|
||||
}
|
||||
|
||||
public function destroy(int $id): array
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ Route::prefix($adminName)
|
|||
Route::resource('products', Controllers\ProductController::class);
|
||||
|
||||
Route::resource('regions', Controllers\RegionController::class);
|
||||
Route::post('rmas/history', [Controllers\RmaController::class, 'addHistory'])->name('rmas.add_history');
|
||||
Route::post('rmas/history/{id}', [Controllers\RmaController::class, 'addHistory'])->name('rmas.add_history');
|
||||
Route::resource('rmas', Controllers\RmaController::class);
|
||||
Route::resource('rma_reasons', Controllers\RmaReasonController::class);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ class Sidebar extends Component
|
|||
$this->addLink('用户组', 'customer_groups.index', 'fa fa-tachometer-alt', $this->equalRoute('customer_groups.index'));
|
||||
}
|
||||
|
||||
if (Str::startsWith($routeName, ['orders.'])) {
|
||||
if (Str::startsWith($routeName, ['orders.', 'rmas.'])) {
|
||||
$this->addLink('订单列表', 'orders.index', 'fa fa-tachometer-alt', $this->equalRoute('orders.index'));
|
||||
$this->addLink('售后列表', 'rmas.index', 'fa fa-tachometer-alt', $this->equalRoute('rmas.index'));
|
||||
}
|
||||
|
||||
if (Str::startsWith($routeName, ['settings.', 'admin_users.', 'admin_roles.', 'plugins.', 'tax_classes', 'tax_rates', 'regions', 'currencies'])) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
<td>{{ $role->updated_at }}</td>
|
||||
<td class="text-end">
|
||||
<a href="{{ admin_route('admin_roles.edit', [$role->id]) }}" class="btn btn-outline-secondary btn-sm">编辑</a>
|
||||
<button class="btn btn-outline-danger btn-sm ml-1" type="button">删除</button>
|
||||
<button class="btn btn-outline-danger btn-sm ml-1 delete-role" data-id="{{ $role->id }}" type="button">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
@ -44,4 +44,17 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script>
|
||||
$('.delete-role').click(function(event) {
|
||||
const id = $(this).data('id');
|
||||
|
||||
$http.delete(`admin_roles/${id}`).then((res) => {
|
||||
layer.msg(res.message);
|
||||
$(this).parents('tr').remove()
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -52,11 +52,91 @@
|
|||
</div>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header"><h6 class="card-title">操作日志</h6></div>
|
||||
<div class="card-body">
|
||||
<div class="card-header"><h6 class="card-title">状态</h6></div>
|
||||
<div class="card-body" id="app">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="当前状态">
|
||||
待支付
|
||||
</el-form-item>
|
||||
<el-form-item label="修改状态" prop="status">
|
||||
<el-select size="small" v-model="form.status" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in statuses"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知客户">
|
||||
{{-- <el-checkbox v-model="form.notify"></el-checkbox> --}}
|
||||
<el-switch v-model="form.notify">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注信息">
|
||||
<textarea class="form-control w-max-500" v-model="form.comment"></textarea>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('form')">更新状态</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header"><h6 class="card-title">操作历史</h6></div>
|
||||
<div class="card-body">
|
||||
@foreach ($rma->histories as $history)
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
||||
data: {
|
||||
statuses: [],
|
||||
rma: @json($rma ?? []),
|
||||
form: {
|
||||
status: "",
|
||||
notify: false,
|
||||
comment: '',
|
||||
},
|
||||
|
||||
rules: {
|
||||
status: [{required: true, message: '请输入用户名', trigger: 'blur'}, ],
|
||||
}
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
let statuses = @json($statuses ?? []);
|
||||
this.statuses = Object.keys(statuses).map(key => {
|
||||
return {
|
||||
value: key,
|
||||
label: statuses[key]
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
submitForm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (!valid) {
|
||||
layer.msg('请检查表单是否填写正确',()=>{});
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post(`rmas/history/${this.rma.id}`,this.form).then((res) => {
|
||||
console.log(res)
|
||||
layer.msg(res.message);
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue