feat: 第三阶段业务模块(服务产康/月嫂/进销存)
- 新增3个migration(15张表): service/nanny/inventory - 新增15个Model + 13个Controller - 新增55条API路由(总计212条) - 新增3个前端API模块 + 11个管理页面 - vite build验证通过
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace App\Models\Service;
|
||||
use App\Models\Crm\Customer;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class ServiceExecution extends Model
|
||||
{
|
||||
protected $fillable = ['service_order_id','service_item_id','customer_id','technician_id','scheduled_at','started_at','ended_at','status','remark'];
|
||||
protected function casts(): array { return ['scheduled_at'=>'datetime','started_at'=>'datetime','ended_at'=>'datetime','status'=>'integer']; }
|
||||
public function order(): BelongsTo { return $this->belongsTo(ServiceOrder::class, 'service_order_id'); }
|
||||
public function serviceItem(): BelongsTo { return $this->belongsTo(ServiceItem::class); }
|
||||
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
|
||||
public function technician(): BelongsTo { return $this->belongsTo(User::class, 'technician_id'); }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace App\Models\Service;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
class ServiceItem extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','name','category','price','duration','description','image','status'];
|
||||
protected function casts(): array { return ['category'=>'integer','price'=>'decimal:2','duration'=>'integer','status'=>'integer']; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace App\Models\Service;
|
||||
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 ServiceOrder extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','customer_id','order_no','type','items','total_amount','discount_amount','actual_amount','status','pay_method','paid_at','created_by'];
|
||||
protected function casts(): array { return ['type'=>'integer','items'=>'array','total_amount'=>'decimal:2','discount_amount'=>'decimal:2','actual_amount'=>'decimal:2','status'=>'integer','pay_method'=>'integer','paid_at'=>'datetime']; }
|
||||
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
|
||||
public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); }
|
||||
public function executions(): HasMany { return $this->hasMany(ServiceExecution::class); }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace App\Models\Service;
|
||||
use App\Traits\BelongsToStore;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
class ServicePackage extends Model
|
||||
{
|
||||
use BelongsToStore;
|
||||
protected $fillable = ['store_id','name','items','price','validity_days','status'];
|
||||
protected function casts(): array { return ['items'=>'array','price'=>'decimal:2','validity_days'=>'integer','status'=>'integer']; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace App\Models\Service;
|
||||
use App\Models\Crm\Customer;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
class ServiceReview extends Model
|
||||
{
|
||||
const UPDATED_AT = null;
|
||||
protected $fillable = ['service_order_id','service_execution_id','customer_id','score','content'];
|
||||
protected function casts(): array { return ['score'=>'integer']; }
|
||||
public function order(): BelongsTo { return $this->belongsTo(ServiceOrder::class, 'service_order_id'); }
|
||||
public function customer(): BelongsTo { return $this->belongsTo(Customer::class); }
|
||||
}
|
||||
Reference in New Issue
Block a user