Commit 23aa6918 authored by 黄奎's avatar 黄奎

页面修改

parent c4664bc2
......@@ -39,4 +39,30 @@ namespace Mall.Model.Entity.User
/// </summary>
public string QIds { get; set; }
}
/// <summary>
/// 门店预约实体
/// </summary>
public class StoreReserveDate
{
/// <summary>
/// 天数
/// </summary>
public DateTime DayDate { get; set; }
/// <summary>
/// 日期字符串
/// </summary>
public string DayDateStr { get; set; }
/// <summary>
/// 星期
/// </summary>
public string WeekDayStr { get; set; }
/// <summary>
/// 具体时间点
/// </summary>
public List<string> TimeList { get; set; }
}
}
......@@ -3530,16 +3530,96 @@ namespace Mall.Module.Product
}
};
}
var servicePersionList = reserve_ServicePersonalRepository.GetServicePersonalList(new Model.Extend.Reserve.RB_Reserve_ServicePersonal_Extend()
#region 门店相关
string categoryIds = "0";
if (model.CategoryList != null && model.CategoryList.Count > 0)
{
StoreId = storeId,
})?.ToList() ?? new List<Model.Extend.Reserve.RB_Reserve_ServicePersonal_Extend>();
categoryIds = string.Join(",", model.CategoryList.Select(qitem => qitem.CategoryId));
}
var servicePersionList = reserve_ServicePersonalRepository.GetServicePersonalListExtRepository(storeId,model.Id, categoryIds)?.ToList() ?? new List<Model.Extend.Reserve.RB_Reserve_ServicePersonal_Extend>();
var storeModel = storesRepository.GetEntity(storeId);
List<StoreReserveDate> storeDateList = new List<StoreReserveDate>();
DateTime currentDay = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
for (int i = 0; i <= 7; i++)
{
var storeDateModel = new StoreReserveDate()
{
DayDate = Convert.ToDateTime(DateTime.Now.AddDays(i).ToString("yyyy-MM-dd")),
DayDateStr = DateTime.Now.AddDays(i).ToString("MM-dd"),
WeekDayStr = (i == 0 ? "今天" : "周" + Common.Plugin.CommonHelper.GetWeekDay(DateTime.Now.AddDays(i))),
TimeList = new List<string>()
};
for (var j = 0; j < 48; j++)
{
string tempTimeStr = "";
if (j % 2 == 0)
{
tempTimeStr=currentDay.AddHours((j / 2)).ToString("HH:mm");
}
else
{
tempTimeStr = currentDay.AddHours((Convert.ToDouble(j) / 2.0)).ToString("HH:mm");
}
storeDateModel.TimeList.Add(tempTimeStr);
}
storeDateList.Add(storeDateModel);
}
if (storeModel != null && storeModel.Id > 0)
{
{
//全天营业
if (storeModel.IsAllDay == 1)
{
List<string> tempTimeList = new List<string>();
var firstModel = storeDateList[0];
foreach (var timeItem in firstModel.TimeList)
{
if (DateTime.Now < Convert.ToDateTime(firstModel.DayDate.ToString("yyyy-MM-dd") + " " + timeItem))
{
tempTimeList.Add(timeItem);
}
}
firstModel.TimeList = tempTimeList;
}
//有具体时间
else
{
for (var i = 0; i < storeDateList.Count; i++)
{
List<string> tempTimeList = new List<string>();
var firstModel = storeDateList[i];
DateTime startTime = Convert.ToDateTime(firstModel.DayDate.ToString("yyyy-MM-dd") + " " + storeModel.StartTime);
DateTime endTime = Convert.ToDateTime(firstModel.DayDate.ToString("yyyy-MM-dd") + " " + storeModel.EndTime);
if (i == 0)
{
foreach (var timeItem in firstModel.TimeList)
{
DateTime currentTime = Convert.ToDateTime(firstModel.DayDate.ToString("yyyy-MM-dd") + " " + timeItem);
if (DateTime.Now < currentTime && currentTime > startTime && currentTime < endTime)
{
tempTimeList.Add(timeItem);
}
}
firstModel.TimeList = tempTimeList;
}
else
{
foreach (var timeItem in firstModel.TimeList)
{
DateTime currentTime = Convert.ToDateTime(firstModel.DayDate.ToString("yyyy-MM-dd") + " " + timeItem);
if (currentTime > startTime && currentTime < endTime)
{
tempTimeList.Add(timeItem);
}
}
firstModel.TimeList = tempTimeList;
}
}
}
}
#endregion
return new
{
goods = new
......@@ -3674,7 +3754,8 @@ namespace Mall.Module.Product
qitem.Name,
qitem.Major,
Gender = qitem.Gender.ToInt()
})
}),
storeDateList= storeDateList.Select(qitem => new {qitem.DayDateStr,qitem.WeekDayStr,qitem.TimeList})
},
delivery = ""
};
......
......@@ -148,5 +148,32 @@ LEFT JOIN (SELECT ServicePersonalId,COUNT(*) as CommentNum from rb_goods_commen
}
return Get<RB_Reserve_ServicePersonal_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 根据门店、商品编号和商品分类编号获取服务人员列表
/// </summary>
/// <param name="storeId"></param>
/// <param name="productId"></param>
/// <param name="categoryIds"></param>
/// <returns></returns>
public List<RB_Reserve_ServicePersonal_Extend> GetServicePersonalListExtRepository(int storeId,int productId,string categoryIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT DISTINCT A.*
FROM RB_Reserve_ServicePersonal AS A
INNER JOIN
(
SELECT * FROM rb_reserve_servicepersonalproduct WHERE ServiceType=3 AND `Status`=0
UNION
SELECT * FROM rb_reserve_servicepersonalproduct WHERE ServiceType=2 AND `Status`=0 AND ProductId={0}
UNION
SELECT * FROM rb_reserve_servicepersonalproduct WHERE ServiceType=1 AND `Status`=0 AND ProductId IN({1})
) AS B ON A.ID=B.ServiceId
WHERE A.Status=0 AND A.StoreId={2}
", productId, categoryIds, storeId);
return Get<RB_Reserve_ServicePersonal_Extend>(builder.ToString()).ToList();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment