修改改价判断
parent
8fad077945
commit
28e16a48d1
|
|
@ -51,7 +51,8 @@ class OrderReduce extends Form implements LazyRenderable
|
|||
|
||||
$reduced = $order->total_amount-$reduceAmount;
|
||||
//判断是否在当前操作人调价权限范围内
|
||||
if (!Admin::user()->inReduceRange($reduced)) {
|
||||
$adminUser = Admin::user();
|
||||
if (! $adminUser->isAdministrator() && ! $adminUser->inReduceRange($reduced)) {
|
||||
throw new BizException('当前调整价格超出权限范围,请重新确认价格。');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,22 @@ class Order extends Model
|
|||
return $this->hasOne(UserCoupon::class, 'id', 'user_coupon_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此订单的商品
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(OrderProduct::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此订单的发货包裹
|
||||
*/
|
||||
public function packages()
|
||||
{
|
||||
return $this->hasMany(OrderPackage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅查询支付过期的订单
|
||||
*/
|
||||
|
|
@ -94,14 +110,6 @@ class Order extends Model
|
|||
->where('created_at', '<=', now()->subSeconds(config('settings.order_payment_expires_at')));
|
||||
}
|
||||
|
||||
/**
|
||||
* 属于此订单的商品
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->hasMany(OrderProduct::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 此订单是否待付款
|
||||
*
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ class OrderPackage extends Model
|
|||
|
||||
/**
|
||||
* 订单
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function order()
|
||||
{
|
||||
|
|
@ -82,6 +80,13 @@ class OrderPackage extends Model
|
|||
$this->orderProducts()->update([
|
||||
'after_expire_at'=>$this->checked_at->addDays(7),
|
||||
]);
|
||||
//看这个包裹的订单下是否还有未签收的包裹,没有,则把订单status改为已完成, 并完成订单
|
||||
if ($this->order->packages()->where('is_failed', false)->whereNotIn('status', [self::STATUS_CHECK, self::STATUS_AUTOCHECK])->doesntExist()) {
|
||||
$this->order()->update([
|
||||
'status' => Order::STATUS_COMPLETED,
|
||||
'completed_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1395,10 +1395,9 @@ class Kuaidi100Service
|
|||
$status = OrderPackage::STATUS_OTHER;
|
||||
}
|
||||
|
||||
//更新状态
|
||||
foreach ($packages as $package) {
|
||||
$package->updatePackageStatus($status);
|
||||
}
|
||||
//更新包裹状态
|
||||
$orderService = new OrderService();
|
||||
$orderService->updatePackageStatus($packages, $status);
|
||||
}
|
||||
//记录物流信息
|
||||
KuaidiLog::updateOrCreate([
|
||||
|
|
|
|||
Loading…
Reference in New Issue