wugg 2 years ago
parent
commit
dcd8223025

+ 24 - 4
app/admin/controller/Purch.php

@@ -119,6 +119,29 @@ class Purch extends Base
                 $value['wsm_supplier'] =isset($wsmcode['name']) ? $wsmcode['name']:"";
                 $value['wsm_supplierNo'] =isset($wsmcode['code']) ? $wsmcode['code']:"";
             }
+            if($value['order_type']==3|| $value['order_type']==4){
+                $goon = Db::name("good_zixun")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
+                $value["speclist"]=isset($goon['specinfo'])&&$goon['specinfo']!=""? json_decode($goon['specinfo'],true):"";
+            }else {
+                $goon =Db::name('good_basic')->where(['spuCode'=>$value['spuCode']])->find();
+                $spec = Db::name("good_spec")->where(["spuCode"=>$goon['spuCode'],"is_del"=>0])->select()->toArray();
+                $speclist=[];
+                if(!empty($spec)){
+                    foreach ($spec as $val){
+                        $temp=[];
+                        $temp['id']=$val['id'];
+                        $temp['spuCode']=$val['spuCode'];
+                        $temp['spec_id']=$val['spec_id'];
+                        $temp['spec_value_id']=$val['spec_value_id'];
+                        $sp = Db::name("specs")->where(["id"=>$val['spec_id']])->find();
+                        $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
+                        $spv = Db::name("spec_value")->where(["id"=>$val['spec_value_id']])->find();
+                        $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
+                        $speclist[]=$temp;
+                    }
+                }
+                $value["speclist"]=empty($speclist)?[]:$speclist;
+            }
             $inorder= Db::name("purchease_in")->where(['cgdNo'=>$value['cgdNo'],"is_del"=>0])->select();
             $value['child']=empty($inorder)? [] : $inorder;
             $data[]=$value;
@@ -146,14 +169,11 @@ class Purch extends Base
             $value['cant']=$cat;
             $var[]=$value;
         }
-        //$var = Db::name('purchease_in')->where(['cgdNo'=>$data['cgdNo'],'is_del'=>0])->select();
         $dom = Db::name("purchease_diff")->where(['cgdNo'=>$data['cgdNo'],'is_del'=>0])->find();
-        //$goon = Db::name('good')->where(['spuCode'=>$data['spuCode']])->find();
         if($data['order_type']==3|| $data['order_type']==4){
             $goon = Db::name("good_zixun")->where(["spuCode"=>$data['spuCode'],"is_del"=>0])->find();
         }else {
-            $goon = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
-                ->where(['a.skuCode' => $data['skuCode']])->find();
+            $goon =Db::name('good_basic')->where(['spuCode'=>$data['spuCode']])->find();
         }
         if(empty($goon)){
             return error_show(1002,"未找到商品数据");

+ 1 - 1
app/admin/controller/Purchback.php

@@ -94,7 +94,7 @@ public function list(){
     }
     $good_type_code=isset($this->post['good_type_code']) && $this->post['good_type_code']!==""? trim($this->post['good_type_code']):"";
     if($good_type_code !=""){
-        $where[]= ["b.good_type_code",'like',"%$good_type_code%"];
+        $where[]= ["b.spuCode",'like',"%$good_type_code%"];
     }
     $good_name=isset($this->post['good_name']) && $this->post['good_name']!==""? trim($this->post['good_name']):"";
     if($good_name !=""){

+ 10 - 1
app/admin/controller/Purchin.php

@@ -273,7 +273,11 @@ class Purchin extends BaseController
             return error_show(1004,"未找到数据");
         }
         $dom = Db::name("purchease_order")->where(['cgdNo'=>$info['cgdNo'],'is_del'=>0])->find();
-        $goon = Db::name('good_basic')->where(['spuCode'=>$dom['spuCode']])->field("cat_id")->find();
+        if($dom['order_type']==3|| $dom['order_type']==4){
+            $goon = Db::name("good_zixun")->where(["spuCode"=>$dom['spuCode'],"is_del"=>0])->find();
+        }else {
+            $goon =Db::name('good_basic')->where(['spuCode'=>$dom['spuCode']])->find();
+        }
         if(empty($goon)){
             return error_show(1002,"未找到商品数据");
         }
@@ -308,6 +312,11 @@ class Purchin extends BaseController
         $return['return_mobile']=isset($return['return_mobile'])&&$return['return_mobile']!="" ?$return['return_mobile']:$info['wsm_mobile'];
         $info['return']= $return;
         $info['can']=$cat;
+        if(isset($goon['companyNo'])&&$goon['companyNo']!=""){
+            $company = Db::name("business")->where(["companyNo"=>$goon['companyNo']])->find();
+        }
+        $info['company'] = isset($company['company'])?$company['company']:"";
+        $info['companyNo'] = isset($goon['companyNo'])?$goon['companyNo']:"";
         return app_show(0,'获取成功',$info);
     }
 

+ 18 - 0
app/admin/controller/Sale.php

@@ -1363,9 +1363,27 @@ class Sale extends Base
         foreach ($list as $value) {
             if($value['order_type']==3|| $value['order_type']==4){
                 $var = Db::name("good_zixun")->where(["spuCode"=>$value['good_code'],"is_del"=>0])->find();
+                $value["speclist"]=isset($var['specinfo'])&&$var['specinfo']!=""? json_decode($var['specinfo'],true):"";
             }else {
                 $var = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
                     ->where(['a.skuCode' => $value['skuCode']])->find();
+                $spec = Db::name("good_spec")->where(["spuCode"=>$var['spuCode'],"is_del"=>0])->select()->toArray();
+                $speclist=[];
+                if(!empty($spec)){
+                    foreach ($spec as $val){
+                        $temp=[];
+                        $temp['id']=$val['id'];
+                        $temp['spuCode']=$val['spuCode'];
+                        $temp['spec_id']=$val['spec_id'];
+                        $temp['spec_value_id']=$val['spec_value_id'];
+                        $sp = Db::name("specs")->where(["id"=>$val['spec_id']])->find();
+                        $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
+                        $spv = Db::name("spec_value")->where(["id"=>$val['spec_value_id']])->find();
+                        $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
+                        $speclist[]=$temp;
+                    }
+                }
+                $value["speclist"]=empty($speclist)?[]:$speclist;
             }
 
             $value['can'] = isset($var['cat_id']) && $var['cat_id'] != 0 ? made($var['cat_id']) : [];