wugg vor 3 Jahren
Ursprung
Commit
fd3b101c0b
3 geänderte Dateien mit 237 neuen und 3 gelöschten Zeilen
  1. 178 0
      app/admin/controller/Consult.php
  2. 56 3
      app/admin/controller/Good.php
  3. 3 0
      app/admin/route/app.php

+ 178 - 0
app/admin/controller/Consult.php

@@ -724,6 +724,110 @@ class Consult extends BaseController
         $info['bargain'] =$bargain;
         return app_show(0,"获取成功",$info);
     }
+
+    public function feededit(){
+        $bidNo= isset($this->post['bidNo'])&&$this->post['bidNo']!=""?trim($this->post['bidNo']):"";
+        if($bidNo==""){
+            return error_show(1002,"参数bidNo不能为空");
+        }
+        $bidinfo = Db::name("consult_bids")->where(["bidNo"=>$bidNo,"is_del"=>0])->find();
+        if($bidinfo==false){
+            return error_show(1003,"未找到信息数据");
+        }
+        if($bidinfo['status']>=5){
+            return error_show(1004,"咨询单已确认无法修改");
+        }
+
+        $zxinfo = Db::name("consult_info")->where(["infoNo"=>$bidinfo['infoNo'],"is_del"=>0])->find();
+        if($zxinfo==false){
+            return error_show(1003,"未找到信息数据");
+        }
+        $pname = isset($this->post['pname'])&&$this->post['pname']!=""? trim($this->post['pname']):"";
+        if($pname==""){
+            return error_show(1002,"参数pname不能为空");
+        }
+        $brandid = isset($this->post['brandid'])&&$this->post['brandid']!=""? intval($this->post['brandid']):"";
+//        if($brandid==""){
+//            return error_show(1002,"参数brandid不能为空");
+//        }
+
+        $cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!=""? trim($this->post['cat_id']):"";
+        if($cat_id==""){
+            return error_show(1002,"参数cat_id不能为空");
+        }
+        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
+        //$unit = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
+        $material = isset($this->post['material'])&&$this->post['material']!=""? trim($this->post['material']):"";
+        $unit_id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']):"";
+        $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""? trim($this->post['cost_desc']):"";
+        $work_day = isset($this->post['work_day'])&&$this->post['work_day']!=""? intval($this->post['work_day']):"";
+        $delivery_day = isset($this->post['delivery_day'])&&$this->post['delivery_day']!=""? intval($this->post['delivery_day']):"";
+        $good_img = isset($this->post['good_img'])&&$this->post['good_img']!=""? trim($this->post['good_img']):"";
+        $expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? intval($this->post['expire_day'])
+            :"";
+        $origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
+        $supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
+        $pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? intval($this->post['pay_way']):"";
+        $tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
+        $send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? intval($this->post['send_way']):"";
+        $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!=""? intval($this->post['metal_id']):"";
+        $is_gold_price = isset($this->post['is_gold_price'])&&$this->post['is_gold_price']!=""? intval($this->post['is_gold_price']):"";
+        $config = isset($this->post['config'])&&$this->post['config']!=""? $this->post['config']:"";
+        $weight = isset($this->post['weight'])&&$this->post['weight']!=""? floatval($this->post['weight']):"";
+        $demo_fee = isset($this->post['demo_fee'])&&$this->post['demo_fee']!=""? floatval($this->post['demo_fee']):"";
+        $delivery_fee = isset($this->post['delivery_fee'])&&$this->post['delivery_fee']!=""? floatval($this->post['delivery_fee']):"";
+        $open_fee = isset($this->post['open_fee'])&&$this->post['open_fee']!=""? floatval($this->post['open_fee']):"";
+        $pakge_fee = isset($this->post['pakge_fee'])&&$this->post['pakge_fee']!=""? floatval($this->post['pakge_fee']):"";
+        $nake_fee = isset($this->post['nake_fee'])&&$this->post['nake_fee']!=""? floatval($this->post['nake_fee']):"";
+        $mark_fee = isset($this->post['mark_fee'])&&$this->post['mark_fee']!=""? floatval($this->post['mark_fee']):"";
+        $cert_fee = isset($this->post['cert_fee'])&&$this->post['cert_fee']!=""? floatval($this->post['cert_fee']):"";
+        $cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!=""? floatval($this->post['cost_fee']):"";
+        $total_fee = isset($this->post['total_fee'])&&$this->post['total_fee']!=""? floatval($this->post['total_fee']):"";
+        $is_diff = isset($this->post['is_diff'])&&$this->post['is_diff']!==""? intval($this->post['is_diff']):"";
+        $supply_area = isset($this->post['supply_area'])&&$this->post['supply_area']!==""? intval($this->post['supply_area']):"";
+        $remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
+        $data=[
+            "good_name"=>$pname,
+            "brand_id"=>$brandid,
+            "cat_id"=>$cat_id,
+            "model"=>$model,
+            "material"=>$material,
+            "unit_id"=>$unit_id,
+            "cost_desc"=>$cost_desc,
+            "work_day"=>$work_day,
+            "delivery_day"=>$delivery_day,
+            "good_img"=>$good_img,
+            "expire_day"=>$expire_day,
+            "origin_place"=>$origin_place,
+            "supplierNo"=>$supplierNo,
+            "pay_way"=>$pay_way,
+            "tax"=>$tax,
+            "send_way"=>$send_way,
+            "metal_id"=>$metal_id,
+            "is_gold_price"=>$is_gold_price,
+            "config"=>$config,
+            "weight"=>$weight,
+            "is_diff"=>$is_diff,
+            "demo_fee"=>$demo_fee,
+            "delivery_fee"=>$delivery_fee,
+            "open_fee"=>$open_fee,
+            "pakge_fee"=>$pakge_fee,
+            "nake_fee"=>$nake_fee,
+            "mark_fee"=>$mark_fee,
+            "cert_fee"=>$cert_fee,
+            "cost_fee"=>$cost_fee,
+            "total_fee"=>$total_fee,
+            "supply_area"=>$supply_area,
+            "remark"=>$remark,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $insert= Db::name("consult_bids")->where($bidinfo)->save($data);
+        if($insert){
+            return app_show(0,"编辑成功");
+        }else{
+            return error_show(1004,"编辑失败");
+        }
+    }
     public function bargain_add(){
         $bidNo = isset($this->post['bidNo'])&& $this->post['bidNo']!=""?trim($this->post['bidNo']):"";
         if($bidNo===""){
@@ -913,4 +1017,78 @@ class Consult extends BaseController
         }
         return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
     }
+
+    public function feedlist(){
+        $where=[['is_del',"=",0]];
+        $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
+        if ($zxNo !== "") {
+            $where[] = ['zxNo','=',$zxNo];
+        }
+        $infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
+        if ($infoNo !== "") {
+            $where[] = ['infoNo','=',$infoNo];
+        }
+        $bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
+        if ($bidNo !== "") {
+            $where[] = ['bidNo','=',$bidNo];
+        }
+        $projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
+        if ($projectNo !== "") {
+            $zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
+            ("zxNo");
+            $where[] = ['zxNo','in',$zxlist];
+        }
+        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
+        if($token==''){
+            return error_show(1002,"参数token不能为空");
+        }
+        $user =GetUserInfo($token);
+        if(empty($user)||$user['code']!=0){
+            return error_show(1005,"用户数据不存在");
+        }
+        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
+        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
+        $where[] = ["createrid","=",$createrid];
+        $list =Db::name('consult_bids')->where($where)->select();
+        $data=[];
+        foreach ($list as $value){
+            $catinfo = Db::name("cat")->where(["id"=>$value['cat_id']])->find();
+
+            $value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
+            $unit =Db::name("unit")->where(["id"=>$value['unit_id']])->find();
+            $value['unit'] = isset($unit['unit'])?$unit['unit']:'';
+            $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
+            $value['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
+            if($value['brand_id']!=0){
+                $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
+                $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
+            }else{
+                $value["brand_name"]="";
+                $value["brand_id"]="";
+            }
+            $bidinfo = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
+            $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
+            $god=[
+                "metal_id"=>$value['metal_id'],
+                "weight"=>$value["weight"],
+                "demo_fee"=>$value["demo_fee"],
+                "delivery_fee"=>$value["delivery_fee"],
+                "open_fee"=>$value["open_fee"],
+                "packing_fee"=>$value["pakge_fee"],
+                "mark_fee"=>$value["mark_fee"],
+                "nake_fee"=>$value["nake_fee"],
+                "cert_fee"=>$value["cert_fee"],
+                "cost_fee"=>$value["cost_fee"],
+                "num"=>$bidinfo["num"],
+            ];
+            if($value['is_gold_price']==1){
+                $price = GoldPrice($god, $budget/100);
+            }else{
+                $price = GoodPrice($god, $budget/100);
+            }
+            $value['sale_price'] =round($price,2);
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",$data);
+    }
 }

+ 56 - 3
app/admin/controller/Good.php

@@ -222,11 +222,9 @@ class Good extends \app\BaseController
             }
         }
         $data["speclist"]=empty($speclist)?[]:$speclist;
-        // $nake=[];
         $ladder = Db::name("good_ladder")->where(['skuCode'=>$skucode,"is_del"=>0])->select()->toArray();
         $data["ladderlist"]=!empty($ladder)?$ladder:[];
-        $nakelist = Db::name("good_nake")->where(['spuCode'=>$good_platform['spuCode'],"is_del"=>0])->select()
-            ->toArray();
+        $nakelist = Db::name("good_nake")->where(['spuCode'=>$good_platform['spuCode'],"is_del"=>0])->select()->toArray();
         $data["nakelist"]=!empty($nakelist)?$nakelist:[];
         return app_show(0,"获取成功",$data);
     }
@@ -603,4 +601,59 @@ class Good extends \app\BaseController
         }
         return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
     }
+
+    public  function  goodlist(){
+        $page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']):"1";
+        $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']):"10";
+        $where =[["a.is_del","=",0]];
+        $paltcode = isset($this->post["platform_code"])&& $this->post["platform_code"]!=""? trim($this->post["platform_code"]):"";
+        if($paltcode!=""){
+            $where[]=["platform_code","=",$paltcode];
+        }
+        $company_id = isset($this->post["company_id"])&& $this->post["company_id"]!=""? trim($this->post["company_id"]):"";
+        if($company_id!=""){
+            $where[]=["company_id","=",$company_id];
+        }
+
+        $cat_id = isset($this->post["cat_id"])&& $this->post["cat_id"]!==""? intval($this->post["cat_id"]):"";
+        if($cat_id!==""){
+            $where[]=["cat_id","=",$cat_id];
+        }
+
+        $buy_num = isset($this->post["buy_num"])&& $this->post["buy_num"]!==""? intval($this->post["buy_num"]):"";
+        if($buy_num!==""){
+            $where[]=["min_num","<=",$buy_num];
+        }
+        $price = isset($this->post["price"])&& $this->post["price"]!==""? floatval($this->post["price"]):"";
+        if($buy_num!==""){
+            $where[]=["sale_price","<=",$price];
+        }
+        $count = Db::name('good')->alias("a")->leftJoin("good_platform b","a.spuCode=b.spuCode")->leftJoin("good_ladder c","b.skuCode=c.skuCode")
+            ->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('good')->alias("a")->leftJoin("good_platform b","a.spuCode=b.spuCode")->leftJoin("good_ladder c","b.skuCode=c.skuCode")->where($where)->page
+        ($page,$size)->field("c.id,c.min_num,c.sale_price,.a.good_name,a.spuCode,a.cat_id,a.brand_id,a.companyNo,a.supplierNo,a.good_unit,b.skuCode,b.platform_code,b.plat_code,b.id as good_id,b.addtime,b.updatetime,b.exam_status")
+            ->order("b.addtime desc")
+            ->select();
+        $data=[];
+        foreach ($list as $value){
+            $value['cat_info']= made($value['cat_id'],[]);
+            $platform = Db::name("platform")->where(["id"=>$value['platform_code']])->find();
+            $value['platform_name'] = isset($platform['platform_name']) ? $platform['platform_name']:"";
+            $value['platform_code_en'] = isset($platform['platform_code_en']) ? $platform['platform_code_en']:"";
+            $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
+            $value['supplier_name'] = isset($supplier['name']) ? $supplier['name']:"";
+            $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
+            $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
+            $unit = Db::name("unit")->where(["id"=>$value['good_unit']])->find();
+            $value['unit'] =isset($unit['unit'])?$unit['unit']:"";
+            $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'];
+            $data[]=$value;
+        }
+        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
+    }
 }

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

@@ -174,6 +174,7 @@ Route::rule("getstockgod","admin/Good/GetStockGod");
 Route::rule("getstockwsm","admin/Good/GetStockWsm");
 Route::rule("getstockbet","admin/Good/GetStockBet");
 Route::rule("goodloglist","admin/Good/loglist");
+Route::rule("goodplist","admin/Good/goodlist");
 
 Route::rule("purchlist","admin/Resign/list");
 Route::rule("purchadd","admin/Resign/add");
@@ -406,6 +407,8 @@ Route::rule('consultfeed','admin/Consult/feadback');
 Route::rule('consultfeadinfo','admin/Consult/feadinfo');
 Route::rule('consultbaradd','admin/Consult/bargain_add');
 Route::rule('consultbidlist','admin/Consult/bidlist');
+Route::rule('consultfeededit','admin/Consult/feededit');
+Route::rule('consultfeedlist','admin/Consult/feedlist');
 Route::rule('bragainstatus','admin/Consult/bargain_status');
 Route::rule('bragaininfo','admin/Consult/bargain_info');