Przeglądaj źródła

app 价格管理

shish 4 lat temu
rodzic
commit
93b1457732

+ 22 - 3
biz-ghs/order/classes/OrderClass.php

@@ -132,12 +132,31 @@ class OrderClass extends BaseClass
         $data['prePrice'] = $currentPrice;
         $actPrice = $currentPrice;
         $realPrice = $currentPrice;
-        //客户采购时使用红包
+		
+		//商家自己开单时
+        if (isset($data['modifyPrice'])) {
+            $modifyPrice = $data['modifyPrice'] ?? 0;
+            if ($modifyPrice > $currentPrice) {
+                //人工和资材费用
+                $data['labourCost'] = bcsub($modifyPrice, $currentPrice, 2);
+            }
+            if ($modifyPrice < $currentPrice) {
+                //优惠金额
+                $data['discountAmount'] = bcsub($currentPrice, $modifyPrice, 2);
+                $data['discountType'] = dict::getDict('discountType', 'discount');
+            }
+            $actPrice = $modifyPrice;
+            $realPrice = $modifyPrice;
+        }
+
+        //客户采购时使用红包时
         if (isset($data['discountType']) && $data['discountType'] == dict::getDict('discountType', 'hb')) {
             $discountAmount = $data['discountAmount'] ?? 0;
-            $actPrice = bcsub($currentPrice, $discountAmount, 2);
-            $realPrice = $actPrice;
+            $currentDiscountPrice = bcsub($currentPrice, $discountAmount, 2);
+            $actPrice = $currentDiscountPrice;
+            $realPrice = $currentDiscountPrice;
         }
+
         $data['actPrice'] = $actPrice;
         $data['realPrice'] = $realPrice;
 

+ 8 - 7
biz-hd/purchase/classes/PurchaseClass.php

@@ -141,20 +141,21 @@ class PurchaseClass extends BaseClass
         $sendCost = $data['sendCost'] ?? 0.00;
         $prePrice = bcadd($prePrice, $sendCost, 2);
         $actPrice = $prePrice;
-        $realPrice = $actPrice;
+        $realPrice = $prePrice;
 
         if (isset($data['modifyPrice'])) {
-            //商家打折,修改金额
             $modifyPrice = $data['modifyPrice'] ?? 0;
-            if ($modifyPrice > $prePrice) {
-                util::fail('实收金额大于订单总金额');
-            }
             if ($modifyPrice < $prePrice) {
+                //优惠金额
                 $data['discountAmount'] = bcsub($prePrice, $modifyPrice, 2);
                 $data['discountType'] = dict::getDict('discountType', 'discount');
-                $actPrice = $modifyPrice;
-                $realPrice = $modifyPrice;
             }
+            if($modifyPrice > $prePrice){
+                //人工和资材费用
+                $data['labourCost'] = bcsub($modifyPrice, $prePrice, 2);
+            }
+            $actPrice = $modifyPrice;
+            $realPrice = $modifyPrice;
         } else {
 
             //验证优惠券