Răsfoiți Sursa

欠账的清理

shish 1 an în urmă
părinte
comite
b12f86a91c
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  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];
     }