wugg 8 months ago
parent
commit
8b65e1c4f4
1 changed files with 11 additions and 9 deletions
  1. 11 9
      app/admin/controller/Activity.php

+ 11 - 9
app/admin/controller/Activity.php

@@ -306,17 +306,19 @@ class Activity extends Base
                if($goodTax->save()){
                  if(!$order->isEmpty()){
                    $orderTax=OrderTax::where(['code'=>$order->orderCode,'spuCode'=>$param['spuCode']])->findOrEmpty();
+                     $Tax=[
+                            'code'=>$order->orderCode,
+                            'spuCode'=>$param['spuCode'],
+                            'tax_code'=>$catgery->merge_code,
+                            'tax_name'=>$catgery->cat_name,
+                            'tax_short_name'=>$catgery->short_name,
+                            'inv_tax'=>str_replace("%","",$param['out_tax']),
+                            'inv_good_name'=>$goodTax->inv_good_name,
+                        ];
                    if($orderTax->isEmpty()){
-                       $Tax=[
-                           'code'=>$order->orderCode,
-                           'spuCode'=>$param['spuCode'],
-                           'tax_code'=>$catgery->merge_code,
-                           'tax_name'=>$catgery->cat_name,
-                           'tax_short_name'=>$catgery->short_name,
-                           'inv_tax'=>$param['out_tax'],
-                           'inv_good_name'=>$goodTax->inv_good_name,
-                       ];
                      OrderTax::create($Tax);
+                   }else {
+                      $orderTax->save($Tax);
                    }
                 };
                  Db::commit();