Browse Source

价格修改大部分

wufeng 2 years ago
parent
commit
7dd0de011b
2 changed files with 40 additions and 11 deletions
  1. 28 8
      app/admin/controller/Consult.php
  2. 12 3
      app/admin/controller/Goodup.php

+ 28 - 8
app/admin/controller/Consult.php

@@ -708,13 +708,22 @@ class Consult extends Base
         if(!$vali->check($temp)) return error_show(0,$vali->getError());
 
 
+        $sale_cost_fee = $cost_fee;//销售工艺费默认取传值
         if($is_gold_price==1){
             $gold = Db::name("gold_price1")->where(["type"=>$metal_id,"is_del"=>0,"status"=>1])->order("addtime desc")
                 ->find();
-            $total_fee = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee*
-                $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
-            $saleprice = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee/(1-$budget)*
-                $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
+
+            //$total_fee = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee*$weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
+            //$total_fee(成本合计初始价格) =打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价0+运费;
+            $total_fee = $demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee;
+
+//            $saleprice = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee/(1-$budget)* $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
+            //$saleprice(最终售价) = (开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100);
+            $saleprice = ($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget);
+
+            //销售工艺费=((开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100)-(打样费/购买数量 + 开模费/购买数量 +包装费+加标费+证书费+产品裸价0+运费) )/商品重量-最新金价
+            $sale_cost_fee = (($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget) - ($demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee)) / $weight - $gold["price"];
+
         }else{
             $saleprice =  $open_fee/$zxinfo['num'] +
                 $cost_fee*$weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee/(1-$budget);
@@ -762,6 +771,7 @@ class Consult extends Base
             "supply_area"=>$supply_area,
             "remark"=>$remark,
             "sale_price"=>$saleprice,
+            "sale_cost_fee"=>$sale_cost_fee,
             "origin_price"=>$saleprice,
             "createrid"=>$createrid,
             "creater"=>$creater,
@@ -1017,13 +1027,22 @@ class Consult extends Base
         $remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
         $catinfo = Db::name("cat")->where(["id"=>$cat_id])->find();
         $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']/100:0;
+
+        $sale_cost_fee = $bidinfo['sale_cost_fee'];
         if($is_gold_price==1){
             $gold = Db::name("gold_price1")->where(["type"=>$metal_id,"is_del"=>0,"status"=>1])->order("addtime desc")
                 ->find();
-            $total_fee = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee*
-                $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
-            $saleprice = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee/(1-$budget)*
-                $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
+
+            //$total_fee(成本合计初始价格) =打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价0+运费;
+            $total_fee = $demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee;
+
+//            $saleprice = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee/(1-$budget)* $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
+            //$saleprice(最终售价) = (开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100);
+            $saleprice = ($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget);
+
+            //销售工艺费=((开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100)-(打样费/购买数量 + 开模费/购买数量 +包装费+加标费+证书费+产品裸价0+运费) )/商品重量-最新金价
+            $sale_cost_fee = (($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget) - ($demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee)) / $weight - $gold["price"];
+
         }else{
             $saleprice =  $open_fee/$zxinfo['num'] +
                 $cost_fee*$weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee/(1-$budget);
@@ -1063,6 +1082,7 @@ class Consult extends Base
                 "mark_fee"=>$mark_fee,
                 "cert_fee"=>$cert_fee,
                 "cost_fee"=>$cost_fee,
+                "sale_cost_fee"=>$sale_cost_fee,
                 "total_fee"=>$total_fee,
                 "sale_price"=>$saleprice,
                 "supply_area"=>$supply_area,

+ 12 - 3
app/admin/controller/Goodup.php

@@ -1219,6 +1219,7 @@ class Goodup extends Base
                 $lemp['sale_price'] = $value['sale_price'];
                 $lemp['market_price'] = $value['market_price'];
                 $lemp['market_platform'] = $value['market_platform'];
+                $lemp['cost_fee'] = $value['cost_fee'];
                 $lemp['status'] = $value['status'];
                 $lemp['is_del'] = isset($value['is_del'])?$value['is_del']:0;
                 isset($value["id"])&&$value["id"]!=""?"": $lemp['addtime'] = date("Y-m-d H:i:s");
@@ -1774,12 +1775,20 @@ class Goodup extends Base
         }
         $catinfo = Db::name("cat")->where(["id"=>$good['cat_id']])->find();
         $budget = isset($catinfo['sale_rate']) ? $catinfo['sale_rate']/100:0;
+
+        $sale_cost_fee = 0;
         if($good['is_gold_price']==1){
-            $saleprice =  $good['noble_weight']*$good["cgd_gold_price"] + $nakelist['cost_fee']/(1-$budget)*
-                $good['noble_weight']+$nakelist['mark_fee']+$nakelist['package_fee']+$nakelist['cert_fee']+$nakelist['nake_fee']+$nakelist['delivery_fee'];
+//            $saleprice =  $good['noble_weight']*$good["cgd_gold_price"] + $nakelist['cost_fee']/(1-$budget)*$good['noble_weight']+$nakelist['mark_fee']+$nakelist['package_fee']+$nakelist['cert_fee']+$nakelist['nake_fee']+$nakelist['delivery_fee'];
+
+            //系统售价=(贵金属重量*供应商采购金价 + 工艺费*贵金属重量+加标费+包装费+证书费+成本裸价+运费+其他费用)/(1-成本售价/100)
+            $saleprice = ($good['noble_weight'] * $good["cgd_gold_price"] + $nakelist['cost_fee'] * $good['noble_weight'] + $nakelist['mark_fee'] + $nakelist['package_fee'] + $nakelist['cert_fee'] + $nakelist['nake_fee'] + $nakelist['delivery_fee'] + $nakelist['other_fee']) / (1 - $budget);
+
+            //计算工艺费
+            //销售工艺费=(( 商品重量* 供应商采购金价 + 采购成本工艺费* 商品重量+包装费+加标费+证书费+产品裸价+其他费用)/(1-成本售价/100)-(包装费+加标费+证书费+产品裸价0+运费+其他费用) )/商品重量-供应商采购金价
+            $sale_cost_fee = (($good['noble_weight'] * $good["cgd_gold_price"] + $nakelist['cost_fee'] * $good['noble_weight'] + $nakelist['package_fee'] + $nakelist['mark_fee'] + $nakelist['cert_fee'] + $nakelist['nake_fee'] + $nakelist['other_fee']) / (1 - $budget) - ($nakelist['package_fee'] + $nakelist['mark_fee'] + $nakelist['cert_fee'] + $nakelist['nake_fee'] + $nakelist['delivery_fee'] + $nakelist['other_fee'])) / $good['noble_weight'] - $good["cgd_gold_price"];
         }else{
             $saleprice =$nakelist['mark_fee']+$nakelist['package_fee']+$nakelist['cert_fee']+$nakelist['delivery_fee']+$nakelist['nake_fee']/(1-$budget);
         }
-        return app_show(0,"获取成功",["sale_price"=>round($saleprice,2)]);
+        return app_show(0, "获取成功", ["sale_price" => round($saleprice, 2), 'new_cost_fee' => round($sale_cost_fee, 2)]);
     }
 }