feat: 第三阶段业务模块(服务产康/月嫂/进销存)

- 新增3个migration(15张表): service/nanny/inventory
- 新增15个Model + 13个Controller
- 新增55条API路由(总计212条)
- 新增3个前端API模块 + 11个管理页面
- vite build验证通过
This commit is contained in:
li
2026-03-13 20:29:45 +08:00
parent 16bcd9bcf0
commit e7d4d9b414
46 changed files with 2573 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Models\Nanny;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Nanny extends Model
{
use BelongsToStore;
protected $fillable = ['store_id','name','phone','id_card','avatar','level','skills','experience_years','health_cert','cooperation_type','base_salary','introduction','status'];
protected function casts(): array { return ['level'=>'integer','skills'=>'array','experience_years'=>'integer','cooperation_type'=>'integer','base_salary'=>'decimal:2','status'=>'integer']; }
public function orders(): HasMany { return $this->hasMany(NannyOrder::class); }
public function schedules(): HasMany { return $this->hasMany(NannySchedule::class); }
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models\Nanny;
use App\Models\Crm\Customer;
use App\Models\User;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class NannyOrder extends Model
{
use BelongsToStore;
protected $fillable = ['store_id','customer_id','nanny_id','order_no','service_type','start_date','end_date','days','price','status','match_candidates','remark','created_by'];
protected function casts(): array { return ['service_type'=>'integer','start_date'=>'date','end_date'=>'date','days'=>'integer','price'=>'decimal:2','status'=>'integer','match_candidates'=>'array']; }
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
public function nanny(): BelongsTo { return $this->belongsTo(Nanny::class); }
public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); }
public function reviews(): HasMany { return $this->hasMany(NannyReview::class); }
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models\Nanny;
use App\Models\Crm\Customer;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class NannyReview extends Model
{
const UPDATED_AT = null;
protected $fillable = ['nanny_order_id','customer_id','nanny_id','score','content'];
protected function casts(): array { return ['score'=>'integer']; }
public function order(): BelongsTo { return $this->belongsTo(NannyOrder::class, 'nanny_order_id'); }
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
public function nanny(): BelongsTo { return $this->belongsTo(Nanny::class); }
}
@@ -0,0 +1,12 @@
<?php
namespace App\Models\Nanny;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class NannySchedule extends Model
{
const UPDATED_AT = null;
protected $fillable = ['nanny_id','nanny_order_id','schedule_date','type','remark'];
protected function casts(): array { return ['schedule_date'=>'date','type'=>'integer']; }
public function nanny(): BelongsTo { return $this->belongsTo(Nanny::class); }
public function order(): BelongsTo { return $this->belongsTo(NannyOrder::class, 'nanny_order_id'); }
}