diff --git a/Application/Admin/Controller/AggregateRelationController.class.php b/Application/Admin/Controller/AggregateRelationController.class.php index 7cd7c8a5a..5703b6540 100644 --- a/Application/Admin/Controller/AggregateRelationController.class.php +++ b/Application/Admin/Controller/AggregateRelationController.class.php @@ -400,6 +400,7 @@ class AggregateRelationController extends AdminController (second_company_type ='{$params['second_company_type']}' and second_company_id = '{$params['second_company_id']}') "; } + $params['first_company_info'] = $this->getCompanyInfo($params['first_company_type'],$params['first_company_id']); $params['first_company_info']['type'] = 'first_party_info'; $params['first_company_info'] = json_encode($params['first_company_info']); @@ -408,6 +409,25 @@ class AggregateRelationController extends AdminController $params['second_company_info']['type'] = 'second_party_info'; $params['second_company_info'] = json_encode($params['second_company_info']); + if(!$params['settlement_type']) { + $params['settlement_type'] = 0; + } + + if(!$params['invoice_type']) { + $params['invoice_type'] = 0; + } + + if ($params['first_company_type'] == 3) { + $company_info = json_decode($params['first_company_info'],true); + $company_info['invoice_item'] = $params['invoice_content']; + $params['first_company_info'] = json_encode($company_info); + + }else if ($params['second_company_type'] == 3) { + $company_info = json_decode($params['second_company_info'],true); + $company_info['invoice_item'] = $params['invoice_content']; + $params['second_company_info'] = json_encode($company_info); + } + $r_res = $this->DBModel->where($where)->find(); if(!empty($r_res)){ $this->error('当前合作方已有绑定关系'); diff --git a/Application/Admin/View/AggregateRelation/addRelation.html b/Application/Admin/View/AggregateRelation/addRelation.html index 656eadf4a..4bc8c5701 100644 --- a/Application/Admin/View/AggregateRelation/addRelation.html +++ b/Application/Admin/View/AggregateRelation/addRelation.html @@ -198,7 +198,7 @@ 开票内容: - + @@ -277,7 +277,11 @@ $(function(){ layer.msg("合作甲乙双方必须有个是己方公司", {icon: 2}); return false; } - + $("select[disabled]").each(function() { + if (parseInt($(this).val()) != -1) { + $(this).attr("disabled", false); + } + }); var target = $('form').get(0).action; var query = $('form').serialize(); @@ -386,26 +390,29 @@ $(function(){ }); function setAggregateInfo(invoice_content,settlement_type,invoice_type) { + if (invoice_content) { + $('.invoice_content').val(invoice_content); + $('#invoice_content').val(invoice_content); + } - $('.invoice_content').val(invoice_content); $('#settlement_type').find("option").each(function() { $(this).removeAttr("selected"); }); - if (!settlement_type) { - $('#settlement_type').removeAttr("disabled"); - } else { + // if (!settlement_type) { + // $('#settlement_type').removeAttr("disabled"); + // } else { $('#settlement_type').prop("disabled",true); - } + // } $('#invoice_type').find("option").each(function() { $(this).removeAttr("selected"); }); - if (!invoice_type) { - $('#invoice_type').removeAttr("disabled"); - } else { + // if (!invoice_type) { + // $('#invoice_type').removeAttr("disabled"); + // } else { $('#invoice_type').prop("disabled",true); - } + // } $("#settlement_type").find("option[value="+settlement_type+"]").prop("selected",true); $("#invoice_type").find("option[value="+invoice_type+"]").prop("selected",true); $("#settlement_type").change();