소스 검색

咨询采反查询

wufeng 2 년 전
부모
커밋
96f1e6c3a4
3개의 변경된 파일150개의 추가작업 그리고 11개의 파일을 삭제
  1. 140 2
      app/abutment/controller/Consult.php
  2. 9 9
      app/abutment/controller/Sale.php
  3. 1 0
      app/abutment/route/app.php

+ 140 - 2
app/abutment/controller/Consult.php

@@ -10,6 +10,7 @@ use think\facade\Db;
 
 
 class Consult extends BaseController
 class Consult extends BaseController
 {
 {
+    private $noble = ['0' => '', '1' => '18K', '2' => '24K', '3' => '白银'];
 
 
     //招标工作台列表
     //招标工作台列表
     public function crontablist()
     public function crontablist()
@@ -56,7 +57,6 @@ class Consult extends BaseController
             ->select()
             ->select()
             ->toArray();
             ->toArray();
         $data = [];
         $data = [];
-        $noble = ['0' => '', '1' => '18K', '2' => '24K', '3' => '白银'];
         $all_cat = Db::name('cat')
         $all_cat = Db::name('cat')
             ->whereIn('id', array_column($list, 'cat_id'))
             ->whereIn('id', array_column($list, 'cat_id'))
             ->column('order_rate', 'id');
             ->column('order_rate', 'id');
@@ -87,7 +87,7 @@ class Consult extends BaseController
                 ->find();
                 ->find();
             $value['is_feed'] = $consult == false ? 0 : 1;
             $value['is_feed'] = $consult == false ? 0 : 1;
             $value['is_all_feed'] = $consults == false ? 0 : 1;
             $value['is_all_feed'] = $consults == false ? 0 : 1;
-            $value['metal_name'] = isset($value['metal_id']) && $value['metal_id'] != 0 ? $noble[$value['metal_id']] : "";
+            $value['metal_name'] = isset($value['metal_id']) && $value['metal_id'] != 0 ? $this->noble[$value['metal_id']] : "";
             $data[] = $value;
             $data[] = $value;
         }
         }
         return json_show(0, "获取成功", ['count' => $count, 'list' => $data]);
         return json_show(0, "获取成功", ['count' => $count, 'list' => $data]);
@@ -481,4 +481,142 @@ class Consult extends BaseController
 
 
     }
     }
 
 
+    //复制上面的bidlist方法,只更改排序方式
+    public function bidlistCopy()
+    {
+        $this->post = $this->request->filter('trim')->post();
+
+        $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 = [['cb.is_del', "=", 0]];
+        $zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
+        if ($zxNo !== "") {
+            $where[] = ['cb.zxNo', 'like', '%' . $zxNo . '%'];
+        }
+        $infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
+        if ($infoNo !== "") {
+            $where[] = ['cb.infoNo', 'like', '%' . $infoNo . '%'];
+        }
+        $bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
+        if ($bidNo !== "") {
+            $where[] = ['cb.bidNo', 'like', '%' . $bidNo . '%'];
+        }
+        $pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
+        if ($pgNo !== "") {
+            $bidinfo = Db::name("consult_info")->where([["pgNo", "=", $pgNo], ["is_del", "=", 0]])->column("infoNo");
+            $where[] = ['cb.infoNo', 'in', $bidinfo];
+        }
+        $bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
+        if ($bargain_status !== "") {
+            $bidinfo = Db::name("consult_info")->where([["bargain_status", "=", $bargain_status], ["is_del", "=", 0]])->column("infoNo");
+            $where[] = ['cb.infoNo', 'in', $bidinfo];
+        }
+        $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[] = ['cb.zxNo', 'in', $zxlist];
+        }
+        $is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
+        if ($is_own == 1) {
+//            $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+//            if ($token == "") {
+//                return json_show(101, 'token不能为空');
+//            }
+//            $apply_id = GetUserInfo($token);
+//            if (empty($apply_id) || $apply_id['code'] != 0) {
+//                return json_show(1002, "申请人数据不存在");
+//            }
+            $rm = $this->request->user['uid'];
+            $where[] = ['cb.createrid', "=", $rm];
+        }
+        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
+        if ($company_name !== "") $where[] = ["cb.createrid", 'in', get_company_item_user_by_name($company_name)];
+
+
+        $count = Db::name('consult_bids')->alias('cb')->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('consult_bids')
+            ->alias('cb')
+            ->field('cb.*,u.itemid')
+            ->leftJoin("depart_user u", "u.uid=cb.createrid AND u.is_del=0")
+            ->where($where)
+            ->page($page, $size)
+            ->order('cb.addtime', 'desc')
+            ->cursor();
+        $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'] : 0;
+            $god = [
+                "metal_id" => $value['metal_id'],
+                "weight" => $value["good_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["sale_cost_fee"] != $value["origin_cost_fee"] ? $value["sale_cost_fee"] : $value["cost_fee"],
+                "num" => $bidinfo["num"],
+            ];
+            if ($value['is_gold_price'] == 1) {
+                $price = GoldPrice($god, $budget / 100);
+                $value['sale_price'] = round($price, 2);
+            }
+            $value['cost_fee'] = $value['origin_cost_fee'];
+            $value['specinfo'] = json_decode($value['specinfo'], true);
+            $value['metal_name'] = isset($value['metal_id']) && $value['metal_id'] != 0 ? $this->noble[$value['metal_id']] : "";
+            $value['bargain_status'] = $bidinfo['bargain_status'];
+
+            //reject驳回原因,status==5表示驳回
+            $value['reject'] = [];
+            if ($value['status'] >= 5) {
+                $value['reject'] = Db::name('bargain_order')
+                    ->field('id,remark,status')
+                    ->where(['infoNo' => $infoNo, 'bidsNo' => $value['bidNo']])
+                    ->whereIn('status', [3, 8, 11])->order("id desc")
+                    ->find();
+            }
+            //产地
+            $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+            if ($value['delivery_place'] != "") {
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['delivery_place']);
+            }
+            $value['delivery_place_cn'] = GetAddr(json_encode($place));
+            $place = ["provice_code" => "", "city_code" => "", "area_code" => ""];
+            if ($value['origin_place'] != "") {
+                list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['origin_place']);
+            }
+            $value['origin_addr'] = GetAddr(json_encode($place));
+//            if($value['origin_place']!=''){
+//                $code = explode(",",$value['origin_place']);
+//                $temp=[];
+//                $temp['provice_code']=isset($code[0])?$code[0]:"";
+//                $temp['city_code']=isset($code[1])?$code[1]:"";
+//                $temp['area_code']=isset($code[2])?$code[2]:"";
+//                $addr= GetAddr(json_encode($temp));
+//                $value['origin_addr'] = $addr;
+//            }
+            $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
+            $data[] = $value;
+        }
+        return json_show(0, "获取成功", ['count' => $count, 'list' => $data]);
+    }
+
 }
 }

+ 9 - 9
app/abutment/controller/Sale.php

@@ -67,13 +67,13 @@ class Sale extends BaseController
         if ($cgdNo != "") {
         if ($cgdNo != "") {
             $where[] = ["os.cgdNo", 'like', '%' . $cgdNo . '%'];
             $where[] = ["os.cgdNo", 'like', '%' . $cgdNo . '%'];
         }
         }
-        $role = $this->checkRole();
-        $condition = '';
-        if (!empty($role['write']) && $this->uid != "") {
-            // $where[]=["a.apply_id","in",$role['write']];
-            $condition .= " (b.is_stock=1 and n.contactor = {$this->uid}) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',',
-                    $role['write']) . ")";
-        }
+//        $role = $this->checkRole();
+//        $condition = '';
+//        if (!empty($role['write']) && $this->uid != "") {
+//            // $where[]=["a.apply_id","in",$role['write']];
+//            $condition .= " (b.is_stock=1 and n.contactor = {$this->uid}) or (b.is_stock=0 and wpo.cgder_id = {$this->uid}) or a.apply_id in (" . implode(',',
+//                    $role['write']) . ")";
+//        }
 //        if(!empty($role['platform']) ){
 //        if(!empty($role['platform']) ){
 //            $where[]=["b.platform_id","in",$role['platform']];
 //            $where[]=["b.platform_id","in",$role['platform']];
 //        }
 //        }
@@ -98,7 +98,7 @@ class Sale extends BaseController
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("order_send os", "os.outCode=a.outCode")
             ->leftJoin("purchease_order wpo", "wpo.cgdNo=os.cgdNo")
             ->leftJoin("purchease_order wpo", "wpo.cgdNo=os.cgdNo")
             ->where($where)
             ->where($where)
-            ->where($condition)
+//            ->where($condition)
             ->count();
             ->count();
         $total = ceil($count / $size);
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
         $page = $page >= $total ? $total : $page;
@@ -112,7 +112,7 @@ class Sale extends BaseController
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
             ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
             ->field("a.*,b.order_type,b.order_source,b.good_name,b.good_code,b.skuCode,b.supplierNo,b.customer_code,v.companyName,b.origin_price,b.sale_price,b.total_price,os.cgdNo,u.itemid")
             ->field("a.*,b.order_type,b.order_source,b.good_name,b.good_code,b.skuCode,b.supplierNo,b.customer_code,v.companyName,b.origin_price,b.sale_price,b.total_price,os.cgdNo,u.itemid")
             ->where($where)
             ->where($where)
-            ->where($condition)
+//            ->where($condition)
             ->order("addtime desc")
             ->order("addtime desc")
             ->page($page, $size)
             ->page($page, $size)
             ->cursor();
             ->cursor();

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

@@ -39,5 +39,6 @@ route::rule('crontabList', 'abutment/Consult/crontablist');//招标工作台列
 route::rule('consultZxInfo', 'abutment/Consult/zxinfo');//招标工作台详情
 route::rule('consultZxInfo', 'abutment/Consult/zxinfo');//招标工作台详情
 route::rule('consultBidList', 'abutment/Consult/bidlist');//招标工作台商品列表
 route::rule('consultBidList', 'abutment/Consult/bidlist');//招标工作台商品列表
 route::rule('consultCreate', 'abutment/Consult/create');//创建采反商品
 route::rule('consultCreate', 'abutment/Consult/create');//创建采反商品
+route::rule('consultBidListCopy', 'abutment/Consult/bidlistCopy');//咨询采反查询