/// <summary> /// 获取订单信息 /// </summary> /// <returns></returns> public ActionResult GetOrderInfo() { returnObj = new Return_Msg_APP(); int userId = Context.GetRequestInt("userid", 0); int id = Context.GetRequestInt("id", 0); if (userId <= 0) { returnObj.Msg = "用户ID不能为0"; return(Json(returnObj)); } PlatChildGoodsOrder model = PlatChildGoodsOrderBLL.SingleModel.GetModel_Api(id); if (model != null) { PlatStore store = PlatStoreBLL.SingleModel.GetModel(model.StoreId); if (store != null) { model.StorePhone = store.Phone; } model.DeliveryInfo = DeliveryFeedbackBLL.SingleModel.GetOrderFeed(orderId: model.Id, orderType: DeliveryOrderType.独立小程序订单商家发货); } returnObj.dataObj = model; returnObj.isok = true; return(Json(returnObj)); }
/// <summary> /// 获取订单退款失败原因 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public ActionResult GetOutOrderFailRemark(int orderId = 0) { Return_Msg returnData = new Return_Msg(); try { PlatChildGoodsOrder order = PlatChildGoodsOrderBLL.SingleModel.GetModel(orderId); CityMorders ctiyMorder = new CityMordersBLL().GetModel(order.OrderId); ReFundResult outOrderRsult = RefundResultBLL.SingleModel.GetModelByTradeno(ctiyMorder.trade_no); if (outOrderRsult == null) { returnData.Msg = "未知原因!"; } else { returnData.Msg = outOrderRsult.err_code_des ?? outOrderRsult.return_msg; returnData.isok = true; } } catch (Exception ex) { returnData.Msg = ex.Message; } return(Json(returnData)); }
public ActionResult OrderEdit(int appid = 0) { int id = Context.GetRequestInt("id", 0); if (id <= 0) { return(Redirect("/base/PageError?type=5")); } ViewBag.appId = appid; PlatChildGoodsOrder order = PlatChildGoodsOrderBLL.SingleModel.GetModel(id); if (order == null) { return(Redirect("/base/PageError?type=4")); } return(View(order)); }
/// <summary> /// 标记订单已评论 /// </summary> /// <param name="xcxtemplateType">模板类型</param> /// <param name="goodsType">商品类型</param> /// <param name="orderId"></param> /// <returns></returns> public bool OrderCommenting(int xcxtemplateType, int goodsType, int orderId) { switch (xcxtemplateType) { case (int)TmpType.小程序专业模板: switch (goodsType) { case (int)EntGoodsType.拼团产品: case (int)EntGoodsType.普通产品: EntGoodsOrder entOrder = EntGoodsOrderBLL.SingleModel.GetModel(orderId); if (entOrder == null) { return(false); } entOrder.IsCommentting = true; return(EntGoodsOrderBLL.SingleModel.Update(entOrder, "IsCommentting")); case (int)EntGoodsType.价产品: BargainUser bargainuser = BargainUserBLL.SingleModel.GetModel(orderId); if (bargainuser == null) { return(true); } bargainuser.IsCommentting = true; return(BargainUserBLL.SingleModel.Update(bargainuser, "IsCommentting")); } break; case (int)TmpType.小未平台子模版: PlatChildGoodsOrder platOrder = PlatChildGoodsOrderBLL.SingleModel.GetModel(orderId); if (platOrder == null) { return(false); } platOrder.IsCommentting = true; return(PlatChildGoodsOrderBLL.SingleModel.Update(platOrder, "IsCommentting")); } return(false); }
/// <summary> /// 取消订单 /// </summary> /// <returns></returns> public ActionResult UpdateOrderState() { returnObj = new Return_Msg_APP(); int id = Context.GetRequestInt("id", 0); //int userId = Context.GetRequestInt("userid", 0); int state = Context.GetRequestInt("state", 0); if (id <= 0) { returnObj.Msg = "订单ID不能为空"; return(Json(returnObj)); } PlatChildGoodsOrder order = PlatChildGoodsOrderBLL.SingleModel.GetModel(id); if (order == null) { returnObj.Msg = "订单已失效"; return(Json(returnObj)); } //if (order.UserId != userId) //{ // returnObj.Msg = "无效用户"; // return Json(returnObj); //} string msg = ""; switch (state) { case (int)PlatChildOrderState.已取消: if (order.State != (int)PlatChildOrderState.待付款) { returnObj.Msg = "取消订单:无效订单状态"; return(Json(returnObj)); } PlatChildGoodsOrderBLL.SingleModel.CancelOrder(order, ref msg); if (msg.Length > 0) { returnObj.Msg = msg; return(Json(returnObj)); } break; case (int)PlatChildOrderState.已完成: if (order.State != (int)PlatChildOrderState.待收货) { returnObj.Msg = "确认收货:无效订单状态"; return(Json(returnObj)); } PlatChildGoodsOrderBLL.SingleModel.ReceiptGoods(order, ref msg); if (msg.Length > 0) { returnObj.Msg = msg; return(Json(returnObj)); } break; default: returnObj.Msg = "无效订单状态"; return(Json(returnObj)); } returnObj.Msg = "操作成功"; returnObj.isok = true; return(Json(returnObj)); }
/// <summary> /// 变更订单状态 /// </summary> /// <param name="state"></param> /// <param name="oldState"></param> /// <param name="orderId"></param> /// <returns></returns> public ActionResult UpdteOrderState() { Return_Msg returnData = new Return_Msg(); int state = Context.GetRequestInt("state", 0); int oldState = Context.GetRequestInt("oldState", 0); int id = Context.GetRequestInt("orderId", 0); string attachData = Context.GetRequest("attachData", ""); if (id <= 0) { returnData.Msg = "参数错误"; return(Json(returnData)); } if (!Enum.IsDefined(typeof(PlatChildOrderState), state)) { returnData.Msg = "无效状态,请刷新再试"; return(Json(returnData)); } PlatChildGoodsOrder order = PlatChildGoodsOrderBLL.SingleModel.GetModel(id); if (order == null || order.State != oldState) { returnData.Msg = "无效订单,请刷新再试"; return(Json(returnData)); } ServiceResult result = new ServiceResult(); string msg = ""; switch (state) { case (int)PlatChildOrderState.已取消: //取消订单 PlatChildGoodsOrderBLL.SingleModel.CancelOrder(order, ref msg); returnData.Msg = msg; break; case (int)PlatChildOrderState.待收货: PlatChildGoodsOrderBLL.SingleModel.SendGoods(order, attachData, ref msg); returnData.Msg = msg; break; case (int)PlatChildOrderState.已完成: PlatChildGoodsOrderBLL.SingleModel.ReceiptGoods(order, ref msg); returnData.Msg = msg; break; case (int)PlatChildOrderState.退款中: //退款 PlatChildGoodsOrderBLL.SingleModel.ReturnOrder(order, ref msg); returnData.Msg = msg; break; case (int)PlatChildOrderState.退款失败: //退款 PlatChildGoodsOrderBLL.SingleModel.ReturnOrderAgain(order, ref msg); returnData.Msg = msg; break; default: returnData.Msg = "无效操作类型"; break; } returnData.isok = returnData.Msg.Length <= 0; returnData.Msg = returnData.isok?"保存成功":"保存失败"; return(Json(returnData)); }
/// <summary> /// 修改订单 /// </summary> /// <returns></returns> public ActionResult UpdateOrderMaterial() { Return_Msg returnData = new Return_Msg(); string orderJson = Context.GetRequest("orderJson", string.Empty); if (string.IsNullOrWhiteSpace(orderJson)) { returnData.Msg = "服务器繁忙,未接收到订单数据"; return(Json(returnData)); } string columnstr = "Address,AccepterName,AccepterTelePhone"; PlatChildGoodsOrder order = null; //要修改成的订单数据 PlatChildGoodsOrder dbOrder = null; //数据库订单 try { //订单 order = Newtonsoft.Json.JsonConvert.DeserializeObject <PlatChildGoodsOrder>(orderJson); if (order == null || order.Id <= 0) { returnData.Msg = $"订单数据出现异常"; return(Json(returnData)); } } catch (Exception) { returnData.Msg = "订单数据存在异常"; return(Json(returnData)); } dbOrder = PlatChildGoodsOrderBLL.SingleModel.GetModel(order.Id); if (dbOrder == null) { returnData.Msg = "订单数据有异常"; return(Json(returnData)); } dbOrder.Address = order.Address; dbOrder.AccepterName = order.AccepterName; dbOrder.AccepterTelePhone = order.AccepterTelePhone; //微信支付,金额不等才去重新生成微信订单并关闭原有订单 if (dbOrder.OrderId > 0 && dbOrder.BuyPrice != order.BuyPrice) { dbOrder.BuyPrice = order.BuyPrice; columnstr += ",BuyPrice,ReducedPrice"; dbOrder.ReducedPrice += dbOrder.BuyPrice - order.BuyPrice;//重新累计优惠金额 //如果微信支付为0,则后台直接改变状态 if (order.BuyPrice <= 0 && dbOrder.BuyMode == (int)miniAppBuyMode.微信支付) { CityMorders cityMorder = new CityMordersBLL().GetModel(dbOrder.OrderId); TransactionModel tran = new TransactionModel(); PayResult payresult = new PayResult(); new CityMordersBLL(payresult, cityMorder).MiniappPlatChildGoods(0, dbOrder); } else { columnstr += ",OrderId"; //关闭原微信订单 string errorMsg = ""; dbOrder.OrderId = new JsApiPay(HttpContext).updateWxOrderMoney(dbOrder.OrderId, order.BuyPrice, ref errorMsg); if (dbOrder.OrderId <= 0 || errorMsg.Length > 0) { returnData.Msg = errorMsg; return(Json(returnData)); } } } bool isSuccess = PlatChildGoodsOrderBLL.SingleModel.Update(dbOrder, columnstr); if (isSuccess) { returnData.isok = true; returnData.Msg = "修改订单资料成功"; } else { returnData.Msg = "修改订单资料失败"; } return(Json(returnData)); }