diff --git a/app/manager/controller/SellInfo.php b/app/manager/controller/SellInfo.php index e1e1cea..8de13db 100644 --- a/app/manager/controller/SellInfo.php +++ b/app/manager/controller/SellInfo.php @@ -23,6 +23,10 @@ class SellInfo extends Controller $where = []; if (!$manager_info['IsRoot']) { $where['ManagerId'] = $this->userinfo['OperaterID']; + } else { + if (!empty($_GET['manager_id'])) { + $where['ManagerId'] = $_GET['manager_id']; + } } $user_id_list = []; @@ -66,6 +70,12 @@ class SellInfo extends Controller } $user_where = ['UserId' => ['in', $user_id_list]]; $register_where = ['UserId' => ['in', $register_id_list]]; + //蘑菇条件单独摘出来 + $mogu_time_where1 = $time_where1.' AND `ProductId`=18'; + //获取本月蘑菇消费额 + $cost_mogu = $product_order_model->getAllMoney($mogu_time_where1, $user_where); + //获取本月蘑菇总退款 + $refund_cost_mogu = $product_order_model->getRefund($mogu_time_where1, $user_where); //获取所有消费额 $cost_data = $product_order_model->getAllMoney('', $user_where); //获取本月所有消费额 @@ -85,6 +95,8 @@ class SellInfo extends Controller $user_cost = $user_cost_data['money'] ?? 0; $all_cost_num = $all_cost_data['num'] ?? 0; $user_cost_num = $user_cost_data['num'] ?? 0; + $mogu_cost = $cost_mogu['money']??0; + $mogu_refund_cost = $refund_cost_mogu['money']??0; //上月 $user_last_month_cost = $user_last_month_cost_data['money'] ?? 0; //注册 @@ -100,6 +112,15 @@ class SellInfo extends Controller $today_new_user = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list); $refund = ($refund_cost_data ? $refund_cost_data['money'] : 0); + + //蘑菇 + $cost_mogu_data = round($mogu_cost-$mogu_refund_cost,2); + //其他营业额 + $cost_not_mogu_data = round($all_cost-$mogu_cost-$refund,2); + + $data['cost_mogu'] = "蘑菇营业额($cost_mogu_data)"; + $data['cost_not_mogu'] = "其他营业额($cost_not_mogu_data)"; + $data['sell_percent'] = "我的营业额($user_cost)/总营业额($all_cost)=" . $sell_percent . '%'; $data['cost_percent'] = "需维护的已消费客户($user_cost_num)/总的已消费客户($all_cost_num)=" . $cost_percent . '%'; $data['cost_register'] = "新注册客户购买率$user_register_cost_count/$user_register_count=" . $cost_register . '%'; @@ -112,6 +133,27 @@ class SellInfo extends Controller \result($data); } + /** + * @description: 获取所有销售管理信息 + * @param {*} + * @return {*} + */ + public function getManagerList() { + $manager_model = new Manager; + $manager_list = $manager_model->getAllList(); + $temp = []; + $temp[] = [ + 'value' => 0, + 'label' => '全部', + ]; + foreach ($manager_list as $info) { + $t['value'] = $info['id']; + $t['label'] = $info['RealName']; + $temp[] = $t; + } + \result($temp); + } + /** * @description: 获取所有客户销售信息 * @param {*} diff --git a/app/manager/controller/UserFollow.php b/app/manager/controller/UserFollow.php index 69d3aea..88b7642 100644 --- a/app/manager/controller/UserFollow.php +++ b/app/manager/controller/UserFollow.php @@ -4,8 +4,8 @@ * @version: * @Author: kangkang * @Date: 2020-10-13 19:52:37 - * @LastEditors: Please set LastEditors - * @LastEditTime: 2022-01-15 10:01:55 + * @LastEditors: “wanyongkang” “937888580@qq.com” + * @LastEditTime: 2023-08-10 16:41:56 */ namespace app\manager\controller; @@ -61,6 +61,11 @@ class UserFollow extends Controller if (!$manager_info['IsRoot']) { $where['ManagerId'] = $this->userinfo['OperaterID']; $sort_where['ManagerId'] = $this->userinfo['OperaterID']; + } else { + if (!empty($_GET['search']['manager_id'])) { + $where['ManagerId'] = $_GET['search']['manager_id']; + $sort_where['ManagerId'] = $_GET['search']['manager_id']; + } } if (isset($_GET['PageIndex'])) { @@ -90,11 +95,13 @@ class UserFollow extends Controller $date4 = date('Y-m-d H:i:s', strtotime($search['new_month']['e_time'])); } + //两个时间是单独分开的 不一定是连续两个月 //上月 $time_where1 .= " UpdateTime>='" . $date1 . "' and UpdateTime<='" . $date2 . "' "; //本月 $time_where2 .= " UpdateTime>='" . $date3 . "' and UpdateTime<='" . $date4 . "' "; + //消费金额 if (!empty($search['money2'])) { $is_screen = true; switch ($search['cost_type']) { @@ -159,14 +166,24 @@ class UserFollow extends Controller $limit = "$page,50"; } - $user_list = $user_model->getListPage($where, 'Id,follow_status,LoginCode,CreateTime,Wx,QQ,pay_time', 'id desc', $limit); + $user_list = $user_model->getListPage($where, 'Id,follow_status,LoginCode,CreateTime,Wx,QQ,pay_time,is_verify,ProductAccountCount,ManagerName', 'id desc', $limit); $list = []; $user_id_list = []; //获取用户列表 foreach ($user_list as $info) { + $isverify = ['未实名','已实名','被禁用']; + + $verify_status = $isverify[$info['is_verify']]; + if ($info['is_verify'] == 1) { + $istest = ['未测试','已测试']; + $verify_status = $istest[$info['ProductAccountCount']]; + } + + $info['ManagerName'] = $info['ManagerName']; $info['last_pay_time'] = $info['pay_time']; - $info['follow_status'] = $user_enum::$FollowStatus[$info['follow_status']]; + $info['is_verify'] = $verify_status; + $info['follow_status'] = $user_enum::$FollowStatus[$info['follow_status']]??$user_enum::$FollowStatus[1]; $info['UserName'] = mb_substr($info['LoginCode'], 0, 3) . '***' . mb_substr($info['LoginCode'], -3); $info['all_amount'] = 0; $info['PrevMonthAmount'] = 0; diff --git a/app/user/controller/User.php b/app/user/controller/User.php index 909f85f..ba14c69 100644 --- a/app/user/controller/User.php +++ b/app/user/controller/User.php @@ -368,4 +368,78 @@ class User extends Controller } } + //获取新注册的用户 + public function getRegisterList () + { + $where = ''; + $where = "`ManagerId` IS NULL"; + + $user_model = new UserModel; + $user_list = $user_model->getUserListPage($where, 'Id,LoginCode,CreateTime,Name,TestCountLimit,UseTestCount,ManagerId,id_code,is_verify', 'id desc', "50"); + + + foreach ($user_list as &$info){ + if(empty($info['id_code'])){ + $info['is_verify'] = '未认证'; + } else { + $info['id_code'] = substr($info['id_code'], 0, 6) . '***'; + if ($info['is_verify']==2) { + $info['is_verify'] = '禁用'; + } else { + $info['is_verify'] = $info['is_verify']?'认证成功':'认证失败'; + } + } + } + $data = [ + 'Code' => 10000, + 'Data' => $user_list, + 'Message' => '', + 'TotalCount' => (int)$user_model->getCount($where)['count'], + ]; + echo json_encode($data); + } + + //管理员领取新注册的用户 + public function getNewUser () + { + $uid = json_decode(file_get_contents("php://input"), true); + if (empty($uid)) { + $data = [ + 'Code' => -30000, + 'Message' => '非法操作', + ]; + echo json_encode($data); + die; + } + + $where = ['Id' => $uid]; + + $user_model = new UserModel; + $user_info = $user_model->getOne($where,'ManagerId'); + if (!empty($user_info['ManagerId'])) { + + $data = [ + 'Code' => -20000, + 'Message' => '已经被其他人领取', + ]; + echo json_encode($data); + die; + } else { + + $updata = [ + 'ManagerId' => $this->userinfo['OperaterID'], + 'ManagerName' => $this->userinfo['RealName'], + ]; + + $user_model->updateOne($where, $updata); + + $data = [ + 'Code' => 10000, + 'Message' => '领取成功', + ]; + echo json_encode($data); + } + } + + } diff --git a/enum/user/User.php b/enum/user/User.php index 1d49a9b..77382cf 100644 --- a/enum/user/User.php +++ b/enum/user/User.php @@ -4,8 +4,8 @@ * @version: * @Author: kangkang * @Date: 2020-10-22 15:35:49 - * @LastEditors: Please set LastEditors - * @LastEditTime: 2022-01-14 18:34:25 + * @LastEditors: “wanyongkang” “937888580@qq.com” + * @LastEditTime: 2023-08-10 16:36:40 */ namespace enum\user; @@ -13,18 +13,9 @@ class User { // 1待跟进-未购买 2跟进超时-未购买 3待跟进-消费减少 4跟进超时-消费减少 5流失-需求减少 6流失-暂时不用 7流失-价格问题 8流失-产品问题 9流失-也可自定义 10高意向客户 11已完成 public static $FollowStatus = [ - 1 => '待跟进-未购买', - 2 => '跟进超时-未购买', - 3 => '待跟进-消费减少', - 4 => '跟进超时-消费减少', - 5 => '流失-需求减少', - 6 => '流失-暂时不用', - 7 => '流失-价格问题', - 8 => '流失-产品问题', - 9 => '流失-其他原因', - 10 => '高意向客户', - 11 => '已完成', - 12 => '无联系通道', + 1 => '待跟进', + 2 => '跟进中', + 3 => '跟进完成', ]; public static $UnfollowNotBuy = 1;