|
|
@@ -38,18 +38,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
- ViewBag.SysUserName = SysUserName;
|
|
|
-
|
|
|
- string Condition = "";
|
|
|
- Condition += "ProductName:\"" + data.ProductName + "\",";
|
|
|
- Condition += "MerchantClassId:\"" + data.MerchantClassId + "\",";
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(Condition))
|
|
|
- {
|
|
|
- Condition = Condition.TrimEnd(',');
|
|
|
- Condition = ", where: {" + Condition + "}";
|
|
|
- }
|
|
|
- ViewBag.Condition = Condition;
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
@@ -61,26 +49,30 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 商品信息列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public JsonResult IndexData(Products data, int page = 1, int limit = 30)
|
|
|
+ public JsonResult IndexData(Products data, string ColId, int page = 1, int limit = 30)
|
|
|
{
|
|
|
- Dictionary<string, string> ProductFareTempDic = new ProductDictionary().getProductFareTempDic(data.MerchantId);
|
|
|
- Dictionary<string, string> MerchantClassDic = new MerchantDictionary().getMerchantClassDic(data.MerchantId);
|
|
|
+ // Dictionary<string, string> ProductFareTempDic = new ProductDictionary().getProductFareTempDic(data.MerchantId);
|
|
|
+ // Dictionary<string, string> MerchantClassDic = new MerchantDictionary().getMerchantClassDic(data.MerchantId);
|
|
|
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
- Fields.Add("ColId", "1"); //分类
|
|
|
+ // Fields.Add("ColId", "1"); //分类
|
|
|
Fields.Add("ProductName", "2"); //商品名称
|
|
|
- Fields.Add("MerchantClassId", "1"); //商家分类
|
|
|
+ // Fields.Add("MerchantClassId", "1"); //商家分类
|
|
|
string condition = "";
|
|
|
- if (SysRealRole == 3)
|
|
|
+ // if (SysRealRole == 3)
|
|
|
+ // {
|
|
|
+ // condition += " and MerchantId=" + SysId;
|
|
|
+ // }
|
|
|
+ if (!string.IsNullOrEmpty(ColId))
|
|
|
{
|
|
|
- condition += " and MerchantId=" + SysId;
|
|
|
+ condition += " and ColId like '%" + ColId + "%'";
|
|
|
}
|
|
|
Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Products", Fields, "Id desc", "False", page, limit, condition);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
|
- dic["FareTemplateId"] = new DictionaryClass().getDictionaryNameByKey(ProductFareTempDic, dic["FareTemplateId"].ToString());
|
|
|
- dic["MerchantClassId"] = new DictionaryClass().getDictionaryNameByKey(MerchantClassDic, dic["MerchantClassId"].ToString());
|
|
|
+ // dic["FareTemplateId"] = new DictionaryClass().getDictionaryNameByKey(ProductFareTempDic, dic["FareTemplateId"].ToString());
|
|
|
+ // dic["MerchantClassId"] = new DictionaryClass().getDictionaryNameByKey(MerchantClassDic, dic["MerchantClassId"].ToString());
|
|
|
dic["Status"] = dic["Status"].ToString() == "1" ? "已上架" : "已下架";
|
|
|
}
|
|
|
return Json(obj);
|
|
|
@@ -118,7 +110,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
Products product = db.Products.FirstOrDefault(m => m.ProductName == data.ProductName);
|
|
|
if (product != null)
|
|
|
- {
|
|
|
+ {
|
|
|
return "商品名称已存在";
|
|
|
}
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
@@ -391,19 +383,19 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#region 根据分类获取商品列表
|
|
|
|
|
|
- public List<Dictionary<string, object>> GetProductByCol(string ColIds,string MerchantIds)
|
|
|
- {
|
|
|
+ public List<Dictionary<string, object>> GetProductByCol(string ColIds, string MerchantIds)
|
|
|
+ {
|
|
|
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
|
|
|
IQueryable<Products> products = db.Products;
|
|
|
if (!string.IsNullOrEmpty(ColIds))
|
|
|
- {
|
|
|
+ {
|
|
|
List<string> colidlist = ColIds.Split(',').ToList();
|
|
|
products = products.Where(m => colidlist.Contains(m.ColId));
|
|
|
}
|
|
|
@@ -419,7 +411,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
products = products.OrderByDescending(m => m.Id);
|
|
|
foreach (Products product in products.ToList())
|
|
|
- {
|
|
|
+ {
|
|
|
Dictionary<string, object> row = new Dictionary<string, object>();
|
|
|
row.Add("title", product.ProductName);
|
|
|
row.Add("value", product.Id);
|
|
|
@@ -460,7 +452,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|