This commit is contained in:
pushuo 2022-07-28 20:50:24 +08:00
parent 2f35268205
commit a57181d386
5 changed files with 22 additions and 17 deletions

View File

@ -36,7 +36,7 @@ class BrandController extends Controller
return json_success("创建成功", $brand);
}
public function update(Request $request, int $customerId, int $id)
public function update(Request $request, int $id)
{
$brand = BrandRepo::update($id, $request->all());

View File

@ -84,7 +84,7 @@ class BrandRepo
$builder->where('status', $data['status']);
}
return $builder->paginate(20)->withQueryString();
return $builder->paginate(10)->withQueryString();
}
public static function listGroupByFirst()

View File

@ -20,7 +20,7 @@ class CreateCustomerTable extends Migration
$table->string('name');
$table->string('avatar')->default('');
$table->unsignedInteger('customer_group_id');
$table->unsignedInteger('address_id');
$table->unsignedInteger('address_id')->default(0);
$table->string('locale', 10);
$table->tinyInteger('status')->default(0);
$table->string('code', 40)->default('');

View File

@ -24,7 +24,7 @@
<tr v-for="brand, index in brands.data" :key="index">
<td>@{{ brand.id }}</td>
<td>@{{ brand.name }}</td>
<td><div class="wh-70"><img :src="thumbnail(brand.logo)" class="img-fluid"></div></td>
<td><div class="wh-50"><img :src="thumbnail(brand.logo)" class="img-fluid"></div></td>
<td>@{{ brand.sort_order }}</td>
<td>@{{ brand.first }}</td>
<td>@{{ brand.status }}</td>
@ -48,11 +48,11 @@
<el-input class="mb-0" v-model="dialog.form.name" placeholder="名称"></el-input>
</el-form-item>
<el-form-item label="图标">
<el-form-item label="图标" prop="logo" required>
<vue-image v-model="dialog.form.logo"></vue-image>
</el-form-item>
<el-form-item label="首字母">
<el-form-item label="首字母" prop="first">
<el-input class="mb-0" v-model="dialog.form.first" placeholder="首字母"></el-input>
</el-form-item>
@ -99,22 +99,30 @@
logo: '',
first: '',
sort_order: '',
status: '',
status: 1,
},
},
rules: {
// password: [{required: true,message: '请输入密码',trigger: 'blur'}, ],
name: [{required: true,message: '请输入名称',trigger: 'blur'}, ],
first: [{required: true,message: '请输入首字母',trigger: 'blur'}, ],
logo: [{required: true,message: '请上传图标',trigger: 'change'}, ],
}
},
mounted() {
// $http.get('brands?page=1').then((res) => {
// console.log(res)
// })
watch: {
page: function() {
this.loadData();
},
},
methods: {
loadData() {
$http.get(`brands?page=${this.page}`).then((res) => {
this.brands = res.data.brands;
})
},
checkedCreate(type, index) {
this.dialog.show = true
this.dialog.type = type
@ -174,6 +182,7 @@
closeDialog(form) {
Object.keys(this.dialog.form).forEach(key => this.dialog.form[key] = '')
this.dialog.form.status = 1
this.dialog.show = false
}
}

View File

@ -130,11 +130,7 @@
$http.post('customers', this.dialogCustomers.form).then((res) => {
this.$message.success(res.message);
if (this.dialog.type == 'add') {
this.customers.push(res.data)
} else {
this.customers[this.dialog.index] = res.data
}
this.customers.push(res.data);
this.dialogCustomers.show = false
})
});