6
0
Fork 0

优惠券允许混合使用

base
panliang 2023-02-16 14:56:25 +08:00
parent b7e56e1375
commit 80f45e3a3e
2 changed files with 8 additions and 2 deletions

View File

@ -121,6 +121,7 @@ class StoreController extends AdminController
$form->image('image')
->required()
->move('store/'.Carbon::now()->toDateString())
->uniqueName()
->saveFullUrl()
->removable(false)
->retainable()

View File

@ -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);