|
@@ -2153,56 +2153,57 @@ class Consult extends Base
|
|
|
}
|
|
|
return app_show(0,"获取成功",$data);
|
|
|
}
|
|
|
- public function bragain_list(){
|
|
|
- $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=[['bo.is_del',"=",0]];
|
|
|
- $bidsNo = isset($this->post['bidsNo'])&&$this->post['bidsNo']!=""?trim($this->post['bidsNo']):"";
|
|
|
- if($bidsNo!=""){
|
|
|
- $where[]=["bo.bidsNo","like","%$bidsNo%"];
|
|
|
+ public function bragain_list()
|
|
|
+ {
|
|
|
+ $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 = [['bo.is_del', "=", 0]];
|
|
|
+ $bidsNo = isset($this->post['bidsNo']) && $this->post['bidsNo'] != "" ? trim($this->post['bidsNo']) : "";
|
|
|
+ if ($bidsNo != "") {
|
|
|
+ $where[] = ["bo.bidsNo", "like", "%$bidsNo%"];
|
|
|
}
|
|
|
$zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
|
|
|
if ($zxNo !== "") {
|
|
|
- $where[] = ['bo.zxNo','like',"%$zxNo%"];
|
|
|
+ $where[] = ['bo.zxNo', 'like', "%$zxNo%"];
|
|
|
}
|
|
|
$bargainNo = isset($this->post['bargainNo']) && $this->post['bargainNo'] !== "" ? trim($this->post['bargainNo']) : "";
|
|
|
if ($bargainNo !== "") {
|
|
|
- $where[] = ['bo.bargainNo','like',"%$bargainNo%"];
|
|
|
+ $where[] = ['bo.bargainNo', 'like', "%$bargainNo%"];
|
|
|
}
|
|
|
|
|
|
$status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
- if ($status!== "") {
|
|
|
- $where[] = ['bo.status','=',$status];
|
|
|
+ if ($status !== "") {
|
|
|
+ $where[] = ['bo.status', '=', $status];
|
|
|
}
|
|
|
|
|
|
$infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
|
|
|
if ($infoNo !== "") {
|
|
|
- $where[] = ['bo.infoNo','like',"%$infoNo%"];
|
|
|
+ $where[] = ['bo.infoNo', 'like', "%$infoNo%"];
|
|
|
}
|
|
|
|
|
|
$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[] = ['bo.zxNo','in',$zxlist];
|
|
|
+ $zxlist = Db::name("consult_order")->where(["projectNo" => $projectNo, "is_del" => 0, "is_project" => 1])->column("zxNo");
|
|
|
+ $where[] = ['bo.zxNo', 'in', $zxlist];
|
|
|
}
|
|
|
$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[] = ['bo.infoNo','in',$bidinfo];
|
|
|
+ $bidinfo = Db::name("consult_info")->where([["pgNo", "=", $pgNo], ["is_del", "=", 0]])->column("infoNo");
|
|
|
+ $where[] = ['bo.infoNo', 'in', $bidinfo];
|
|
|
}
|
|
|
- $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
|
|
|
- $end= isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
|
|
|
- if($start!=""){
|
|
|
- $where[]=["bo.addtime",">=",date("Y-m-d H:i:s",strtotime($start))];
|
|
|
+ $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
|
|
|
+ $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
|
|
|
+ if ($start != "") {
|
|
|
+ $where[] = ["bo.addtime", ">=", date("Y-m-d H:i:s", strtotime($start))];
|
|
|
}
|
|
|
- if($end!=""){
|
|
|
- $where[]=["bo.addtime","<=",date("Y-m-d H:i:s",strtotime($end))];
|
|
|
+ if ($end != "") {
|
|
|
+ $where[] = ["bo.addtime", "<=", date("Y-m-d H:i:s", strtotime($end))];
|
|
|
}
|
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
if ($company_name !== "") $where[] = ["bo.createrid", 'in', get_company_item_user_by_name($company_name)];
|
|
|
|
|
|
- $relaComNo = trim($this->post['relaComNo']??'');
|
|
|
- if ($relaComNo !== "") $where[] = ["b.companyNo", '=', $relaComNo];
|
|
|
+ $companyNo = trim($this->post['companyNo'] ?? '');
|
|
|
+ if ($companyNo !== "") $where[] = ["b.companyNo", 'like', '%' . $companyNo . '%'];
|
|
|
|
|
|
// $role=$this->checkRole();
|
|
|
// if(!empty($role['write'])){
|
|
@@ -2211,15 +2212,16 @@ class Consult extends Base
|
|
|
// $role = $this->checkDataShare();
|
|
|
// if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['bo.createrid', 'in', $role[DataGroupModel::$type_全部]];
|
|
|
$role = $this->checkDataShare();
|
|
|
- $hand = resign_hand_user($this->uid,0);
|
|
|
+ $hand = resign_hand_user($this->uid, 0);
|
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- $arr= array_unique(array_merge($hand,$role[DataGroupModel::$type_全部]));
|
|
|
- $where[] = ['bo.createrid', 'in',$arr];
|
|
|
+ $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
|
|
|
+ $where[] = ['bo.createrid', 'in', $arr];
|
|
|
}
|
|
|
|
|
|
- $count=Db::name("bargain_order")
|
|
|
+ $count = Db::name("bargain_order")
|
|
|
->alias('bo')
|
|
|
- ->leftJoin('consult_order b','b.zxNo=bo.zxNo')
|
|
|
+ ->leftJoin('consult_order b', 'b.zxNo=bo.zxNo')
|
|
|
+ ->leftJoin('consult_info c', 'c.infoNo=bo.infoNo')
|
|
|
->where($where)
|
|
|
->count('bo.id');
|
|
|
|
|
@@ -2227,76 +2229,94 @@ class Consult extends Base
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
$list = Db::name('bargain_order')
|
|
|
->alias('bo')
|
|
|
- ->field('bo.*,b.companyNo')
|
|
|
- ->leftJoin('consult_order b','b.zxNo=bo.zxNo')
|
|
|
+ ->field('bo.*,b.companyNo,c.num')
|
|
|
+ ->leftJoin('consult_order b', 'b.zxNo=bo.zxNo')
|
|
|
+ ->leftJoin('consult_info c', 'c.infoNo=bo.infoNo')
|
|
|
->where($where)
|
|
|
->page($page, $size)
|
|
|
->order('bo.addtime', 'desc')
|
|
|
->select()
|
|
|
->toArray();
|
|
|
|
|
|
- $all_createrid = array_column($list,'createrid');
|
|
|
+ $all_createrid = array_column($list, 'createrid');
|
|
|
$item = get_company_name_by_uid($all_createrid);
|
|
|
|
|
|
$userCommon = new \app\admin\common\User();
|
|
|
- $names = $userCommon->handle('getCodeAndName',['code'=>array_column($list,'companyNo')]);
|
|
|
+ $names = $userCommon->handle('getCodeAndName', ['code' => array_column($list, 'companyNo')]);
|
|
|
|
|
|
- $data=[];
|
|
|
- foreach ($list as $value){
|
|
|
- $value['companyName'] = $names['data'][$value['companyNo']]??'';
|
|
|
- $bidinfos = Db::name("consult_bids")->where([["bidNo","=",$value['bidsNo']],["is_del","=",0]])->find();
|
|
|
- $value['spuCode'] = isset($bidinfos['spuCode'])?$bidinfos['spuCode']:"";
|
|
|
- $value['good_name'] = isset($bidinfos['good_name'])?$bidinfos['good_name']:"";
|
|
|
- $value['good_img'] = isset($bidinfos['good_img'])?$bidinfos['good_img']:"";
|
|
|
- $value['brand_id'] = isset($bidinfos['brand_id'])?$bidinfos['brand_id']:"";
|
|
|
- if($bidinfos['brand_id']!=0){
|
|
|
+ $bidinfos_list = Db::name('consult_bids')
|
|
|
+ ->where(['is_del' => 0, 'bidNo' => array_column($list, 'bidsNo')])
|
|
|
+ ->column('*', 'bidNo');
|
|
|
+
|
|
|
+ $brand = Db::name("brand")
|
|
|
+ ->where(["id" =>array_column($bidinfos_list,'brand_id')])
|
|
|
+ ->column('brand_name', 'id');
|
|
|
+
|
|
|
+ $cat = Db::name("cat")
|
|
|
+ ->where(["id" => array_column($bidinfos_list,'cat_id')])
|
|
|
+ ->column('order_rate', 'id');
|
|
|
+
|
|
|
+ $unit = Db::name("unit")
|
|
|
+ ->where(["id" => array_column($bidinfos_list,'unit_id')])
|
|
|
+ ->column('unit', 'id');
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $value) {
|
|
|
+ $value['companyName'] = $names['data'][$value['companyNo']] ?? '';
|
|
|
+// $bidinfos = Db::name("consult_bids")->where([["bidNo","=",$value['bidsNo']],["is_del","=",0]])->find();
|
|
|
+ $bidinfos = $bidinfos_list[$value['bidsNo']];
|
|
|
+ $value['spuCode'] = isset($bidinfos['spuCode']) ? $bidinfos['spuCode'] : "";
|
|
|
+ $value['good_name'] = isset($bidinfos['good_name']) ? $bidinfos['good_name'] : "";
|
|
|
+ $value['good_img'] = isset($bidinfos['good_img']) ? $bidinfos['good_img'] : "";
|
|
|
+ $value['brand_id'] = isset($bidinfos['brand_id']) ? $bidinfos['brand_id'] : "";
|
|
|
+ if ($bidinfos['brand_id'] != 0) {
|
|
|
$value['brand_id'] = $bidinfos['brand_id'];
|
|
|
- $brand=Db::name("brand")->where(["id"=>$bidinfos['brand_id']])->find();
|
|
|
- $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
|
|
|
- }else{
|
|
|
- $value["brand_name"]="";
|
|
|
- $value["brand_id"]="";
|
|
|
+// $brand=Db::name("brand")->where(["id"=>$bidinfos['brand_id']])->find();
|
|
|
+ $value["brand_name"] = $brand[$value['brand_id']] ?? '';//isset($brand['brand_name'])?$brand['brand_name']:"";
|
|
|
+ } else {
|
|
|
+ $value["brand_name"] = "";
|
|
|
+ $value["brand_id"] = "";
|
|
|
}
|
|
|
- $catinfo = Db::name("cat")->where(["id"=>$bidinfos['cat_id']])->find();
|
|
|
- $value['can']= isset($bidinfos['cat_id']) && $bidinfos['cat_id'] !=0 ? made($bidinfos['cat_id']):[];
|
|
|
- $unit =Db::name("unit")->where(["id"=>$bidinfos['unit_id']])->find();
|
|
|
- $value['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
|
- $bidinfoe = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
|
|
|
- $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:0;
|
|
|
- $value['budget'] =$budget;
|
|
|
- $god=[
|
|
|
- "metal_id"=>$bidinfos['metal_id'],
|
|
|
- "weight"=>$bidinfos["good_weight"],
|
|
|
- "demo_fee"=>$bidinfos["demo_fee"],
|
|
|
- "delivery_fee"=>$bidinfos["delivery_fee"],
|
|
|
- "open_fee"=>$bidinfos["open_fee"],
|
|
|
- "packing_fee"=>$bidinfos["pakge_fee"],
|
|
|
- "mark_fee"=>$bidinfos["mark_fee"],
|
|
|
- "nake_fee"=>$bidinfos["nake_fee"],
|
|
|
- "cert_fee"=>$bidinfos["cert_fee"],
|
|
|
- "cost_fee"=>$bidinfos["cost_fee"],
|
|
|
- "num"=>$bidinfoe["num"],
|
|
|
+// $catinfo = Db::name("cat")->where(["id"=>$bidinfos['cat_id']])->find();
|
|
|
+ $value['can'] = isset($bidinfos['cat_id']) && $bidinfos['cat_id'] != 0 ? made($bidinfos['cat_id']) : [];
|
|
|
+// $unit =Db::name("unit")->where(["id"=>$bidinfos['unit_id']])->find();
|
|
|
+ $value['unit'] = $unit[$bidinfos['unit_id']] ?? '';//isset($unit['unit'])?$unit['unit']:'';
|
|
|
+// $bidinfoe = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
|
|
|
+ $budget = $cat[$bidinfos['cat_id']] ?? 0;//isset($catinfo['order_rate']) ? $catinfo['order_rate']:0;
|
|
|
+ $value['budget'] = $budget;
|
|
|
+ $god = [
|
|
|
+ "metal_id" => $bidinfos['metal_id'],
|
|
|
+ "weight" => $bidinfos["good_weight"],
|
|
|
+ "demo_fee" => $bidinfos["demo_fee"],
|
|
|
+ "delivery_fee" => $bidinfos["delivery_fee"],
|
|
|
+ "open_fee" => $bidinfos["open_fee"],
|
|
|
+ "packing_fee" => $bidinfos["pakge_fee"],
|
|
|
+ "mark_fee" => $bidinfos["mark_fee"],
|
|
|
+ "nake_fee" => $bidinfos["nake_fee"],
|
|
|
+ "cert_fee" => $bidinfos["cert_fee"],
|
|
|
+ "cost_fee" => $bidinfos["cost_fee"],
|
|
|
+ "num" => $value["num"],
|
|
|
];
|
|
|
// if($bidinfos['is_gold_price']==1){
|
|
|
// $price = GoldPrice($god, $budget/100);
|
|
|
// }else{
|
|
|
// $price = GoodPrice($god, $budget/100);
|
|
|
// }
|
|
|
- $value['metal_name']=isset($bidinfos['metal_id'])&& $bidinfos['metal_id']!=0?$this->noble[$bidinfos['metal_id']]:"";
|
|
|
- $value['sale_price'] =round($bidinfos['origin_price'],2);
|
|
|
- $value['cost_before_price'] =round($bidinfos['origin_cost_fee'],2);
|
|
|
+ $value['metal_name'] = isset($bidinfos['metal_id']) && $bidinfos['metal_id'] != 0 ? $this->noble[$bidinfos['metal_id']] : "";
|
|
|
+ $value['sale_price'] = round($bidinfos['origin_price'], 2);
|
|
|
+ $value['cost_before_price'] = round($bidinfos['origin_cost_fee'], 2);
|
|
|
|
|
|
- $value['specinfo'] = isset($bidinfos['specinfo'])&&$bidinfos['specinfo']!=""?json_decode($bidinfos['specinfo'],true):[];
|
|
|
- $value['company_name'] = $item[$value['createrid']]??'';
|
|
|
+ $value['specinfo'] = isset($bidinfos['specinfo']) && $bidinfos['specinfo'] != "" ? json_decode($bidinfos['specinfo'], true) : [];
|
|
|
+ $value['company_name'] = $item[$value['createrid']] ?? '';
|
|
|
|
|
|
//是否具有编辑权限
|
|
|
$value['is_allow_update'] = 0;
|
|
|
if (in_array($this->roleid, [1, 33]) || in_array($value['createrid'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
|
|
|
- $data[]=$value;
|
|
|
+ $data[] = $value;
|
|
|
}
|
|
|
|
|
|
- return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
|
|
|
+ return app_show(0, "获取成功", ["count" => $count, "list" => $data]);
|
|
|
}
|
|
|
|
|
|
//招标工作台
|