Update
parent
28e16a48d1
commit
95ebc75d5f
|
|
@ -257,7 +257,7 @@ class OrderController extends AdminController
|
||||||
$packagesBox = Box::make('发货包裹', $packageGrid);
|
$packagesBox = Box::make('发货包裹', $packageGrid);
|
||||||
//显示发货动作
|
//显示发货动作
|
||||||
$order = OrderModel::findOrFail($id);
|
$order = OrderModel::findOrFail($id);
|
||||||
if ($order->isPaid() || $order->isShipping()) {
|
if ($order->isWaitShipping() || $order->isShipping()) {
|
||||||
$packagesBox->tool(new OrderCreatePackage(null, $id));
|
$packagesBox->tool(new OrderCreatePackage(null, $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ namespace App\Constants;
|
||||||
|
|
||||||
class OrderStatus
|
class OrderStatus
|
||||||
{
|
{
|
||||||
public const UNKNOWN = -1; // 未知
|
public const UNKNOWN = -1; // 未知
|
||||||
public const PENDING = 0; // 待付款
|
public const PENDING = 0; // 待付款
|
||||||
public const PAID = 1; // 已付款/待发货
|
public const WAIT_SHIPPING = 1; // 待发货
|
||||||
public const SHIPPING = 2; // 发货中
|
public const SHIPPING = 2; // 发货中
|
||||||
public const SHIPPED = 3; // 已发货/待收货
|
public const SHIPPED = 3; // 已发货/待收货
|
||||||
public const COMPLETED = 9; // 已完成
|
public const COMPLETED = 9; // 已完成
|
||||||
public const CANCELLED = 10; // 已取消
|
public const CANCELLED = 10; // 已取消
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,11 +121,21 @@ class Order extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认此订单是否是待发货
|
* 确认此订单是否已付款
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isPaid(): bool
|
public function isPaid(): bool
|
||||||
|
{
|
||||||
|
return $this->status === static::STATUS_PAID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认此订单是否是待发货
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isWaitShipping(): bool
|
||||||
{
|
{
|
||||||
return $this->status === static::STATUS_PAID
|
return $this->status === static::STATUS_PAID
|
||||||
&& $this->shipping_state === static::SHIPPING_STATE_PENDING;
|
&& $this->shipping_state === static::SHIPPING_STATE_PENDING;
|
||||||
|
|
@ -263,9 +273,9 @@ class Order extends Model
|
||||||
return OrderStatus::PENDING;
|
return OrderStatus::PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已付款(待发货)
|
// 待发货
|
||||||
if ($this->isPaid()) {
|
if ($this->isWaitShipping()) {
|
||||||
return OrderStatus::PAID;
|
return OrderStatus::WAIT_SHIPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发货中
|
// 发货中
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue