优化工会关系

master
chenzhi 4 years ago
parent d9d55a3bcb
commit f731a417bd

@ -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){

@ -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);

@ -2,6 +2,7 @@
<block name="css">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<style>
@ -32,6 +33,48 @@
border-radius: 4px;
cursor: pointer;
}
.list-ratio {
display: table;
}
.list-ratio .li-ratio {
display: flex;
margin-bottom: 20px;
align-items: center;
}
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
position: relative;
}
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
color: red;
position: absolute;
left: 0;
top: 30px;
white-space: nowrap;
display: none;
}
.iconfont-btn {
cursor: pointer;
}
.iconfont-style {
font-size: 18px;
color: #fff;
border-radius: 4px;
border: 0;
padding: 5px;
margin-left: 10px;
}
.iconfont-selected {
background-color: #0A9AF2;
}
.iconfont-selected:hover {
background-color: #03a9f4;
}
.iconfont-unselected {
background-color: #999;
}
.iconfont-unselected:hover {
background-color: #ababab;
}
</style>
<!-- 标签页导航 -->
@ -53,6 +96,19 @@
<input type="text" class="txt " name="company_name" value="{$data.company_name}" placeholder="请输入推广公司名称">
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>团体归属:</td>
<td class="r" >
<div class="input-list input-list-server search_label_rehab" style="margin:0;">
<select id="company_belong" name="company_belong" class="select_gallery" style="width: 215px;">
<!-- <option value="">请选择团体归属</option> -->
<volist name=":getCompanyBlong()" id="vo">
<option value="{$vo.id}" <php> if($data['company_belong'] !='' && $vo['id'] == $data['company_belong'])echo selected;</php>>{$vo.name}</option>
</volist>
</select>
</div>
</td>
</tr>
<tr>
<td class="l">对应平台(简称):</td>
<td class="r" >
@ -77,24 +133,32 @@
<tr>
<td class="l">结算生效期限:</td>
<td class="r">
<input type="text" class="txt time time3" name="validity_start_time" value="" placeholder="生效开始时间">
&nbsp;-&nbsp;<input type="text" class="txt time time4" name="validity_end_time" value="" placeholder="生效结束时间">
<input type="text" class="txt time time3" name="validity_start_time" value="{$data.validity_start_time}" placeholder="生效开始时间">
&nbsp;-&nbsp;<input type="text" class="txt time time4" name="validity_end_time" value="{$data.validity_end_time}" placeholder="生效结束时间">
</td>
</tr>
<tr>
<td class="l">开票税点:</td>
<td class="r" >
<input type="number" class="txt" name="fax_ratio" value="{$data.fax_ratio}" placeholder="请输入开票税点">
<input type="text" class="txt" name="fax_ratio" value="{$data.fax_ratio}" placeholder="开票税点(最多两位小数)">
<span style="margin-left: 3px;padding-top: 5px">%</span>
</td>
</tr>
<tr>
<td class="l">渠道费率:</td>
<td class="r" >
<input type="text" class="txt " name="channel_rate" value="{$data.channel_rate}" placeholder="渠道费率(最多两位小数)"> <span style="margin-left: 3px;padding-top: 5px">%</span>
</td>
</tr>
<tr>
<td class="l">税费费率:</td>
<td class="r" >
<input type="text" class="txt " name="taxation_rate" value="{$data.taxation_rate}" placeholder="税费费率(最多三位小数)"><span style="margin-left: 3px;padding-top: 5px">%</span>
</td>
</tr>
<tr>
<td class="l">公司性质:</td>
<td class="r" >
@ -137,17 +201,16 @@
</div>
</td>
</tr>
<tr>
<td class="l">团体归属:</td>
<td class="l">开发类型:</td>
<td class="r" >
<div class="input-list input-list-server search_label_rehab" style="margin:0;">
<select id="company_belong" name="company_belong" class="select_gallery" style="width: 215px;">
<!-- <option value="">请选择团体归属</option> -->
<volist name=":getCompanyBlong()" id="vo">
<option value="{$vo.id}" <php> if($data['company_belong'] !='' && $vo['id'] == $data['company_belong'])echo selected;</php>>{$vo.name}</option>
</volist>
</select>
</div>
<select id="develop_type" name="develop_type" class="select_gallery" style="width: 215px;">
<option value="">请选择开发类型</option>
<option value="1" <if condition="$data.develop_type eq 1">selected</if>>自主开发</option>
<option value="2" <if condition="$data.develop_type eq 2">selected</if>>自主开发及维护</option>
<option value="3" <if condition="$data.develop_type eq 3">selected</if>>只维护</option>
</select>
</td>
</tr>
@ -178,35 +241,30 @@
</tr>
<tr>
<td class="l">所在地址:</td>
<td class="l">邮寄地址:</td>
<td class="r" >
<input type="text" class="txt " name="address" value="{$data.address}" placeholder="请输入所在地址">
<input type="text" class="txt " name="address" value="{$data.address}" placeholder="请输入邮寄地址">
</td>
</tr>
<tr>
<td class="l">银行卡号</td>
<td class="l">账户名</td>
<td class="r" >
<input type="text" class="txt " name="bank_card" value="{$data.bank_card}" placeholder="请输入银行卡号">
<input type="text" class="txt " name="bank_address" value="{$data.bank_address}" placeholder="请输入账户名">
</td>
</tr>
<!-- <tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>银行卡名:</td>
<td class="r" >
<input type="text" class="txt " name="bank_cardname" value="" placeholder="请输入银行卡名">
</td>
</tr> -->
<tr>
<td class="l">收款银行:</td>
<td class="l">银行卡号:</td>
<td class="r" >
<input type="text" class="txt " name="bank_name" value="{$data.bank_name}" placeholder="请输入收款银行">
<input type="text" class="txt " name="bank_card" value="{$data.bank_card}" placeholder="请输入银行卡号">
</td>
</tr>
<tr>
<td class="l">账户名</td>
<td class="l">收款银行</td>
<td class="r" >
<input type="text" class="txt " name="bank_address" value="{$data.bank_address}" placeholder="请输入账户名">
<input type="text" class="txt " name="bank_name" value="{$data.bank_name}" placeholder="请输入收款银行">
</td>
</tr>
<tr>
<td class="l">支付宝真实姓名:</td>
@ -222,23 +280,44 @@
</td>
</tr>
<tr>
<td class="l">开发类型</td>
<td class="l">备注</td>
<td class="r" >
<select id="develop_type" name="develop_type" class="select_gallery" style="width: 215px;">
<option value="">请选择开发类型</option>
<option value="1" <if condition="$data.develop_type eq 1">selected</if>>自主开发</option>
<option value="2" <if condition="$data.develop_type eq 2">selected</if>>自主开发及维护</option>
<option value="3" <if condition="$data.develop_type eq 3">selected</if>>只维护</option>
</select>
<input type="text" class="txt " name="content" value="{$data.content}" placeholder="">
</td>
</tr>
<tr>
<td class="l">备注:</td>
<td class="r" >
<input type="text" class="txt " name="content" value="{$data.content}" placeholder="">
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>承担服务费:</td>
<td class="r table_radio">
<span class="form_radio table_btn" style="width: auto;">
<label>
<input type="radio" class="inp_radio" value="0" name="has_server_fee" <if condition="$data['has_server_fee'] eq 0">checked</if>> 否
</label>
<label>
<input type="radio" class="inp_radio" value="1" name="has_server_fee" <if condition="$data['has_server_fee'] eq 1">checked</if>> 是
</label>
</span>
<span class="notice-text" id="server_fee_input" style="color: #000;<if condition="$data['has_server_fee'] eq 0">display: none;</if>"><input type="text" class="txt " name="server_fee" value="{$data['server_fee']}" placeholder="请输入服务器费用" style="width: 100px;">&nbsp;&nbsp;</span>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>合作关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="cooperation_status" <if condition="$data['cooperation_status'] eq 1">checked</if>> 合作中
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="cooperation_status" <if condition="$data['cooperation_status'] eq 0">checked</if>> 停止合作
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>显示状态:</td>
<td class="r table_radio">
@ -256,32 +335,82 @@
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="l noticeinfo">市场总监信息展示:</td>
<td class="r table_radio">
<div class="coin-detail" data-url="{:U('PromoteCompany/addfile')}" style="margin:0px;background: #fff;color: #333;font-weight: 400;border: 1px solid #777;">
添加
</div>
<span style="margin-left:30px;color: red;">
* 新增加文档需要保存修改后生效,删除文档即时生效(取消保存修改也生效,请慎重删除)
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="marketing_director_show" <if condition="$data['marketing_director_show'] eq 1">checked</if>> 展示
</label>
<label>
<input type="radio" class="inp_radio" value="2" name="marketing_director_show" <if condition="$data['marketing_director_show'] eq 2">checked
</if>> 隐藏
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">市场总监信息展示:</td>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>合作方比例增量:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="marketing_director_show" <if condition="$data['marketing_director_show'] eq 1">checked
</if>> 展示
<input type="radio" class="inp_radio" value="0" name="has_ratio" <if condition="$data['has_ratio'] eq 0">checked</if>> 否
</label>
<label>
<input type="radio" class="inp_radio" value="2" name="marketing_director_show" <if condition="$data['marketing_director_show'] eq 2">checked
</if>> 隐藏
<input type="radio" class="inp_radio" value="1" name="has_ratio" <if condition="$data['has_ratio'] eq 1">checked</if>> 是
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<tr id="turnover_ratio" <if condition="$data['has_ratio'] eq 0">style="display: none;"</if> >
<td class="l"></td>
<td class="r table_radio">
<div class="list-ratio">
<div class="li-ratio">
<label class="instanceof_text" style="margin-right: 10px;">流水分成设定:</label>
<span class="iconfont-btn iconfont-btn-add" title="添加流水比例"><i class="iconfont-style iconfont-selected iconfont iconjiahao1"></i></span>
<span class="iconfont-btn iconfont-btn-del" title="删除流水比例"><i class="iconfont-style iconfont-unselected iconfont iconjianhao"></i></span>
</div>
<volist name="data['turnover_ratio']" key="key" id="vo">
<div class="li-ratio">
<label class="instanceof_text" style="margin-right: 10px;">月流水</label>
<select name="instanceof[]" style="width: 50px;margin-right: 10px;">
<option value="1" <if condition="empty($vo['instanceof']) or $vo['instanceof'] eq 1">selected</if>>≥</option>
<option value="2" <if condition="!empty($vo['instanceof']) and $vo['instanceof'] eq 2">selected</if>>></option>
</select>
<div class="turnover">
<input type="text" class="txt turnover_money" name="turnover[]" value="{$vo['turnover']|default=''}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 100px;margin-right: 10px;">
<span class="error-message"></span>
</div>
<label>分成比例:</label>
<div class="turnover-ratio">
<input type="text" class="txt turnover_ratio" name="turnover_ratio[]" value="{$vo['ratio']|default=''}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 60px;">
<span class="form_unit" style="margin-right: 10px;">%</span>
<span class="error-message"></span>
</div>
</div>
</volist>
</div>
<span class="notice-text" style="width: auto;"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">
<div class="coin-detail" data-url="{:U('PromoteCompany/addfile')}" style="margin:0px;background: #fff;color: #333;font-weight: 400;border: 1px solid #777;">
添加
</div>
<span style="margin-left:30px;color: red;">
* 新增加文档需要保存修改后生效,删除文档即时生效(取消保存修改也生效,请慎重删除)
</span>
</td>
</tr>
</tbody>
</table>
<table border="1" style="width: 600px;text-align: center;margin:10px 0 0 60px;" cellspacing="0" cellpadding="0" id="docShow">
@ -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 += '<div class="li-ratio">';
html += '<label class="instanceof_text">月流水:</label>';
html += '<select name="instanceof[]" style="width: 50px;margin-right: 10px;">';
html += '<option value="1"></option>';
html += '<option value="2">></option>';
html += '</select>';
html += '<div class="turnover">';
html += '<input type="text" class="txt turnover_money" name="turnover[]" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 100px;margin-right: 10px;">';
html += '<span class="error-message"></span>';
html += '</div>';
html += '<label>分成比例:</label>';
html += '<div class="turnover-ratio">';
html += '<input type="text" class="txt turnover_ratio" name="turnover_ratio[]" value="" placeholder="请输入比例" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 60px;">';
html += '<span class="form_unit" style="margin-right: 10px;">%</span>';
html += '<span class="error-message"></span>';
html += '</div>';
html += '</div>';
$('.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({

@ -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){

Loading…
Cancel
Save