|
|
@@ -48,16 +48,17 @@ class OrderClearClass extends BaseClass
|
|
|
return true;
|
|
|
}
|
|
|
$totalAmount = 0;
|
|
|
+ $totalMoney = 0;
|
|
|
$need = [];
|
|
|
foreach ($orderList as $order) {
|
|
|
$orderId = $order->id ?? 0;
|
|
|
$remainDebtPrice = $order->remainDebtPrice ?? 0;
|
|
|
- if ($totalAmount <= $customBalance) {
|
|
|
- $need[] = ['id' => $orderId];
|
|
|
- $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
|
|
|
- } else {
|
|
|
+ $totalMoney = bcadd($totalMoney, $remainDebtPrice, 2);
|
|
|
+ if ($totalMoney > $customBalance) {
|
|
|
break;
|
|
|
}
|
|
|
+ $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
|
|
|
+ $need[] = ['id' => $orderId];
|
|
|
}
|
|
|
if (empty($need)) {
|
|
|
return true;
|
|
|
@@ -84,7 +85,8 @@ class OrderClearClass extends BaseClass
|
|
|
'complete' => 1,
|
|
|
];
|
|
|
$clearInfo = self::clear($clearData, $idText, $sjId, $shopId);
|
|
|
- echo $totalAmount.' '.$customBalance;die;
|
|
|
+ echo $totalAmount . ' ' . $customBalance;
|
|
|
+ die;
|
|
|
//结账消费余额
|
|
|
CustomClass::clearConsumeBalance($totalAmount, $custom, $ghs, $shop, $staff, $clearInfo);
|
|
|
}
|