优化:推广员新增与编辑的推广公司增加万盟天下科技

新增需求:推广员增加工会归属和工会关系属性
master
liuweiwen 5 years ago
parent 1c8f0d4464
commit 0b3ae062b1

@ -141,6 +141,7 @@ class PromoteController extends ThinkController
//为数据权限添加 //为数据权限添加
setPowerPromoteIds($map, 'id'); setPowerPromoteIds($map, 'id');
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select(); $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select();
$list_data = D(self::model_name)->parseListData($list_data);
$oa_data = []; $oa_data = [];
if (I('oa_associated', -1) == -1) { if (I('oa_associated', -1) == -1) {
foreach ($list_data as $k => $v) { foreach ($list_data as $k => $v) {
@ -220,14 +221,29 @@ class PromoteController extends ThinkController
if ($this->accountExist($account)) { if ($this->accountExist($account)) {
$this->error('该账号已存在'); $this->error('该账号已存在');
} }
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name, $company_belong = $_REQUEST['company_belong'];
'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card, $company_relation = $_REQUEST['company_relation'];
'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id); $data = array(
'account'=>$account,
'password'=>$password,
'second_pwd'=>$second_pwd,
'real_name'=>$real_name,
'email'=>$email,
'mobile_phone'=>$mobile_phone,
'bank_name'=>$bank_name,
'bank_card'=>$bank_card,
'admin_id'=>session('user_auth')['uid'],
'status'=>$status,
'ba_id'=>$ba_id,
'company_id' => $company_id,
'company_belong' => $company_belong,
'company_relation' => $company_relation,
);
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) {
$this->error('账号只能是6-15位字母或数字'); $this->error('账号只能是6-15位字母或数字');
} }
if (empty($company_id)) { if ($company_id < 0) {
$this->error('请选择推广公司'); $this->error('请选择推广公司');
} }
$promoteService = new PromoteService(); $promoteService = new PromoteService();
@ -277,12 +293,16 @@ class PromoteController extends ThinkController
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', I('post.account'))==false) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/', I('post.account'))==false) {
$this->error('账号只能是6-15位字母或数字'); $this->error('账号只能是6-15位字母或数字');
} }
$promote = M("promote", "tab_")->where(array("id" => $_POST['id']))->field('id, level')->find(); $promote = M("promote", "tab_")
->where(array("id" => $_POST['id']))
->field('id, level, company_belong, company_relation, company_id')
->find();
$data['account'] = I('post.account'); $data['account'] = I('post.account');
if ($this->accountExist($data['account'], $_POST['id'])) { if ($this->accountExist($data['account'], $_POST['id'])) {
$this->error('该账号已存在'); $this->error('该账号已存在');
} }
if (empty(I('company_id')) && $promote['level'] ==1) { $company_id = I('company_id');
if ($company_id <0 && $promote['level'] ==1) {
$this->error('请选择推广公司'); $this->error('请选择推广公司');
} }
empty(I('post.id')) ? : $data['id'] =I('post.id'); empty(I('post.id')) ? : $data['id'] =I('post.id');
@ -310,15 +330,33 @@ class PromoteController extends ThinkController
$ba = new \Admin\Model\BusinessAffairsModel(); $ba = new \Admin\Model\BusinessAffairsModel();
$ba->update_child($ba_id['ba_id'], $_REQUEST['ba_id'], $id); $ba->update_child($ba_id['ba_id'], $_REQUEST['ba_id'], $id);
} }
if (!empty(I('company_id')) && $promote['level'] ==1) {
$data['company_id'] = I('company_id'); if ($promote['level'] ==1) {//如果是会长才能修改的选项
if (!is_null($company_id)) {
$data['company_id'] = $company_id;//推广公司
}
$data['company_belong'] = I('company_belong');//工会归属
$data['company_relation'] = I('company_relation');//工会关系
} }
$res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data); $res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data);
if ($res !== false) { if ($res !== false) {
if (!empty(I('company_id')) && $promote['level'] ==1) {//修改会长底下推广员的推广公司 if ($promote['level'] == 1) {//修改会长底下推广员的推广公司
M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save([ $array = array();
'company_id' => I('company_id') if ($promote['company_id'] != $company_id) {
]); $array['company_id'] = I('company_id');
}
if ($promote['company_belong'] != I('company_belong')) {
$array['company_belong'] = I('company_belong');
}
if ($promote['company_relation'] != I('company_relation')) {
$array['company_relation'] = I('company_relation');
}
if ($array) {
$res = M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save($array);
}
} }
$this->success("修改成功", U('lists')); $this->success("修改成功", U('lists'));
} else { } else {

@ -407,4 +407,16 @@ class PromoteModel extends Model{
return $result; return $result;
} }
public function parseListData($result)
{
$parseData = array();
foreach ($result as $key => $value) {
$parseData[$key] = $value;
$parseData[$key]['company_belong_str'] = $value['company_belong'] ? '外团' : '内团';
}
return $parseData;
}
} }

@ -43,7 +43,8 @@
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所属推广公司</td> <td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所属推广公司</td>
<td class="r"> <td class="r">
<select name="company_id" id="company_id"> <select name="company_id" id="company_id">
<option value="0">请选择推广公司</option> <option value="-1">请选择推广公司</option>
<option value="0">万盟天下科技</option>
<volist name="companys" id="vo"> <volist name="companys" id="vo">
<option value="{$vo.id}">{$vo.company_name}</option> <option value="{$vo.id}">{$vo.company_name}</option>
</volist> </volist>
@ -65,6 +66,37 @@
<span class="notice-text">锁定状态下,推广员账号则无法登录</span> <span class="notice-text">锁定状态下,推广员账号则无法登录</span>
</td> </td>
</tr> </tr>
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" name="company_belong" checked="checked" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1" name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr style="display: none" id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1" name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr> <tr>
<td class="l">真实姓名:</td> <td class="l">真实姓名:</td>
<td class="r"> <td class="r">
@ -137,6 +169,15 @@ $(function(){
prov="{:substr($data['bank_area'],0,2)}"; prov="{:substr($data['bank_area'],0,2)}";
city="{:substr($data['bank_area'],2,2)}"; city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}"; ciarea="{:substr($data['bank_area'],4,2)}";
$("input[name=company_belong]").click(function () {
if ($(this).val() == 1) {
$('#company_relation').show();
} else {
$('#company_relation').hide();
}
});
}); });
//得到地区码 //得到地区码
function getAreaID(){ function getAreaID(){

@ -183,7 +183,8 @@
<select name="company_id" id="company_id" <select name="company_id" id="company_id"
<if condition="$data['level'] != 1"> <if condition="$data['level'] != 1">
disabled style="background:#CCCCCC" </if>> disabled style="background:#CCCCCC" </if>>
<option value="0">请选择推广公司</option> <option value="-1">请选择推广公司</option>
<option value="0" <?php echo (0 == $data['company_id'] ? 'selected':''); ?>>万盟天下科技</option>
<volist name="companys" id="vo"> <volist name="companys" id="vo">
<option value="{$vo.id}" <?php echo ($vo['id'] == $data['company_id'] ? 'selected':''); ?> <option value="{$vo.id}" <?php echo ($vo['id'] == $data['company_id'] ? 'selected':''); ?>
@ -193,6 +194,82 @@
<span class="notice-text">设置该推广员所属的推广公司</span> <span class="notice-text">设置该推广员所属的推广公司</span>
</td> </td>
</tr> </tr>
<!--如果是会长可编辑,其他人只能查看-->
<if condition="$data['level'] == 1">
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0"
<if condition="$data['company_belong'] == 0">
checked="checked"
</if>
name="company_belong" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1"
<if condition="$data['company_belong'] == 1">
checked="checked"
</if>
name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr <?php echo (0 == $data['company_belong'] ? 'style="display: none"':''); ?> id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0"
<?php echo (1 == $data['company_relation'] ? 'checked':''); ?>
name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1"
<?php echo (1 == $data['company_relation'] ? 'checked':''); ?>
name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<else/>
<!--非会长只能查看-->
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" <?php echo (0 == $data['company_belong'] ? 'checked':''); ?> disabled="disabled" name="company_belong" checked="checked" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1" <?php echo (1 == $data['company_belong'] ? 'checked':''); ?> disabled="disabled" name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr <?php echo (0 == $data['company_belong'] ? 'style="display: none"':''); ?> id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" <?php echo (0 == $data['company_relation'] ? 'checked':''); ?> disabled="disabled" name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1" <?php echo (1 == $data['company_relation'] ? 'checked':''); ?> disabled="disabled" name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
</if>
<tr> <tr>
<td class="l">注册时间:</td> <td class="l">注册时间:</td>
@ -353,6 +430,15 @@ $(function(){
city="{:substr($data['bank_area'],2,2)}"; city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}"; ciarea="{:substr($data['bank_area'],4,2)}";
//initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, prov, city, ciarea); //initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, prov, city, ciarea);
$("input[name=company_belong]").click(function () {
if ($(this).val() == 1) {
$('#company_relation').show();
} else {
$('#company_relation').hide();
}
});
}); });
// //得到地区码 // //得到地区码
// function getAreaID(){ // function getAreaID(){

@ -184,6 +184,7 @@
<th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th> <th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th>
<th>渠道类型</th> <th>渠道类型</th>
<th>所属会长</th> <th>所属会长</th>
<th>工会归属</th>
<th>商务专员</th> <th>商务专员</th>
<th>状态</th> <th>状态</th>
<th>身份状态</th> <th>身份状态</th>
@ -231,6 +232,7 @@
{:encryptStr(getTopPromote($data['id'])['account'])} {:encryptStr(getTopPromote($data['id'])['account'])}
</if> </if>
</td> </td>
<td>{$data['company_belong_str']}</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td> <td>{:get_business_affairs_account($data['ba_id'])}</td>
<td> <td>
<?php $status_str = get_info_status($data['status'],3); $status_str = $status_str ?: '待审核';?> <?php $status_str = get_info_status($data['status'],3); $status_str = $status_str ?: '待审核';?>

@ -940,6 +940,8 @@ class PromoteService {
'company_id' => $params['company_id'] ?? 0, 'company_id' => $params['company_id'] ?? 0,
'invite_code' => $params['invite_code'] ?? '', 'invite_code' => $params['invite_code'] ?? '',
'create_time' => time(), 'create_time' => time(),
'company_belong' => $params['company_belong'] ?? 0,
'company_relation' => $params['company_relation'] ?? 0,
]; ];
if ($parent) { if ($parent) {

Loading…
Cancel
Save