Fix
parent
7f4c44aa5e
commit
fe32dba089
|
|
@ -201,7 +201,7 @@ class OfflineOrderService
|
||||||
throw new BizException('商品总额不能小于0');
|
throw new BizException('商品总额不能小于0');
|
||||||
}
|
}
|
||||||
|
|
||||||
$discountReductionAmount = 0;
|
$paymentAmount = $productsTotalAmount;
|
||||||
if (is_numeric($item['discount'])) {
|
if (is_numeric($item['discount'])) {
|
||||||
if ($item['discount'] <= 0) {
|
if ($item['discount'] <= 0) {
|
||||||
throw new BizException('折扣必须大于0');
|
throw new BizException('折扣必须大于0');
|
||||||
|
|
@ -209,14 +209,14 @@ class OfflineOrderService
|
||||||
throw new BizException('折扣必须小于10');
|
throw new BizException('折扣必须小于10');
|
||||||
}
|
}
|
||||||
$discount = bcdiv($item['discount'], 10, 3);
|
$discount = bcdiv($item['discount'], 10, 3);
|
||||||
$discountReductionAmount = round(bcmul($productsTotalAmount, $discount, 2));
|
$paymentAmount = round(bcmul($productsTotalAmount, $discount, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'product_category_id' => $item['product_category_id'],
|
'product_category_id' => $item['product_category_id'],
|
||||||
'products_total_amount' => (int) $productsTotalAmount,
|
'products_total_amount' => (int) $productsTotalAmount,
|
||||||
'discount_reduction_amount' => (int) $discountReductionAmount,
|
'discount_reduction_amount' => (int) ($productsTotalAmount - $paymentAmount),
|
||||||
'payment_amount' => (int) ($productsTotalAmount - $discountReductionAmount),
|
'payment_amount' => (int) $paymentAmount,
|
||||||
];
|
];
|
||||||
})->all();
|
})->all();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue