/// <summary> /// 确认收货操作 /// </summary> /// <returns></returns> public ActionResult DoTakeGoods(string pwd2, string guid) { try { //1.验证支付密码 Member_Info curUser = User_Shop.GetMember_Info(); if (curUser.Pwd2 != Common.CryptHelper.DESCrypt.Encrypt(pwd2)) { throw new Exception("支付密码不正确"); } //2.订单进入,待评价/已收货状态 ShopOrder model = DB.ShopOrder.FindEntity(guid); model.State = ShopEnum.OrderState.Finish.GetHashCode(); //确认收货 model.FinishTime = DateTime.Now; DB.ShopOrder.Update(model); ////3.结算系统处理 //DB.ShopOrder.OrderSettlement(guid); //if (model.OrderType != "积分优惠券") //{ // DB.Jiang.GiveJiang(DB.Member_Info.FindEntity(model.MemberID), model); //} return(Success("操作成功")); } catch (Exception ex) { return(Error(ex)); } }
/// <summary> /// 标记订单,挂卖 /// </summary> /// <param name="OrderID"></param> /// <returns></returns> public ActionResult WeiTuoOrder(string pwd2, string guid) { try { //1.验证支付密码 Member_Info curUser = User_Shop.GetMember_Info(); if (curUser.Pwd2 != Common.CryptHelper.DESCrypt.Encrypt(pwd2)) { throw new Exception("支付密码不正确"); } ShopOrder model = DB.ShopOrder.FindEntity(q => q.GUID == guid); #region 挂卖 //给零售区加库存 //var lingshouqu = DB.ShopOrderProduct.Where(p => p.OrderID == model.GUID).FirstOrDefault(); //var shopOrderProudct = DB.ShopProduct.Where(p => p.Title == lingshouqu.Name && p.CategoryID1 == 15).FirstOrDefault(); //shopOrderProudct.Inventory = Convert.ToInt32(shopOrderProudct.Inventory + model.ZongDay); //DB.ShopProduct.Update(shopOrderProudct); model.State = ShopEnum.OrderState.GuaM.GetHashCode(); model.Type = "挂卖中"; model.SubmitTime = DateTime.Now;//挂卖时间 DB.ShopOrder.Update(model); #endregion return(Success("操作成功")); } catch (Exception ex) { return(Error(ex)); } }
/// <summary> /// 保存基本信息 /// </summary> /// <returns></returns> public ActionResult InfoSave(Member_Info entity) { try { if (DB.XmlConfig.XmlSite.IsJiHuo) { var code = Session["smscode"] as string; if (string.IsNullOrEmpty(code)) { throw new Exception("验证码过期"); } if (code != entity.OpenBank) { throw new Exception("验证码不正确"); } } Member_Info model = User_Shop.GetMember_Info(); if (DB.Member_Info.Any(a => a.Mobile == entity.Mobile && a.MemberId != model.MemberId)) { throw new Exception("手机号已存在"); } //完善资料 model.Mobile = entity.Mobile; if (model.IsDL != "是") { model.NickName = entity.NickName; var rec = DB.Member_Info.Where(a => a.RecommendId == model.MemberId && a.MemberId != model.MemberId).ToList(); foreach (var item in rec) { var recommendmodel = DB.Member_Info.FindEntity(item.MemberId); recommendmodel.RecommendName = model.NickName; DB.Member_Info.Update(recommendmodel); } model.IdCode = entity.IdCode; model.IsDL = "是"; model.BankAccount = entity.BankAccount; model.BankCode = entity.BankCode; model.BankName = entity.BankName; } if (DB.Member_Info.Update(model) == false) { throw new Exception("修改会员信息失败"); } return(Success("修改成功")); } catch (Exception ex) { return(Error(ex)); } }
/// <summary> /// 确认订单页面 /// </summary> /// <returns></returns> public ActionResult payment(string orderid) { LogHelper.Error("回调311111111111111111111111"); #region 如果页面无参数传入,微信会把Payment作为一个目录处理,这里增加个判断,如果无参数,则随便加个参数 if (Request.QueryString.Count == 0) { return(RedirectToAction("/mobile/mobilecenter/bill", new { q = "t", orderid = orderid })); } #endregion List <string> orderList = new List <string>(); if (string.IsNullOrEmpty(orderid)) { //throw new Exception("获取订单id失败"); //来自购物车 string cartlist = CookieHelper.GetCookieValue("cart"); if (string.IsNullOrEmpty(cartlist)) { return(RedirectToAction("Bill")); } //获取下单总金额 cartlist = SecurityHelper.UrlDecode(cartlist); Dictionary <int, int> prodList = cartlist.JsonDeserializer <Dictionary <int, int> >(); //生成订单 Member_Info curUser = User_Shop.GetMember_Info(); DB.ShopOrder.GenerateOrder(curUser, 0, null); //3.清空cookie CookieHelper.ClearCookie("cart"); CookieHelper.ClearCookie("total"); return(RedirectToAction("Bill"));//跳转待付款 } orderList.Add(orderid); ShopOrder model = DB.ShopOrder.FindEntity(orderid); if (model == null) { throw new Exception("获取订单信息失败"); } if (model.TraceNo.IsNull()) { model.TraceNo = model.GUID; DB.ShopOrder.Update(model); } CookieHelper.SetCookie("traceno", model.TraceNo, 1); CookieHelper.SetCookie("orderlist", orderList.ToJsonString(), null); return(View(model)); }
/// <summary> /// 修改密码 /// </summary> /// <param name="oldPwd"></param> /// <param name="pwd"></param> /// <param name="type"></param> /// <returns></returns> public ActionResult UpdatePwd(string oldPwd, string pwd, int type) { JsonHelp result = new JsonHelp(true, "操作成功"); try { if (DB.XmlConfig.XmlSite.IsJiHuo) { var code = Session["smscode"] as string; if (string.IsNullOrEmpty(code)) { throw new Exception("验证码过期"); } if (code != oldPwd) { throw new Exception("验证码不正确"); } } Member_Info model = User_Shop.GetMember_Info(); if (type == 1) { model.LoginPwd = Common.CryptHelper.DESCrypt.Encrypt(pwd); } else { model.Pwd2 = Common.CryptHelper.DESCrypt.Encrypt(pwd); } if (DB.Member_Info.Update(model) == false) { throw new Exception("修改失败"); } } catch (Exception ex) { result.IsSuccess = false; result.Msg = ex.Message; } return(Json(result)); }
public ActionResult TiHuoOrder(string pwd2, string guid) { try { //1.验证支付密码 Member_Info curUser = User_Shop.GetMember_Info(); if (curUser.Pwd2 != Common.CryptHelper.DESCrypt.Encrypt(pwd2)) { throw new Exception("支付密码不正确"); } ShopOrder model = DB.ShopOrder.FindEntity(q => q.GUID == guid); model.State = ShopEnum.OrderState.Pay.GetHashCode(); model.Type = "提货"; if (DB.ShopOrder.Update(model)) { return(Success("操作成功")); } return(Error("操作失败")); } catch (Exception ex) { return(Error(ex)); } }
/// <summary> /// 确认付款操作 /// </summary> /// <returns></returns> public ActionResult DoPay(int addressid, string paytype, string remark, bool isziti, string payPwd) { JsonHelp json = new JsonHelp(true); try { Xml_Site config = DB.XmlConfig.XmlSite; Xml_Shop shopConfig = DB.XmlConfig.XmlShop; Member_Info curUser = User_Shop.GetMember_Info(); //获取订单信息 string orderlist = CookieHelper.GetCookieValue("orderlist"); List <string> orderList = orderlist.JsonDeserializer <List <string> >(); if (orderList == null) { throw new Exception("订单支付异常"); } if (orderList.Count <= 0) { throw new Exception("获取订单信息失败"); } var orderid = orderList.First(); var query = DB.ShopOrder.Where(q => q.GUID == orderid).FirstOrDefault(); if (query.State != 1) { throw new Exception("订单不是待支付订单不可支付"); } DB.ShopOrder.UpdateOrderInfo(orderList, addressid, remark, isziti, paytype); if (paytype == "余额") { //计算处理 DB.ShopOrder.Calcute(curUser, orderList.First(), payPwd); CookieHelper.ClearCookie("orderlist"); } else if (paytype == "支付宝") { json.ReUrl = "/Member_Mall/Pay/Pay?OrderId=" + orderList.First();//http://tjyy.fabeisha.cn //r.ReUrl = "http://tjyy.fabeisha.cn/Member_Mall/Pay/Pay?BillId=" + r.BillId;//http://www.738600.cn } else if (paytype == "微信") { var orderModel = DB.ShopOrder.FindEntity(orderList.First()); H5Pay h5Pay = new H5Pay(); var wxConfig = WxPayConfig.GetConfig(); string clientIP = wxConfig.GetIp(); //获取客户端真实IP var url = h5Pay.GetPayUrl(clientIP, orderModel.OrderCode, (orderModel.RealAmount + orderModel.Postage.Value) * 100M); //通过统一下单接口进行H5支付 //Response.Redirect(url);//跳转到微信支付中间页 json.ReUrl = url; //json.ReUrl = "/Member_Mall/Pay/WXPay?OrderId=" + orderList.First();//http://tjyy.fabeisha.cn //r.ReUrl = "/Member_Mall/Pay/WXPay?BillId=" + r.BillId;//http://tjyy.fabeisha.cn } //3.清空cookie CookieHelper.ClearCookie("cart"); CookieHelper.ClearCookie("total"); CookieHelper.ClearCookie("traceno"); } catch (Exception ex) { StringBuilder str = new StringBuilder(); Exception inner = ex; while (inner != null) { str.AppendLine(inner.Message); inner = inner.InnerException; } json.IsSuccess = false; json.Msg = str.ToString(); str.AppendLine("跟踪:" + ex.StackTrace); LogHelper.Debug(str.ToString()); } return(Json(json)); }