跟进维护

This commit is contained in:
“wanyongkang”
2023-08-10 17:34:39 +08:00
parent b8ec386b02
commit dcf0a909f6
4 changed files with 142 additions and 18 deletions

View File

@@ -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 {*}

View File

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