83 lines
1.4 KiB
PHP
83 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Mall\Models\Traits;
|
|
|
|
use Modules\Mall\Models\Order;
|
|
|
|
trait OrderCando
|
|
{
|
|
|
|
/**
|
|
* Notes: 是否可支付
|
|
*
|
|
* @Author: <C.Jason>
|
|
* @Date : 2019/11/20 3:39 下午
|
|
* @return bool
|
|
*/
|
|
public function canPay(): bool
|
|
{
|
|
return $this->can('pay');
|
|
}
|
|
|
|
/**
|
|
* Notes: 是否可取消
|
|
*
|
|
* @Author: <C.Jason>
|
|
* @Date : 2019/11/20 3:39 下午
|
|
* @return bool
|
|
*/
|
|
public function canCancel(): bool
|
|
{
|
|
return in_array($this->state, [Order::STATUS_INIT,]);
|
|
}
|
|
|
|
/**
|
|
* 可发货
|
|
*
|
|
* @Author:<C.Jason>
|
|
* @Date :2018-10-22T17:12:13+0800
|
|
* @return boolean
|
|
*/
|
|
public function canDeliver(): bool
|
|
{
|
|
return $this->can('deliver');
|
|
}
|
|
|
|
/**
|
|
* 可签收
|
|
*
|
|
* @Author:<C.Jason>
|
|
* @Date :2018-10-22T17:12:43+0800
|
|
* @return boolean
|
|
*/
|
|
public function canSign(): bool
|
|
{
|
|
return $this->can('sign');
|
|
}
|
|
|
|
/**
|
|
* 可完成订单
|
|
*
|
|
* @Author:<C.Jason>
|
|
* @Date :2018-10-25T17:35:12+0800
|
|
* @return boolean
|
|
*/
|
|
public function canComplete(): bool
|
|
{
|
|
return $this->can('complete');
|
|
}
|
|
|
|
/**
|
|
* 可申请退款
|
|
*
|
|
* @Author:<C.Jason>
|
|
* @Date :2018-10-22T17:11:45+0800
|
|
* @return boolean
|
|
*/
|
|
public function canRefund(): bool
|
|
{
|
|
return $this->can('refund');
|
|
}
|
|
|
|
}
|