shish 5 lat temu
rodzic
commit
1ed22e35fa

+ 16 - 0
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -98,9 +98,25 @@ class PurchaseOrderClass extends BaseClass
         $orderPrice = bcadd($orderPrice, $longCharge, 2);
         $orderPrice = bcadd($orderPrice, $pickCharge, 2);
         $orderPrice = bcadd($orderPrice, $localCharge, 2);
+
         $data['orderPrice'] = $orderPrice;
         $data['prePrice'] = $orderPrice;
+
+        if (isset($data['modifyPrice'])) {
+            //商家打折,修改金额
+            $modifyPrice = $data['modifyPrice'] ?? 0;
+            if ($modifyPrice > $orderPrice) {
+                util::fail('实收金额大于订单总金额');
+            }
+            if ($modifyPrice < $orderPrice) {
+                $data['discountAmount'] = bcsub($orderPrice, $modifyPrice, 2);
+                $data['discountType'] = dict::getDict('discountType', 'discount');
+                $orderPrice = $modifyPrice;
+            }
+        }
+        //实付款
         $data['actPrice'] = $orderPrice;
+        //实付款,扣除平台补贴
         $data['realPrice'] = $orderPrice;
 
         //总运费

+ 1 - 1
common/components/dict.php

@@ -89,7 +89,7 @@ class dict
             //使用平台优惠券
             'usePtCoupon' => 2,
             //商家打折
-            'discount'=>3,
+            'discount' => 3,
         ],
 
         'payStatus' => ['cancel' => -1, 'waitForPay' => 0, 'waitForSend' => 1],