assign('lists', $lists); return $this->fetch(); } /** * order: 哆啦猫客户来源渠道 * Desc: 增加渠道 */ public function channel_add(){ if ($this->request->isAjax()) { $post = $this->request->post(); $lists = CustomLogic::channel_add($post); $this->_success('增加渠道成功'); } $this->assign('menu_lists', CustomLogic::Menu()); return $this->fetch(); } public function staff_del($id){ $del=Db::name('staffchannel')->where('pid',$id)->find(); if($del){ $this->_error('请先删除下级分类'); }else{ $del=Db::name('staffchannel')->where('id',$id)->delete(); $this->_success('删除成功'); } } public function staff_edit($id){ if ($this->request->isAjax()) { $post = $this->request->post(); $lists = CustomLogic::ordertypeedit($post); $this->_success('修改客户渠道成功'); } $this->assign('info', CustomLogic::info($id)); $this->assign('menu_lists', CustomLogic::Menu($id)); return $this->fetch(); } //公海客户列表 public function list(){ if ($this->request->isAjax()) { $get = $this->request->get(); $lists = CustomLogic::list($get); $this->_success('',$lists); } return $this->fetch(); } //修改派单人员信息 public function dispatch(){ if ($this->request->isAjax()) { $id=$this->request->get('id'); $custom=Db::name('user_address')->where('id',$id)->update(['admin_id'=>$this->request->post('admin_id')]); $this->_success('修改跟踪人员成功'); } $user=Db::name('admin')->select(); $this->assign('user',$user); return $this->fetch(); } public function custom(){ $id=$this->request->get('id'); $result['comment']=Db::name('custom')->where('custom_id',$id)->limit(7)->order('id desc')->select(); foreach($result['comment'] as &$item){ $admin=Db::name('admin')->where('id',$item['admin_id'])->find(); $item['name']=$admin['name']; $item['phone']=$admin['phone']; } $this->assign('result',$result); $this->assign('id',$id); return $this->fetch(); } //我的客户 public function usercustomlist(){ if ($this->request->isAjax()) { $get = $this->request->get(); $lists = CustomLogic::userlist($get); $this->_success('',$lists); } $label_id=Db::name('user_label')->where('del','<>',1)->select(); $this->assign('label_id', $label_id); return $this->fetch(); } //写入跟进的消息 public function comment(){ $data['admin_id'] = session('admin_info.id'); //获取员工的id $data['custom_id']=$this->request->post('custom_id'); $data['connect']=$this->request->post('reply_msg'); $data['create_time'] = time(); $insert_id=Db::name('custom')->insertGetId($data); $datas=Db::name('custom')->where('id',$insert_id)->find(); $datas['create_time']=date("Y年m月d日 H:i", $datas['create_time']); $custom=Db::name('admin')->where('id', $datas['admin_id'])->find(); $datas['name']= $custom['name']; $datas['phone']= $custom['phone']; if($insert_id){ $this->_success('增加成功',$datas); } } //客户的备注的信息 public function user_remarks() { // 获取的 if ($this->request->isAjax() && $this->request->isGet()){ $get = $this->request->get(); $detail = CustomLogic::user_remarks($get, 'get'); $this->_success('获取成功', $detail); } // 提交的 if ($this->request->isAjax() && $this->request->isPost()) { $post = $this->request->post(); $result = CustomLogic::user_remarks($post, 'post'); if ($result) { $this->_success('保存成功'); } $this->error('保存失败'); } } //管理员备注 public function admin_remarks() { // 获取的 if ($this->request->isAjax() && $this->request->isGet()){ $get = $this->request->get(); $detail = CustomLogic::admin_remarks($get, 'get'); $this->_success('获取成功', $detail); } // 提交的 if ($this->request->isAjax() && $this->request->isPost()) { $post = $this->request->post(); $result = CustomLogic::admin_remarks($post, 'post'); if ($result) { $this->_success('保存成功'); } $this->error('保存失败'); } } //保洁师备注信息 public function staff_remarks() { // 获取的 if ($this->request->isAjax() && $this->request->isGet()){ $get = $this->request->get(); $detail = CustomLogic::staff_remarks($get, 'get'); $this->_success('获取成功', $detail); } // 提交的 if ($this->request->isAjax() && $this->request->isPost()) { $post = $this->request->post(); $result = CustomLogic::staff_remarks($post, 'post'); if ($result) { $this->_success('保存成功'); } $this->error('保存失败'); } } //编辑客户的档案 public function edit($id){ if ($this->request->isAjax()) { $post = $this->request->post(); $detail = CustomLogic::edit($post); $this->_success('修改成功'); } $this->assign('info', json_encode(UserLogic::adders($id), JSON_UNESCAPED_UNICODE)); $this->assign('category_lists', json_encode(StaffLogic::getAllTree(), JSON_UNESCAPED_UNICODE)); $brand_lists=Db::name('staffchannel')->where('deletetime','NULL')->select(); $this->assign('brand_lists', json_encode($brand_lists, JSON_UNESCAPED_UNICODE)); return $this->fetch(); } //查看客户档案的信息 public function infolist(){ if ($this->request->isAjax()) { } return $this->fetch(); } //客户的下单详情 public function Customlist(){ $post = $this->request->get(''); $list = CustomLogic::Customlist($post); $this->_success('',$list); } //删除客户的基本信息 public function del(){ $post = $this->request->post(); if($this->admin_id==5){ $list = CustomLogic::del($post); $this->_success('删除客户数据成功'); }else{ $this->error('无权限删除'); } } }