回筐、账单完成
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user