回筐、账单完成

This commit is contained in:
liu
2026-08-14 01:19:47 +08:00
parent e35c951a59
commit bf8ac68391
39 changed files with 1392 additions and 963 deletions
+34
View File
@@ -15,6 +15,17 @@ class BillModel extends Model
{
use HasFactory;
/** 支付状态:未支付 */
public const int STATUS_UNPAID = 0;
/** 支付状态:已支付 */
public const int STATUS_PAID = 1;
/** 支付状态中文名 */
public const array STATUS_NAMES = [
self::STATUS_UNPAID => '未支付',
self::STATUS_PAID => '已支付',
];
protected $table = 'bill';
protected $primaryKey = 'id';
@@ -31,6 +42,10 @@ class BillModel extends Model
'tray_price',
'added_amount',
'total_amount',
'status',
'paid_at',
'pay_remark',
'paid_operator_id',
'operator_id',
'remark',
];
@@ -47,6 +62,9 @@ class BillModel extends Model
'tray_price' => 'decimal:2',
'added_amount' => 'decimal:2',
'total_amount' => 'decimal:2',
'status' => 'integer',
'paid_at' => 'datetime:Y-m-d H:i:s',
'paid_operator_id' => 'integer',
'operator_id' => 'integer',
'created_at' => 'datetime:Y-m-d H:i:s',
];
@@ -75,6 +93,14 @@ class BillModel extends Model
return $this->belongsTo(SysUserModel::class, 'operator_id', 'id');
}
/**
* 收款操作人(后台系统用户,线下收款登记)
*/
public function paidOperator(): BelongsTo
{
return $this->belongsTo(SysUserModel::class, 'paid_operator_id', 'id');
}
/**
* 本账单关联的门店订单
*/
@@ -82,4 +108,12 @@ class BillModel extends Model
{
return $this->hasMany(StoreOrderModel::class, 'bill_id', 'id');
}
/**
* 本账单关联的门店订单明细
*/
public function items(): HasMany
{
return $this->hasMany(StoreOrderItemModel::class, 'bill_id', 'id');
}
}