|
@@ -3,9 +3,9 @@
|
|
namespace app\admin\controller;
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\model\ActionLog;
|
|
use app\admin\model\ActionLog;
|
|
-use app\admin\model\ConsultTemp;use app\admin\model\DataGroup as DataGroupModel;
|
|
|
|
-use app\admin\model\ProcessOrder;
|
|
|
|
-use think\App;
|
|
|
|
|
|
+use app\admin\model\ConsultBids;use app\admin\model\ConsultInfo;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;
|
|
use think\facade\Db;
|
|
use think\facade\Validate;
|
|
use think\facade\Validate;
|
|
|
|
|
|
@@ -457,7 +457,7 @@ class Consult extends Base
|
|
if($is_custom===""){
|
|
if($is_custom===""){
|
|
return error_show(1003,"参数is_custom不能为空");
|
|
return error_show(1003,"参数is_custom不能为空");
|
|
}
|
|
}
|
|
- $metal_id= isset($this->post['metal_id'])&&$this->post['metal_id']!==""?intval($this->post['metal_id']):"";
|
|
|
|
|
|
+ $metal_id= isset($this->post['metal_id'])&&$this->post['metal_id']!==""?intval($this->post['metal_id']):"0";
|
|
if($metal_id===""){
|
|
if($metal_id===""){
|
|
return error_show(1003,"参数metal_id不能为空");
|
|
return error_show(1003,"参数metal_id不能为空");
|
|
}
|
|
}
|
|
@@ -561,21 +561,19 @@ class Consult extends Base
|
|
"action_remark" => '',//备注
|
|
"action_remark" => '',//备注
|
|
"action_type" => "edit"//新建create,编辑edit,更改状态status
|
|
"action_type" => "edit"//新建create,编辑edit,更改状态status
|
|
], "ZXD", 1, $this->post);
|
|
], "ZXD", 1, $this->post);
|
|
-
|
|
|
|
-// ProcessOrder::AddProcess($this->post['token'], [
|
|
|
|
-// "order_type" => 'ZXD',
|
|
|
|
-// "order_code" => $innew,//咨询单详情编号
|
|
|
|
-// "order_id" => 0,
|
|
|
|
-// "order_status" => 1
|
|
|
|
-// ]);
|
|
|
|
if($isbids==1){
|
|
if($isbids==1){
|
|
$bidlist = Db::name("consult_bids")->where(["infoNo"=>$zxinfo['infoNo'],"is_del"=>0])->select()->toArray();
|
|
$bidlist = Db::name("consult_bids")->where(["infoNo"=>$zxinfo['infoNo'],"is_del"=>0])->select()->toArray();
|
|
- if (!empty($bidlist)){
|
|
|
|
|
|
+ if (!empty($bidlist)){
|
|
foreach ($bidlist as $value){
|
|
foreach ($bidlist as $value){
|
|
unset($value['id']);
|
|
unset($value['id']);
|
|
|
|
+ $bidno=$value['bidNo'];
|
|
$value['infoNo']=$innew;
|
|
$value['infoNo']=$innew;
|
|
$value['bidNo']=makeNo("BD");
|
|
$value['bidNo']=makeNo("BD");
|
|
- $value['spuCode']=makeNo("SKU");
|
|
|
|
|
|
+ $value['spuCode']= $value['is_combind']==1?makeNo("SSU"):makeNo("SKU");
|
|
|
|
+ $value['tax_status']=-1;
|
|
|
|
+ $value['out_tax_id'] =0;
|
|
|
|
+ $value['out_tax'] ="";
|
|
|
|
+ $value["remark"]="";
|
|
$value['status'] =0;
|
|
$value['status'] =0;
|
|
$value['updatetime'] =date("Y-m-d H:i:s");
|
|
$value['updatetime'] =date("Y-m-d H:i:s");
|
|
$in = Db::name("consult_bids")->insert($value);
|
|
$in = Db::name("consult_bids")->insert($value);
|
|
@@ -586,6 +584,19 @@ class Consult extends Base
|
|
"action_remark" => '',//备注
|
|
"action_remark" => '',//备注
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
"action_type" => "create"//新建create,编辑edit,更改状态status
|
|
], "FKD", 1, $this->post);
|
|
], "FKD", 1, $this->post);
|
|
|
|
+ if($value['is_combind']==1){
|
|
|
|
+ $combine = ConsultTemp::where(["bidNo"=>$bidno])->select();
|
|
|
|
+ if(!$combine->isEmpty()){
|
|
|
|
+ (new ConsultTemp)->saveAll(array_map(function($v)use($value){
|
|
|
|
+ $v['id']=null;
|
|
|
|
+ $v['bidNo']=$value['bidNo'];
|
|
|
|
+ $v['spuCode']= substr(makeNo('SPU'), 0, -2) . round(10,99);
|
|
|
|
+ $v['out_tax_id'] =0;
|
|
|
|
+ $v['out_tax'] ="";
|
|
|
|
+ return $v;
|
|
|
|
+ },$combine->toArray()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -648,16 +659,14 @@ class Consult extends Base
|
|
if($status===""){
|
|
if($status===""){
|
|
return error_show(1004,"参数status不能为空");
|
|
return error_show(1004,"参数status不能为空");
|
|
}
|
|
}
|
|
-// if($status==1&&$zxinfo['status']>1){
|
|
|
|
-// $zxinfo['bargain_num']=+1;
|
|
|
|
-// }
|
|
|
|
$old_zxinfo_status = $zxinfo['status'];
|
|
$old_zxinfo_status = $zxinfo['status'];
|
|
$zxinfo['status']=$status;
|
|
$zxinfo['status']=$status;
|
|
$zxinfo['updatetime']=date("Y-m-d H:i:s");
|
|
$zxinfo['updatetime']=date("Y-m-d H:i:s");
|
|
$up = Db::name("consult_info")->save($zxinfo);
|
|
$up = Db::name("consult_info")->save($zxinfo);
|
|
if($up){
|
|
if($up){
|
|
-
|
|
|
|
- //修改状态,添加待办
|
|
|
|
|
|
+ if($status==2 || $status==7){
|
|
|
|
+ Db::name("consult_bids")->where(["infoNo"=>$infoNo,"is_del"=>0])->update(["tax_status"=>0]);
|
|
|
|
+ }
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
"order_code" => $zxinfo['infoNo'],//咨询单详情编号
|
|
"order_code" => $zxinfo['infoNo'],//咨询单详情编号
|
|
"status" => $old_zxinfo_status,//这里的status是之前的值
|
|
"status" => $old_zxinfo_status,//这里的status是之前的值
|
|
@@ -749,7 +758,7 @@ class Consult extends Base
|
|
$cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!==""? floatval($this->post['cost_fee']):"0";
|
|
$cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!==""? floatval($this->post['cost_fee']):"0";
|
|
if($nake_fee==="" ){
|
|
if($nake_fee==="" ){
|
|
return error_show(1004,"参数nake_fee不能为空");
|
|
return error_show(1004,"参数nake_fee不能为空");
|
|
- }
|
|
|
|
|
|
+ }
|
|
$is_diff = isset($this->post['is_diff'])&&$this->post['is_diff']!==""? intval($this->post['is_diff']):"";
|
|
$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']):"";
|
|
$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']):"";
|
|
$remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
|
|
@@ -758,8 +767,8 @@ class Consult extends Base
|
|
return error_show(1002,"参数delivery_place不能为空");
|
|
return error_show(1002,"参数delivery_place不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
- $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] != '' ? trim($this->post['relaComNo']) : "";
|
|
|
|
- if ($relaComNo == '') return error_show(1004, '关联公司不能为空');
|
|
|
|
|
|
+// $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] != '' ? trim($this->post['relaComNo']) : "";
|
|
|
|
+// if ($relaComNo == '') return error_show(1004, '关联公司不能为空');
|
|
|
|
|
|
$createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
$createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
$creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
$creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
@@ -770,7 +779,20 @@ class Consult extends Base
|
|
if(empty($goodBind))$this->error('组合商品商品明细不能为空');
|
|
if(empty($goodBind))$this->error('组合商品商品明细不能为空');
|
|
$spucode=makeNo('SSU');
|
|
$spucode=makeNo('SSU');
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ $tax_id = isset($this->post['tax_id'])&&$this->post['tax_id']!==''? intval($this->post['tax_id']):'0';
|
|
|
|
+ $cgd_tax_id = isset($this->post['cgd_tax_id'])&&$this->post['cgd_tax_id']!==''? intval($this->post['cgd_tax_id']):'0';
|
|
|
|
+ $cgd_tax = isset($this->post['cgd_tax'])&&$this->post['cgd_tax']!==''? trim($this->post['cgd_tax']):'';
|
|
|
|
+ $open_type= isset($this->post['open_type'])&&$this->post['open_type']!==''? intval($this->post['open_type']):1;
|
|
|
|
+ $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($cgd_supplier_code!=""){
|
|
|
|
+ if($cgd_tax_id==0) return error_show(1004,'源头供应商开票税目不能为空');
|
|
|
|
+ if($cgd_tax==='') return error_show(1004,'源头供应商开票税率不能为空');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//计算毛利率
|
|
//计算毛利率
|
|
$budget = get_budget($zxinfo['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
$budget = get_budget($zxinfo['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
@@ -896,6 +918,11 @@ class Consult extends Base
|
|
'cgd_supplier_name'=>$cgd_supplier_name,//采购供应商编号
|
|
'cgd_supplier_name'=>$cgd_supplier_name,//采购供应商编号
|
|
'cgd_apply_id'=>$cgd_apply_id,//竞单人
|
|
'cgd_apply_id'=>$cgd_apply_id,//竞单人
|
|
'cgd_apply_name'=>$cgd_apply_name,//竞单人
|
|
'cgd_apply_name'=>$cgd_apply_name,//竞单人
|
|
|
|
+ "open_type"=>$open_type,
|
|
|
|
+ "inv_good_name"=>$inv_good_name,//采购商品名称
|
|
|
|
+ "tax_id"=>$tax_id,//税目id
|
|
|
|
+ "cgd_tax"=>$cgd_tax,//税目
|
|
|
|
+ "cgd_tax_id"=>$cgd_tax_id
|
|
];
|
|
];
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
try{
|
|
try{
|
|
@@ -1013,9 +1040,10 @@ class Consult extends Base
|
|
$info['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
$info['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
$info['cat_info'] = made($info['cat_id'],[]);
|
|
$info['cat_info'] = made($info['cat_id'],[]);
|
|
$info['noble_weight'] = $info['good_weight'];
|
|
$info['noble_weight'] = $info['good_weight'];
|
|
|
|
+ $info['companyNo'] = $zx['companyNo'];
|
|
|
|
+ $info['companyName'] = $zx['companyName'];
|
|
$user= \app\admin\common\User::getIns();
|
|
$user= \app\admin\common\User::getIns();
|
|
$supplier =$user->handle("getCodeAndName",["code"=>$info['supplierNo']]);
|
|
$supplier =$user->handle("getCodeAndName",["code"=>$info['supplierNo']]);
|
|
-// $supplier = Db::name("supplier")->where(["code"=>$info['supplierNo']])->find();
|
|
|
|
$info['supplierName'] = isset($supplier['data'][$info['supplierNo']])?$supplier['data'][$info['supplierNo']]:"";
|
|
$info['supplierName'] = isset($supplier['data'][$info['supplierNo']])?$supplier['data'][$info['supplierNo']]:"";
|
|
if($info['brand_id']!=0){
|
|
if($info['brand_id']!=0){
|
|
$brand=Db::name("brand")->where(["id"=>$info['brand_id']])->find();
|
|
$brand=Db::name("brand")->where(["id"=>$info['brand_id']])->find();
|
|
@@ -1024,9 +1052,8 @@ class Consult extends Base
|
|
$info["brand_name"]="";
|
|
$info["brand_name"]="";
|
|
$info["brand_id"]="";
|
|
$info["brand_id"]="";
|
|
}
|
|
}
|
|
-// $catinfo = Db::name("cat")->where(["id"=>$info['cat_id']])->find();
|
|
|
|
$bidinfo = Db::name("consult_info")->where(["infoNo"=>$info["infoNo"]])->find();
|
|
$bidinfo = Db::name("consult_info")->where(["infoNo"=>$info["infoNo"]])->find();
|
|
-// $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:0;
|
|
|
|
|
|
+
|
|
$budget = get_budget($info['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
$budget = get_budget($info['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
$god=[
|
|
$god=[
|
|
@@ -1061,8 +1088,21 @@ class Consult extends Base
|
|
$info['metal_name']=isset($info['metal_id'])&& $info['metal_id']!=0?$this->noble[$info['metal_id']]:"";
|
|
$info['metal_name']=isset($info['metal_id'])&& $info['metal_id']!=0?$this->noble[$info['metal_id']]:"";
|
|
$bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
|
|
$bargain =Db::name("bargain_order")->where(['bidsNo'=>$bidNo,"is_del"=>0])->find();
|
|
$info['bargain'] =$bargain;
|
|
$info['bargain'] =$bargain;
|
|
|
|
+ $info["info_status"]=$bidinfo['status'];
|
|
$info['good_img'] = explode(',',$info['good_img']);
|
|
$info['good_img'] = explode(',',$info['good_img']);
|
|
-
|
|
|
|
|
|
+ $tax = TaxCategory::where(['id'=>[$info['tax_id'],$info['out_tax_id'],$info['cgd_tax_id']]])->column("short_name,cat_name,cat_code,merge_code","id");
|
|
|
|
+ $info['in_info'] = $tax[$info['tax_id']]??[];
|
|
|
|
+ $info['out_info'] = $tax[$info['out_tax_id']]??[];
|
|
|
|
+ $info['cgd_info'] = $tax[$info['cgd_tax_id']]??[];
|
|
|
|
+ $info['child'] =[];
|
|
|
|
+ if($info['is_combind']==1){
|
|
|
|
+ $info['child'] =ConsultTemp::where(['bidNo'=>$bidNo])->select()->each(function(&$item){
|
|
|
|
+ $tax = TaxCategory::where(['id'=>[$item['tax_id'],$item['out_tax_id'],$item['cgd_tax_id']]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
|
+ $item['in_info'] = $tax[$item['tax_id']]??[];
|
|
|
|
+ $item['out_info'] = $tax[$item['out_tax_id']]??[];
|
|
|
|
+ $item['cgd_info'] = $tax[$item['cgd_tax_id']]??[];
|
|
|
|
+ });
|
|
|
|
+ }
|
|
//添加商品创建人字段
|
|
//添加商品创建人字段
|
|
$good_info = Db::name('good_basic')
|
|
$good_info = Db::name('good_basic')
|
|
->field('id,createrid,creater')
|
|
->field('id,createrid,creater')
|
|
@@ -1140,7 +1180,6 @@ class Consult extends Base
|
|
$cgd_apply_id = isset($this->post['cgd_apply_id'])&&$this->post['cgd_apply_id']!=''? trim($this->post['cgd_apply_id']):0;
|
|
$cgd_apply_id = isset($this->post['cgd_apply_id'])&&$this->post['cgd_apply_id']!=''? trim($this->post['cgd_apply_id']):0;
|
|
$cgd_apply_name = isset($this->post['cgd_apply_name'])&&$this->post['cgd_apply_name']!=''? trim($this->post['cgd_apply_name']):'';
|
|
$cgd_apply_name = isset($this->post['cgd_apply_name'])&&$this->post['cgd_apply_name']!=''? trim($this->post['cgd_apply_name']):'';
|
|
$supplier_origin_price = isset($this->post['supplier_origin_price'])&&$this->post['supplier_origin_price']!=''? floatval($this->post['supplier_origin_price']):0;
|
|
$supplier_origin_price = isset($this->post['supplier_origin_price'])&&$this->post['supplier_origin_price']!=''? floatval($this->post['supplier_origin_price']):0;
|
|
- $cgd_supplier_name='';
|
|
|
|
$user= \app\admin\common\User::getIns();
|
|
$user= \app\admin\common\User::getIns();
|
|
$supplier =$user->handle("getCodeAndName",["code"=>[$supplierNo,$cgd_supplier_code]]);
|
|
$supplier =$user->handle("getCodeAndName",["code"=>[$supplierNo,$cgd_supplier_code]]);
|
|
|
|
|
|
@@ -1201,27 +1240,36 @@ class Consult extends Base
|
|
$supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
|
|
$supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
|
|
if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
|
|
if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
|
|
$supplierArr=$supplier_temp['data']??[];
|
|
$supplierArr=$supplier_temp['data']??[];
|
|
-// $supplier=$supplierArr['child']??[];
|
|
|
|
$goodBind= isset($this->post['goodBind']) && !empty($this->post['goodBind']) ? $this->post['goodBind'] :[];
|
|
$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'] != '') {
|
|
if ($supplierArr['relation_code'] == $zx['companyNo']) return error_show(1004, "业务公司与供应商信息一致");
|
|
if ($supplierArr['relation_code'] == $zx['companyNo']) return error_show(1004, "业务公司与供应商信息一致");
|
|
-
|
|
|
|
//判断支付渠道中是否有相关供应商
|
|
//判断支付渠道中是否有相关供应商
|
|
$is_select_pay_rate = Db::name('platform')
|
|
$is_select_pay_rate = Db::name('platform')
|
|
->where(['is_del' => 0, 'id' => $zx['platform_code'],"status"=>1])
|
|
->where(['is_del' => 0, 'id' => $zx['platform_code'],"status"=>1])
|
|
->value('is_select_pay_rate', 0);
|
|
->value('is_select_pay_rate', 0);
|
|
if ($is_select_pay_rate == 1) {
|
|
if ($is_select_pay_rate == 1) {
|
|
if(channel_is_company($zx['platform_code'],$supplierArr['relation_code'])) return error_show(1004, "平台渠道包含当前供应商公司{$supplierNo}");
|
|
if(channel_is_company($zx['platform_code'],$supplierArr['relation_code'])) return error_show(1004, "平台渠道包含当前供应商公司{$supplierNo}");
|
|
-//
|
|
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
if($is_combind==1)$this->error('当前供应商无对应业务公司,不可选择组合商品');
|
|
if($is_combind==1)$this->error('当前供应商无对应业务公司,不可选择组合商品');
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ $tax_id = isset($this->post['tax_id'])&&$this->post['tax_id']!==''? intval($this->post['tax_id']):'';
|
|
|
|
+ $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']):'';
|
|
|
|
+ $cgd_tax_id = isset($this->post['cgd_tax_id'])&&$this->post['cgd_tax_id']!==''? intval($this->post['cgd_tax_id']):'0';
|
|
|
|
+ $cgd_tax = isset($this->post['cgd_tax'])&&$this->post['cgd_tax']!==''? trim($this->post['cgd_tax']):'';
|
|
|
|
+ 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($cgd_supplier_code!=''){
|
|
|
|
+ if($cgd_tax_id==0) return error_show(1004,'源头供应商开票税目不能为空');
|
|
|
|
+ if($cgd_tax==='') return error_show(1004,'源头供应商开票税率不能为空');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
try{
|
|
try{
|
|
$data=[
|
|
$data=[
|
|
@@ -1272,6 +1320,11 @@ class Consult extends Base
|
|
'cgd_supplier_name'=>$cgd_supplier_name,//采购供应商编号
|
|
'cgd_supplier_name'=>$cgd_supplier_name,//采购供应商编号
|
|
'cgd_apply_id'=>$cgd_apply_id,//竞单人
|
|
'cgd_apply_id'=>$cgd_apply_id,//竞单人
|
|
'cgd_apply_name'=>$cgd_apply_name,//竞单人
|
|
'cgd_apply_name'=>$cgd_apply_name,//竞单人
|
|
|
|
+ 'open_type'=>$open_type,
|
|
|
|
+ 'inv_good_name'=>$inv_good_name,//采购商品名称
|
|
|
|
+ 'tax_id'=>$tax_id,//税目id
|
|
|
|
+ 'cgd_tax'=>$cgd_tax,//税目
|
|
|
|
+ 'cgd_tax_id'=>$cgd_tax_id
|
|
];
|
|
];
|
|
$insert= Db::name("consult_bids")->where($bidinfo)->save($data);
|
|
$insert= Db::name("consult_bids")->where($bidinfo)->save($data);
|
|
if($insert){
|
|
if($insert){
|
|
@@ -1515,64 +1568,124 @@ class Consult extends Base
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //选择商品
|
|
|
|
public function bids_check(){
|
|
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"=>"","remark"=>"","out_tax_id"=>"","out_tax"=>"","goodCombind"=>[]],"post");
|
|
|
|
+ $valid = Validate::rule([
|
|
|
|
+ "bidNo|反馈单编号"=>"require",
|
|
|
|
+ "status|状态"=>"require|number",
|
|
|
|
+ "remark|备注"=>"max:255",
|
|
|
|
+ "out_tax_id|税目id"=>"requireIf:status,1|number",
|
|
|
|
+ "out_tax|税目税率"=>"requireIf:status,1",
|
|
|
|
+ "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,"未找到商品数据");
|
|
return error_show(1004,"未找到商品数据");
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($infos['status']!=2&&$infos['status']!=3&&$infos['status']!=7){
|
|
|
|
|
|
+ $consult_info =ConsultInfo::where(['infoNo'=>$info['infoNo'],"is_del"=>0])->findOrEmpty();
|
|
|
|
+ if($consult_info->isEmpty()) $this->error("未找到商品数据");
|
|
|
|
+ if($consult_info['status']!=2&&$consult_info['status']!=3&&$consult_info['status']!=7){
|
|
return error_show(1004,"咨询单招标未结束或已确认商品");
|
|
return error_show(1004,"咨询单招标未结束或已确认商品");
|
|
}
|
|
}
|
|
|
|
+ $goodCombind = $params['goodCombind'];
|
|
|
|
+ if($info->is_combind==1 && $params['status']==1){
|
|
|
|
+ if(empty($goodCombind)){
|
|
|
|
+ return error_show(1004,"组合商品信息不能为空");
|
|
|
|
+ }
|
|
|
|
+ $valids = Validate::rule(["out_tax_id|税目id"=>"require|number",'out_tax|税目税率'=>'require',"id|商品id"=>"require"]);
|
|
|
|
+ foreach ($goodCombind as $k=>$v){
|
|
|
|
+ if(!$valids->check($v)){
|
|
|
|
+ return error_show(1004,$valids->getError());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
try {
|
|
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,"商品确定成功");
|
|
|
|
- }
|
|
|
|
|
|
+ $oldstattus=$info->status;
|
|
|
|
+ $info->tax_status=$params['status'];
|
|
|
|
+ $info->out_tax_id=$params['out_tax_id'];
|
|
|
|
+ $info->out_tax=$params['out_tax'];
|
|
|
|
+ $info->remark=$params['remark'];
|
|
|
|
+ $save=$info->save();
|
|
|
|
+ if($save){
|
|
|
|
+ ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
|
+ 'order_code' =>$params['bidNo'],//咨询单详情编号
|
|
|
|
+ 'status' => $oldstattus,//这里的status是之前的值
|
|
|
|
+ 'action_remark' => '',//备注
|
|
|
|
+ 'action_type' => 'status'//新建create,编辑edit,更改状态status
|
|
|
|
+ ], 'FKD', $params['status'], $info);
|
|
|
|
+ if(!empty($goodCombind)){
|
|
|
|
+ (new ConsultTemp())->saveAll($goodCombind);
|
|
}
|
|
}
|
|
- Db::rollback();
|
|
|
|
- return error_show(1004,"商品确认失败");
|
|
|
|
|
|
+ }
|
|
|
|
+ Db::commit();
|
|
|
|
+ return app_show(0,'商品确定成功');
|
|
}catch (\Exception $e){
|
|
}catch (\Exception $e){
|
|
Db::rollback();
|
|
Db::rollback();
|
|
return error_show(1004,$e->getMessage());
|
|
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());
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
//议价审核
|
|
//议价审核
|
|
/**
|
|
/**
|
|
@@ -1705,7 +1818,7 @@ class Consult extends Base
|
|
return error_show(1004,$e->getMessage());
|
|
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']):"";
|
|
$bargainNo = isset($this->post['bargainNo'])&& $this->post['bargainNo']!=""?trim($this->post['bargainNo']):"";
|
|
if($bargainNo===""){
|
|
if($bargainNo===""){
|
|
return error_show(1004,"参数bargainNo不能为空");
|
|
return error_show(1004,"参数bargainNo不能为空");
|
|
@@ -1810,9 +1923,7 @@ class Consult extends Base
|
|
$info['supplierNo'] =$bidinfos['supplierNo'];
|
|
$info['supplierNo'] =$bidinfos['supplierNo'];
|
|
$user= \app\admin\common\User::getIns();
|
|
$user= \app\admin\common\User::getIns();
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>$info['supplierNo']]);
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>$info['supplierNo']]);
|
|
-// if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) throw new Exception('该供应商不存在');
|
|
|
|
$supplier=$supplier_temp['data']??[];
|
|
$supplier=$supplier_temp['data']??[];
|
|
-// $supplier = Db::name("supplier")->where(["code"=>$info['supplierNo']])->find();
|
|
|
|
$info['supplier_name'] = $supplier[$info['supplierNo']]??"";
|
|
$info['supplier_name'] = $supplier[$info['supplierNo']]??"";
|
|
$info['pay_way'] =$bidinfos['pay_way'];
|
|
$info['pay_way'] =$bidinfos['pay_way'];
|
|
$info['tax'] =$bidinfos['tax'];
|
|
$info['tax'] =$bidinfos['tax'];
|
|
@@ -1853,14 +1964,14 @@ class Consult extends Base
|
|
public function bidlist(){
|
|
public function bidlist(){
|
|
$page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
|
|
$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";
|
|
$size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
|
|
- $where=[['is_del',"=",0]];
|
|
|
|
|
|
+ $where=[['a.is_del',"=",0]];
|
|
$zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
|
|
$zxNo = isset($this->post['zxNo']) && $this->post['zxNo'] !== "" ? trim($this->post['zxNo']) : "";
|
|
if ($zxNo !== "") {
|
|
if ($zxNo !== "") {
|
|
- $where[] = ['zxNo','like','%'.$zxNo.'%'];
|
|
|
|
|
|
+ $where[] = ['a.zxNo','like','%'.$zxNo.'%'];
|
|
}
|
|
}
|
|
$infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
|
|
$infoNo = isset($this->post['infoNo']) && $this->post['infoNo'] !== "" ? trim($this->post['infoNo']) : "";
|
|
if ($infoNo !== "") {
|
|
if ($infoNo !== "") {
|
|
- $where[] = ['infoNo','like','%'.$infoNo.'%'];
|
|
|
|
|
|
+ $where[] = ['a.infoNo','like','%'.$infoNo.'%'];
|
|
}
|
|
}
|
|
$bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
|
|
$bidNo = isset($this->post['bidNo']) && $this->post['bidNo'] !== "" ? trim($this->post['bidNo']) : "";
|
|
if ($bidNo !== "") {
|
|
if ($bidNo !== "") {
|
|
@@ -1868,49 +1979,64 @@ class Consult extends Base
|
|
}
|
|
}
|
|
$pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
|
|
$pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
|
|
if ($pgNo !== "") {
|
|
if ($pgNo !== "") {
|
|
- $bidinfo = Db::name("consult_info")->where([["pgNo","=",$pgNo],["is_del","=",0]])->column("infoNo");
|
|
|
|
- $where[] = ['infoNo','in',$bidinfo];
|
|
|
|
|
|
+ $where[] = ['c.pgNo','=',$pgNo];
|
|
}
|
|
}
|
|
$bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
|
|
$bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
|
|
if ($bargain_status !== "") {
|
|
if ($bargain_status !== "") {
|
|
- $bidinfo = Db::name("consult_info")->where([["bargain_status","=",$bargain_status],["is_del","=",0]])->column("infoNo");
|
|
|
|
- $where[] = ['infoNo','in',$bidinfo];
|
|
|
|
|
|
+ $where[] = ['bargain_status','=',$bargain_status];
|
|
|
|
+ }
|
|
|
|
+ $infoStatus = isset($this->post['info_status']) && !empty($this->post['info_status'])? $this->post['info_status'] : [];
|
|
|
|
+ if (!empty($infoStatus)) {
|
|
|
|
+ $where[] = ['c.status','in',$infoStatus];
|
|
}
|
|
}
|
|
$projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
|
|
$projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
|
|
if ($projectNo !== "") {
|
|
if ($projectNo !== "") {
|
|
- $zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
|
|
|
|
- ("zxNo");
|
|
|
|
- $where[] = ['zxNo','in',$zxlist];
|
|
|
|
|
|
+ $where[] = ['b.projectNo','=',$projectNo];
|
|
}
|
|
}
|
|
$is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
|
|
$is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
|
|
if($is_own==1){
|
|
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;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
- $where[]=['createrid',"=",$rm];
|
|
|
|
|
|
+ $where[]=['a.createrid',"=",$rm];
|
|
|
|
+ }
|
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
|
+ if ($status !== "") {
|
|
|
|
+ $where[] = ['a.status','=',$status];
|
|
|
|
+ }
|
|
|
|
+ $tax_status = isset($this->post['tax_status']) && $this->post['tax_status'] !== "" ? intval($this->post['tax_status']) : "";
|
|
|
|
+ if ($tax_status !== "") {
|
|
|
|
+ $where[] = ['a.tax_status','=',$tax_status];
|
|
|
|
+ }
|
|
|
|
+ $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
|
|
|
|
+ if ($companyNo !== "") {
|
|
|
|
+ $where[] = ['companyNo','=',$companyNo];
|
|
|
|
+ }
|
|
|
|
+ $goodName = isset($this->post['goodName']) && $this->post['goodName'] !== "" ? trim($this->post['goodName']) : "";
|
|
|
|
+ if ($goodName !== "") {
|
|
|
|
+ $where[] = ['a.good_name','like','%'.$goodName.'%'];
|
|
}
|
|
}
|
|
|
|
|
|
- $count = Db::name('consult_bids')->where($where)->count();
|
|
|
|
|
|
+ $count = Db::name('consult_bids')->alias("a")
|
|
|
|
+ ->leftJoin('consult_info c','a.infoNo=c.infoNo')
|
|
|
|
+ ->leftJoin("consult_order b","a.zxNo=b.zxNo")->where($where)->count();
|
|
$total = ceil($count / $size);
|
|
$total = ceil($count / $size);
|
|
$page = $page >= $total ? $total : $page;
|
|
$page = $page >= $total ? $total : $page;
|
|
- $list =Db::name('consult_bids')->where($where)->page($page,$size)->select()->toArray();
|
|
|
|
|
|
+ $list =Db::name('consult_bids')->alias('a')
|
|
|
|
+ ->leftJoin('consult_info c','a.infoNo=c.infoNo')
|
|
|
|
+ ->leftJoin('consult_order b','a.zxNo=b.zxNo')
|
|
|
|
+ ->where($where)
|
|
|
|
+ ->field("a.*,b.companyNo,b.companyName,platform_code,c.num info_num,c.bargain_status,c.status info_status")
|
|
|
|
+ ->order("a.id desc")
|
|
|
|
+ ->page($page,$size)
|
|
|
|
+ ->select()
|
|
|
|
+ ->toArray();
|
|
$data=[];
|
|
$data=[];
|
|
$user= \app\admin\common\User::getIns();
|
|
$user= \app\admin\common\User::getIns();
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>array_column($list,"supplierNo")]);
|
|
$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']??[];
|
|
$supplier=$supplier_temp['data']??[];
|
|
foreach ($list as $value){
|
|
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']):[];
|
|
$value['can']= isset($value['cat_id']) && $value['cat_id'] !=0 ? made($value['cat_id']):[];
|
|
$unit =Db::name("unit")->where(["id"=>$value['unit_id']])->find();
|
|
$unit =Db::name("unit")->where(["id"=>$value['unit_id']])->find();
|
|
$value['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
$value['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
-// $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
|
|
|
|
$value['supplierName'] = isset($supplier[$value['supplierNo']])?$supplier[$value['supplierNo']]:"";
|
|
$value['supplierName'] = isset($supplier[$value['supplierNo']])?$supplier[$value['supplierNo']]:"";
|
|
if($value['brand_id']!=0){
|
|
if($value['brand_id']!=0){
|
|
$brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
|
|
$brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
|
|
@@ -1919,11 +2045,7 @@ class Consult extends Base
|
|
$value["brand_name"]="";
|
|
$value["brand_name"]="";
|
|
$value["brand_id"]="";
|
|
$value["brand_id"]="";
|
|
}
|
|
}
|
|
- $bidinfo = Db::name("consult_info")->where(["infoNo"=>$value["infoNo"]])->find();
|
|
|
|
- $zx = Db::name("consult_order")->where(["zxNo"=>$value["zxNo"]])->find();
|
|
|
|
- $budget = get_budget($value['cat_id'],$zx['companyNo']??'',$zx['platform_code']??0);
|
|
|
|
-// if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
|
-// $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:0;
|
|
|
|
|
|
+ $budget = get_budget($value['cat_id'],$value['companyNo']??'',$value['platform_code']??0);
|
|
$god=[
|
|
$god=[
|
|
"metal_id"=>$value['metal_id'],
|
|
"metal_id"=>$value['metal_id'],
|
|
"weight"=>$value["good_weight"],
|
|
"weight"=>$value["good_weight"],
|
|
@@ -1934,10 +2056,8 @@ class Consult extends Base
|
|
"mark_fee"=>$value["mark_fee"],
|
|
"mark_fee"=>$value["mark_fee"],
|
|
"nake_fee"=>$value["nake_fee"],
|
|
"nake_fee"=>$value["nake_fee"],
|
|
"cert_fee"=>$value["cert_fee"],
|
|
"cert_fee"=>$value["cert_fee"],
|
|
- // "cost_fee"=>$value["cost_fee"],
|
|
|
|
- "cost_fee"=>$value["sale_cost_fee"]!=$value['origin_cost_fee']? $value["sale_cost_fee"]: $value["cost_fee"],
|
|
|
|
- //暂时注掉,搞不清楚原因@吴广广
|
|
|
|
- "num"=>$bidinfo["num"],
|
|
|
|
|
|
+ "cost_fee"=>$value["sale_cost_fee"]!=$value['origin_cost_fee']? $value["sale_cost_fee"]: $value["cost_fee"],
|
|
|
|
+ "num"=>$value["info_num"],
|
|
];
|
|
];
|
|
|
|
|
|
$top_cat = made($value['cat_id']);
|
|
$top_cat = made($value['cat_id']);
|
|
@@ -1952,7 +2072,6 @@ class Consult extends Base
|
|
$value['cost_fee'] =$value['origin_cost_fee'];
|
|
$value['cost_fee'] =$value['origin_cost_fee'];
|
|
$value['specinfo'] = json_decode($value['specinfo'],true);
|
|
$value['specinfo'] = json_decode($value['specinfo'],true);
|
|
$value['metal_name']=isset($value['metal_id'])&& $value['metal_id']!=0?$this->noble[$value['metal_id']]:"";
|
|
$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表示驳回
|
|
//reject驳回原因,status==5表示驳回
|
|
$value['reject']=[];
|
|
$value['reject']=[];
|
|
@@ -1974,15 +2093,10 @@ class Consult extends Base
|
|
list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$value['origin_place']);
|
|
list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$value['origin_place']);
|
|
}
|
|
}
|
|
$value['origin_addr']=GetAddr(json_encode($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;
|
|
|
|
-// }
|
|
|
|
|
|
+ $tax = TaxCategory::where(['id'=>[$value['tax_id'],$value['out_tax_id'],$value["cgd_tax_id"]]])->column('short_name,cat_name,cat_code,merge_code','id');
|
|
|
|
+ $value['in_info'] = $tax[$value['tax_id']]??[];
|
|
|
|
+ $value['out_info'] = $tax[$value['out_tax_id']]??[];
|
|
|
|
+ $value['cgd_info'] = $tax[$value['cgd_tax_id']]??[];
|
|
$good_info = Db::name('good_basic')
|
|
$good_info = Db::name('good_basic')
|
|
->field('id,createrid,creater')
|
|
->field('id,createrid,creater')
|
|
->where('is_del',0)
|
|
->where('is_del',0)
|
|
@@ -2143,12 +2257,6 @@ class Consult extends Base
|
|
$companyNo = trim($this->post['companyNo'] ?? '');
|
|
$companyNo = trim($this->post['companyNo'] ?? '');
|
|
if ($companyNo !== "") $where[] = ["b.companyNo", 'like', '%' . $companyNo . '%'];
|
|
if ($companyNo !== "") $where[] = ["b.companyNo", 'like', '%' . $companyNo . '%'];
|
|
|
|
|
|
-// $role=$this->checkRole();
|
|
|
|
-// if(!empty($role['write'])){
|
|
|
|
-// $where[]=["bo.createrid","in",$role['write']];
|
|
|
|
-// }
|
|
|
|
-// $role = $this->checkDataShare();
|
|
|
|
-// if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['bo.createrid', 'in', $role[DataGroupModel::$type_全部]];
|
|
|
|
$role = $this->checkDataShare();
|
|
$role = $this->checkDataShare();
|
|
$hand = resign_hand_user($this->uid, 0);
|
|
$hand = resign_hand_user($this->uid, 0);
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
@@ -2201,51 +2309,23 @@ class Consult extends Base
|
|
$data = [];
|
|
$data = [];
|
|
foreach ($list as $value) {
|
|
foreach ($list as $value) {
|
|
$value['companyName'] = $names['data'][$value['companyNo']] ?? '';
|
|
$value['companyName'] = $names['data'][$value['companyNo']] ?? '';
|
|
-// $bidinfos = Db::name("consult_bids")->where([["bidNo","=",$value['bidsNo']],["is_del","=",0]])->find();
|
|
|
|
- $bidinfos = $bidinfos_list[$value['bidsNo']];
|
|
|
|
|
|
+ $bidinfos = $bidinfos_list[$value['bidsNo']]??[];
|
|
$value['spuCode'] = isset($bidinfos['spuCode']) ? $bidinfos['spuCode'] : "";
|
|
$value['spuCode'] = isset($bidinfos['spuCode']) ? $bidinfos['spuCode'] : "";
|
|
$value['good_name'] = isset($bidinfos['good_name']) ? $bidinfos['good_name'] : "";
|
|
$value['good_name'] = isset($bidinfos['good_name']) ? $bidinfos['good_name'] : "";
|
|
$value['good_img'] = isset($bidinfos['good_img']) ? $bidinfos['good_img'] : "";
|
|
$value['good_img'] = isset($bidinfos['good_img']) ? $bidinfos['good_img'] : "";
|
|
$value['brand_id'] = isset($bidinfos['brand_id']) ? $bidinfos['brand_id'] : "";
|
|
$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"] = $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['brand_id'] = $bidinfos['brand_id']??0;
|
|
|
|
+ $value['brand_name'] = $brand[$value['brand_id']] ?? '';
|
|
$value['can'] = isset($bidinfos['cat_id']) && $bidinfos['cat_id'] != 0 ? made($bidinfos['cat_id']) : [];
|
|
$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;
|
|
|
|
|
|
|
|
- $budget = get_budget($bidinfos['cat_id'],$value['companyNo']??'',$value['platform_code']??0);
|
|
|
|
|
|
+ $value['unit'] = $unit[$bidinfos['unit_id']??0] ?? '';//isset($unit['unit'])?$unit['unit']:'';
|
|
|
|
+
|
|
|
|
+ $budget = get_budget($bidinfos['cat_id']??0,$value['companyNo']??'',$value['platform_code']??0);
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
$value['budget'] = $budget;
|
|
$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['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['sale_price'] = round($bidinfos['origin_price']??0, 2);
|
|
|
|
+ $value['cost_before_price'] = round($bidinfos['origin_cost_fee']??0, 2);
|
|
|
|
|
|
$value['specinfo'] = isset($bidinfos['specinfo']) && $bidinfos['specinfo'] != "" ? json_decode($bidinfos['specinfo'], true) : [];
|
|
$value['specinfo'] = isset($bidinfos['specinfo']) && $bidinfos['specinfo'] != "" ? json_decode($bidinfos['specinfo'], true) : [];
|
|
$value['company_name'] = $item[$value['createrid']] ?? '';
|
|
$value['company_name'] = $item[$value['createrid']] ?? '';
|
|
@@ -2259,7 +2339,6 @@ class Consult extends Base
|
|
|
|
|
|
return app_show(0, "获取成功", ["count" => $count, "list" => $data]);
|
|
return app_show(0, "获取成功", ["count" => $count, "list" => $data]);
|
|
}
|
|
}
|
|
-
|
|
|
|
//招标工作台
|
|
//招标工作台
|
|
public function crontablist(){
|
|
public function crontablist(){
|
|
$page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
|
|
$page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
|
|
@@ -2365,8 +2444,6 @@ class Consult extends Base
|
|
}
|
|
}
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
//复制上面的bidlist方法,只更改排序方式
|
|
//复制上面的bidlist方法,只更改排序方式
|
|
public function bidlistCopy()
|
|
public function bidlistCopy()
|
|
{
|
|
{
|
|
@@ -2399,13 +2476,7 @@ class Consult extends Base
|
|
}
|
|
}
|
|
$is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
|
|
$is_own = isset($this->post['is_own']) ? intval($this->post['is_own']) : "0";
|
|
if ($is_own == 1) {
|
|
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];
|
|
$where[] = ['cb.createrid', "=", $rm];
|
|
}
|
|
}
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
@@ -2413,10 +2484,6 @@ class Consult extends Base
|
|
|
|
|
|
$good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
|
|
$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 . '%'];
|
|
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']) : "";
|
|
$supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !== "" ? trim($this->post['supplierNo']) : "";
|
|
if ($supplierNo !== "") $where[] = ["cb.supplierNo", '=', $supplierNo];
|
|
if ($supplierNo !== "") $where[] = ["cb.supplierNo", '=', $supplierNo];
|
|
|
|
|
|
@@ -2425,13 +2492,10 @@ class Consult extends Base
|
|
|
|
|
|
$companyNo = $this->post['companyNo']??'';
|
|
$companyNo = $this->post['companyNo']??'';
|
|
if($companyNo!='') $where[]=['d.companyNo','like','%' .$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')
|
|
$count = Db::name('consult_bids')
|
|
->alias('cb')
|
|
->alias('cb')
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
-// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
|
->where($where)
|
|
->where($where)
|
|
->count();
|
|
->count();
|
|
|
|
|
|
@@ -2442,7 +2506,6 @@ class Consult extends Base
|
|
->field('cb.*,d.companyNo,d.platform_code,d.area')
|
|
->field('cb.*,d.companyNo,d.platform_code,d.area')
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
->leftJoin("consult_info c", "c.infoNo=cb.infoNo")
|
|
->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
->leftJoin("consult_order d", "d.zxNo=c.zxNo")
|
|
-// ->leftJoin('supplier s', 's.code=cb.supplierNo')
|
|
|
|
->where($where)
|
|
->where($where)
|
|
->page($page, $size)
|
|
->page($page, $size)
|
|
->order('cb.addtime', 'desc')
|
|
->order('cb.addtime', 'desc')
|
|
@@ -2451,7 +2514,6 @@ class Consult extends Base
|
|
$data = [];
|
|
$data = [];
|
|
$user= \app\admin\common\User::getIns();
|
|
$user= \app\admin\common\User::getIns();
|
|
$supplier_temp =$user->handle("getCodeAndName",["code"=>array_unique(array_merge(array_column($list,"supplierNo"),array_column($list,"companyNo")))]);
|
|
$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']??[];
|
|
$supplier=$supplier_temp['data']??[];
|
|
|
|
|
|
$unit=Db::name('unit')
|
|
$unit=Db::name('unit')
|
|
@@ -2466,24 +2528,13 @@ class Consult extends Base
|
|
|
|
|
|
foreach ($list as $value) {
|
|
foreach ($list as $value) {
|
|
if(!isset($tmp_cat[$value['cat_id']])) $tmp_cat[$value['cat_id']] =made($value['cat_id']);
|
|
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']) : [];
|
|
$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'] : '';
|
|
$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['supplierName'] = isset($supplier[$value['supplierNo']]) ? $supplier[$value['supplierNo']] : "";
|
|
$value['companyName'] = $supplier[$value['companyNo']]??'';
|
|
$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'] : "";
|
|
$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();
|
|
$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']);
|
|
$budget = get_budget((int)$value['cat_id'], $value['companyNo'], (int)$value['platform_code']);
|
|
-// if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
|
$god = [
|
|
$god = [
|
|
"metal_id" => $value['metal_id'],
|
|
"metal_id" => $value['metal_id'],
|
|
"weight" => $value["good_weight"],
|
|
"weight" => $value["good_weight"],
|
|
@@ -2526,15 +2577,6 @@ class Consult extends Base
|
|
list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['origin_place']);
|
|
list($place['provice_code'], $place['city_code'], $place['area_code']) = explode(",", $value['origin_place']);
|
|
}
|
|
}
|
|
$value['origin_addr'] = GetAddr(json_encode($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']]??'';
|
|
$value['company_name'] = $item[$value['createrid']]??'';
|
|
|
|
|
|
$data[] = $value;
|
|
$data[] = $value;
|