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') $form->image('image')
->required() ->required()
->move('store/'.Carbon::now()->toDateString()) ->move('store/'.Carbon::now()->toDateString())
->uniqueName()
->saveFullUrl() ->saveFullUrl()
->removable(false) ->removable(false)
->retainable() ->retainable()

View File

@ -891,11 +891,12 @@ class OrderService
// 可使用优惠券的商品总额 // 可使用优惠券的商品总额
$amounts = []; $amounts = [];
$pass = false;
foreach ($products as $item) { foreach ($products as $item) {
$sku = $item['sku']; $sku = $item['sku'];
if (! $coupon->isSupport($sku)) { if ($coupon->isSupport($sku)) {
throw new BizException('优惠券不满足使用条件'); $pass = true;
} }
$amount = $item['total_amount'] - $item['vip_discount_amount']; $amount = $item['total_amount'] - $item['vip_discount_amount'];
@ -906,6 +907,10 @@ class OrderService
} }
} }
if (!$pass) {
throw new BizException('优惠券不满足使用条件');
}
// 全部商品总额 // 全部商品总额
$totalAmount = array_sum($amounts); $totalAmount = array_sum($amounts);