shish 1 год назад
Родитель
Сommit
b12f86a91c
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      biz-mall/order/classes/OrderClass.php

+ 13 - 0
biz-mall/order/classes/OrderClass.php

@@ -62,6 +62,19 @@ class OrderClass extends BaseClass
     public static function getDebtList($where)
     {
         $list = self::getAllList('*', $where, 'addTime DESC');
+
+        if (!empty($list)) {
+            foreach ($list as $key => $value) {
+                $debtPrice = $value['debtPrice'] ?? 0;
+                $remainDebtPrice = $value['remainDebtPrice'] ?? 0;
+                $hasPayDebt = 0;
+                if ($debtPrice > $remainDebtPrice) {
+                    $hasPayDebt = bcsub($debtPrice, $remainDebtPrice, 2);
+                }
+                $list[$key]['hasPayDebt'] = floatval($hasPayDebt);
+            }
+        }
+
         $count = self::getCount($where);
         return ['list' => $list, 'debtNum' => $count];
     }