shish 2 роки тому
батько
коміт
01f010a592
1 змінених файлів з 5 додано та 3 видалено
  1. 5 3
      biz-ghs/order/services/RefundOrderService.php

+ 5 - 3
biz-ghs/order/services/RefundOrderService.php

@@ -172,7 +172,7 @@ class RefundOrderService extends BaseService
             if (empty($orderItemData)) {
                 util::fail('没有找到花材');
             }
-
+            $originPrice = 0;
             foreach ($postProduct as $currentProduct) {
                 $id = $currentProduct['productId'] ?? 0;
                 if (isset($orderItemData[$id]) == false) {
@@ -191,7 +191,7 @@ class RefundOrderService extends BaseService
                 $unitType = $currentProduct['unitType'] ?? 0;
 
                 $xhPrice = bcmul($num, $xhUnitPrice, 2);
-
+                $originPrice =bcadd($originPrice,$xhPrice,2);
                 $itemNum = $num;
                 if ($unitType == dict::getDict('unitType', 'small')) {
                     $itemNum = bcdiv($num, $ratio, 2);
@@ -217,7 +217,9 @@ class RefundOrderService extends BaseService
                 ];
                 RefundOrderItemClass::addData($thisItemData, $order);
             }
-
+            if($refundPrice < $originPrice){
+                util::fail('退款金额要等于或大于花材金额总合');
+            }
         }
         $data['customId'] = $order->customId ?? 0;
         $data['imgList'] = $post['imgList'] ?? '';