优化后台多语言
This commit is contained in:
parent
5c233f1bc5
commit
3c1ffdc0f8
|
|
@ -19,6 +19,7 @@ class CustomerResource extends JsonResource
|
|||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'status' => $this->status,
|
||||
'created_at' => time_format($this->created_at),
|
||||
'avatar' => image_resize($this->avatar),
|
||||
'from' => $this->from,
|
||||
'customer_group_name' => $this->customerGroup->description->name ?? '',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Beike\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
|
@ -18,6 +19,11 @@ class Customer extends Authenticatable
|
|||
|
||||
protected $fillable = ['name', 'email', 'password', 'status', 'avatar', 'customer_group_id', 'locale', 'status', 'from'];
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date): string
|
||||
{
|
||||
return Carbon::createFromFormat('Y-m-d H:i:s', $date)->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function addresses(): HasMany
|
||||
{
|
||||
return $this->hasMany(Address::class);
|
||||
|
|
|
|||
|
|
@ -85,31 +85,31 @@
|
|||
:total="customers.total"></el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog title="创建客户" :visible.sync="dialogCustomers.show" width="600px"
|
||||
<el-dialog title="{{ __('admin/customer.customers_create') }}" :visible.sync="dialogCustomers.show" width="670px"
|
||||
@close="closeCustomersDialog('form')" :close-on-click-modal="false">
|
||||
<el-form ref="form" :rules="rules" :model="dialogCustomers.form" label-width="100px">
|
||||
<el-form-item label="用户名" prop="name">
|
||||
<el-input v-model="dialogCustomers.form.name" placeholder="用户名"></el-input>
|
||||
<el-form ref="form" :rules="rules" :model="dialogCustomers.form" label-width="120px">
|
||||
<el-form-item label="{{ __('admin/customer.user_name') }}" prop="name">
|
||||
<el-input v-model="dialogCustomers.form.name" placeholder="{{ __('admin/customer.user_name') }}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="dialogCustomers.form.email" placeholder="邮箱"></el-input>
|
||||
<el-form-item label="{{ __('common.edit') }}" prop="email">
|
||||
<el-input v-model="dialogCustomers.form.email" placeholder="{{ __('common.edit') }}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="dialogCustomers.form.password" placeholder="密码"></el-input>
|
||||
<el-form-item label="{{ __('shop/login.password') }}" prop="password">
|
||||
<el-input v-model="dialogCustomers.form.password" placeholder="{{ __('shop/login.password') }}"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户组">
|
||||
<el-select v-model="dialogCustomers.form.customer_group_id" placeholder="请选择">
|
||||
<el-form-item label="{{ __('customer.customer_group') }}">
|
||||
<el-select v-model="dialogCustomers.form.customer_group_id" placeholder="">
|
||||
<el-option v-for="item in source.customer_group" :key="item.id" :label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-form-item label="{{ __('common.status') }}" prop="status">
|
||||
<el-switch v-model="dialogCustomers.form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addCustomersFormSubmit('form')">保存</el-button>
|
||||
<el-button @click="closeCustomersDialog('form')">取消</el-button>
|
||||
<el-button type="primary" @click="addCustomersFormSubmit('form')">{{ __('common.save') }}</el-button>
|
||||
<el-button @click="closeCustomersDialog('form')">{{ __('common.cancel') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
|
@ -142,12 +142,12 @@
|
|||
},
|
||||
|
||||
rules: {
|
||||
name: [{required: true,message: '请输入用户名',trigger: 'blur'}, ],
|
||||
name: [{required: true,message: '{{ __('common.error_required', ['name' => __('admin/customer.user_name')] ) }}', trigger: 'blur'}, ],
|
||||
email: [
|
||||
{required: true, message: '请输入邮箱', trigger: 'blur'},
|
||||
{type: 'email', message: '请输入正确邮箱格式' ,trigger: 'blur'},
|
||||
{required: true, message: '{{ __('common.error_required', ['name' => __('common.email')] ) }}', trigger: 'blur'},
|
||||
{type: 'email', message: '{{ __('admin/customer.error_email') }}' ,trigger: 'blur'},
|
||||
],
|
||||
password: [{required: true,message: '请输入密码',trigger: 'blur'}, ],
|
||||
password: [{required: true,message: '{{ __('common.error_required', ['name' => __('shop/login.password')] ) }}',trigger: 'blur'}, ],
|
||||
},
|
||||
|
||||
url: @json(admin_route('customers.index')),
|
||||
|
|
@ -203,7 +203,7 @@
|
|||
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (!valid) {
|
||||
this.$message.error('请检查表单是否填写正确');
|
||||
this.$message.error('{{ __('common.error_form') }}');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -217,9 +217,9 @@
|
|||
|
||||
deleteCustomer(url, index) {
|
||||
const self = this;
|
||||
this.$confirm('确定要删除用户吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
this.$confirm('{{ __('common.confirm_delete') }}', '{{ __('common.text_hint') }}', {
|
||||
confirmButtonText: '{{ __('common.confirm') }}',
|
||||
cancelButtonText: '{{ __('common.cancel') }}',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$http.delete(url).then((res) => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@
|
|||
<x-admin-alert type="danger" msg="{{ $errors->first('error') }}" class="mt-4" />
|
||||
@endif
|
||||
|
||||
@if (session()->has('message'))
|
||||
<x-admin-alert type="success" msg="{{ session('message') }}" class="mt-4" />
|
||||
@endif
|
||||
|
||||
<div id="product-app">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
|
|
|||
|
|
@ -33,11 +33,6 @@ return [
|
|||
'address_1' => '详细地址 1',
|
||||
'address_2' => '详细地址 2',
|
||||
|
||||
// 'customers_delete' => '邮箱',
|
||||
// 'customers_delete' => '密码',
|
||||
// 'customers_delete' => '用户组',
|
||||
// 'customers_delete' => '添加地址',
|
||||
|
||||
'cannot_delete_root' => '不能删除Root账户',
|
||||
'error_email' => '请输入正确邮箱格式',
|
||||
'confirm_delete_address' => '确定要删除地址吗?',
|
||||
|
|
|
|||
Loading…
Reference in New Issue