|
@@ -3,7 +3,7 @@
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\model\ActionLog;
|
|
|
-use app\admin\model\DataGroup as DataGroupModel;
|
|
|
+use app\admin\model\ConsultTemp;use app\admin\model\DataGroup as DataGroupModel;
|
|
|
use app\admin\model\ProcessOrder;
|
|
|
use think\App;
|
|
|
use think\facade\Db;
|
|
@@ -127,13 +127,14 @@ class Consult extends Base
|
|
|
return app_show(0,"获取成功",$fo);
|
|
|
}
|
|
|
}
|
|
|
- public function del(){
|
|
|
+ public function delete(){
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) : "";
|
|
|
- $de = Db::name('consult')->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
+ $de = Db::name('consult_bids')->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
if($de==false){
|
|
|
- return error_show(1002,'咨询单信息未找到');
|
|
|
+ return error_show(1002,'咨询商品信息未找到');
|
|
|
}
|
|
|
- $dell= Db::name('consult')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
|
|
|
+ if($de['status']>1) return error_show(1002,'咨询商品信息当前状态不可删除');
|
|
|
+ $dell= Db::name('consult_bids')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
|
|
|
if($dell){
|
|
|
return error_show(0,"删除成功");
|
|
|
}else
|
|
@@ -331,9 +332,6 @@ class Consult extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
public function zxinfo(){
|
|
|
$infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
|
|
|
if($infoNo==""){
|
|
@@ -347,12 +345,8 @@ class Consult extends Base
|
|
|
if($zxorder==false){
|
|
|
return error_show(1004,"未找到咨询信息数据");
|
|
|
}
|
|
|
-
|
|
|
-// $cat =Db::name("cat")->where(["id"=>$zxinfo['cat_id']])->find();
|
|
|
-// $budget = isset($cat['order_rate']) ? $cat['order_rate']:0;
|
|
|
-
|
|
|
$budget = get_budget($zxinfo['cat_id'], $zxorder['companyNo'], $zxorder['platform_code']);
|
|
|
-
|
|
|
+ if($budget===false) $this->error("未找到业务公司有关的平台分类毛利信息");
|
|
|
$zxinfo['can']= isset($zxinfo['cat_id']) && $zxinfo['cat_id'] !=0 ? made($zxinfo['cat_id'],[]):[];
|
|
|
$zxinfo['khname']="";
|
|
|
$zxinfo['original_price']=sprintf("%.2f",$zxinfo['budget_price']* (1 -$budget));
|
|
@@ -375,7 +369,6 @@ class Consult extends Base
|
|
|
$zxinfo['unit_name']="";
|
|
|
$zxinfo['metal_name']=isset($zxinfo['metal_id'])&& $zxinfo['metal_id']!=0?$this->noble[$zxinfo['metal_id']]:"";
|
|
|
$zxinfo['specinfo']=json_decode($zxinfo['specinfo'],true);
|
|
|
-
|
|
|
$userCommon = \app\admin\common\User::getIns();
|
|
|
$tmp = $userCommon->handle('getCodeAndName', ['code' => [$zxorder['companyNo'],$zxorder['khNo']]]);
|
|
|
|
|
@@ -694,11 +687,11 @@ class Consult extends Base
|
|
|
if($zx==false){
|
|
|
return error_show(1003,"未找咨询信息数据");
|
|
|
}
|
|
|
- $pname = isset($this->post['pname'])&&$this->post['pname']!=""? trim($this->post['pname']):"";
|
|
|
- if($pname==""){
|
|
|
- return error_show(1002,"参数pname不能为空");
|
|
|
+ $good_name = isset($this->post['good_name'])&&$this->post['good_name']!=""? trim($this->post['good_name']):"";
|
|
|
+ if($good_name==""){
|
|
|
+ return error_show(1002,"参数good_name不能为空");
|
|
|
}
|
|
|
- $brandid = isset($this->post['brandid'])&&$this->post['brandid']!=""? intval($this->post['brandid']):"";
|
|
|
+ $brandid = isset($this->post['brand_id'])&&$this->post['brand_id']!=""? intval($this->post['brand_id']):"";
|
|
|
$cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!=""? trim($this->post['cat_id']):"";
|
|
|
if($cat_id==""){
|
|
|
return error_show(1002,"参数cat_id不能为空");
|
|
@@ -709,14 +702,14 @@ class Consult extends Base
|
|
|
}
|
|
|
$specinfo=[];
|
|
|
foreach ($specin as $v){
|
|
|
- $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
|
|
|
+ $spec =Db::name("specs")->where(["id"=>$v['spec_id']])->find();
|
|
|
$spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
|
|
|
$v['spec_name']=isset($spec['spec_name'])?$spec['spec_name']:"";
|
|
|
- $v['spec_id']=$v['specid'];
|
|
|
$v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"";
|
|
|
$specinfo[]=$v;
|
|
|
}
|
|
|
$unit_id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? intval($this->post['unit_id']):"";
|
|
|
+ $is_combind = isset($this->post['is_combind'])&&$this->post['is_combind']!=""? intval($this->post['is_combind']):"0";
|
|
|
$cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""? trim($this->post['cost_desc']):"";
|
|
|
$work_day = isset($this->post['work_day'])&&$this->post['work_day']!=""? intval($this->post['work_day']):"";
|
|
|
$delivery_day = isset($this->post['delivery_day'])&&$this->post['delivery_day']!=""? intval($this->post['delivery_day']):"";
|
|
@@ -724,21 +717,19 @@ class Consult extends Base
|
|
|
$expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? intval($this->post['expire_day']) :"";
|
|
|
$origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
|
|
|
$supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
|
|
|
- $supplier_account = checkHasAccountBySupplierNos([$supplierNo]);
|
|
|
- $cgd_supplier_code = isset($this->post['cgd_supplier_code'])&&$this->post['cgd_supplier_code']!=''? trim($this->post['cgd_supplier_code']):'';
|
|
|
- $cgd_apply_id = isset($this->post['cgd_apply_id'])&&$this->post['cgd_apply_id']!=''? trim($this->post['cgd_apply_id']):'';
|
|
|
- $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']):'';
|
|
|
- $cgd_supplier_name='';
|
|
|
+ if ($this->level == 2) {
|
|
|
+ $supplier_account = checkHasAccountBySupplierNos([$supplierNo]);
|
|
|
+ if (isset($supplier_account[$supplierNo])) return json_show(1004, '供应商已开通账号,请用供应商账户反馈');
|
|
|
+ }
|
|
|
+ $cgd_supplier_code = isset($this->post['cgd_supplier_code'])&&$this->post['cgd_supplier_code']!=''? trim($this->post['cgd_supplier_code']):'';
|
|
|
+ $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']):'';
|
|
|
+ $supplier_origin_price = isset($this->post['supplier_origin_price'])&&$this->post['supplier_origin_price']!=''? floatval($this->post['supplier_origin_price']):0;
|
|
|
+
|
|
|
$user= \app\admin\common\User::getIns();
|
|
|
$supplier =$user->handle("getCodeAndName",["code"=>[$supplierNo,$cgd_supplier_code]]);
|
|
|
$supplierName = isset($supplier['data'][$supplierNo])?$supplier['data'][$supplierNo]:"";
|
|
|
- if(isset($supplier_account[$supplierNo])){
|
|
|
- if($cgd_supplier_code=='')return error_show(1004,'采购供应商信息不能为空');
|
|
|
- if($cgd_apply_id=='')return error_show(1004,'采购竞单人信息不能为空');
|
|
|
- if($supplier_origin_price==='')return error_show(1004,'采购供应商信息采购成本不能为空');
|
|
|
- $cgd_supplier_name= $supplier['data'][$cgd_supplier_code]??'';
|
|
|
- }
|
|
|
+ $cgd_supplier_name= $supplier['data'][$cgd_supplier_code]??'';
|
|
|
$pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? intval($this->post['pay_way']):"";
|
|
|
$tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
|
|
|
$send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? intval($this->post['send_way']):"";
|
|
@@ -769,29 +760,20 @@ class Consult extends Base
|
|
|
|
|
|
$relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] != '' ? trim($this->post['relaComNo']) : "";
|
|
|
if ($relaComNo == '') return error_show(1004, '关联公司不能为空');
|
|
|
-
|
|
|
-// $platform_id = isset($this->post['platform_id']) && $this->post['platform_id'] != '' ? intval($this->post['platform_id']) : 0;
|
|
|
-// if ($platform_id == 0) return error_show(1004, '平台id不能为空');
|
|
|
-
|
|
|
-
|
|
|
-// $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
-// if($token==''){
|
|
|
-// return error_show(1002,"参数token不能为空");
|
|
|
-// }
|
|
|
-// $user =GetUserInfo($token);
|
|
|
-// if(empty($user)||$user['code']!=0){
|
|
|
-// return error_show(1005,"用户数据不存在");
|
|
|
-// }
|
|
|
+
|
|
|
$createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
$creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
|
$bidNo=makeNo("BD");
|
|
|
$spucode=makeNo("SKU");
|
|
|
-// $catinfo = Db::name("cat")->where(["id"=>$cat_id])->find();
|
|
|
-
|
|
|
+ $goodBind= isset($this->post['goodBind']) && !empty($this->post['goodBind']) ? $this->post['goodBind'] :[];
|
|
|
+ if($is_combind==1){
|
|
|
+ if(empty($goodBind))$this->error('组合商品商品明细不能为空');
|
|
|
+ $spucode=makeNo('SSU');
|
|
|
+ }
|
|
|
+
|
|
|
//计算毛利率
|
|
|
$budget = get_budget($zxinfo['cat_id'], $zx['companyNo'], $zx['platform_code']);
|
|
|
-// $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']/100:0;
|
|
|
-
|
|
|
+ if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
//部分参数的大小校验
|
|
|
$vali = Validate::rule([
|
|
|
'expire_day|有效时长'=>'require|elt:214748364',
|
|
@@ -799,7 +781,6 @@ class Consult extends Base
|
|
|
'work_day|生产工期'=>'require|elt:214748364',
|
|
|
'weight|总重量'=>'require|max:10',
|
|
|
]);
|
|
|
-
|
|
|
$temp = [
|
|
|
'expire_day'=>$expire_day,
|
|
|
'delivery_day'=>$delivery_day,
|
|
@@ -809,9 +790,7 @@ class Consult extends Base
|
|
|
|
|
|
if(!$vali->check($temp)) return error_show(0,$vali->getError());
|
|
|
|
|
|
-
|
|
|
$sale_cost_fee = $cost_fee;//销售工艺费默认取传值
|
|
|
-
|
|
|
$cat_top_list = made($cat_id);
|
|
|
$cat_top_id = isset($cat_top_list[0]['id']) ? $cat_top_list[0]['id'] : 0;
|
|
|
if ($is_gold_price == 1 && $cat_top_id == 6) {
|
|
@@ -819,16 +798,10 @@ class Consult extends Base
|
|
|
->where(["type"=>$metal_id,"is_del"=>0,"status"=>1])
|
|
|
->order("addtime desc")
|
|
|
->find();
|
|
|
-
|
|
|
- //$total_fee = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee*$weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
|
|
|
- //$total_fee(成本合计初始价格) =打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价0+运费;
|
|
|
$total_fee = $demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $good_weight * $gold["price"] + $cost_fee * $good_weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee;
|
|
|
-
|
|
|
-// $saleprice = $open_fee/$zxinfo['num'] + $weight* $gold["price"] + $cost_fee/(1-$budget)* $weight+$pakge_fee+$mark_fee+$cert_fee+$nake_fee;
|
|
|
//$saleprice(最终售价) = (开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100);
|
|
|
-// $saleprice = ($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget);
|
|
|
+ // $saleprice = ($open_fee / $zxinfo['num'] + $weight * $gold["price"] + $cost_fee * $weight + $pakge_fee + $mark_fee + $cert_fee + $nake_fee) / (1 - $budget);
|
|
|
$saleprice = $total_fee/ (1 - $budget);
|
|
|
-
|
|
|
//销售工艺费=((开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价)/(1-成本售价/100)-(打样费/购买数量 + 开模费/购买数量 +包装费+加标费+证书费+产品裸价0+运费) )/商品重量-最新金价
|
|
|
$sale_cost_fee = ($saleprice - ($demo_fee / $zxinfo['num'] + $open_fee / $zxinfo['num'] + $pakge_fee + $mark_fee + $cert_fee + $nake_fee + $delivery_fee)) /$good_weight - $gold["price"];
|
|
|
|
|
@@ -843,11 +816,6 @@ class Consult extends Base
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-// $supplier = Db::name('supplier')
|
|
|
-// ->field('id,person,personid')
|
|
|
-// ->where('code',$supplierNo)
|
|
|
-// ->findOrEmpty();
|
|
|
$userCommon= \app\admin\common\User::getIns();
|
|
|
$supplier_temp =$userCommon->handle("hqInfo",["code"=>$supplierNo]);
|
|
|
if($supplier_temp['code']!=0 || empty($supplier_temp['data']) ) return error_show(1004,"供应商信息未找到");
|
|
@@ -856,15 +824,15 @@ class Consult extends Base
|
|
|
|
|
|
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']])
|
|
|
->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}");
|
|
|
-// if (!empty($temp)) return json_show(1004, '招标任务平台已存在该供应商,请更换其他供应商');
|
|
|
}
|
|
|
+ }else{
|
|
|
+ if($is_combind==1)$this->error("当前供应商无对应业务公司,不可选择组合商品");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -874,7 +842,7 @@ class Consult extends Base
|
|
|
"infoNo"=>$infoNo,
|
|
|
"zxNo"=>$zxinfo['zxNo'],
|
|
|
"spuCode"=>$spucode,
|
|
|
- "good_name"=>$pname,
|
|
|
+ "good_name"=>$good_name,
|
|
|
"brand_id"=>$brandid,
|
|
|
"cat_id"=>$cat_id,
|
|
|
"specinfo"=>json_encode($specinfo),
|
|
@@ -917,6 +885,7 @@ class Consult extends Base
|
|
|
"creater"=>$creater,
|
|
|
"status"=>$zxinfo['status']==1 ?1 :2,
|
|
|
"is_del"=>0,
|
|
|
+ "is_combind"=>$is_combind,
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s"),
|
|
|
'delivery_place'=>$delivery_place,//发货地
|
|
@@ -943,7 +912,7 @@ class Consult extends Base
|
|
|
$temp['skuCode']="";
|
|
|
$temp['pgNo']=$zxinfo['pgNo'];
|
|
|
$temp['projectNo']=$zx['projectNo'];
|
|
|
- $temp['good_name']=$pname;
|
|
|
+ $temp['good_name']=$good_name;
|
|
|
$temp['good_type']=$projectinfo['good_type'];
|
|
|
$temp['data_source']=2;
|
|
|
$temp['cat_id']=$cat_id;
|
|
@@ -1006,7 +975,15 @@ class Consult extends Base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if($is_combind==1){
|
|
|
+ $arram=[
|
|
|
+ 'bidNo'=>$bidNo,
|
|
|
+ "companyNo"=>$zx['companyNo'],
|
|
|
+ "companyName"=>$zx['companyName'],
|
|
|
+ 'supplierName'=>$supplierName,
|
|
|
+ ];
|
|
|
+ (new \app\admin\model\ConsultTemp)->CreateByZx($goodBind,$arram);
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
return app_show(0,"反馈成功",["bidNo"=>$bidNo]);
|
|
|
|
|
@@ -1051,6 +1028,7 @@ class Consult extends Base
|
|
|
$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']);
|
|
|
+ if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$god=[
|
|
|
"metal_id"=>$info['metal_id'],
|
|
|
"weight"=>$info["good_weight"],
|
|
@@ -1119,15 +1097,15 @@ class Consult extends Base
|
|
|
if($zx==false){
|
|
|
return error_show(1003,"未找咨询信息数据");
|
|
|
}
|
|
|
- $pname = isset($this->post['pname'])&&$this->post['pname']!=""? trim($this->post['pname']):"";
|
|
|
+ $pname = isset($this->post['good_name'])&&$this->post['good_name']!=""? trim($this->post['good_name']):"";
|
|
|
if($pname==""){
|
|
|
- return error_show(1002,"参数pname不能为空");
|
|
|
+ return error_show(1002,"参数good_name不能为空");
|
|
|
}
|
|
|
- $brandid = isset($this->post['brandid'])&&$this->post['brandid']!=""? intval($this->post['brandid']):"";
|
|
|
+ $brandid = isset($this->post['brand_id'])&&$this->post['brand_id']!=""? intval($this->post['brand_id']):"";
|
|
|
// if($brandid==""){
|
|
|
// return error_show(1002,"参数brandid不能为空");
|
|
|
// }
|
|
|
-
|
|
|
+ $is_combind = isset($this->post['is_combind'])&&$this->post['is_combind']!=''? intval($this->post['is_combind']):'0';
|
|
|
$cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!=""? trim($this->post['cat_id']):"";
|
|
|
if($cat_id==""){
|
|
|
return error_show(1002,"参数cat_id不能为空");
|
|
@@ -1152,22 +1130,24 @@ class Consult extends Base
|
|
|
$expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? intval($this->post['expire_day']) :"";
|
|
|
$origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
|
|
|
$supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
|
|
|
- $supplier_account = checkHasAccountBySupplierNos([$supplierNo]);
|
|
|
+
|
|
|
+ if ($this->level == 2) {
|
|
|
+ $supplier_account = checkHasAccountBySupplierNos([$bidinfo['supplierNo'],$supplierNo]);
|
|
|
+ if (isset($supplier_account[$bidinfo['supplierNo']])) return json_show(1004, '原供应商已开通账号,请用供应商账户反馈');
|
|
|
+ if (isset($supplier_account[$supplierNo])) return json_show(1004, '供应商已开通账号,请用供应商账户反馈');
|
|
|
+ }
|
|
|
$cgd_supplier_code = isset($this->post['cgd_supplier_code'])&&$this->post['cgd_supplier_code']!=''? trim($this->post['cgd_supplier_code']):'';
|
|
|
- $cgd_apply_id = isset($this->post['cgd_apply_id'])&&$this->post['cgd_apply_id']!=''? trim($this->post['cgd_apply_id']):'';
|
|
|
+ $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']):'';
|
|
|
- $supplier_origin_price = isset($this->post['supplier_origin_price'])&&$this->post['supplier_origin_price']!=''? floatval($this->post['supplier_origin_price']):'';
|
|
|
+ $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();
|
|
|
$supplier =$user->handle("getCodeAndName",["code"=>[$supplierNo,$cgd_supplier_code]]);
|
|
|
|
|
|
$supplierName = isset($supplier['data'][$supplierNo])?$supplier['data'][$supplierNo]:"";
|
|
|
- if(isset($supplier_account[$supplierNo])){
|
|
|
- if($cgd_supplier_code=='')return error_show(1004,'采购供应商信息不能为空');
|
|
|
- if($cgd_apply_id=='')return error_show(1004,'采购竞单人信息不能为空');
|
|
|
- if($supplier_origin_price==='')return error_show(1004,'采购供应商信息采购成本不能为空');
|
|
|
- $cgd_supplier_name= $supplier['data'][$cgd_supplier_code]??'';
|
|
|
- }
|
|
|
+
|
|
|
+ $cgd_supplier_name= $supplier['data'][$cgd_supplier_code]??'';
|
|
|
+
|
|
|
$pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? intval($this->post['pay_way']):"";
|
|
|
$tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
|
|
|
$send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? intval($this->post['send_way']):"0";
|
|
@@ -1193,10 +1173,8 @@ class Consult extends Base
|
|
|
if($delivery_place==''){
|
|
|
return error_show(1002,"参数delivery_place不能为空");
|
|
|
}
|
|
|
-// $catinfo = Db::name("cat")->where(["id"=>$cat_id])->find();
|
|
|
-
|
|
|
$budget = get_budget($cat_id,$zx['companyNo'],$zx['platform_code']);
|
|
|
-
|
|
|
+ if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$sale_cost_fee = $bidinfo['sale_cost_fee'];
|
|
|
|
|
|
$cat_top_list = made($cat_id);
|
|
@@ -1224,7 +1202,11 @@ class Consult extends Base
|
|
|
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 ($supplierArr['relation_code'] != '') {
|
|
|
if ($supplierArr['relation_code'] == $zx['companyNo']) return error_show(1004, "业务公司与供应商信息一致");
|
|
|
|
|
@@ -1236,6 +1218,8 @@ class Consult extends Base
|
|
|
if(channel_is_company($zx['platform_code'],$supplierArr['relation_code'])) return error_show(1004, "平台渠道包含当前供应商公司{$supplierNo}");
|
|
|
//
|
|
|
}
|
|
|
+ }else{
|
|
|
+ if($is_combind==1)$this->error('当前供应商无对应业务公司,不可选择组合商品');
|
|
|
}
|
|
|
|
|
|
Db::startTrans();
|
|
@@ -1245,7 +1229,6 @@ class Consult extends Base
|
|
|
"brand_id"=>$brandid,
|
|
|
"cat_id"=>$cat_id,
|
|
|
"specinfo"=>json_encode($specinfo),
|
|
|
-// "material"=>$material,
|
|
|
"unit_id"=>$unit_id,
|
|
|
"cost_desc"=>$cost_desc,
|
|
|
"work_day"=>$work_day,
|
|
@@ -1371,6 +1354,15 @@ class Consult extends Base
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if($is_combind==1){
|
|
|
+ $arram=[
|
|
|
+ 'bidNo'=>$bidNo,
|
|
|
+ "companyNo"=>$zx['companyNo'],
|
|
|
+ "companyName"=>$zx['companyName'],
|
|
|
+ "supplierName"=>$supplierName,
|
|
|
+ ];
|
|
|
+ (new \app\admin\model\ConsultTemp)->CreateByZx($goodBind,$arram);
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
return app_show(0,"编辑成功");
|
|
|
}else{
|
|
@@ -1623,7 +1615,7 @@ class Consult extends Base
|
|
|
->findOrEmpty();
|
|
|
|
|
|
$catinfo = get_budget($bids['cat_id'],$tmp['companyNo']??'',$tmp['platform_code']??0,true);
|
|
|
-
|
|
|
+ if($catinfo===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$rate = isset($catinfo['rate']) ? $catinfo['rate']/100:0; //业务主管利率
|
|
|
if($bids['is_gold_price']==1){
|
|
|
$gold = Db::name("gold_price1")->where(["type"=>$bids['metal_id'],"is_del"=>0,"status"=>1])->order("addtime desc")
|
|
@@ -1735,10 +1727,6 @@ class Consult extends Base
|
|
|
$info['good_img'] = isset($bidinfos['good_img'])?$bidinfos['good_img']:"";
|
|
|
$info['brand_id'] = isset($bidinfos['brand_id'])?$bidinfos['brand_id']:"";
|
|
|
$info['good_num'] = isset($consultinfos['num'])?$consultinfos['num']:"";
|
|
|
-// $info['before_rate'] =round($info['before_rate']*100,2);
|
|
|
-// $info['sale_price'] =round($bidinfos['origin_price'],2);
|
|
|
-// $info['cost_before_price'] =round($bidinfos['origin_cost_fee'],2);
|
|
|
-// $info['after_rate'] = round($info['after_rate']*100,2);
|
|
|
$info['exam_info'] = isset($info['exam_info'])&&$info['exam_info']!=""?json_decode($info['exam_info'],true):"";
|
|
|
if($bidinfos['brand_id']!=0){
|
|
|
$info['brand_id'] = $bidinfos['brand_id'];
|
|
@@ -1757,7 +1745,7 @@ class Consult extends Base
|
|
|
->findOrEmpty();
|
|
|
|
|
|
$catinfo = get_budget($bidinfos['cat_id'],$tmp['companyNo']??'',$tmp['platform_code']??0,true);
|
|
|
-
|
|
|
+ if($catinfo===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$info['can']= isset($bidinfos['cat_id']) && $bidinfos['cat_id'] !=0 ? made($bidinfos['cat_id']):[];
|
|
|
$unit =Db::name("unit")->where(["id"=>$bidinfos['unit_id']])->find();
|
|
|
$info['unit'] = isset($unit['unit'])?$unit['unit']:'';
|
|
@@ -1798,10 +1786,10 @@ class Consult extends Base
|
|
|
|
|
|
}else{
|
|
|
if($bidinfos['nake_fee']!=0){
|
|
|
- $lower_price =($bidinfos['demo_fee']/$consultinfos['num']+$bidinfos['delivery_fee']+$bidinfos['open_fee']/$consultinfos['num']+$bidinfos['cost_fee']*$bidinfos['good_weight']+$bidinfos['pakge_fee'] +$bidinfos['mark_fee']+ $bidinfos['cert_fee'] + $bidinfos['nake_fee']) / (1 - $lower_rate);
|
|
|
+ $lower_price =($bidinfos['demo_fee']/$consultinfos['num']+$bidinfos['delivery_fee']+$bidinfos['open_fee']/$consultinfos['num']+$bidinfos['cost_fee']*$bidinfos['good_weight']+$bidinfos['pakge_fee'] +$bidinfos['mark_fee']+ $bidinfos['cert_fee'] + $bidinfos['nake_fee']) / (1 - $lower_rate);
|
|
|
|
|
|
}else{
|
|
|
- $lower_price = ($bidinfos['demo_fee']/$consultinfos['num']+$bidinfos['delivery_fee']+$bidinfos['open_fee']/$consultinfos['num']+$bidinfos['cost_fee']*$bidinfos['good_weight']+$bidinfos['pakge_fee'] +$bidinfos['mark_fee']+ $bidinfos['cert_fee'])/ (1 - $lower_rate);
|
|
|
+ $lower_price = ($bidinfos['demo_fee']/$consultinfos['num']+$bidinfos['delivery_fee']+$bidinfos['open_fee']/$consultinfos['num']+$bidinfos['cost_fee']*$bidinfos['good_weight']+$bidinfos['pakge_fee'] +$bidinfos['mark_fee']+ $bidinfos['cert_fee'])/ (1 - $lower_rate);
|
|
|
}
|
|
|
}
|
|
|
$info['cost_desc'] =$bidinfos['cost_desc'];
|
|
@@ -1851,7 +1839,6 @@ class Consult extends Base
|
|
|
$info['is_custom'] =$consultinfos['is_custom'];
|
|
|
|
|
|
$info['metal_name']=isset($bidinfos['metal_id'])&& $bidinfos['metal_id']!=0?$this->noble[$bidinfos['metal_id']]:"";
|
|
|
-// $info['sale_price'] =round($bidinfos['sale_price'],2);//议价前价格
|
|
|
$info['specinfo'] = isset($bidinfos['specinfo'])&&$bidinfos['specinfo']!=""?json_decode($bidinfos['specinfo'],true):[];
|
|
|
$info['lower_price'] =round($lower_price,2);
|
|
|
//获取议价原因
|
|
@@ -1935,6 +1922,7 @@ class Consult extends Base
|
|
|
$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;
|
|
|
$god=[
|
|
|
"metal_id"=>$value['metal_id'],
|
|
@@ -2057,6 +2045,7 @@ class Consult extends Base
|
|
|
// $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:0;
|
|
|
$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('未找到业务公司有关的平台分类毛利信息');
|
|
|
$god=[
|
|
|
"metal_id"=>$value['metal_id'],
|
|
|
"weight"=>$value["good_weight"],
|
|
@@ -2234,6 +2223,7 @@ class Consult extends Base
|
|
|
// $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);
|
|
|
+ if($budget===false) $this->error('未找到业务公司有关的平台分类毛利信息');
|
|
|
$value['budget'] = $budget;
|
|
|
$god = [
|
|
|
"metal_id" => $bidinfos['metal_id'],
|
|
@@ -2493,6 +2483,7 @@ class Consult extends Base
|
|
|
$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"],
|