wugg 8 months ago
parent
commit
7544bec292
1 changed files with 6 additions and 10 deletions
  1. 6 10
      app/admin/controller/Activity.php

+ 6 - 10
app/admin/controller/Activity.php

@@ -198,7 +198,10 @@ class Activity extends Base
         if($tax_status!==''){
             $where[] = ['b.status', '=', $tax_status==0?null :$tax_status];
         }
-
+        $orderCode= isset($this->post['orderCode']) && $this->post['orderCode']!='' ? $this->post['orderCode']:'';
+        if($orderCode!==''){
+            $where[]=['a.spuCode',"=",\app\admin\model\Sale::where('orderCode','=',$orderCode)->value('spuCode','')];
+        }
         $count = Db::name('good_zixun')
             ->alias("a")
             ->leftJoin("good_tax b","a.spuCode=b.spuCode")
@@ -230,6 +233,7 @@ class Activity extends Base
         $all_unit = Db::name('unit')
             ->where(['is_del'=>0,'id'=>$all_good_unit])
             ->column('unit','id');
+        $orderCoderArr=\app\admin\model\Sale::where('good_code','in',array_unique(array_column($list,'spuCode')))->column('orderCode','good_code');
 
         $all_code = array_merge(array_column($list,'supplierNo'),array_column($list,'companyNo'));
         $userCommon = \app\admin\common\User::getIns();
@@ -244,26 +248,18 @@ class Activity extends Base
             $value['is_basic']=$goodbasice[$value['spuCode']]??null;
             $value['order_creater_depart']=$depart[$value['order_createrid']]??'';
             $value['is_online']=isset($good_online[$value['spuCode']])?1:0;
-
             $value['platform_name'] = $all_platform[$value['platform_id']]??'';//isset($platform['platform_name']) ? $platform['platform_name']:"";
             $value['platform_code_en'] = '';//isset($platform['platform_code_en']) ? $platform['platform_code_en']:"";
-
             $value['supplier_name'] = $tmp[$value['supplierNo']] ?? '';//isset($supplier['name']) ? $supplier['name']:"";
-
             $value["brand_name"]=$all_brand[$value['brand_id']]??'';//isset($brand['brand_name'])?$brand['brand_name']:"";
-
             $value['unit'] =$all_unit[$value['good_unit']]??'';//isset($unit['unit'])?$unit['unit']:"";
-//            $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find();
             $value['company'] = $tmp[$value['companyNo']]??'';//isset($company['company'])?$company['company']:"";
-//            $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find();
-//            $value['company'] = isset($company['company'])?$company['company']:"";
             $value['stock_total'] = Db::name("good_stock")
                 ->where(['spuCode'=>$value['spuCode'],"is_del"=>0])
                 ->sum("usable_stock");
-//            $value['status']=$value['exam_status'];
-//            $value['exclusive']=makeExcluse($value['is_exclusive']);
             $value['good_info_img']=$value['good_info_img'];
             $value['good_img']=$value['good_img'];
+            $value['orderCode']=$orderCoderArr[$value['spuCode']]??'';
             $spec = Db::name("good_spec")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->select()->toArray();
             $speclist=[];
             if(!empty($spec)){