Browse Source

Merge branch 'master' into redesign‌-260706

shish 3 days ago
parent
commit
d4adc30754

+ 11 - 2
biz-ghs/order/classes/OrderClass.php

@@ -2244,8 +2244,17 @@ class OrderClass extends BaseClass
                 $content .= '退款金额:' . floatval($orderInfo['tkPrice']) . '<BR>';
                 $content .= '退款金额:' . floatval($orderInfo['tkPrice']) . '<BR>';
             }
             }
             $content .= '<B>金额:' . floatval($respond['realPrice']) . '</B><BR>';
             $content .= '<B>金额:' . floatval($respond['realPrice']) . '</B><BR>';
-            if (isset($respond['debt']) && $respond['debt'] == 1) {
-                $content .= '实付金额:0<BR>';
+            if (isset($orderInfo['debtPrice']) && $orderInfo['debtPrice'] > 0) {
+                $remainDebt = bcadd((string)($orderInfo['remainDebtPrice'] ?? '0'), '0', 2);
+                $totalRefund = bcadd((string)($orderInfo['tkPrice'] ?? '0'), (string)($orderInfo['nextDayTkPrice'] ?? '0'), 2);
+                if ($totalRefund > 0) {
+                    $content .= '退款:' . floatval($totalRefund) . '<BR>';
+                }
+                if ($remainDebt > 0) {
+                    $content .= '<B>待结:' . floatval($remainDebt) . '</B><BR>';
+                } else {
+                    $content .= '<B>本单已结清!</B><BR>';
+                }
             } else {
             } else {
                 $content .= '实付金额:' . floatval($respond['realPrice']) . '<BR>';
                 $content .= '实付金额:' . floatval($respond['realPrice']) . '<BR>';
             }
             }

+ 12 - 3
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -898,9 +898,18 @@ class PurchaseOrderClass extends BaseClass
         if (isset($orderInfo['tkPrice']) && $orderInfo['tkPrice'] > 0) {
         if (isset($orderInfo['tkPrice']) && $orderInfo['tkPrice'] > 0) {
             $content .= '退款金额:' . floatval($orderInfo['tkPrice']) . '元<BR>';
             $content .= '退款金额:' . floatval($orderInfo['tkPrice']) . '元<BR>';
         }
         }
-        $content .= '<B>订单金额:' . floatval($orderInfo['realPrice']) . '</B><BR>';
-        if (isset($orderInfo['debt']) && $orderInfo['debt'] == 1) {
-            $content .= '实付金额:0元<BR>';
+        $content .= '<B>金额:' . floatval($orderInfo['realPrice']) . '</B><BR>';
+        if (isset($orderInfo['debtPrice']) && $orderInfo['debtPrice'] > 0) {
+            $remainDebt = bcadd((string)($orderInfo['remainDebtPrice'] ?? '0'), '0', 2);
+            $totalRefund = bcadd((string)($orderInfo['tkPrice'] ?? '0'), (string)($orderInfo['nextDayTkPrice'] ?? '0'), 2);
+            if($totalRefund > 0) {
+                $content .= '退款:' . floatval($totalRefund) . '元<BR>';
+            }
+            if($remainDebt > 0) {
+                $content .= '<B>待结:' . floatval($remainDebt) . '</B><BR>';   
+            }else{
+                $content .= '<B>本单已结清!</B><BR>';
+            }
         } else {
         } else {
             $content .= '实付金额:' . floatval($orderInfo['realPrice']) . '元<BR>';
             $content .= '实付金额:' . floatval($orderInfo['realPrice']) . '元<BR>';
         }
         }

+ 5 - 0
biz-ghs/order/models/PurchaseOrder.php

@@ -8,6 +8,11 @@ use bizGhs\base\models\Base;
  */
  */
 class PurchaseOrder extends Base
 class PurchaseOrder extends Base
 {
 {
+	/**
+	 * 内存标记(非表字段):当天售后是否刚把本单挂账结清。
+	 * CgRefundService 写入,供 PurchaseOrderClass::applyPurchaseRefundOnAccounts 减 debtNum。
+	 */
+	public $_purchaseDebtClearedByRefund = false;
 
 
 	public static function tableName()
 	public static function tableName()
 	{
 	{