Commit a0862604 authored by 吴春's avatar 吴春

提交下单页面返回自定义表单

parent a7e50a4f
...@@ -21,6 +21,7 @@ using Mall.Repository.Product; ...@@ -21,6 +21,7 @@ using Mall.Repository.Product;
using Mall.Repository.Reserve; using Mall.Repository.Reserve;
using Mall.Repository.User; using Mall.Repository.User;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -394,6 +395,13 @@ namespace Mall.Module.Product ...@@ -394,6 +395,13 @@ namespace Mall.Module.Product
/// </summary> /// </summary>
private readonly Repository.Product.RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository(); private readonly Repository.Product.RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository();
/// <summary>
/// 关联商品仓储层对象
/// </summary>
private readonly Repository.TradePavilion.RB_Custom_FormRepository custom_FormRepository = new Repository.TradePavilion.RB_Custom_FormRepository();
#region 购物车 #region 购物车
/// <summary> /// <summary>
...@@ -434,7 +442,7 @@ namespace Mall.Module.Product ...@@ -434,7 +442,7 @@ namespace Mall.Module.Product
List<RB_Goods_Relevance_Extend> goodsRelevanceList = new List<RB_Goods_Relevance_Extend>(); List<RB_Goods_Relevance_Extend> goodsRelevanceList = new List<RB_Goods_Relevance_Extend>();
if (!string.IsNullOrEmpty(relationIds)) if (!string.IsNullOrEmpty(relationIds))
{ {
goodsRelevanceList= goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() { QRelevanceIds = relationIds }); goodsRelevanceList = goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() { QRelevanceIds = relationIds });
} }
#region 微店价格 #region 微店价格
...@@ -456,7 +464,7 @@ namespace Mall.Module.Product ...@@ -456,7 +464,7 @@ namespace Mall.Module.Product
foreach (var item in list) foreach (var item in list)
{ {
item.EduData = goodsRepository.ParsingEduJsonRepository(item.EduJsonData); item.EduData = goodsRepository.ParsingEduJsonRepository(item.EduJsonData);
item.GoodsRelevanceList = goodsRelevanceList?.Where(qitem => qitem.RelevanceId == item.RelationId)?.ToList()??new List<RB_Goods_Relevance_Extend> (); item.GoodsRelevanceList = goodsRelevanceList?.Where(qitem => qitem.RelevanceId == item.RelationId)?.ToList() ?? new List<RB_Goods_Relevance_Extend>();
item.CoverImage = ""; item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]") if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{ {
...@@ -731,7 +739,7 @@ namespace Mall.Module.Product ...@@ -731,7 +739,7 @@ namespace Mall.Module.Product
TenantId = demodel.TenantId, TenantId = demodel.TenantId,
UpdateDate = DateTime.Now, UpdateDate = DateTime.Now,
UserId = demodel.UserId, UserId = demodel.UserId,
RelationId=demodel.RelationId, RelationId = demodel.RelationId,
}) > 0; }) > 0;
} }
if (flag) if (flag)
...@@ -918,7 +926,7 @@ namespace Mall.Module.Product ...@@ -918,7 +926,7 @@ namespace Mall.Module.Product
{ {
string orderDetailIds = string.Join(",", dlist.Select(x => x.Id)); string orderDetailIds = string.Join(",", dlist.Select(x => x.Id));
string goodIds = string.Join(",", dlist.Select(qitem => qitem.GoodsId)); string goodIds = string.Join(",", dlist.Select(qitem => qitem.GoodsId));
goodsRelevanceList= goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() { QGoodsIds = goodIds }); goodsRelevanceList = goods_RelevanceRepository.GetGoodsRelevanceListRepository(new RB_Goods_Relevance_Extend() { QGoodsIds = goodIds });
var oasList = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { OrderDetailIds = orderDetailIds, TenantId = tenantId, MallBaseId = mallBaseId }, false); var oasList = goods_OrderAfterSaleRepository.GetList(new RB_Goods_OrderAfterSale_Extend() { OrderDetailIds = orderDetailIds, TenantId = tenantId, MallBaseId = mallBaseId }, false);
foreach (var item in dlist) foreach (var item in dlist)
{ {
...@@ -992,7 +1000,7 @@ namespace Mall.Module.Product ...@@ -992,7 +1000,7 @@ namespace Mall.Module.Product
item.IsApplyForAfterSale, item.IsApplyForAfterSale,
item.FreeShippingRemarks, item.FreeShippingRemarks,
EduData, EduData,
GoodsRelevanceList= tempList, GoodsRelevanceList = tempList,
}); });
} }
return ApiResult.Success("", new return ApiResult.Success("", new
...@@ -1562,6 +1570,196 @@ namespace Mall.Module.Product ...@@ -1562,6 +1570,196 @@ namespace Mall.Module.Product
}); });
} }
#region 自定义表单解析
/// <summary>
/// 解析表单组件
/// </summary>
/// <param name="formData"></param>
/// <param name="isGetAnswer"></param>
/// <returns></returns>
public List<Model.Extend.TradePavilion.FormDataItem> AnalyzeFormComponent(string formData, bool isGetAnswer = false)
{
List<Model.Extend.TradePavilion.FormDataItem> dataList = new List<Model.Extend.TradePavilion.FormDataItem>();
if (!string.IsNullOrEmpty(formData))
{
JArray jArray = JArray.Parse(formData);
if (jArray != null && jArray.Count > 0)
{
foreach (var jItem in jArray)
{
JObject jObj = JObject.Parse(jItem.ToString());
Model.Extend.TradePavilion.FormDataItem dataItem = new Model.Extend.TradePavilion.FormDataItem()
{
CompKey = jObj.GetStringValue("CompKey"),
CompData = new object(),
isCked = false,
};
if (!string.IsNullOrEmpty(dataItem.CompKey))
{
string compData = jObj.GetStringValue("CompData");
switch (dataItem.CompKey)
{
//单行文本
case "SingleLineText":
Model.Extend.TradePavilion.TextItem txtItem = GetTextItem(compData);
if (!isGetAnswer)
{
txtItem.TextValue = "";
}
dataItem.CompData = txtItem;
break;
//多行文本
case "MultiLineText":
Model.Extend.TradePavilion.TextItem multiItem = GetTextItem(compData);
if (!isGetAnswer)
{
multiItem.TextValue = "";
}
dataItem.CompData = multiItem;
break;
//下拉框
case "DorpDownList":
Model.Extend.TradePavilion.SelectItem selectItem = GetSelectItem(compData);
if (!isGetAnswer)
{
selectItem.OptionValue = "";
}
dataItem.CompData = selectItem;
break;
//图片上传组件
case "ImageUploadComp":
Model.Extend.TradePavilion.UploadItem imgItem = GetUploadItem(compData);
if (!isGetAnswer)
{
imgItem.FileList = new List<string>();
}
dataItem.CompData = imgItem;
break;
//视频上传组件
case "VideoUploadComp":
Model.Extend.TradePavilion.UploadItem videoItem = GetUploadItem(compData);
if (!isGetAnswer)
{
videoItem.FileList = new List<string>();
}
dataItem.CompData = videoItem;
break;
//通用上传组件
case "CommonUploadComp":
Model.Extend.TradePavilion.UploadItem commonUpload = GetUploadItem(compData);
if (!isGetAnswer)
{
commonUpload.FileList = new List<string>();
}
dataItem.CompData = commonUpload;
break;
}
dataList.Add(dataItem);
}
}
}
}
return dataList;
}
/// <summary>
/// 获取文本框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.TextItem GetTextItem(string CompData)
{
JObject textObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.TextItem txtItem = new Model.Extend.TradePavilion.TextItem()
{
Name = textObj.GetStringValue("Name"),
WordsLength = textObj.GetInt("WordsLength"),
IsRequire = textObj.GetBoolValue("IsRequire"),
Remark = textObj.GetStringValue("Remark"),
TextValue = textObj.GetStringValue("TextValue"),
};
return txtItem;
}
/// <summary>
/// 获取下拉框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.SelectItem GetSelectItem(string CompData)
{
JObject dropdownObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.SelectItem selectItem = new Model.Extend.TradePavilion.SelectItem()
{
Name = dropdownObj.GetStringValue("Name"),
IsMultiple = dropdownObj.GetBoolValue("IsMultiple"),
IsRequire = dropdownObj.GetBoolValue("IsRequire"),
OptionList = new List<Model.Extend.TradePavilion.SelectOption>(),
Remark = dropdownObj.GetStringValue("Remark"),
};
if (selectItem.IsMultiple)
{
List<int> valueList = Common.ConvertHelper.StringToList(dropdownObj.GetStringValue("OptionValue").Split(','));
if (valueList != null && valueList.Count > 0)
{
selectItem.OptionValue = string.Join(",", valueList);
}
}
else
{
selectItem.OptionValue = dropdownObj.GetStringValue("OptionValue");
}
var optionList = JArray.Parse(dropdownObj.GetStringValue("OptionList"));
if (optionList != null && optionList.Count > 0)
{
foreach (var oItem in optionList)
{
JObject optionObj = JObject.Parse(oItem.ToString());
Model.Extend.TradePavilion.SelectOption option = new Model.Extend.TradePavilion.SelectOption()
{
Id = optionObj.GetInt("Id"),
Name = optionObj.GetStringValue("Name"),
};
selectItem.OptionList.Add(option);
}
}
return selectItem;
}
/// <summary>
/// 获取上传配置信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.UploadItem GetUploadItem(string CompData)
{
JObject uploadObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.UploadItem uploadItem = new Model.Extend.TradePavilion.UploadItem()
{
Name = uploadObj.GetStringValue("Name"),
FileCount = uploadObj.GetInt("FileCount"),
FileType = uploadObj.GetStringValue("FileType"),
FileSizeLimit = uploadObj.GetInt("FileSizeLimit"),
Remark = uploadObj.GetStringValue("Remark"),
FileList = new List<string>(),
};
if (!string.IsNullOrEmpty(uploadObj.GetStringValue("FileList")))
{
try
{
uploadItem.FileList = JsonHelper.DeserializeObject<List<string>>(uploadObj.GetStringValue("FileList"));
}
catch
{
}
}
return uploadItem;
}
#endregion
/// <summary> /// <summary>
/// 获取小程序结算页面详情 /// 获取小程序结算页面详情
/// </summary> /// </summary>
...@@ -1719,6 +1917,7 @@ namespace Mall.Module.Product ...@@ -1719,6 +1917,7 @@ namespace Mall.Module.Product
List<Model.Extend.BaseSetUp.RB_Logistics_Rules_Extend> rulesList = new List<Model.Extend.BaseSetUp.RB_Logistics_Rules_Extend>(); List<Model.Extend.BaseSetUp.RB_Logistics_Rules_Extend> rulesList = new List<Model.Extend.BaseSetUp.RB_Logistics_Rules_Extend>();
List<Model.Extend.BaseSetUp.RB_Logistics_RulesPrice_Extend> priceList = new List<Model.Extend.BaseSetUp.RB_Logistics_RulesPrice_Extend>(); List<Model.Extend.BaseSetUp.RB_Logistics_RulesPrice_Extend> priceList = new List<Model.Extend.BaseSetUp.RB_Logistics_RulesPrice_Extend>();
List<Model.Extend.BaseSetUp.RB_Logistics_RulesRegion_Extend> regionList = new List<Model.Extend.BaseSetUp.RB_Logistics_RulesRegion_Extend>(); List<Model.Extend.BaseSetUp.RB_Logistics_RulesRegion_Extend> regionList = new List<Model.Extend.BaseSetUp.RB_Logistics_RulesRegion_Extend>();
List<Model.Extend.TradePavilion.RB_Custom_Form_Extend> customFormList = new List<Model.Extend.TradePavilion.RB_Custom_Form_Extend>();
if (gList.Any() && defModel.Id > 0) if (gList.Any() && defModel.Id > 0)
{ {
List<int> FreightIdList = new List<int>(); List<int> FreightIdList = new List<int>();
...@@ -1746,6 +1945,20 @@ namespace Mall.Module.Product ...@@ -1746,6 +1945,20 @@ namespace Mall.Module.Product
} }
#region 获取商品的自定义表单
if (gList != null && gList.Any())
{
string formsIds = string.Join(",", gList.Where(x => x.FormsId > 1).Select(x => x.FormsId));
if (!string.IsNullOrWhiteSpace(formsIds))
{
customFormList = custom_FormRepository.GetCustomFormByIdsListRepository(new Model.Extend.TradePavilion.RB_Custom_Form_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }, formsIds);
// var dataList = AnalyzeFormComponent(customFormModel.FormData, isGetAnswer: false);
}
}
#endregion
#region 优惠卷初始化 #region 优惠卷初始化
List<RB_Member_DiscountCoupon_Extend> cList = new List<RB_Member_DiscountCoupon_Extend>(); List<RB_Member_DiscountCoupon_Extend> cList = new List<RB_Member_DiscountCoupon_Extend>();
List<Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend> dcList = new List<Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend>(); List<Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend> dcList = new List<Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend>();
...@@ -1941,7 +2154,7 @@ namespace Mall.Module.Product ...@@ -1941,7 +2154,7 @@ namespace Mall.Module.Product
{ {
var sModel = speciList.Where(x => x.GoodsId == item.GoodsId).ToList()[i]; var sModel = speciList.Where(x => x.GoodsId == item.GoodsId).ToList()[i];
var svModel = speciVList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationId == sModel.Id && x.Sort == Convert.ToInt32(KeyArr[i])).FirstOrDefault(); var svModel = speciVList.Where(x => x.GoodsId == item.GoodsId && x.SpecificationId == sModel.Id && x.Sort == Convert.ToInt32(KeyArr[i])).FirstOrDefault();
if(svModel!= null) if (svModel != null)
{ {
item.SpecificationNameList.Add(sModel.Name + ":" + svModel.Name); item.SpecificationNameList.Add(sModel.Name + ":" + svModel.Name);
attr_list.Add(new attr_list.Add(new
...@@ -2228,7 +2441,7 @@ namespace Mall.Module.Product ...@@ -2228,7 +2441,7 @@ namespace Mall.Module.Product
Total_integral_price += (item.IntegralMoney ?? 0); Total_integral_price += (item.IntegralMoney ?? 0);
Total_use_integral += (item.IntegralNumber ?? 0); Total_use_integral += (item.IntegralNumber ?? 0);
TotalGoodsMoney += (item.Final_Price ?? 0)+ tempRelevancePrice; TotalGoodsMoney += (item.Final_Price ?? 0) + tempRelevancePrice;
TotalGoodsOriginalMoney += (gmodel.OriginalPrice ?? 0) * (item.Number ?? 0); TotalGoodsOriginalMoney += (gmodel.OriginalPrice ?? 0) * (item.Number ?? 0);
TotalGoodsSellMoney += gmodel.MemberPrice * (item.Number ?? 0); TotalGoodsSellMoney += gmodel.MemberPrice * (item.Number ?? 0);
...@@ -2721,6 +2934,7 @@ namespace Mall.Module.Product ...@@ -2721,6 +2934,7 @@ namespace Mall.Module.Product
} }
//进阶小课堂扩展字段 //进阶小课堂扩展字段
var eduData = goodsRepository.ParsingEduJsonRepository(gmodel.EduJsonData); var eduData = goodsRepository.ParsingEduJsonRepository(gmodel.EduJsonData);
var customFormModel = customFormList?.FirstOrDefault(x => x.Id == gmodel.FormsId);
goods_list.Add(new goods_list.Add(new
{ {
id = gmodel.Id, id = gmodel.Id,
...@@ -2730,7 +2944,7 @@ namespace Mall.Module.Product ...@@ -2730,7 +2944,7 @@ namespace Mall.Module.Product
GoodsRelevanceList = goodsRelevanceList?.Where(qitem => qitem.GoodsId == gmodel.Id)?.ToList(), GoodsRelevanceList = goodsRelevanceList?.Where(qitem => qitem.GoodsId == gmodel.Id)?.ToList(),
num = item.Number, num = item.Number,
EduData = eduData, EduData = eduData,
EduTeacherId= gmodel?.EduTeacherId??0, EduTeacherId = gmodel?.EduTeacherId ?? 0,
forehead_integral = gmodel.PointsDeduction, forehead_integral = gmodel.PointsDeduction,
forehead_integral_type = gmodel.PointsDeductionType, forehead_integral_type = gmodel.PointsDeductionType,
accumulative = gmodel.IsMultipleDeduction,//累计多件抵扣 accumulative = gmodel.IsMultipleDeduction,//累计多件抵扣
...@@ -2790,6 +3004,7 @@ namespace Mall.Module.Product ...@@ -2790,6 +3004,7 @@ namespace Mall.Module.Product
sign = "", sign = "",
confine_order_count = gmodel.LimitBuyOrderNum,//限制订单数量 confine_order_count = gmodel.LimitBuyOrderNum,//限制订单数量
form_id = gmodel.FormsId,//表单id form_id = gmodel.FormsId,//表单id
form_data_json = (customFormModel?.Id??0)>0 ? AnalyzeFormComponent(customFormModel.FormData, isGetAnswer: false):new List<Model.Extend.TradePavilion.FormDataItem>(),
marketingLogo = JsonHelper.Serialize(tempLogo), marketingLogo = JsonHelper.Serialize(tempLogo),
}); });
} }
...@@ -3390,7 +3605,8 @@ namespace Mall.Module.Product ...@@ -3390,7 +3605,8 @@ namespace Mall.Module.Product
foreach (var item in glist) foreach (var item in glist)
{ {
var slist = item.Split('-'); var slist = item.Split('-');
if (slist[0] == BuyNum.ToString()) { if (slist[0] == BuyNum.ToString())
{
PresentCoffeeNum = Convert.ToInt32(slist[1]); PresentCoffeeNum = Convert.ToInt32(slist[1]);
break; break;
} }
...@@ -3651,11 +3867,11 @@ namespace Mall.Module.Product ...@@ -3651,11 +3867,11 @@ namespace Mall.Module.Product
var tempRelevancePrice = goodsRelevanceList?.Where(qitem => qitem.GoodsId == gmodel.Id)?.Sum(qitem => qitem.RelevancePrice) ?? 0; var tempRelevancePrice = goodsRelevanceList?.Where(qitem => qitem.GoodsId == gmodel.Id)?.Sum(qitem => qitem.RelevancePrice) ?? 0;
if (umodel.MemberGrade > 0) if (umodel.MemberGrade > 0)
{ {
item.Final_Price = gmodel.MemberPrice * (item.Number ?? 0)+ tempRelevancePrice; item.Final_Price = gmodel.MemberPrice * (item.Number ?? 0) + tempRelevancePrice;
} }
else else
{ {
item.Final_Price = (gmodel.SellingPrice ?? 0) * (item.Number ?? 0)+ tempRelevancePrice; item.Final_Price = (gmodel.SellingPrice ?? 0) * (item.Number ?? 0) + tempRelevancePrice;
} }
#endregion #endregion
...@@ -3953,7 +4169,8 @@ namespace Mall.Module.Product ...@@ -3953,7 +4169,8 @@ namespace Mall.Module.Product
} }
if (demodel.OrderEduType == 2) if (demodel.OrderEduType == 2)
{ {
if (item.MaterialId <= 0) { if (item.MaterialId <= 0)
{
return ApiResult.Failed("不同板块商品,无法一起下单"); return ApiResult.Failed("不同板块商品,无法一起下单");
} }
} }
...@@ -4581,13 +4798,13 @@ namespace Mall.Module.Product ...@@ -4581,13 +4798,13 @@ namespace Mall.Module.Product
string str = HttpHelper.HttpPost(url, Common.Plugin.JsonHelper.Serialize(postData)); string str = HttpHelper.HttpPost(url, Common.Plugin.JsonHelper.Serialize(postData));
Common.Plugin.LogHelper.WriteInfo("SetAppletGoodsOrderInfo_更新小课堂订单::" + OrderId + " Result::" + str); Common.Plugin.LogHelper.WriteInfo("SetAppletGoodsOrderInfo_更新小课堂订单::" + OrderId + " Result::" + str);
} }
catch(Exception ex) catch (Exception ex)
{ {
Common.Plugin.LogHelper.Write(ex, "SetAppletGoodsOrderInfo_更新小课堂订单::" + OrderId); Common.Plugin.LogHelper.Write(ex, "SetAppletGoodsOrderInfo_更新小课堂订单::" + OrderId);
} }
}, TaskCreationOptions.LongRunning); }, TaskCreationOptions.LongRunning);
} }
return ApiResult.Success("", new { OrderId,demodel.OrderStatus }); return ApiResult.Success("", new { OrderId, demodel.OrderStatus });
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -4647,7 +4864,8 @@ namespace Mall.Module.Product ...@@ -4647,7 +4864,8 @@ namespace Mall.Module.Product
} }
} }
else { else
{
eduUserId = Convert.ToInt32(Config.EduXuZongId ?? "2602"); eduUserId = Convert.ToInt32(Config.EduXuZongId ?? "2602");
} }
} }
...@@ -8527,7 +8745,8 @@ namespace Mall.Module.Product ...@@ -8527,7 +8745,8 @@ namespace Mall.Module.Product
Common.Plugin.LogHelper.Write(ex, "CancelAppletGoodsOrderInfo"); Common.Plugin.LogHelper.Write(ex, "CancelAppletGoodsOrderInfo");
} }
} }
if (type == 2) { if (type == 2)
{
#region 管理端通知 #region 管理端通知
message_NoticeRepository.Insert(new RB_Message_Notice() message_NoticeRepository.Insert(new RB_Message_Notice()
{ {
......
...@@ -222,11 +222,6 @@ namespace Mall.Module.Product ...@@ -222,11 +222,6 @@ namespace Mall.Module.Product
private readonly RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository(); private readonly RB_Goods_RelevanceRepository goods_RelevanceRepository = new RB_Goods_RelevanceRepository();
/// <summary>
/// 关联商品仓储层对象
/// </summary>
private readonly Repository.TradePavilion.RB_Custom_FormRepository custom_FormRepository = new Repository.TradePavilion.RB_Custom_FormRepository();
#region 教育咖啡劵 #region 教育咖啡劵
/// <summary> /// <summary>
...@@ -1485,194 +1480,6 @@ namespace Mall.Module.Product ...@@ -1485,194 +1480,6 @@ namespace Mall.Module.Product
#endregion #endregion
#region 自定义表单解析
/// <summary>
/// 解析表单组件
/// </summary>
/// <param name="formData"></param>
/// <param name="isGetAnswer"></param>
/// <returns></returns>
public List<Model.Extend.TradePavilion.FormDataItem> AnalyzeFormComponent(string formData, bool isGetAnswer = false)
{
List<Model.Extend.TradePavilion.FormDataItem> dataList = new List<Model.Extend.TradePavilion.FormDataItem>();
if (!string.IsNullOrEmpty(formData))
{
JArray jArray = JArray.Parse(formData);
if (jArray != null && jArray.Count > 0)
{
foreach (var jItem in jArray)
{
JObject jObj = JObject.Parse(jItem.ToString());
Model.Extend.TradePavilion.FormDataItem dataItem = new Model.Extend.TradePavilion.FormDataItem()
{
CompKey = jObj.GetStringValue("CompKey"),
CompData = new object(),
isCked = false,
};
if (!string.IsNullOrEmpty(dataItem.CompKey))
{
string compData = jObj.GetStringValue("CompData");
switch (dataItem.CompKey)
{
//单行文本
case "SingleLineText":
Model.Extend.TradePavilion.TextItem txtItem = GetTextItem(compData);
if (!isGetAnswer)
{
txtItem.TextValue = "";
}
dataItem.CompData = txtItem;
break;
//多行文本
case "MultiLineText":
Model.Extend.TradePavilion.TextItem multiItem = GetTextItem(compData);
if (!isGetAnswer)
{
multiItem.TextValue = "";
}
dataItem.CompData = multiItem;
break;
//下拉框
case "DorpDownList":
Model.Extend.TradePavilion.SelectItem selectItem = GetSelectItem(compData);
if (!isGetAnswer)
{
selectItem.OptionValue = "";
}
dataItem.CompData = selectItem;
break;
//图片上传组件
case "ImageUploadComp":
Model.Extend.TradePavilion.UploadItem imgItem = GetUploadItem(compData);
if (!isGetAnswer)
{
imgItem.FileList = new List<string>();
}
dataItem.CompData = imgItem;
break;
//视频上传组件
case "VideoUploadComp":
Model.Extend.TradePavilion.UploadItem videoItem = GetUploadItem(compData);
if (!isGetAnswer)
{
videoItem.FileList = new List<string>();
}
dataItem.CompData = videoItem;
break;
//通用上传组件
case "CommonUploadComp":
Model.Extend.TradePavilion.UploadItem commonUpload = GetUploadItem(compData);
if (!isGetAnswer)
{
commonUpload.FileList = new List<string>();
}
dataItem.CompData = commonUpload;
break;
}
dataList.Add(dataItem);
}
}
}
}
return dataList;
}
/// <summary>
/// 获取文本框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.TextItem GetTextItem(string CompData)
{
JObject textObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.TextItem txtItem = new Model.Extend.TradePavilion.TextItem()
{
Name = textObj.GetStringValue("Name"),
WordsLength = textObj.GetInt("WordsLength"),
IsRequire = textObj.GetBoolValue("IsRequire"),
Remark = textObj.GetStringValue("Remark"),
TextValue = textObj.GetStringValue("TextValue"),
};
return txtItem;
}
/// <summary>
/// 获取下拉框信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.SelectItem GetSelectItem(string CompData)
{
JObject dropdownObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.SelectItem selectItem = new Model.Extend.TradePavilion.SelectItem()
{
Name = dropdownObj.GetStringValue("Name"),
IsMultiple = dropdownObj.GetBoolValue("IsMultiple"),
IsRequire = dropdownObj.GetBoolValue("IsRequire"),
OptionList = new List<Model.Extend.TradePavilion.SelectOption>(),
Remark = dropdownObj.GetStringValue("Remark"),
};
if (selectItem.IsMultiple)
{
List<int> valueList = Common.ConvertHelper.StringToList(dropdownObj.GetStringValue("OptionValue").Split(','));
if (valueList != null && valueList.Count > 0)
{
selectItem.OptionValue = string.Join(",", valueList);
}
}
else
{
selectItem.OptionValue = dropdownObj.GetStringValue("OptionValue");
}
var optionList = JArray.Parse(dropdownObj.GetStringValue("OptionList"));
if (optionList != null && optionList.Count > 0)
{
foreach (var oItem in optionList)
{
JObject optionObj = JObject.Parse(oItem.ToString());
Model.Extend.TradePavilion.SelectOption option = new Model.Extend.TradePavilion.SelectOption()
{
Id = optionObj.GetInt("Id"),
Name = optionObj.GetStringValue("Name"),
};
selectItem.OptionList.Add(option);
}
}
return selectItem;
}
/// <summary>
/// 获取上传配置信息
/// </summary>
/// <param name="CompData"></param>
/// <returns></returns>
private Model.Extend.TradePavilion.UploadItem GetUploadItem(string CompData)
{
JObject uploadObj = JObject.Parse(CompData);
Model.Extend.TradePavilion.UploadItem uploadItem = new Model.Extend.TradePavilion.UploadItem()
{
Name = uploadObj.GetStringValue("Name"),
FileCount = uploadObj.GetInt("FileCount"),
FileType = uploadObj.GetStringValue("FileType"),
FileSizeLimit = uploadObj.GetInt("FileSizeLimit"),
Remark = uploadObj.GetStringValue("Remark"),
FileList = new List<string>(),
};
if (!string.IsNullOrEmpty(uploadObj.GetStringValue("FileList")))
{
try
{
uploadItem.FileList = JsonHelper.DeserializeObject<List<string>>(uploadObj.GetStringValue("FileList"));
}
catch
{
}
}
return uploadItem;
}
#endregion
/// <summary> /// <summary>
/// 获取小程序商品详情 /// 获取小程序商品详情
/// </summary> /// </summary>
...@@ -2626,14 +2433,7 @@ namespace Mall.Module.Product ...@@ -2626,14 +2433,7 @@ namespace Mall.Module.Product
GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId); GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, goodsId);
#endregion #endregion
#region 获取商品的自定义表单
Model.Entity.TradePavilion.RB_Custom_Form customFormModel = new Model.Entity.TradePavilion.RB_Custom_Form();
if (model.FormsId > 1)
{
customFormModel = custom_FormRepository.GetEntity(model.FormsId);
var dataList = AnalyzeFormComponent(customFormModel.FormData, isGetAnswer: false);
}
#endregion
#region 返回参数 #region 返回参数
......
...@@ -96,5 +96,53 @@ WHERE 1=1 ...@@ -96,5 +96,53 @@ WHERE 1=1
} }
return Get<RB_Custom_Form_Extend>(builder.ToString(), parameters).ToList(); return Get<RB_Custom_Form_Extend>(builder.ToString(), parameters).ToList();
} }
/// <summary>
/// 获取自定义表单列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Custom_Form_Extend> GetCustomFormByIdsListRepository(RB_Custom_Form_Extend query,string FormIds)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Custom_Form AS A
WHERE 1=1
");
// builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.FormName))
{
builder.AppendFormat(" AND A.{0} LIKE @FormName ", nameof(RB_Custom_Form_Extend.FormName));
parameters.Add("FormName", "%" + query.FormName.Trim() + "%");
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.Id), query.Id);
}
if (!string.IsNullOrWhiteSpace(FormIds))
{
builder.AppendFormat(" AND A.{0} in ({1}) ", nameof(RB_Custom_Form_Extend.Id), FormIds);
}
if (query.FormType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Custom_Form_Extend.FormType), (int)query.FormType);
}
}
return Get<RB_Custom_Form_Extend>(builder.ToString(), parameters).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