From f731a417bdfb2663e4314f2860abe0ef6392c322 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 16 Jul 2020 18:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E4=BC=9A=E5=85=B3?= =?UTF-8?q?=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 11 +- .../PromoteCompanyController.class.php | 22 +- .../Admin/View/PromoteCompany/edit.html | 374 +++++++++++++++--- Application/Payment/Common/extend.php | 7 +- 4 files changed, 345 insertions(+), 69 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 8d73aa48c..c3d9700bb 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2300,11 +2300,12 @@ function a_array_unique($array){ */ function getCompanyRelation($id = -1) { - $data = array( - ["id"=>0,'name'=>"自主开发及维护"], - ["id"=>1,'name'=>"只维护"], - ["id"=>2,'name'=>"无"] - ); + $data = array( + ["id"=>0,'name'=>"无"], + ["id"=>1,'name'=>"自主开发"], + ["id"=>2,'name'=>"自主开发及维护"], + ["id"=>3,'name'=>"只维护"] + ); if($id > -1){ foreach($data as $k=>$v){ if($v['id'] == $id){ diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 092d5b60a..2d4a2a70b 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -301,16 +301,11 @@ class PromoteCompanyController extends ThinkController $model = M($this->modelName, 'tab_'); if ($_POST) { - $time = time(); $save = I('post.');//前端已经验证 - $save['create_time'] = $time; - $save['last_up_time'] = $time; - $save['contact_begin']=strtotime($save['contact_begin']); - $save['contact_end']=strtotime($save['contact_end']); + $this->checkData($save); + $save['turnover_ratio'] = $this->setTurnoverRatio($save); + // dd($save); - if(isset($save['resources'])){ - $save['resources'] = json_encode($save['resources'],JSON_UNESCAPED_UNICODE); - } //判断内外团是否修改 $is_change_belong = false; $company_id = $save['id']; @@ -321,9 +316,8 @@ class PromoteCompanyController extends ThinkController if(empty($save['contact_phone'])){ $save['contact_phone'] = 0; } - $res = $model->save($save); + $res = M("promote_company","tab_")->save($save); if ($res) { - \Think\Log::actionLog('PromoteCompany/edit', 'partner', $res); //处理底下所有会长的公会属性 if($is_change_belong){ $savedata = array( @@ -379,6 +373,7 @@ class PromoteCompanyController extends ThinkController if($data['resources'] == ''){ $data['resources'] ="[]"; } + $data['turnover_ratio'] = $data['turnover_ratio'] ? json_decode($data['turnover_ratio'], true) : $data['turnover_ratio']; $this->assign('serviceAgreements', M('service_agreement', 'tab_')->select()); $this->assign('data', $data); $this->display(); @@ -418,7 +413,6 @@ class PromoteCompanyController extends ThinkController $this->error('删除失败'); } -// echo M()->_sql();die(); addOperationLog(['op_type'=>2,'key'=>$companyData['company_name'],'op_name'=>'删除推广公司','url'=>U('PromoteCompany/lists'),'menu'=>'推广员-推广员管理-推广公司管理-删除推广公司']); @@ -522,9 +516,9 @@ class PromoteCompanyController extends ThinkController if ($promoteData) { $sql_spend = "UPDATE `tab_spend` SET `promote_id`=`old_change_promote_id`,`promote_account`=`old_change_promote_account`,`old_change_promote_id`=0,`old_change_promote_account`='' -WHERE old_change_promote_id in ({$promoteData})"; + WHERE old_change_promote_id in ({$promoteData})"; $sql_deposit = "UPDATE `tab_deposit` SET `promote_id`=`old_change_promote_id`,`promote_account`=`old_change_promote_account`,`old_change_promote_id`=0,`old_change_promote_account`='' -WHERE old_change_promote_id in ({$promoteData})"; + WHERE old_change_promote_id in ({$promoteData})"; $model = new \Think\Model(); $num_pend = $model->execute($sql_spend,true); @@ -547,7 +541,7 @@ WHERE old_change_promote_id in ({$promoteData})"; $spendData = M('spend','tab_')->field("old_change_promote_account")->where(['old_change_promote_id'=>['in',$promoteData]])->find(); -// var_dump($spendData);die(); + // var_dump($spendData);die(); if ($spendData['old_change_promote_account']) { $this->assign('old_change_promote_account',1); diff --git a/Application/Admin/View/PromoteCompany/edit.html b/Application/Admin/View/PromoteCompany/edit.html index 328b23598..2d2457ef3 100644 --- a/Application/Admin/View/PromoteCompany/edit.html +++ b/Application/Admin/View/PromoteCompany/edit.html @@ -2,6 +2,7 @@ + @@ -53,6 +96,19 @@ + + *团体归属: + +
+ +
+ + 对应平台(简称): @@ -77,24 +133,32 @@ 结算生效期限: - -  -  + +  -  开票税点: - + % + + 渠道费率: + + % + + + 税费费率: % + 公司性质: @@ -137,17 +201,16 @@ + - 团体归属: + 开发类型: -
- -
+ @@ -178,35 +241,30 @@ - 所在地址: + 邮寄地址: - + - 银行卡号: + 账户名: - + - - 收款银行: + 银行卡号: - + - 账户名: + 收款银行: - + + 支付宝真实姓名: @@ -222,23 +280,44 @@ + - 开发类型: + 备注: - + - 备注: - - + *承担服务费: + + + + + + display: none;">  元 + + + *合作关系: + + + + + + + + + *显示状态: @@ -256,32 +335,82 @@ - 文档管理 + 市场总监信息展示: -
- 添加 -
- - * 新增加文档需要保存修改后生效,删除文档即时生效(取消保存修改也生效,请慎重删除) + + + + - 市场总监信息展示: + *合作方比例增量: + style="display: none;" > + + +
+
+ + + +
+ +
+ + +
+ + +
+ +
+ + % + +
+
+
+ +
+ + + + + + + + 文档管理 + +
+ 添加 +
+ + * 新增加文档需要保存修改后生效,删除文档即时生效(取消保存修改也生效,请慎重删除) + + + + @@ -406,6 +535,22 @@ PROMOTE.juicerFun(); // window.parent.addFile(info); } + $("input[type=radio][name=has_server_fee]").on('change', function (e) { +     var v = $(this).val(); + if(v == 1){ + $("#server_fee_input").show(); + }else{ + $("#server_fee_input").hide(); + } +   }); + $("input[type=radio][name=has_ratio]").on('change', function (e) { +     var v = $(this).val(); + if(v == 1){ + $("#turnover_ratio").show(); + }else{ + $("#turnover_ratio").hide(); + } +   }); $('#contact_begin').datetimepicker({ format: 'yyyy-mm-dd', language: "zh-CN", @@ -447,7 +592,121 @@ return false; }); + $('.iconfont-btn-add').click(function (e) { + var delBtn = $('.iconfont-btn-del'); + var html = ''; + html += '
'; + html += ''; + html += ''; + html += '
'; + html += ''; + html += ''; + html += '
'; + html += ''; + html += '
'; + html += ''; + html += '%'; + html += ''; + html += '
'; + html += '
'; + + $('.list-ratio').append(html); + // subevn(); + if ($('.list-ratio').children().length > 1 && delBtn.children('i').hasClass('iconfont-unselected')) { + delBtn.children('i').removeClass('iconfont-unselected'); + delBtn.children('i').addClass('iconfont-selected'); + } + + $('.list-ratio').children(':last-child').children('.turnover').children('input').change(function (e) { + turnoverChangeHandle(); + }); + + $('.list-ratio').children(':last-child').children('.turnover-ratio').children('input').change(function (e) { + turnoverRatioChangeHandle(); + }); + }); + + $('.list-ratio').children('.li-ratio').children('.turnover').children('input').change(function (e) { + turnoverChangeHandle(); + }); + + $('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').change(function (e) { + turnoverRatioChangeHandle(); + }); + + function turnoverChangeHandle() + { + $('.list-ratio').children('.li-ratio').children('.turnover').children('input').each(function () { + var that = $(this); + var thatLiRatio = that.parent().parent(); + var thatLiRatioIndex = thatLiRatio.index(); + var prevTurnover = 0; + var prev = thatLiRatio.prev().children().children('input'); + var thatTurnover = parseFloat(that.val()); + + if (thatLiRatioIndex > 0) { + prevTurnover = parseFloat(prev.val()); + prevTurnoverHandle(thatTurnover, prevTurnover, that); + } + }); + } + + function turnoverRatioChangeHandle() { + var ratio = parseFloat($('#ratio').val()); + $('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').each(function () { + var that = $(this); + var thatLiRatio = that.parent().parent(); + var thatLiRatioIndex = thatLiRatio.index(); + var thatTurnoverRatio = parseFloat(that.val()); + + if (thatLiRatioIndex === 1) { + prevTurnoverRatio = ratio; + prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, true); + } else { + var prev = thatLiRatio.prev().children('.turnover-ratio').children('input'); + var prevTurnoverRatio = parseFloat(prev.val()); + prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that); + } + }); + } + + function prevTurnoverHandle(thatTurnover, prevTurnover, that) + { + if (thatTurnover <= prevTurnover) { + that.parent().children('span').text('月流水必须大于上一个月流水'); + that.parent().children('span').show(); + } else { + that.parent().children('span').hide(); + } + return true; + } + + function prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, isDefault = false) + { + // if (thatTurnoverRatio <= prevTurnoverRatio) { + // var msg = isDefault ? '月流水分成比例必须大于默认分成比例' : '月流水分成比例必须大于上一个月流水分成比例'; + // that.parent().children('.error-message').text(msg); + // that.parent().children('.error-message').show(); + // } else { + // that.parent().children('.error-message').hide(); + // } + return true; + } + + $('.iconfont-btn-del').click(function (e) { + var that = $(this); + if ($('.list-ratio').children().length > 1) { + $('.list-ratio').children(':last-child').remove(); + if ($('.list-ratio').children().length === 1) { + that.children('i').removeClass('iconfont-selected'); + that.children('i').addClass('iconfont-unselected'); + } + } + }); $(".coin-detail").click(function () { var url = $(this).data('url'); @@ -462,6 +721,7 @@ }); }); $("#submit").on("click",function(){ + var flag = true; var obj = { "company_name":["required",false,"推广公司名称不允许为空"], "fax_ratio":["number",true,"开票税率必须是数字,如果无此项请填0"], @@ -473,6 +733,26 @@ senddata.push({"name":"resources", "value":JSON.stringify(doc)}); senddata.push({"name":"id", "value":id}); //资源不需要二次修改 + var hasratio = $("input[type=radio][name=has_ratio]:checked").val(); + if(hasratio == 1){ + $(".error-message").each(function(index,elm){ + var t = $(elm).css("display"); + if(t == 'block' || t == 'inline'){ + flag = false; + layer.msg("请先处理错误的比例配置", {icon: 2}); + return false; + } + }) + $(".turnover_money").each(function(index,elm){ + var t = $(elm).val(); + if(t == ''){ + flag = false; + layer.msg("流水及比例不允许为空,如不需要请删除", {icon: 2}); + return false; + } + }) + } + if(!flag) return false; //添加 $.ajax({ diff --git a/Application/Payment/Common/extend.php b/Application/Payment/Common/extend.php index 5dcb80a9f..2e4b75364 100644 --- a/Application/Payment/Common/extend.php +++ b/Application/Payment/Common/extend.php @@ -2299,9 +2299,10 @@ function a_array_unique($array){ function getCompanyRelation($id = -1) { $data = array( - ["id"=>0,'name'=>"自主开发及维护"], - ["id"=>1,'name'=>"只维护"], - ["id"=>2,'name'=>"无"] + ["id"=>0,'name'=>"无"], + ["id"=>1,'name'=>"自主开发"], + ["id"=>2,'name'=>"自主开发及维护"], + ["id"=>3,'name'=>"只维护"] ); if($id > -1){ foreach($data as $k=>$v){