wugg 2 years ago
parent
commit
601db0eb2a
2 changed files with 14 additions and 0 deletions
  1. 13 0
      app/admin/controller/InvCat.php
  2. 1 0
      app/admin/route/app.php

+ 13 - 0
app/admin/controller/InvCat.php

@@ -76,6 +76,19 @@ class InvCat extends BaseController{
         }
         return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
     }
+    //商品详情
+    public function goodinfo(){
+         $spuCode=isset($this->post['spuCode'])&&$this->post['spuCode']!=''?trim($this->post['spuCode']):"";
+         if($spuCode=="") return error_show(1004,"参数 spuCode 不能为空");
+         $goodinfo =Db::name("good")->where(["spuCode"=>$spuCode])->findOrEmpty();
+         if(empty($goodinfo))return error_show(1004,"商品数据未找到");
+          $company =Db::name("company_info")->where(["companyNo"=>$goodinfo['companyNo']])->find();
+            $goodinfo['companyName']=$company['company_name']??"";
+            $supplier =Db::name("supplier_info")->where(["code"=>$goodinfo["supplierNo"]])->find();
+            $goodinfo["supplierName"]=$supplier["name"]??"";
+
+            return app_show(0,"获取成功",$goodinfo);
+    }
     //发票类目列表
     public function catlist(){
         $page =isset($this->post['page'])&&  $this->post['page']!="" ? intval($this->post['page']) :1;

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

@@ -135,6 +135,7 @@ Route::rule("goodlist","admin/InvCat/GoodList");
 Route::rule("catlist","admin/InvCat/catlist");
 Route::rule("catquery","admin/InvCat/query");
 Route::rule("addgood","admin/InvCat/AddGood");
+Route::rule("goodinfo","admin/InvCat/goodinfo");