diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 54fb16bb2..512e9206b 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -305,6 +305,12 @@ class PromoteCompanyController extends ThinkController $this->assign('data', $data); $this->display(); } + + public function marketingDirectorShow($ids=[], $isShow=0) + { + $upt = M('promote_company','tab_')->where(['id'=>['in', $ids]])->save(['marketing_director_show'=>$isShow]); + return $upt ? $this->success('更新成功'): $this->error('更新失败'); + } //编辑 @@ -577,7 +583,7 @@ WHERE old_change_promote_id in ({$promoteData})"; } $list = M('service_agreement', 'tab_') ->field("tab_service_agreement.*, group_concat(distinct(tab_promote_company.company_name)) as company_name") - ->join('tab_promote_company on tab_promote_company.service_agreement_show = tab_service_agreement.id', 'LEFT')->where($map)->page($p, $row)->order("status desc")->select(); + ->join('tab_promote_company on tab_promote_company.service_agreement_show = tab_service_agreement.id', 'LEFT')->where($map)->group('tab_service_agreement.id asc')->page($p, $row)->order("status desc")->select(); $count = M('service_agreement', 'tab_')->where($map)->count(); $page = set_pagination($count, $row); if ($page) { @@ -590,6 +596,20 @@ WHERE old_change_promote_id in ({$promoteData})"; public function serviceAgreementSave($id=0, $delete=0) { if (IS_POST) { + if (!empty(I('ids'))) { + $ids = is_array(I('ids')) ? I('ids') : [I('ids')]; + if ($delete) { + // 获取默认合同id + $defaultService = M('service_agreement', 'tab_')->where(['status'=>2])->find(); + if(in_array($defaultService['id'], $ids)) { + return $this->error('无法删除默认模板'); + } + $useingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>['in', $ids]])->find(); + if (!empty($useingService)) return $this->error('有正在使用该服务合同的公司,无法删除'); + $result = M('service_agreement', 'tab_')->where(['id'=>['in', $ids]])->delete(); + return $result ? $this->success('删除完成') : $this->error('删除失败'); + } + } if (empty($_POST['name']) || empty($_POST['content'])) { return $this->error('请填写完整内容'); } @@ -604,13 +624,7 @@ WHERE old_change_promote_id in ({$promoteData})"; return $result ? $this->success('生成协议完成') : $this->error('生成协议失败'); } } else { - if ($id) { - if ($delete) { - $useingService = M('promote_company', 'tab_')->where(['service_agreement_show'=>$id])->find(); - if (!empty($useingService)) return $this->error('有正在使用该服务协议的公司,无法删除'); - $result = M('service_agreement', 'tab_')->where(['id'=>$id])->delete(); - return $result ? $this->success('删除完成') : $this->error('删除失败'); - } + if (!empty($id)) { $info = M('service_agreement', 'tab_')->where(['id'=>$id])->find(); if (empty($info)) return $this->error('未找到协议'); $this->assign('info', $info); diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index 27564e782..d2a55b961 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -34,14 +34,18 @@ padding: 3px; height: 30px; } - + .clearfix:after { + content:""; + display: block; + clear:both; + } -
+
新增 @@ -91,6 +95,15 @@
+ +
@@ -98,6 +111,9 @@ + + + 操作 合作方名称 对应平台 @@ -125,6 +141,7 @@ + 查看 编辑 diff --git a/Application/Admin/View/PromoteCompany/service_agreement_list.html b/Application/Admin/View/PromoteCompany/service_agreement_list.html index 5770762cc..4c616895b 100644 --- a/Application/Admin/View/PromoteCompany/service_agreement_list.html +++ b/Application/Admin/View/PromoteCompany/service_agreement_list.html @@ -34,9 +34,9 @@
- +
@@ -55,9 +55,9 @@ - + ID 标题 是否默认合同 @@ -74,11 +74,15 @@ - + {$data.id} {$data.name} {$data.status} - + +
+ {$data.company_name} +
+ {:get_admin_nickname($data['creator'])} {$data.created_time|date='Y-m-d H:i:s',###} @@ -203,5 +207,7 @@ }); }) + +