public ActionResult CommodityRichText(string id) { string hotelId = id; string key = HotelCloud.Common.HCRequest.GetString("key"); //"酒店微信id@用户微信id" string weixinid = HotelCloud.Common.HCRequest.GetString("weixinID"); //酒店微信id string commodityId = HotelCloud.Common.HCRequest.GetString("CommodityID"); //酒店微信id string userweixinid = ""; if (!key.Equals("") && key.Contains("@")) { weixinid = key.Split('@')[0];//酒店微信id userweixinid = key.Split('@')[1]; } var DataTable = CommodityService.GetDataById(commodityId); var hotelData = GetHotelBySupermarket(int.Parse(id)).Rows[0]; ViewData["myPoints"] = 0; var userDt = orderService.GetScoreByUser(weixinid, userweixinid); if (userDt.Rows.Count > 0) { ViewData["myPoints"] = userDt.Rows[0]["Emoney"]; } ViewData["Address"] = hotelData["address"]; ViewData["soldCount"] = SupermarketOrderDetailService.GetSoldCount(commodityId).Rows[0][0]; ViewData["hotelName"] = DishOrderLogic.GetHotelName(hotelId); ViewData["commodityTable"] = DataTable; ViewData["hotelId"] = id; ViewData["weixinid"] = weixinid; ViewData["userweixinid"] = userweixinid; ViewData["CommodityID"] = commodityId; return(View()); }
public ActionResult OrderDetailsAlone(string id) { string hotelId = id; string key = HotelCloud.Common.HCRequest.GetString("key"); //"酒店微信id@用户微信id" string weixinid = HotelCloud.Common.HCRequest.GetString("weixinID"); //酒店微信id string commodityId = HotelCloud.Common.HCRequest.GetString("commodityid"); //酒店微信id string PayMode = HotelCloud.Common.HCRequest.GetString("PayMode"); //支付模式 string userweixinid = ""; if (!key.Equals("") && key.Contains("@")) { weixinid = key.Split('@')[0];//酒店微信id userweixinid = key.Split('@')[1]; } ViewData["commodityId"] = commodityId; //计算订单总金额 var DataTable = CommodityService.GetDataById(commodityId); double sum = 0; decimal canCouponSum = 0; int needPoints = 0; int canPoints = 1; foreach (DataRow data in DataTable.Rows) { needPoints = int.Parse(data["PurchasePoints"].ToString()); canPoints = int.Parse(data["CanPurchase"].ToString()); sum += double.Parse(data["Price"].ToString()); if (int.Parse(data["CanCouPon"].ToString()) == 1) { canCouponSum += decimal.Parse(data["Price"].ToString()); } } ViewData["PayMode"] = PayMode; ViewData["canPoints"] = canPoints; ViewData["needPoints"] = needPoints; ViewData["myPoints"] = 0; var userDt = orderService.GetScoreByUser(weixinid, userweixinid); if (userDt.Rows.Count > 0) { ViewData["myPoints"] = userDt.Rows[0]["Emoney"]; } //获取可用红包 var couponDataTable = CouPon.GetUserCouPonDataTable(weixinid, userweixinid, "3"); ViewData["couponDataTable"] = new DataTable(); ViewData["canCouponSum"] = canCouponSum; if (couponDataTable.Rows.Count > 0 && canCouponSum > 0) { ViewData["couponDataTable"] = couponDataTable; //var q1 = from dt1 in couponDataTable.AsEnumerable()//查询 // //orderby dt1.Field<int>("ID") descending//排序 // where dt1.Field<decimal>("amountlimit") <= canCouponSum//条件 // select dt1; //if (q1.Count() > 0) //{ // ViewData["couponDataTable"] = q1.CopyToDataTable<DataRow>(); //} } //获取收货地址 List <OrderAddress> list = DishOrderLogic.GetAddressList(userweixinid); OrderAddress address = list.Find(a => a.isSelected == true); ViewData["ExpressFee"] = 0; ViewData["hotelName"] = DishOrderLogic.GetHotelName(hotelId); ViewData["addressRoomNo"] = ""; if (address != null) { var hotelData = SupermarketController.GetHotelBySupermarket(int.Parse(id)).Rows[0]; ViewData["ExpressFee2"] = hotelData["expressfee"]; if (address.addressType == 1) { ViewData["addressType"] = "酒店"; ViewData["addressName"] = address.Address + address.RoomNo; ViewData["addressRoomNo"] = address.RoomNo; ViewData["ExpressFee"] = 0; } else { ViewData["addressType"] = "快递"; ViewData["addressName"] = address.kuaidiAddress; try { ViewData["ExpressFee"] = hotelData["expressfee"]; ViewData["hotelPhone"] = hotelData["tel"]; sum += double.Parse(hotelData["expressfee"].ToString()); } catch (Exception e) { ViewData["ExpressFee"] = 0; ViewData["hotelPhone"] = ""; } } ViewData["Address"] = address; ViewData["OriginAddressType"] = address.addressType; } else { ViewData["Address"] = new OrderAddress(); ViewData["addressType"] = "酒店"; ViewData["hotelPhone"] = ""; ViewData["addressName"] = ViewData["hotelName"]; ViewData["OriginAddressType"] = 1; } //获取积分 ViewData["orderScore"] = 0; ViewData["equivalence"] = 1; ViewData["GradePlus"] = 1; MemberInfo Info = MemberHelper.GetMemberInfo(weixinid); string cardno = MemberHelper.GetCardNo(userweixinid, weixinid); if (!string.IsNullOrEmpty(cardno)) { MemberCard MyCard = MemberHelper.GetMemberCard(cardno, weixinid); MemberCardIntegralRule IntegralRule = MemberHelper.IntegralRule(Info, MyCard); var score = sum; if (IntegralRule.equivalence > 0) { score = score * IntegralRule.equivalence; ViewData["equivalence"] = IntegralRule.equivalence; } if ((double)IntegralRule.GradePlus > 0) { score = score * (double)IntegralRule.GradePlus; ViewData["GradePlus"] = IntegralRule.GradePlus; } ViewData["orderScore"] = Math.Floor(Math.Round(score, 2));; } ViewData["shoppingCarDataTable"] = DataTable; ViewData["amount"] = sum; ViewData["hotelId"] = id; ViewData["weixinid"] = weixinid; ViewData["userweixinid"] = userweixinid; return(View()); }