优惠券允许混合使用
parent
b7e56e1375
commit
80f45e3a3e
|
|
@ -121,6 +121,7 @@ class StoreController extends AdminController
|
|||
$form->image('image')
|
||||
->required()
|
||||
->move('store/'.Carbon::now()->toDateString())
|
||||
->uniqueName()
|
||||
->saveFullUrl()
|
||||
->removable(false)
|
||||
->retainable()
|
||||
|
|
|
|||
|
|
@ -891,11 +891,12 @@ class OrderService
|
|||
// 可使用优惠券的商品总额
|
||||
$amounts = [];
|
||||
|
||||
$pass = false;
|
||||
foreach ($products as $item) {
|
||||
$sku = $item['sku'];
|
||||
|
||||
if (! $coupon->isSupport($sku)) {
|
||||
throw new BizException('优惠券不满足使用条件');
|
||||
if ($coupon->isSupport($sku)) {
|
||||
$pass = true;
|
||||
}
|
||||
|
||||
$amount = $item['total_amount'] - $item['vip_discount_amount'];
|
||||
|
|
@ -906,6 +907,10 @@ class OrderService
|
|||
}
|
||||
}
|
||||
|
||||
if (!$pass) {
|
||||
throw new BizException('优惠券不满足使用条件');
|
||||
}
|
||||
|
||||
// 全部商品总额
|
||||
$totalAmount = array_sum($amounts);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue