|
@@ -3,7 +3,7 @@
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\model\ActionLog;
|
|
|
-use app\admin\model\ConsultTemp;use app\admin\model\DataGroup as DataGroupModel;
|
|
|
+use app\admin\model\ConsultBids;use app\admin\model\ConsultTemp;use app\admin\model\DataGroup as DataGroupModel;
|
|
|
use app\admin\model\GoodTax;use app\admin\model\ProcessOrder;
|
|
|
use app\model\TaxCategory;use think\App;
|
|
|
use think\facade\Db;
|
|
@@ -648,16 +648,11 @@ class Consult extends Base
|
|
|
if($status===""){
|
|
|
return error_show(1004,"参数status不能为空");
|
|
|
}
|
|
|
-// if($status==1&&$zxinfo['status']>1){
|
|
|
-// $zxinfo['bargain_num']=+1;
|
|
|
-// }
|
|
|
$old_zxinfo_status = $zxinfo['status'];
|
|
|
$zxinfo['status']=$status;
|
|
|
$zxinfo['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up = Db::name("consult_info")->save($zxinfo);
|
|
|
if($up){
|
|
|
-
|
|
|
- //修改状态,添加待办
|
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
"order_code" => $zxinfo['infoNo'],//咨询单详情编号
|
|
|
"status" => $old_zxinfo_status,//这里的status是之前的值
|
|
@@ -1070,10 +1065,9 @@ class Consult extends Base
|
|
|
$bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
|
|
|
$info['bargain'] =$bargain;
|
|
|
$info['good_img'] = explode(',',$info['good_img']);
|
|
|
- $tax = TaxCategory::where(['id'=>$info['tax_id']])->findOrEmpty();
|
|
|
- $info['tax_short_name'] =$tax['short_name']??"";
|
|
|
- $info['tax_name'] =$tax['cat_name']??"";
|
|
|
- $info['tax_code'] =$tax['merge_code']??"";
|
|
|
+ $tax = TaxCategory::where(['id'=>[$info['tax_id'],$info['out_tax_id']]])->column("shot_name,cat_name,cat_code,merge_code","id");
|
|
|
+ $info['in_tax'] = $tax[$info['tax_id']]??[];
|
|
|
+ $info['out_tax'] = $tax[$info['out_tax_id']]??[];
|
|
|
|
|
|
//添加商品创建人字段
|
|
|
$good_info = Db::name('good_basic')
|
|
@@ -1213,22 +1207,18 @@ class Consult extends Base
|
|
|
$supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
|
|
|
if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
|
|
|
$supplierArr=$supplier_temp['data']??[];
|
|
|
-// $supplier=$supplierArr['child']??[];
|
|
|
$goodBind= isset($this->post['goodBind']) && !empty($this->post['goodBind']) ? $this->post['goodBind'] :[];
|
|
|
- if($is_combind==1){
|
|
|
- if(empty($goodBind))$this->error('组合商品商品明细不能为空');
|
|
|
-// $spucode=makeNo('SSU');
|
|
|
- }
|
|
|
+ if($is_combind==1){
|
|
|
+ if(empty($goodBind))$this->error('组合商品商品明细不能为空');
|
|
|
+ }
|
|
|
if ($supplierArr['relation_code'] != '') {
|
|
|
if ($supplierArr['relation_code'] == $zx['companyNo']) return error_show(1004, "业务公司与供应商信息一致");
|
|
|
-
|
|
|
//判断支付渠道中是否有相关供应商
|
|
|
$is_select_pay_rate = Db::name('platform')
|
|
|
->where(['is_del' => 0, 'id' => $zx['platform_code'],"status"=>1])
|
|
|
->value('is_select_pay_rate', 0);
|
|
|
if ($is_select_pay_rate == 1) {
|
|
|
if(channel_is_company($zx['platform_code'],$supplierArr['relation_code'])) return error_show(1004, "平台渠道包含当前供应商公司{$supplierNo}");
|
|
|
-//
|
|
|
}
|
|
|
}else{
|
|
|
if($is_combind==1)$this->error('当前供应商无对应业务公司,不可选择组合商品');
|
|
@@ -1237,10 +1227,10 @@ class Consult extends Base
|
|
|
$open_type= isset($this->post['open_type'])&&$this->post['open_type']!==''? intval($this->post['open_type']):'';
|
|
|
$inv_good_name = isset($this->post['inv_good_name'])&&$this->post['inv_good_name']!==''? trim($this->post['inv_good_name']):'';
|
|
|
if($open_type=='') return error_show(1004,'开票商品类型不能为空');
|
|
|
- if($open_type==1){
|
|
|
- if($tax_id=='') return error_show(1004,'商品税目id不能为空');
|
|
|
- if($inv_good_name=='') return error_show(1004,'开票商品名称不能为空');
|
|
|
- }
|
|
|
+ if($open_type==1){
|
|
|
+ if($tax_id=='') return error_show(1004,'商品税目id不能为空');
|
|
|
+ if($inv_good_name=='') return error_show(1004,'开票商品名称不能为空');
|
|
|
+ }
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$data=[
|
|
@@ -1537,64 +1527,81 @@ class Consult extends Base
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //选择商品
|
|
|
public function bids_check(){
|
|
|
- $bidNo = isset($this->post['bidNo'])&& $this->post['bidNo']!=""?trim($this->post['bidNo']):"";
|
|
|
- if($bidNo===""){
|
|
|
- return error_show(1004,"参数bidNo不能为空");
|
|
|
- }
|
|
|
- $info =Db::name("consult_bids")->where(['bidNo'=>$bidNo,"is_del"=>0])->find();
|
|
|
- if($info==false){
|
|
|
- return error_show(1004,"未找到商品数据");
|
|
|
+ $params = $this->request->param(["bidNo"=>"","status"=>"","out_tax_id"=>"","out_tax"=>"","goodCombind"=>[]],"post");
|
|
|
+ $valid = Validate::rule([
|
|
|
+ "bidNo|反馈单编号"=>"require",
|
|
|
+ "status|状态"=>"require|number",
|
|
|
+ "out_tax_id|税目id"=>"requireIf:status,3|number",
|
|
|
+ "out_tax|税目税率"=>"requireIf:status,3",
|
|
|
+ "goodCombind|组合商品信息"=>"array",
|
|
|
+ ]);
|
|
|
+ if(!$valid->check($params)){
|
|
|
+ return error_show(1004,$valid->getError());
|
|
|
}
|
|
|
- $infos =Db::name("consult_info")->where(['infoNo'=>$info['infoNo'],"is_del"=>0])->find();
|
|
|
- if($infos==false){
|
|
|
+ $info =ConsultBids::where(['bidNo'=>$params['bidNo'],"is_del"=>0])->findOrEmpty();
|
|
|
+ if($info->isEmpty()){
|
|
|
return error_show(1004,"未找到商品数据");
|
|
|
}
|
|
|
|
|
|
- if($infos['status']!=2&&$infos['status']!=3&&$infos['status']!=7){
|
|
|
- return error_show(1004,"咨询单招标未结束或已确认商品");
|
|
|
- }
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $oldstattus=$info['status'];
|
|
|
- $info['status']=6;
|
|
|
- $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $bids = Db::name("consult_bids")->save($info);
|
|
|
- if($bids){
|
|
|
- //修改状态,添加待办
|
|
|
- ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
- "order_code" =>$bidNo,//咨询单详情编号
|
|
|
- "status" => $oldstattus,//这里的status是之前的值
|
|
|
- "action_remark" => '',//备注
|
|
|
- "action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
- ], "FKD", $info['status'], $info);
|
|
|
- $old_infos_status = $infos['status'];
|
|
|
- $infos['status']=4;
|
|
|
- $infos['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $se = Db::name("consult_info")->save($infos);
|
|
|
- if($se){
|
|
|
-
|
|
|
- //修改状态,添加待办
|
|
|
- ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
- "order_code" => $infos['infoNo'],//咨询单详情编号
|
|
|
- "status" => $old_infos_status,//这里的status是之前的值
|
|
|
- "action_remark" => '',//备注
|
|
|
- "action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
- ], "ZXD", $infos['status'], $infos);
|
|
|
- Db::name("bargain_order")->where(["bidsNo"=>$bidNo,"is_del"=>0,"status"=>[0,2,4,5,7]])
|
|
|
- ->update(['status'=>12,"remark"=>'已选择商品,取消议价',"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
- Db::commit();
|
|
|
- return app_show(0,"商品确定成功");
|
|
|
- }
|
|
|
- }
|
|
|
- Db::rollback();
|
|
|
- return error_show(1004,"商品确认失败");
|
|
|
- }catch (\Exception $e){
|
|
|
- Db::rollback();
|
|
|
- return error_show(1004,$e->getMessage());
|
|
|
- }
|
|
|
}
|
|
|
+ //选择商品
|
|
|
+// public function bids_check(){
|
|
|
+// $bidNo = isset($this->post['bidNo'])&& $this->post['bidNo']!=""?trim($this->post['bidNo']):"";
|
|
|
+// if($bidNo===""){
|
|
|
+// return error_show(1004,"参数bidNo不能为空");
|
|
|
+// }
|
|
|
+// $info =Db::name("consult_bids")->where(['bidNo'=>$bidNo,"is_del"=>0])->find();
|
|
|
+// if($info==false){
|
|
|
+// return error_show(1004,"未找到商品数据");
|
|
|
+// }
|
|
|
+// $infos =Db::name("consult_info")->where(['infoNo'=>$info['infoNo'],"is_del"=>0])->find();
|
|
|
+// if($infos==false){
|
|
|
+// return error_show(1004,"未找到商品数据");
|
|
|
+// }
|
|
|
+//
|
|
|
+// if($infos['status']!=2&&$infos['status']!=3&&$infos['status']!=7){
|
|
|
+// return error_show(1004,"咨询单招标未结束或已确认商品");
|
|
|
+// }
|
|
|
+// Db::startTrans();
|
|
|
+// try {
|
|
|
+// $oldstattus=$info['status'];
|
|
|
+// $info['status']=6;
|
|
|
+// $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
+// $bids = Db::name("consult_bids")->save($info);
|
|
|
+// if($bids){
|
|
|
+// //修改状态,添加待办
|
|
|
+// ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
+// "order_code" =>$bidNo,//咨询单详情编号
|
|
|
+// "status" => $oldstattus,//这里的status是之前的值
|
|
|
+// "action_remark" => '',//备注
|
|
|
+// "action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
+// ], "FKD", $info['status'], $info);
|
|
|
+// $old_infos_status = $infos['status'];
|
|
|
+// $infos['status']=4;
|
|
|
+// $infos['updatetime']=date("Y-m-d H:i:s");
|
|
|
+// $se = Db::name("consult_info")->save($infos);
|
|
|
+// if($se){
|
|
|
+// //修改状态,添加待办
|
|
|
+// ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
+// "order_code" => $infos['infoNo'],//咨询单详情编号
|
|
|
+// "status" => $old_infos_status,//这里的status是之前的值
|
|
|
+// "action_remark" => '',//备注
|
|
|
+// "action_type" => "status"//新建create,编辑edit,更改状态status
|
|
|
+// ], "ZXD", $infos['status'], $infos);
|
|
|
+// Db::name("bargain_order")->where(["bidsNo"=>$bidNo,"is_del"=>0,"status"=>[0,2,4,5,7]])
|
|
|
+// ->update(['status'=>12,"remark"=>'已选择商品,取消议价',"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+// Db::commit();
|
|
|
+// return app_show(0,"商品确定成功");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// Db::rollback();
|
|
|
+// return error_show(1004,"商品确认失败");
|
|
|
+// }catch (\Exception $e){
|
|
|
+// Db::rollback();
|
|
|
+// return error_show(1004,$e->getMessage());
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
//议价审核
|
|
|
/**
|
|
@@ -1727,7 +1734,7 @@ class Consult extends Base
|
|
|
return error_show(1004,$e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
- public function bargain_info(){
|
|
|
+ public function bargain_info(){
|
|
|
$bargainNo = isset($this->post['bargainNo'])&& $this->post['bargainNo']!=""?trim($this->post['bargainNo']):"";
|
|
|
if($bargainNo===""){
|
|
|
return error_show(1004,"参数bargainNo不能为空");
|
|
@@ -2276,7 +2283,6 @@ class Consult extends Base
|
|
|
|
|
|
return app_show(0, "获取成功", ["count" => $count, "list" => $data]);
|
|
|
}
|
|
|
-
|
|
|
//招标工作台
|
|
|
public function crontablist(){
|
|
|
$page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
|
|
@@ -2382,8 +2388,6 @@ class Consult extends Base
|
|
|
}
|
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//复制上面的bidlist方法,只更改排序方式
|
|
|
public function bidlistCopy()
|
|
|
{
|
|
@@ -2416,13 +2420,7 @@ class Consult extends Base
|
|
|
}
|
|
|
$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 error_show(101, 'token不能为空');
|
|
|
-
|
|
|
-// $apply_id = GetUserInfo($token);
|
|
|
-// if (empty($apply_id) || $apply_id['code'] != 0) return error_show(1002, "申请人数据不存在");
|
|
|
-
|
|
|
- $rm = $this->uid;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
+ $rm = $this->uid;
|
|
|
$where[] = ['cb.createrid', "=", $rm];
|
|
|
}
|
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
@@ -2430,10 +2428,6 @@ class Consult extends Base
|
|
|
|
|
|
$good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
|
|
|
if ($good_name !== "") $where[] = ["cb.good_name", 'like', '%' . $good_name . '%'];
|
|
|
-
|
|
|
-// $supplierName = isset($this->post['supplierName']) && $this->post['supplierName'] !== "" ? trim($this->post['supplierName']) : "";
|
|
|
-// if ($supplierName !== "") $where[] = ["s.name", 'like', '%' . $supplierName . '%'];
|
|
|
-
|
|
|
$supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !== "" ? trim($this->post['supplierNo']) : "";
|
|
|
if ($supplierNo !== "") $where[] = ["cb.supplierNo", '=', $supplierNo];
|
|
|
|
|
@@ -2442,13 +2436,10 @@ class Consult extends Base
|
|
|
|
|
|
$companyNo = $this->post['companyNo']??'';
|
|
|
if($companyNo!='') $where[]=['d.companyNo','like','%' .$this->post['companyNo']. '%'];
|
|
|
- //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();
|
|
|
|
|
@@ -2459,7 +2450,6 @@ class Consult extends Base
|
|
|
->field('cb.*,d.companyNo,d.platform_code,d.area')
|
|
|
->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)
|
|
|
->order('cb.addtime', 'desc')
|
|
@@ -2468,7 +2458,6 @@ class Consult extends Base
|
|
|
$data = [];
|
|
|
$user= \app\admin\common\User::getIns();
|
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>array_unique(array_merge(array_column($list,"supplierNo"),array_column($list,"companyNo")))]);
|
|
|
-// if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) throw new Exception('该供应商不存在');
|
|
|
$supplier=$supplier_temp['data']??[];
|
|
|
|
|
|
$unit=Db::name('unit')
|
|
@@ -2483,24 +2472,13 @@ class Consult extends Base
|
|
|
|
|
|
foreach ($list as $value) {
|
|
|
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']] : "";
|
|
|
$value['companyName'] = $supplier[$value['companyNo']]??'';
|
|
|
-// 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 = get_budget((int)$value['cat_id'], $value['companyNo'], (int)$value['platform_code']);
|
|
|
-// if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$god = [
|
|
|
"metal_id" => $value['metal_id'],
|
|
|
"weight" => $value["good_weight"],
|
|
@@ -2543,15 +2521,6 @@ class Consult extends Base
|
|
|
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'] = $item[$value['createrid']]??'';
|
|
|
|
|
|
$data[] = $value;
|