wugg 3 роки тому
батько
коміт
3439251592
2 змінених файлів з 32 додано та 0 видалено
  1. 31 0
      app/admin/controller/Goodup.php
  2. 1 0
      app/admin/route/app.php

+ 31 - 0
app/admin/controller/Goodup.php

@@ -1603,4 +1603,35 @@ class Goodup extends BaseController
             return error_show(1004,$e->getMessage());
         }
     }
+
+    public function checkPrice(){
+        $spuCode=isset($this->post['spuCode'])&&$this->post['spuCode']!=""? trim($this->post['spuCode']):"";
+        if($spuCode==""){
+            return error_show(1005,"参数spuCode不能为空");
+        }
+        $good =Db::name("good_basic")->where(["spuCode"=>$spuCode,"is_del"=>0])->find();
+        if($good==false){
+            return error_show(1005,"商品数据未找到");
+        }
+        $nake_fee=isset($this->post['nake_fee'])&&$this->post['nake_fee']!="" ? floatval($this->post['nake_fee']):"";
+        if($nake_fee==""){
+            return error_show(1005,"参数nake_fee不能为空");
+        }
+        $num=isset($this->post['min_mun'])&&$this->post['min_mun']!=="" ? intval($this->post['min_mun']):"";
+        if($num==""){
+            return error_show(1005,"参数num不能为空");
+        }
+        $catinfo = Db::name("cat")->where(["id"=>$good['cat_id']])->find();
+        $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']/100:0;
+        if($good['is_gold_price']==1){
+            $gold = Db::name("gold_price1")->where(["type"=>$good['noble_metal'],"is_del"=>0,"status"=>1])->order("addtime desc")
+                ->find();
+            $saleprice = $good['open_fee']/$num + $good['weight']*$gold["price"] + $good['cost_fee']/(1-$budget)*
+                $good['noble_weight']+$good['mark_fee']+$good['packing_fee']+$good['cert_fee']+$nake_fee;
+        }else{
+            $saleprice = $good['open_fee']/$num + $good['cost_fee']*
+                $good['noble_weight']+$good['mark_fee']+$good['packing_fee']+$good['cert_fee']+$nake_fee/(1-$budget);
+        }
+        return app_show(0,"获取成功",["sale_price"=>$saleprice]);
+    }
 }

+ 1 - 0
app/admin/route/app.php

@@ -360,6 +360,7 @@ Route::rule('goodinfo','admin/Good/info');
 Route::rule('againonline','admin/Goodup/againOnline');
 Route::rule('goodupcopy','admin/Goodup/copy');
 Route::rule('goodupedit','admin/Goodup/edit');
+Route::rule('goodupprice','admin/Goodup/checkPrice');
 
 Route::rule('goodproof','admin/Goodup/prooflist');