first version

This commit is contained in:
liu
2026-07-23 20:41:25 +08:00
parent 00a0938a1b
commit 10cff754a4
211 changed files with 11577 additions and 842 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* 门店订单模型(小程序下单,快照等级价)
*/
class StoreOrderModel extends Model
{
use HasFactory;
/** 状态:待汇总(可被采购单生成归集、可取消) */
public const STATUS_PENDING = 0;
/** 状态:已汇总(已生成采购单) */
public const STATUS_SUMMARIZED = 1;
/** 状态:配送中 */
public const STATUS_DELIVERING = 2;
/** 状态:已完成 */
public const STATUS_COMPLETED = 3;
/** 状态:已取消 */
public const STATUS_CANCELLED = 9;
protected $table = 'store_order';
protected $primaryKey = 'id';
protected $fillable = [
'order_no',
'store_id',
'order_date',
'total_quantity',
'total_weight',
'total_amount',
'status',
'remark',
];
protected $casts = [
'store_id' => 'integer',
'order_date' => 'date:Y-m-d',
'total_quantity' => 'decimal:2',
'total_weight' => 'decimal:3',
'total_amount' => 'decimal:2',
'status' => 'integer',
];
/**
* 下单门店
*/
public function store(): BelongsTo
{
return $this->belongsTo(StoreModel::class, 'store_id', 'id');
}
/**
* 订单明细
*/
public function items(): HasMany
{
return $this->hasMany(StoreOrderItemModel::class, 'order_id', 'id');
}
}