Compare commits

..

2 Commits

Author SHA1 Message Date
f7e6b9c418 fix : order list 2025-08-07 16:13:59 +08:00
ea08aa94a6 fix : auto coupon 2025-08-06 21:37:30 +08:00
2 changed files with 26 additions and 1 deletions

View File

@@ -68,6 +68,18 @@ class OrderListService extends BaseService
->when($this->request->input('search_kitchen_id'), function ($query) {
$query->where('kitchen_id', $this->request->input('search_kitchen_id'));
})
->when($this->request->input('search_order_sno'), function ($query) {
$searchOrderSno = $this->request->input('search_order_sno');
$query->where('order_sno', 'like', "$searchOrderSno%");
})
->when($this->request->input('search_create_time'), function ($query) {
$searchCreateTime = $this->request->input('search_create_time');
$query->whereBetween('create_time', [reset($searchCreateTime), end($searchCreateTime)]);
})
->when($this->request->input('search_pay_time'), function ($query) {
$searchPayTime = $this->request->input('search_pay_time');
$query->whereBetween('pay_time', [reset($searchPayTime), end($searchPayTime)]);
})
->select([
'id',
'cycle_id',

View File

@@ -72,7 +72,20 @@ class ConfirmationOrderService extends BaseOrderService
foreach ($filtered as &$value) {
$value['amount'] = match ($value['coupon_type']) {
CouponCode::COUPON_TYPE_INSTANT_REDUCTION => $value['amount'],
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcsub("1", (string)$value['ratio'],2),(string)$orderMaxPrice,2),
// CouponCode::COUPON_TYPE_DISCOUNT => bcmul(bcsub("100", (string)$value['ratio'],2),(string)$orderMaxPrice,2),
CouponCode::COUPON_TYPE_DISCOUNT => bcmul(
bcdiv(
bcsub(
"100",
(string)$value['ratio'],
2
),
"100",
2
),
bcadd((string)max(array_column($this->orderRes['good'],'price')),(string)$this->orderRes['sundry_price'],2),
2
),
default => 0
};