Browse Source

针对退货处理

wufeng 2 years ago
parent
commit
a370ad78e7
1 changed files with 7 additions and 4 deletions
  1. 7 4
      app/command/SplitSale.php

+ 7 - 4
app/command/SplitSale.php

@@ -197,9 +197,10 @@ class SplitSale extends Command
     //构建销售单
     private function _handle_sale_caixiao(array $sale = [], string $orderCode = '', string $cgdNo = '', float $sale_total = 0.00, array $customer = [], array $supplier = [])
     {
+        $sale_price = $sale['good_num'] > 0 ? bcdiv($sale_total, $sale['good_num'], 5) : 0;
         $tmp_sale = [
             'origin_price' => $sale['origin_price'] ?? 0,
-            'sale_price' => $sale['good_num'] > 0 ? round(bcdiv($sale_total, $sale['good_num'], 5), 4) : 0,
+            'sale_price' => round($sale_price, 4),
             'total_price' => $sale_total,
             'post_fee' => $sale['post_fee'] ?? 0,
             'is_diff' => $sale['is_diff'] ?? 0,
@@ -212,7 +213,7 @@ class SplitSale extends Command
             'status' => $sale['status'] ?? 0,
             'updatetime' => $sale['updatetime'],
             'delivery_day' => $sale['delivery_day'] ?? 0,
-            'th_fee' => $sale['th_fee'] ?? 0,
+            'th_fee' => round(bcmul($sale_price, $sale['th_num'] ?? 0, 3), 2),
             'cost_fee' => $sale['cost_price'] ?? 0,
             'diff_fee' => $sale['diff_fee'] ?? 0,
             'diff_weight' => $sale['diff_weight'] ?? 0,
@@ -278,8 +279,10 @@ class SplitSale extends Command
     private function _handle_cgd_caixiao(array $cgd = [], array $sale = [], array $pay_rate = [], string $cgdNo = '', string $orderCode = '', float $cgd_total = 0.00)
     {
 
+        $good_price = $sale['good_num'] > 0 ? bcdiv($cgd_total, $sale['good_num'], 5) : 0;
+
         $tmp_cgd = [
-            'good_price' => $sale['good_num'] > 0 ? round(bcdiv($cgd_total, $sale['good_num'], 5), 4) : 0,
+            'good_price' => round($good_price, 4),
             'total_fee' => $cgd_total,
             'pakage_fee' => $cgd['pakge_fee'] ?? 0,
             'open_fee' => $cgd['open_fee'] ?? 0,
@@ -303,7 +306,7 @@ class SplitSale extends Command
             'send_type' => $sale['send_type'] ?? '',
             'send_status' => $sale['send_status'] ?? '',
             'th_num' => $sale['th_num'] ?? 0,
-            'th_fee' => $sale['th_fee'] ?? 0,
+            'th_fee' => round(bcmul($good_price, $sale['th_num'] ?? 0, 3), 2),
             'updatetime' => $sale['updatetime'],
         ];