/// <summary> /// 确认订单信息 /// </summary> /// <param name="id"></param> /// <param name="count"></param> /// <returns></returns> public GiftOrderConfirmPageModel ConfirmOrder(GiftConfirmOrder value) { if (value.Count < 1) { value.Count = 1; } var id = value.ID; var regionId = value.RegionId; var count = value.Count; //Checkout GiftOrderConfirmPageModel data = new GiftOrderConfirmPageModel(); List <GiftOrderItemDtoModel> gorditemlist = new List <GiftOrderItemDtoModel>(); GiftOrderItemDtoModel gorditem; //订单项 #region 礼品信息判断 //礼品信息 GiftInfo giftdata = _iGiftService.GetById(id); if (giftdata == null) { throw new Exception("错误的礼品编号!"); } #endregion gorditem = new GiftOrderItemDtoModel(); //补充订单项 gorditem.GiftId = giftdata.Id; gorditem.GiftName = giftdata.GiftName; gorditem.GiftValue = giftdata.GiftValue; gorditem.ImagePath = giftdata.ImagePath; gorditem.OrderId = 0; gorditem.Quantity = count; gorditem.SaleIntegral = giftdata.NeedIntegral; if (!string.IsNullOrWhiteSpace(gorditem.ImagePath)) { gorditem.DefaultImage = HimallIO.GetRomoteProductSizeImage(gorditem.ImagePath, 1, ImageSize.Size_100.GetHashCode()); } gorditemlist.Add(gorditem); data.GiftList = gorditemlist; data.GiftValueTotal = (decimal)data.GiftList.Sum(d => d.Quantity * d.GiftValue); data.TotalAmount = (int)data.GiftList.Sum(d => d.SaleIntegral * d.Quantity); //用户地址 Entities.ShippingAddressInfo shipdata = GetShippingAddress(regionId); if (shipdata != null) { Mapper.CreateMap <Entities.ShippingAddressInfo, ShippingAddressDtoModel>(); ShippingAddressDtoModel shipobj = Mapper.Map <ShippingAddressDtoModel>(shipdata); shipobj.Address = shipobj.Address + " " + shipdata.AddressDetail; data.ShipAddress = shipobj; } data.success = true; return(data); }
public object GetConfirmOrder(long id, int count, long?regionId = null) { CheckUserLogin(); if (count < 1) { count = 1; } //Checkout dynamic data = new System.Dynamic.ExpandoObject(); List <GiftOrderItemDtoModel> gorditemlist = new List <GiftOrderItemDtoModel>(); GiftOrderItemDtoModel gorditem; //订单项 //礼品信息 var giftdata = GiftApplication.GetById(id); if (giftdata == null) { throw new Exception("错误的礼品编号!"); } gorditem = new GiftOrderItemDtoModel(); //补充订单项 gorditem.GiftId = giftdata.Id; gorditem.GiftName = giftdata.GiftName; gorditem.GiftValue = giftdata.GiftValue; gorditem.ImagePath = giftdata.ImagePath; gorditem.OrderId = 0; gorditem.Quantity = count; gorditem.SaleIntegral = giftdata.NeedIntegral; if (!string.IsNullOrWhiteSpace(gorditem.ImagePath)) { gorditem.DefaultImage = MallIO.GetRomoteProductSizeImage(gorditem.ImagePath, 1, ImageSize.Size_100.GetHashCode()); } gorditemlist.Add(gorditem); data.GiftList = gorditemlist; data.GiftValueTotal = (decimal)gorditemlist.Sum(d => d.Quantity * d.GiftValue); data.TotalAmount = (int)gorditemlist.Sum(d => d.SaleIntegral * d.Quantity); //用户地址 Entities.ShippingAddressInfo shipdata = GetShippingAddress(regionId); if (shipdata != null) { // Mapper.CreateMap<Entities.ShippingAddressInfo, ShippingAddressDtoModel>(); ShippingAddressDtoModel shipobj = shipdata.Map <ShippingAddressDtoModel>(); shipobj.Address = shipobj.Address + " " + shipdata.AddressDetail; data.ShipAddress = shipobj; } return(Json(data)); }