/// <summary> /// 添加跟进日志 /// </summary> /// <param name="reception">接待序号</param> /// <param name="trackingPeopleName">跟进人姓名</param> /// <returns></returns> public ActionResult AddTrackLogView(string reception) { Session["method"] = "N"; SetEmployee(); ViewBag.Store = store; ViewBag.Employee = employeeName; ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长; ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师; ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售; CustomerTrackingModel customerTrackingModel = new CustomerTrackingModel { 店铺 = store, 跟进人 = employeeName }; if (reception != null) { customerTrackingModel.接待序号 = reception; customerTrackingModel.接待ID = customerInfoBLL.GetModel(p => p.接待序号 == reception).ID; } var trackingPeopleId = storeEmployeesBLL.GetModel(p => p.姓名 == employeeName).ID; var customerModels = customerInfoBLL.GetModels(p => p.跟进人ID == trackingPeopleId); if (customerModels.Count() == 0)//如果没有查到匹配的跟进信息 { string str = string.Format("<script>alert('当前没有匹配到任何您可以进行跟进的客户,请让店长为您添加!');parent.location.href='TrackLogIndex';</script>"); return(Content(str)); } ViewBag.ReceptionSer = customerTrackingModel.接待序号; return(View(customerTrackingModel)); }
/// <summary> /// 申请设计 /// </summary> /// <returns></returns> public ActionResult ApplyDesignView(int?recepitonID) { Session["method"] = "N"; SetEmployee(); ViewBag.Store = store; ViewBag.Employee = employeeName; ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长; ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师; ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售; List <销售_接待记录> customerInfos = new List <销售_接待记录>(); DesignSubmitModel designSubmitModel = new DesignSubmitModel(); if (recepitonID != null && recepitonID != 0) { var model = customerInfoBLL.GetModel(p => p.ID == recepitonID); designSubmitModel.客户姓名 = model.客户姓名; designSubmitModel.家庭成员 = model.家庭成员; designSubmitModel.职业 = model.家庭成员; designSubmitModel.楼盘具体位置 = model.安装地址; designSubmitModel.职业 = model.客户职业; designSubmitModel.联系方式 = model.客户电话; designSubmitModel.客户喜好 = model.主导者喜好风格; designSubmitModel.客户在意品牌或已购买品牌 = model.比较品牌; designSubmitModel.装修风格 = model.装修风格; designSubmitModel.装修进度 = model.装修进度; designSubmitModel.预算 = model.预算金额; designSubmitModel.接待记录ID = model.ID; designSubmitModel.销售人员 = employeeName; } else if (employeeID != 0) { customerInfos = customerInfoBLL.GetModels(p => p.接待人ID == employeeID || p.跟进人ID == employeeID).ToList(); SelectList customerInfosSelectListItem = new SelectList(customerInfos, "客户电话", "客户电话"); ViewBag.CustomerPhoneNumber = customerInfosSelectListItem; } ViewBag.EmployeeName = employeeName; return(View(designSubmitModel)); }
// GET: Customer /// <summary> /// 展示客户信息 /// </summary> /// <returns></returns> public ViewResult CustomerIndex(string sortOrder, string searchString, string currentFilter, int?page) { Session["method"] = "N"; SetEmployee(); ViewBag.Store = store; ViewBag.Employee = employeeName; ViewBag.CustomerCurrentSort = sortOrder; ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长; ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师; ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售; ViewBag.CustomerDate = sortOrder == "first"? "first_desc" : "first";//该排序作废 ViewBag.CustomerID = sortOrder == "last" ? "last_desc" : "last"; List <CustomerInfoModel> customerInfoModels = new List <CustomerInfoModel>(); if (BuildCustomerInfo() != null) { customerInfoModels = BuildCustomerInfo().ToList();//将顾客接待信息数据优化 } if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CustomerCurrentFilter = searchString;//获得前端传回来的搜索关键词 if (!string.IsNullOrEmpty(searchString)) { customerInfoModels = customerInfoModels.Where(w => w.客户电话 == searchString).ToList();//通过电话查找 } //Session["Name"] = customerInfoModels.FirstOrDefault(); #region 排序,默认按ID升序 switch (sortOrder) { case "first_desc": customerInfoModels = customerInfoModels.OrderByDescending(w => w.接待日期).ToList(); break; case "last_desc": customerInfoModels = customerInfoModels.OrderByDescending(w => w.ID).ToList(); break; case "last": customerInfoModels = customerInfoModels.OrderBy(w => w.ID).ToList(); break; default: customerInfoModels = customerInfoModels.OrderBy(w => w.接待日期).ToList(); break; } #endregion int pageSize = 10; int pageNumber = (page ?? 1); ViewBag.employeeName = employeeName; //给前端传入当前操作人 ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.姓名 == employeeName).是否店长; //给前端传入当前操作人职位 ViewBag.Goals = goals; //总共跟进数目 ViewBag.AvailableGoals = goals - customerInfoBLL.GetModels(p => p.跟进人ID == employeeID).Count(); //剩余跟进数目 return(View(customerInfoModels.ToPagedList(pageNumber, pageSize))); }
/// <summary> /// 构建客户信息 /// </summary> private IQueryable <CustomerInfoModel> BuildCustomerInfo() { List <CustomerInfoModel> customerInfoModelsList = new List <CustomerInfoModel>(); var customer = customerInfoBLL.GetModels(p => p.店铺ID == storeID); //查询当前店铺所有顾客接待信息 if (customer != null) { foreach (var item in customer) { CustomerInfoModel customerInfo = new CustomerInfoModel(); try { customerInfo.ID = item.ID; customerInfo.店铺 = storeBLL.GetModel(p => p.ID == item.店铺ID).称; customerInfo.接待人 = storeEmployeesBLL.GetModel(p => p.ID == item.接待人ID).姓名; customerInfo.接待序号 = item.接待序号; customerInfo.接待日期 = item.接待日期.ToString("d"); customerInfo.主导者 = item.主导者; customerInfo.主导者喜好风格 = item.主导者喜好风格; customerInfo.使用空间 = item.使用空间; customerInfo.出店时间 = item.出店时间; customerInfo.制单日期 = item.制单日期; customerInfo.行人 = item.行人; customerInfo.如何得知品牌 = item.如何得知品牌; customerInfo.安装地址 = item.安装地址; customerInfo.客户姓名 = item.客户姓名; customerInfo.客户建议 = item.客户建议; customerInfo.客户来源 = item.客户来源; customerInfo.客户电话 = item.客户电话; customerInfo.客户着装 = item.客户着装; customerInfo.客户类别 = item.客户类别; customerInfo.客户类型 = item.客户类型; customerInfo.客户职业 = item.客户职业; customerInfo.家庭成员 = item.家庭成员; customerInfo.年龄段 = item.年龄段; customerInfo.性别 = item.性别; customerInfo.是否有意向 = item.是否有意向; if (item.更新人 != null) { customerInfo.更新人 = storeEmployeesBLL.GetModel(p => p.ID == item.更新人).姓名; } customerInfo.更新日期 = item.更新日期; customerInfo.来店次数 = item.来店次数; customerInfo.比较品牌 = item.比较品牌; customerInfo.特征 = item.特征; customerInfo.社交软件 = item.社交软件; customerInfo.装修情况 = item.装修情况; customerInfo.装修进度 = item.装修进度; customerInfo.装修风格 = item.装修风格; customerInfo.设计师 = item.设计师; if (item.跟进人ID != null) { customerInfo.跟进人 = storeEmployeesBLL.GetModel(p => p.ID == item.跟进人ID).姓名; } customerInfo.返点 = item.返点; customerInfo.进店时长 = item.进店时长; customerInfo.进店时间 = item.进店时间; customerInfo.预报价折扣 = item.预报价折扣; customerInfo.预算金额 = item.预算金额; customerInfo.预计使用时间 = item.预计使用时间; } catch (Exception ex) { throw ex; } customerInfoModelsList.Add(customerInfo); } } return(customerInfoModelsList.AsEnumerable().AsQueryable()); }
/// <summary> /// 门店管理首页 /// </summary> /// <returns></returns> public ActionResult Index() { string userName = HttpContext.User.Identity.Name; if (userName != null) { var employees = HttpContext.Session["Employee"] as Employees; ViewBag.Store = employees.店铺; ViewBag.IsManager = employees.是否店长; ViewBag.Employee = employees.姓名; ViewBag.IsManager = storeEmployeesBLL.GetModel(p => p.ID == employees.ID).是否店长; ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employees.ID).是否设计师; ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employees.ID).是否销售; } SetEmployee(); ViewBag.CustomerCount = "" + customerInfoBLL.GetModels(p => p.店铺ID == storeID).Count(); ViewBag.DesignApplyCount = "" + DesignSubmitBLL.GetModels(p => p.店铺ID == storeID).Count(); ViewBag.DesignResultCount = "" + DesignResultBLL.GetModels(p => p.店铺ID == storeID).Count(); //创建区域1 var series1 = new Series(); series1.Name = "全年接待数据"; //Poin数组 Point[] series1Points = new Point[12]; for (int i = 1; i < 13; i++) { var n = customerInfoBLL.GetModels(p => p.店铺ID == storeID && p.接待日期.Month == i).Count(); series1Points[i - 1] = new Point() { X = i, Y = n * 10 }; } series1.Data = new Data(series1Points); //创建区域2 var series2 = new Series(); series2.Name = "本月接待数据"; //获取本月有多少天 var month_days = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); //Point数组 Point[] series2Points = new Point[month_days]; var n1 = customerInfoBLL.GetModels(p => p.店铺ID == storeID && p.接待日期.Month == DateTime.Now.Month); for (int i = 0; i < month_days; i++) { var m = n1.Where(p => p.接待日期.Day == i + 1).Count(); series2Points[i] = new Point() { X = i + 1, Y = m }; } series2.Data = new Data(series2Points); //把2个区域加入到Series集合中 var chartSeries = new List <Series>(); chartSeries.Add(series1); var chartSeries2 = new List <Series>(); chartSeries2.Add(series2); //创建chart model var chart1 = new Highcharts("接待年度统计"); chart1.InitChart(new Chart() { DefaultSeriesType = ChartTypes.Line }) .SetTitle(new Title() { Text = "接待年度统计" }) .SetSeries(chartSeries.ToArray()); ViewBag.ChartModel1 = chart1; var chart2 = new Highcharts("接待月统计"); chart2.InitChart(new Chart() { DefaultSeriesType = ChartTypes.Column }) .SetTitle(new Title() { Text = "接待月统计" }) .SetSeries(chartSeries2.ToArray()); ViewBag.ChartModel2 = chart2; return(View()); }