|
@@ -2541,9 +2541,15 @@ class Consult extends Base
|
|
|
$supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !== "" ? trim($this->post['supplierNo']) : "";
|
|
|
if ($supplierNo !== "") $where[] = ["cb.supplierNo", '=', $supplierNo];
|
|
|
|
|
|
+ $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] !== "" ? trim($this->post['relaComNo']) : "";
|
|
|
+ if ($relaComNo !== "") $where[] = ["d.companyNo", '=', $relaComNo];
|
|
|
+
|
|
|
+ //Db::name("consult_order")->where(["zxNo"=>$zxinfo['zxNo'],"is_del"=>0])->find();
|
|
|
+
|
|
|
$count = Db::name('consult_bids')
|
|
|
->alias('cb')
|
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
|
+ ->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
|
// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
->where($where)
|
|
|
->count();
|
|
@@ -2552,8 +2558,9 @@ class Consult extends Base
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
$list = Db::name('consult_bids')
|
|
|
->alias('cb')
|
|
|
- ->field('cb.*')
|
|
|
+ ->field('cb.*,d.companyNo,d.platform_code')
|
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
|
+ ->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
|
// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
->where($where)
|
|
|
->page($page, $size)
|
|
@@ -2565,22 +2572,35 @@ class Consult extends Base
|
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>array_column($list,"supplierNo")]);
|
|
|
// if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) throw new Exception('该供应商不存在');
|
|
|
$supplier=$supplier_temp['data']??[];
|
|
|
+
|
|
|
+ $unit=Db::name('unit')
|
|
|
+ ->where(['id'=>array_column($list,'unit_id'),'is_del'=>0])
|
|
|
+ ->column('unit','id');
|
|
|
+
|
|
|
+ $brand=Db::name('brand')
|
|
|
+ ->where(['id'=>array_column($list,'brand_id'),'is_del'=>0])
|
|
|
+ ->column('brand_name','id');
|
|
|
+
|
|
|
+ $tmp_cat = [];
|
|
|
+
|
|
|
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'] : '';
|
|
|
+ if(!isset($tmp_cat[$value['cat_id']])) $tmp_cat[$value['cat_id']] =made($value['cat_id']);
|
|
|
+// $catinfo = Db::name("cat")->where(["id" => $value['cat_id']])->find();
|
|
|
+ $value['can'] = $tmp_cat[$value['cat_id']]??[];//isset($value['cat_id']) && $value['cat_id'] != 0 ? made($value['cat_id']) : [];
|
|
|
+// $unit = Db::name("unit")->where(["id" => $value['unit_id']])->find();
|
|
|
+ $value['unit'] = $unit[$value['unit_id']]??'';//isset($unit['unit']) ? $unit['unit'] : '';
|
|
|
// $supplier = Db::name("supplier")->where(["code" => $value['supplierNo']])->find();
|
|
|
$value['supplierName'] = isset($supplier[$value['supplierNo']]) ? $supplier[$value['supplierNo']] : "";
|
|
|
- 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"] = "";
|
|
|
- }
|
|
|
+// if ($value['brand_id'] != 0) {
|
|
|
+// $brand = Db::name("brand")->where(["id" => $value['brand_id']])->find();
|
|
|
+ $value["brand_name"] = $brand[$value['brand_id']] ?? '';//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;
|
|
|
+// $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate'] : 0;
|
|
|
+ $budget = get_budget((int)$value['cat_id'], $value['companyNo'], (int)$value['platform_code']);
|
|
|
$god = [
|
|
|
"metal_id" => $value['metal_id'],
|
|
|
"weight" => $value["good_weight"],
|
|
@@ -2636,6 +2656,9 @@ class Consult extends Base
|
|
|
|
|
|
$data[] = $value;
|
|
|
}
|
|
|
+
|
|
|
+ unset($tmp_cat);
|
|
|
+ unset($list);
|
|
|
return app_show(0, "获取成功", ['count' => $count, 'list' => $data]);
|
|
|
}
|
|
|
|